fix(测试跟踪): 当前项目责任人删除时展示问题

--bug=1023182 --user=宋昌昌 【测试跟踪】功能用例-选择模块-全选-选择所有页-导出文件-用例状态和责任人为空 https://www.tapd.cn/55049933/s/1376158
This commit is contained in:
song-cc-rock 2023-05-26 11:56:47 +08:00 committed by fit2-zhao
parent e440569e3b
commit 99879a4a3c
1 changed files with 12 additions and 1 deletions

View File

@ -813,7 +813,7 @@ public class TestCaseService {
ServiceUtils.buildCombineTagsToSupportMultiple(request);
List<TestCaseDTO> list = extTestCaseMapper.list(request);
if (!isSampleInfo) {
buildUserInfo(list);
buildUserInfoByCurrentProjectMembers(list);
if (StringUtils.isNotBlank(request.getProjectId())) {
buildProjectInfo(request.getProjectId(), list);
} else {
@ -3047,6 +3047,17 @@ public class TestCaseService {
});
}
public void buildUserInfoByCurrentProjectMembers(List<TestCaseDTO> testCases) {
Map<String, String> userMap = baseUserService.getProjectMemberOption(SessionUtils.getCurrentProjectId())
.stream()
.collect(Collectors.toMap(User::getId, User::getName));
testCases.forEach(caseResult -> {
caseResult.setCreateName(userMap.get(caseResult.getCreateUser()));
caseResult.setDeleteUserId(userMap.get(caseResult.getDeleteUserId()));
caseResult.setMaintainerName(userMap.get(caseResult.getMaintainer()));
});
}
public void buildUserInfo(List<TestCaseDTO> testCases) {
List<String> userIds = new ArrayList();
userIds.addAll(testCases.stream().map(TestCase::getCreateUser).collect(Collectors.toList()));