fix(测试跟踪): 功能用例附件列表创建人显示有误
--bug=1018697 --user=宋昌昌 【测试跟踪】功能用例添加附件同一账号添加一个显示id一个显示名称 https://www.tapd.cn/55049933/s/1273313
This commit is contained in:
parent
2990b81492
commit
f665abfcec
|
@ -35,6 +35,7 @@ import javax.annotation.Resource;
|
|||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author songcc
|
||||
|
@ -64,6 +65,8 @@ public class AttachmentService {
|
|||
@Resource
|
||||
private FileMetadataService fileMetadataService;
|
||||
@Resource
|
||||
private BaseUserService baseUserService;
|
||||
@Resource
|
||||
SqlSessionFactory sqlSessionFactory;
|
||||
|
||||
public void uploadAttachment(AttachmentRequest request, MultipartFile file) {
|
||||
|
@ -198,6 +201,7 @@ public class AttachmentService {
|
|||
FileAttachmentMetadataExample fileExample = new FileAttachmentMetadataExample();
|
||||
fileExample.createCriteria().andIdIn(attachmentIds);
|
||||
List<FileAttachmentMetadata> fileAttachmentMetadata = fileAttachmentMetadataMapper.selectByExample(fileExample);
|
||||
Map<String, List<User>> userMap = baseUserService.getUserList().stream().collect(Collectors.groupingBy(User::getId));
|
||||
fileAttachmentMetadata.forEach(file -> {
|
||||
String fileRefId = relationMap.get(file.getId());
|
||||
if (StringUtils.isEmpty(fileRefId)) {
|
||||
|
@ -212,7 +216,12 @@ public class AttachmentService {
|
|||
file.setIsRelatedDeleted(Boolean.FALSE);
|
||||
file.setName(fileMetadata.getName());
|
||||
file.setSize(fileMetadata.getSize());
|
||||
file.setCreator(fileMetadata.getCreateUser());
|
||||
List<User> users = userMap.get(fileMetadata.getCreateUser());
|
||||
if (CollectionUtils.isNotEmpty(users)) {
|
||||
file.setCreator(users.get(0).getName());
|
||||
} else {
|
||||
file.setCreator(fileMetadata.getCreateUser());
|
||||
}
|
||||
file.setCreateTime(fileMetadata.getCreateTime());
|
||||
} else {
|
||||
file.setIsRelatedDeleted(Boolean.TRUE);
|
||||
|
|
Loading…
Reference in New Issue