From 532d8b20969a89b903ea2cddeebf3e631fee4fea Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Thu, 31 Oct 2024 16:37:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=8A=9F=E8=83=BD=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E6=89=A7=E8=A1=8C=E4=BA=BA=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=98=AF=E4=B8=8D=E5=9C=A8=E9=A1=B9=E7=9B=AE=E7=9A=84=E8=B6=85?= =?UTF-8?q?=E7=AE=A1=EF=BC=8C=E6=98=BE=E7=A4=BA=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1040309 --user=陈建星 [测试跟踪] github #30599超级管理员角色执行功能用例,没有更新执行人 https://www.tapd.cn/55049933/s/1603487 --- .../plan/service/TestPlanTestCaseService.java | 20 ++++++++++++------- .../functional/FunctionalTestCaseEdit.vue | 5 ++++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java index 63dedccf8a..1458be4eea 100644 --- a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java @@ -121,10 +121,6 @@ public class TestPlanTestCaseService { ServiceUtils.buildProjectInfo(list); ServiceUtils.buildCustomNumInfo(list); - QueryMemberRequest queryMemberRequest = new QueryMemberRequest(); - queryMemberRequest.setProjectId(request.getProjectId()); - Map userMap = baseUserService.getProjectMemberList(queryMemberRequest) - .stream().collect(Collectors.toMap(User::getId, User::getName)); List versionIds = list.stream().map(TestPlanCaseDTO::getVersionId).collect(Collectors.toList()); ProjectVersionService projectVersionService = CommonBeanFactory.getBean(ProjectVersionService.class); if (projectVersionService != null) { @@ -134,10 +130,20 @@ public class TestPlanTestCaseService { item.setVersionName(projectVersionMap.get(item.getVersionId())); }); } - list.forEach(item -> { - item.setExecutorName(userMap.get(item.getExecutor())); - item.setMaintainerName(userMap.get(item.getMaintainer())); + + Set userIds = new HashSet<>(); + list.forEach(i -> { + userIds.add(i.getExecutor()); + userIds.add(i.getMaintainer()); }); + if (!CollectionUtils.isEmpty(userIds)) { + Map userMap = ServiceUtils.getUserNameMap(new ArrayList<>(userIds)); + list.forEach(item -> { + item.setExecutorName(userMap.get(item.getExecutor())); + item.setMaintainerName(userMap.get(item.getMaintainer())); + }); + } + } return list; } diff --git a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseEdit.vue b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseEdit.vue index 367baecdfc..b28400edc5 100644 --- a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseEdit.vue +++ b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseEdit.vue @@ -220,7 +220,7 @@ import {getTestTemplate} from "@/api/custom-field-template"; import {checkProjectPermission} from "@/api/testCase"; import {openCaseEdit, resetPlanCaseSystemField} from "@/business/case/test-case"; import CustomFieldFormItems from "@/business/common/CustomFieldFormItems"; -import {getCurrentProjectID, parseMdImage, saveMarkDownImg} from "@/business/utils/sdk-utils"; +import {getCurrentProjectID, getCurrentUser, parseMdImage, saveMarkDownImg} from "@/business/utils/sdk-utils"; export default { name: "FunctionalTestCaseEdit", @@ -386,6 +386,9 @@ export default { testCase.results = param.results; testCase.issues = param.issues; testCase.status = param.status; + let user = getCurrentUser(); + testCase.executor = user.id; + testCase.executorName = user.name; return; } }