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)) {
|
if (MapUtils.isNotEmpty(attachmentMap)) {
|
||||||
for (String issueId : attachmentMap.keySet()) {
|
for (String issueId : attachmentMap.keySet()) {
|
||||||
// 查询我们平台的附件
|
// 查询我们平台的附件
|
||||||
Set<String> jiraAttachmentSet = new HashSet<>();
|
Set<String> platformAttachmentSet = new HashSet<>();
|
||||||
List<FileAttachmentMetadata> allMsAttachments = getIssueFileAttachmentMetadata(issueId);
|
List<FileAttachmentMetadata> allMsAttachments = getIssueFileAttachmentMetadata(issueId);
|
||||||
Set<String> attachmentsNameSet = allMsAttachments.stream()
|
Set<String> attachmentsNameSet = allMsAttachments.stream()
|
||||||
.map(FileAttachmentMetadata::getName)
|
.map(FileAttachmentMetadata::getName)
|
||||||
|
@ -1031,14 +1031,14 @@ public class IssuesService {
|
||||||
for (PlatformAttachment syncAttachment : syncAttachments) {
|
for (PlatformAttachment syncAttachment : syncAttachments) {
|
||||||
String fileName = syncAttachment.getFileName();
|
String fileName = syncAttachment.getFileName();
|
||||||
String fileKey = syncAttachment.getFileKey();
|
String fileKey = syncAttachment.getFileKey();
|
||||||
|
platformAttachmentSet.add(fileName);
|
||||||
if (!attachmentsNameSet.contains(fileName)) {
|
if (!attachmentsNameSet.contains(fileName)) {
|
||||||
jiraAttachmentSet.add(fileName);
|
|
||||||
saveAttachmentModuleRelation(platform, issueId, fileName, fileKey, batchAttachmentModuleRelationMapper);
|
saveAttachmentModuleRelation(platform, issueId, fileName, fileKey, batchAttachmentModuleRelationMapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除Jira中不存在的附件
|
// 删除Jira中不存在的附件
|
||||||
deleteSyncAttachment(batchAttachmentModuleRelationMapper, jiraAttachmentSet, allMsAttachments);
|
deleteSyncAttachment(batchAttachmentModuleRelationMapper, platformAttachmentSet, allMsAttachments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1081,13 +1081,13 @@ public class IssuesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteSyncAttachment(AttachmentModuleRelationMapper batchAttachmentModuleRelationMapper,
|
private void deleteSyncAttachment(AttachmentModuleRelationMapper batchAttachmentModuleRelationMapper,
|
||||||
Set<String> jiraAttachmentSet,
|
Set<String> platformAttachmentSet,
|
||||||
List<FileAttachmentMetadata> allMsAttachments) {
|
List<FileAttachmentMetadata> allMsAttachments) {
|
||||||
try {
|
try {
|
||||||
// 删除Jira中不存在的附件
|
// 删除Jira中不存在的附件
|
||||||
if (CollectionUtils.isNotEmpty(allMsAttachments)) {
|
if (CollectionUtils.isNotEmpty(allMsAttachments)) {
|
||||||
List<FileAttachmentMetadata> deleteMsAttachments = allMsAttachments.stream()
|
List<FileAttachmentMetadata> deleteMsAttachments = allMsAttachments.stream()
|
||||||
.filter(msAttachment -> !jiraAttachmentSet.contains(msAttachment.getName()))
|
.filter(msAttachment -> !platformAttachmentSet.contains(msAttachment.getName()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
deleteMsAttachments.forEach(fileAttachmentMetadata -> {
|
deleteMsAttachments.forEach(fileAttachmentMetadata -> {
|
||||||
List<String> ids = List.of(fileAttachmentMetadata.getId());
|
List<String> ids = List.of(fileAttachmentMetadata.getId());
|
||||||
|
|
Loading…
Reference in New Issue