fix(用例管理): 用例详情附件未显示上传人
--bug=1035839 --user=王旭 【用例管理】功能用例-用例详情-附件-未显示上传人 https://www.tapd.cn/55049933/s/1466258
This commit is contained in:
parent
fe74f96b8a
commit
bbe88c5ae4
|
@ -133,6 +133,8 @@ public class FunctionalCaseAttachmentController {
|
|||
fileAssociationDTO.setModuleId(request.getModuleId());
|
||||
fileId = fileAssociationService.transferAndAssociation(fileAssociationDTO);
|
||||
functionalCaseAttachmentService.deleteCaseAttachment(Arrays.asList(request.getFileId()), request.getCaseId(), request.getProjectId());
|
||||
} catch (MSException e) {
|
||||
throw new MSException(e);
|
||||
} catch (Exception e) {
|
||||
throw new MSException(Translator.get("file.transfer.error"));
|
||||
}
|
||||
|
|
|
@ -33,9 +33,12 @@ public class FunctionalCaseAttachmentDTO implements Serializable {
|
|||
@Schema(description = "是否本地")
|
||||
private Boolean local;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
@Schema(description = "创建人id")
|
||||
private String createUser;
|
||||
|
||||
@Schema(description = "创建人姓名")
|
||||
private String createUserName;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Long createTime;
|
||||
|
||||
|
|
|
@ -24,7 +24,10 @@ import io.metersphere.sdk.file.FileCopyRequest;
|
|||
import io.metersphere.sdk.file.FileRepository;
|
||||
import io.metersphere.sdk.file.FileRequest;
|
||||
import io.metersphere.sdk.util.*;
|
||||
import io.metersphere.system.domain.User;
|
||||
import io.metersphere.system.domain.UserExample;
|
||||
import io.metersphere.system.log.constants.OperationLogModule;
|
||||
import io.metersphere.system.mapper.UserMapper;
|
||||
import io.metersphere.system.uid.IDGenerator;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
@ -64,6 +67,9 @@ public class FunctionalCaseAttachmentService {
|
|||
private static final String UPLOAD_FILE = "/attachment/upload/file";
|
||||
private static final String DELETED_FILE = "/attachment/delete/file";
|
||||
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
|
||||
@Value("50MB")
|
||||
private DataSize maxFileSize;
|
||||
|
@ -156,6 +162,18 @@ public class FunctionalCaseAttachmentService {
|
|||
}));
|
||||
attachmentDTOs.addAll(filesDTOs);
|
||||
attachmentDTOs.sort(Comparator.comparing(FunctionalCaseAttachmentDTO::getCreateTime));
|
||||
|
||||
if (CollectionUtils.isNotEmpty(attachmentDTOs)) {
|
||||
List<String> userList = attachmentDTOs.stream().map(FunctionalCaseAttachmentDTO::getCreateUser).toList();
|
||||
UserExample userExample = new UserExample();
|
||||
userExample.createCriteria().andIdIn(userList);
|
||||
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);
|
||||
});
|
||||
}
|
||||
functionalCaseDetailDTO.setAttachments(attachmentDTOs);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
class="flex items-center gap-[8px] text-[12px] leading-[16px] text-[var(--color-text-4)]"
|
||||
>
|
||||
{{
|
||||
`${formatFileSize(item.file.size)} ${t('ms.upload.uploadAt')} ${dayjs(item.uploadedTime).format(
|
||||
`${formatFileSize(item.file.size)} ${item.createUserName} ${t('ms.upload.uploadAt')} ${dayjs(item.uploadedTime).format(
|
||||
'YYYY-MM-DD HH:mm:ss'
|
||||
)}`
|
||||
}}
|
||||
|
|
|
@ -100,7 +100,7 @@ export function convertToFile(fileInfo: AssociatedList): MsFileItem {
|
|||
type: `application/${type}`,
|
||||
});
|
||||
Object.defineProperty(file, 'size', { value: fileInfo.size });
|
||||
const { id, local, isUpdateFlag, associateId } = fileInfo;
|
||||
const { id, createUserName, local, isUpdateFlag, associateId } = fileInfo;
|
||||
return {
|
||||
enable: fileInfo.enable || false,
|
||||
file,
|
||||
|
@ -110,6 +110,7 @@ export function convertToFile(fileInfo: AssociatedList): MsFileItem {
|
|||
status: 'done',
|
||||
uid: id,
|
||||
url: `${gatewayAddress}/${fileInfo.filePath || ''}`,
|
||||
createUserName,
|
||||
local: !!local,
|
||||
deleteContent: local ? '' : 'caseManagement.featureCase.cancelLink',
|
||||
isUpdateFlag,
|
||||
|
|
Loading…
Reference in New Issue