refactor(用例管理): 增加用例新增的日志,用来辅助判断新增用例卡顿情况

--bug=1036494 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036494
This commit is contained in:
guoyuqi 2024-03-01 09:46:11 +08:00 committed by 刘瑞斌
parent de874be6e3
commit 7257dc05e5
2 changed files with 8 additions and 2 deletions

View File

@ -96,6 +96,7 @@ public class FunctionalCaseAttachmentService {
* @param files files
*/
public List<String> uploadFile(String projectId, String caseId, List<MultipartFile> files, Boolean isLocal, String userId) {
LogUtils.info("开始上传附件");
List<String>fileIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(files)) {
files.forEach(file -> {
@ -116,6 +117,7 @@ public class FunctionalCaseAttachmentService {
fileIds.add(fileId);
});
}
LogUtils.info("附件上传结束");
return fileIds;
}
@ -414,6 +416,7 @@ public class FunctionalCaseAttachmentService {
String systemTempDir = DefaultRepositoryDir.getSystemTempDir();
// 添加文件与功能用例的关联关系
Map<String, String> addFileMap = new HashMap<>();
LogUtils.info("开始上传副文本里的附件");
List<FunctionalCaseAttachment> functionalCaseAttachments = filIds.stream().map(fileId -> {
FunctionalCaseAttachment functionalCaseAttachment = new FunctionalCaseAttachment();
String fileName = getTempFileNameByFileId(fileId);
@ -440,7 +443,9 @@ public class FunctionalCaseAttachmentService {
}).toList();
functionalCaseAttachmentMapper.batchInsert(functionalCaseAttachments);
// 上传文件到对象存储
LogUtils.info("上传文件到对象存储");
uploadFileResource(functionalCaseDir, addFileMap, projectId, caseId);
LogUtils.info("上传副文本里的附件结束");
}
/**
@ -505,7 +510,7 @@ public class FunctionalCaseAttachmentService {
fileCopyRequest.setFileName(fileName);
defaultRepository.delete(fileCopyRequest);
} catch (Exception e) {
LogUtils.error(e);
LogUtils.error("上传副文本文件失败:{}",e);
throw new MSException(Translator.get("file_upload_fail"));
}
}

View File

@ -189,7 +189,7 @@ public class FunctionalCaseService {
if (CollectionUtils.isNotEmpty(request.getAttachments())) {
copyAttachment(request, userId, uploadFileIds, caseId);
}
LogUtils.info("保存用例的文件操作完成");
addCaseReviewCase(request.getReviewId(), caseId, userId);
//记录日志
@ -223,6 +223,7 @@ public class FunctionalCaseService {
FunctionalCaseAttachment caseAttachment = functionalCaseAttachmentService.creatAttachment(saveAttachmentFileId, functionalCaseAttachmentDTO.getFileName(), functionalCaseAttachmentDTO.getSize(), caseId, functionalCaseAttachmentDTO.getLocal(), userId);
if(functionalCaseAttachmentDTO.getLocal()) {
caseAttachment.setFileSource(CaseFileSourceType.ATTACHMENT.toString());
LogUtils.info("开始复制文件");
copyFile(request, caseId, saveAttachmentFileId, oldFileMap, functionalCaseAttachmentDTO, defaultRepository);
}
functionalCaseAttachmentMapper.insertSelective(caseAttachment);