From 23788673a9250cdd660229e8cf604619e38f248a Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 22 Feb 2023 17:36:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E5=90=8C=E6=AD=A5=E5=B9=B3=E5=8F=B0=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1023082 --user=陈建星 【测试跟踪】缺陷管理,ms创建带附件的缺陷在禅道编辑后再同步回ms,附件没了 https://www.tapd.cn/55049933/s/1340797 --- .../java/io/metersphere/service/IssuesService.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test-track/backend/src/main/java/io/metersphere/service/IssuesService.java b/test-track/backend/src/main/java/io/metersphere/service/IssuesService.java index 5b7298655f..03aa33f25c 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/IssuesService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/IssuesService.java @@ -1018,7 +1018,7 @@ public class IssuesService { if (MapUtils.isNotEmpty(attachmentMap)) { for (String issueId : attachmentMap.keySet()) { // 查询我们平台的附件 - Set jiraAttachmentSet = new HashSet<>(); + Set platformAttachmentSet = new HashSet<>(); List allMsAttachments = getIssueFileAttachmentMetadata(issueId); Set attachmentsNameSet = allMsAttachments.stream() .map(FileAttachmentMetadata::getName) @@ -1031,14 +1031,14 @@ public class IssuesService { for (PlatformAttachment syncAttachment : syncAttachments) { String fileName = syncAttachment.getFileName(); String fileKey = syncAttachment.getFileKey(); + platformAttachmentSet.add(fileName); if (!attachmentsNameSet.contains(fileName)) { - jiraAttachmentSet.add(fileName); saveAttachmentModuleRelation(platform, issueId, fileName, fileKey, batchAttachmentModuleRelationMapper); } } // 删除Jira中不存在的附件 - deleteSyncAttachment(batchAttachmentModuleRelationMapper, jiraAttachmentSet, allMsAttachments); + deleteSyncAttachment(batchAttachmentModuleRelationMapper, platformAttachmentSet, allMsAttachments); } } } @@ -1081,13 +1081,13 @@ public class IssuesService { } private void deleteSyncAttachment(AttachmentModuleRelationMapper batchAttachmentModuleRelationMapper, - Set jiraAttachmentSet, + Set platformAttachmentSet, List allMsAttachments) { try { // 删除Jira中不存在的附件 if (CollectionUtils.isNotEmpty(allMsAttachments)) { List deleteMsAttachments = allMsAttachments.stream() - .filter(msAttachment -> !jiraAttachmentSet.contains(msAttachment.getName())) + .filter(msAttachment -> !platformAttachmentSet.contains(msAttachment.getName())) .collect(Collectors.toList()); deleteMsAttachments.forEach(fileAttachmentMetadata -> { List ids = List.of(fileAttachmentMetadata.getId());