fix(用例管理): 修复功能用例附件显示问题

--bug=1047174 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001047174
This commit is contained in:
guoyuqi 2024-10-23 15:53:57 +08:00 committed by Craftsman
parent 9bc44f74c4
commit 81a2c17ad6
1 changed files with 7 additions and 4 deletions

View File

@ -167,7 +167,7 @@ public class FunctionalCaseAttachmentService {
}));
attachmentDTOs.addAll(filesDTOs);
attachmentDTOs.sort(Comparator.comparing(FunctionalCaseAttachmentDTO::getCreateTime).reversed());
List<FunctionalCaseAttachmentDTO> returnAttachmentDTO = new ArrayList<>();
if (CollectionUtils.isNotEmpty(attachmentDTOs)) {
List<String> userList = attachmentDTOs.stream().map(FunctionalCaseAttachmentDTO::getCreateUser).toList();
UserExample userExample = new UserExample();
@ -175,11 +175,14 @@ public class FunctionalCaseAttachmentService {
List<User> users = userMapper.selectByExample(userExample);
Map<String, String> collect = users.stream().collect(Collectors.toMap(User::getId, User::getName));
attachmentDTOs.forEach(item -> {
String userName = collect.get(item.getCreateUser());
item.setCreateUserName(userName);
if (!item.isDeleted()) {
String userName = collect.get(item.getCreateUser());
item.setCreateUserName(userName);
returnAttachmentDTO.add(item);
}
});
}
functionalCaseDetailDTO.setAttachments(attachmentDTOs);
functionalCaseDetailDTO.setAttachments(returnAttachmentDTO);
}