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());