feat(缺陷管理): 复制缺陷中带有附件提示报错

--bug=1036949 --user=宋昌昌 【缺陷管理】复制本地缺陷并同步到三方平台时提示空指针 https://www.tapd.cn/55049933/s/1474048
This commit is contained in:
song-cc-rock 2024-03-13 15:43:03 +08:00 committed by Craftsman
parent ff2062d94d
commit f4058352ca
2 changed files with 10 additions and 5 deletions

View File

@ -1036,7 +1036,9 @@ public class BugService {
throw new MSException(Translator.get("bug_attachment_upload_error"));
}
});
extBugLocalAttachmentMapper.batchInsert(copyFiles);
if (CollectionUtils.isNotEmpty(copyFiles)) {
extBugLocalAttachmentMapper.batchInsert(copyFiles);
}
// 关联的附件, 直接合并, 后续逻辑会处理
List<String> copyLinkFileIds = request.getCopyFiles().stream().filter(file -> !file.getLocal()).map(BugFileDTO::getFileId).collect(Collectors.toList());
request.setLinkFileIds(ListUtils.union(request.getLinkFileIds(), copyLinkFileIds));

View File

@ -312,16 +312,16 @@
// link file
const associateFileIds = attachmentsList.value.filter((item) => !item.local).map((item) => item.fileId);
form.value.linkFileIds = fileList.value
.filter((item) => !item.local && !associateFileIds.includes(item.uid))
.filter((item) => !item.local && !item.isCopyFlag && !associateFileIds.includes(item.uid))
.map((item) => item.uid);
// unlink file
const remainLinkFileIds = fileList.value.filter((item) => !item.local).map((item) => item.uid);
const remainLinkFileIds = fileList.value.filter((item) => !item.local && !item.isCopyFlag).map((item) => item.uid);
form.value.unLinkRefIds = attachmentsList.value
.filter((item) => !item.local && !remainLinkFileIds.includes(item.fileId))
.map((item) => item.refId);
// delete local file
const remainLocalFileIds = fileList.value
.filter((item) => item.local && item.status !== 'init')
.filter((item) => item.local && !item.isCopyFlag && item.status !== 'init')
.map((item) => item.uid);
form.value.deleteLocalFileIds = attachmentsList.value
.filter((item) => item.local && !remainLocalFileIds.includes(item.fileId))
@ -627,7 +627,10 @@
await templateChange(templateId, { fromStatusId: res.status, platformBugKey: res.platformBugId });
}
if (attachments && attachments.length) {
attachmentsList.value = attachments;
if (!isCopy.value) {
// Copy,
attachmentsList.value = attachments;
}
//
const checkUpdateFileIds = await checkFileIsUpdateRequest(attachments.map((item: any) => item.fileId));
//