mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-05 05:29:29 +08:00
fix(测试跟踪): 缺陷同步平台附件有误
--bug=1023082 --user=陈建星 【测试跟踪】缺陷管理,ms创建带附件的缺陷在禅道编辑后再同步回ms,附件没了 https://www.tapd.cn/55049933/s/1340797
This commit is contained in:
parent
60351d2119
commit
62662ba23d
@ -1018,7 +1018,7 @@ public class IssuesService {
|
||||
if (MapUtils.isNotEmpty(attachmentMap)) {
|
||||
for (String issueId : attachmentMap.keySet()) {
|
||||
// 查询我们平台的附件
|
||||
Set<String> jiraAttachmentSet = new HashSet<>();
|
||||
Set<String> platformAttachmentSet = new HashSet<>();
|
||||
List<FileAttachmentMetadata> allMsAttachments = getIssueFileAttachmentMetadata(issueId);
|
||||
Set<String> 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<String> jiraAttachmentSet,
|
||||
Set<String> platformAttachmentSet,
|
||||
List<FileAttachmentMetadata> allMsAttachments) {
|
||||
try {
|
||||
// 删除Jira中不存在的附件
|
||||
if (CollectionUtils.isNotEmpty(allMsAttachments)) {
|
||||
List<FileAttachmentMetadata> deleteMsAttachments = allMsAttachments.stream()
|
||||
.filter(msAttachment -> !jiraAttachmentSet.contains(msAttachment.getName()))
|
||||
.filter(msAttachment -> !platformAttachmentSet.contains(msAttachment.getName()))
|
||||
.collect(Collectors.toList());
|
||||
deleteMsAttachments.forEach(fileAttachmentMetadata -> {
|
||||
List<String> ids = List.of(fileAttachmentMetadata.getId());
|
||||
|
Loading…
Reference in New Issue
Block a user