diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/domain/FunctionalCaseExportColumns.java b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/domain/FunctionalCaseExportColumns.java index 53138e2a44..c8f04c0002 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/domain/FunctionalCaseExportColumns.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/domain/FunctionalCaseExportColumns.java @@ -24,6 +24,7 @@ public class FunctionalCaseExportColumns { systemColumns.put("module", Translator.get("case.export.system.columns.module")); systemColumns.put("text_description", Translator.get("case.export.system.columns.text_description")); systemColumns.put("expected_result", Translator.get("case.export.system.columns.expected_result")); + systemColumns.put("tags", Translator.get("xmind_tags")); // 其他字段 otherColumns.put("last_execute_result", Translator.get("case.export.system.other.columns.last_execute_result")); diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseFileService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseFileService.java index 9a8ef9c49b..b1be63ec9e 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseFileService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseFileService.java @@ -630,6 +630,8 @@ public class FunctionalCaseFileService { buildExportStep(data, functionalCaseBlob, functionalCase.getCaseEditType(), textDescriptionList, expectedResultList); data.setPrerequisite(new String(functionalCaseBlob.getPrerequisite() == null ? new byte[0] : functionalCaseBlob.getPrerequisite(), StandardCharsets.UTF_8)); + //标签 + data.setTags(JSON.toJSONString(functionalCase.getTags())); // 设置超链接 WriteCellData hyperlink = new WriteCellData<>(functionalCase.getName()); data.setHyperLinkName(hyperlink); diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseXmindService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseXmindService.java index 6954bc1d2c..e83f8b57e9 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseXmindService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseXmindService.java @@ -236,7 +236,7 @@ public class FunctionalCaseXmindService { dto.setNum(item.getNum().toString()); dto.setProjectId(item.getProjectId()); dto.setName(item.getName()); - dto.setTags(item.getTags().toString()); + dto.setTags(JSON.toJSONString(item.getTags())); dto.setCaseEditType(item.getCaseEditType()); dto.setSteps(new String(functionalCaseBlob.getSteps() == null ? new byte[0] : functionalCaseBlob.getSteps(), StandardCharsets.UTF_8)); dto.setTextDescription(new String(functionalCaseBlob.getTextDescription() == null ? new byte[0] : functionalCaseBlob.getTextDescription(), StandardCharsets.UTF_8)); diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/xmind/utils/XmindExportUtil.java b/backend/services/case-management/src/main/java/io/metersphere/functional/xmind/utils/XmindExportUtil.java index 0dc1e4cea2..e2ed3106c4 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/xmind/utils/XmindExportUtil.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/xmind/utils/XmindExportUtil.java @@ -29,6 +29,7 @@ import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; /** @@ -440,6 +441,9 @@ public class XmindExportUtil { case "module": preTopic.setTitleText(columns.getSystemColumns().get(item).concat(":").concat(moduleName)); break; + case "tags": + preTopic.setTitleText(columns.getSystemColumns().get(item).concat(":").concat(parseTag(dto.getTags()))); + break; default: break; } @@ -545,5 +549,14 @@ public class XmindExportUtil { topic.add(itemTopic); } + private static String parseTag(String tags) { + List list = JSON.parseArray(tags); + AtomicReference tag = new AtomicReference<>(""); + list.forEach(item -> { + tag.set(tag.get() + item.toString().concat("|")); + }); + return tag.get().substring(0, tag.get().length() - 1); + } + }