fix(测试跟踪): 测试计划功能用例执行人,如果是不在项目的超管,显示为空

--bug=1040309 --user=陈建星 [测试跟踪] github #30599超级管理员角色执行功能用例,没有更新执行人 https://www.tapd.cn/55049933/s/1603487
This commit is contained in:
AgAngle 2024-10-31 16:37:25 +08:00 committed by 刘瑞斌
parent dcb701e95e
commit 532d8b2096
2 changed files with 17 additions and 8 deletions

View File

@ -121,10 +121,6 @@ public class TestPlanTestCaseService {
ServiceUtils.buildProjectInfo(list);
ServiceUtils.buildCustomNumInfo(list);
QueryMemberRequest queryMemberRequest = new QueryMemberRequest();
queryMemberRequest.setProjectId(request.getProjectId());
Map<String, String> userMap = baseUserService.getProjectMemberList(queryMemberRequest)
.stream().collect(Collectors.toMap(User::getId, User::getName));
List<String> 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<String> userIds = new HashSet<>();
list.forEach(i -> {
userIds.add(i.getExecutor());
userIds.add(i.getMaintainer());
});
if (!CollectionUtils.isEmpty(userIds)) {
Map<String, String> userMap = ServiceUtils.getUserNameMap(new ArrayList<>(userIds));
list.forEach(item -> {
item.setExecutorName(userMap.get(item.getExecutor()));
item.setMaintainerName(userMap.get(item.getMaintainer()));
});
}
}
return list;
}

View File

@ -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;
}
}