diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/listener/FunctionalCaseCheckEventListener.java b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/listener/FunctionalCaseCheckEventListener.java index 1d7bff2845..2a16366c25 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/listener/FunctionalCaseCheckEventListener.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/listener/FunctionalCaseCheckEventListener.java @@ -310,6 +310,10 @@ public class FunctionalCaseCheckEventListener extends AnalysisEventListener tags = functionalCaseService.handleImportTags(data.getTags()); if (tags.size() > TAGS_COUNT) { errMsg.append(Translator.get("tags_count")) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java index 2e050a6d3d..ad9a2dab8b 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java @@ -1246,6 +1246,10 @@ public class FunctionalCaseService { //需要保存的自定义字段 Map customData = functionalCaseExcelData.getCustomData(); customFieldsMap.forEach((k, v) -> { + //用例等级如果没有默认值,则为P0 + if (StringUtils.equalsIgnoreCase(v.getInternalFieldKey(), "functional_priority") && v.getDefaultValue()==null) { + v.setDefaultValue("P0"); + } Object value = customData.get(k); FunctionalCaseCustomField caseCustomField = new FunctionalCaseCustomField(); caseCustomField.setCaseId(caseId); diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/xmind/parser/XMindCaseParser.java b/backend/services/case-management/src/main/java/io/metersphere/functional/xmind/parser/XMindCaseParser.java index 5abe7320f2..200100b8c2 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/xmind/parser/XMindCaseParser.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/xmind/parser/XMindCaseParser.java @@ -173,7 +173,7 @@ public class XMindCaseParser { private boolean validateTags(FunctionalCaseExcelData data) { AtomicBoolean validate = new AtomicBoolean(true); if (StringUtils.isBlank(data.getTags())) { - data.setTags(""); + data.setTags(StringUtils.EMPTY); return validate.get(); } List tags = functionalCaseService.handleImportTags(data.getTags()); @@ -286,6 +286,8 @@ public class XMindCaseParser { //如果是覆盖,那么有id的需要更新 functionalCaseExcelData.setNum(checkResult); updateList.add(functionalCaseExcelData); + } else { + list.add(functionalCaseExcelData); } } else { list.add(functionalCaseExcelData); diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/NoticeTemplateService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/NoticeTemplateService.java index b1c4141997..c8b90b69a0 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/NoticeTemplateService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/NoticeTemplateService.java @@ -52,7 +52,7 @@ public class NoticeTemplateService { Field[] allFields = FieldUtils.getAllFields(ApiReportMessageDTO.class); addOptionDto(messageTemplateFieldDTOList, allFields, null); } - case NoticeConstants.TaskType.TEST_PLAN_TASK -> { + case NoticeConstants.TaskType.TEST_PLAN_TASK, NoticeConstants.TaskType.JENKINS_TASK -> { Field[] allFields = FieldUtils.getAllFields(TestPlanMessageDTO.class); addOptionDto(messageTemplateFieldDTOList, allFields, null); } @@ -80,13 +80,6 @@ public class NoticeTemplateService { Field[] allFields = FieldUtils.getAllFields(Schedule.class); addOptionDto(messageTemplateFieldDTOList, allFields, "schedule_"); } - case NoticeConstants.TaskType.JENKINS_TASK -> { - MessageTemplateFieldDTO messageTemplateFieldOperator = new MessageTemplateFieldDTO(); - messageTemplateFieldOperator.setId("name"); - messageTemplateFieldOperator.setFieldSource(NoticeConstants.FieldSource.CASE_FIELD); - messageTemplateFieldOperator.setName(Translator.get("message.jenkins_name")); - messageTemplateFieldDTOList.add(messageTemplateFieldOperator); - } default -> messageTemplateFieldDTOList = new ArrayList<>(); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/utils/MessageTemplateUtils.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/utils/MessageTemplateUtils.java index f95c713373..3a0bc391f2 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/utils/MessageTemplateUtils.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/utils/MessageTemplateUtils.java @@ -140,12 +140,12 @@ public class MessageTemplateUtils { case NoticeConstants.TaskType.API_DEFINITION_TASK -> FieldUtils.getAllFields(ApiDefinitionCaseDTO.class); case NoticeConstants.TaskType.API_SCENARIO_TASK -> FieldUtils.getAllFields(ApiScenarioMessageDTO.class); case NoticeConstants.TaskType.API_REPORT_TASK -> FieldUtils.getAllFields(ApiReportMessageDTO.class); - case NoticeConstants.TaskType.TEST_PLAN_TASK -> FieldUtils.getAllFields(TestPlanMessageDTO.class); + case NoticeConstants.TaskType.TEST_PLAN_TASK, NoticeConstants.TaskType.JENKINS_TASK -> FieldUtils.getAllFields(TestPlanMessageDTO.class); case NoticeConstants.TaskType.CASE_REVIEW_TASK -> FieldUtils.getAllFields(CaseReview.class); case NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK -> FieldUtils.getAllFields(FunctionalCaseMessageDTO.class); case NoticeConstants.TaskType.BUG_TASK -> FieldUtils.getAllFields(BugMessageDTO.class); case NoticeConstants.TaskType.SCHEDULE_TASK -> FieldUtils.getAllFields(Schedule.class); - default -> new Field[0]; + default -> new Field[0]; }; } @@ -194,27 +194,20 @@ public class MessageTemplateUtils { } public static String getTranslateTemplate(String taskType, String template, Map> customFielddMap) { - if (StringUtils.equalsIgnoreCase(taskType, NoticeConstants.TaskType.JENKINS_TASK)) { - if (StringUtils.isNotBlank(template) && template.contains("${name}")) { - template = template.replace("${name}", "{{" + Translator.get("message.jenkins_name") + "}}"); - } - return template; - } else { - Field[] domainTemplateFields = getDomainTemplateFields(taskType); - Map map = new HashMap<>(); - if (StringUtils.isNotBlank(template) && template.contains("${OPERATOR}")) { - template = template.replace("${OPERATOR}", "<" + Translator.get("message.operator") + ">"); - } - if (StringUtils.isNotBlank(template) && template.contains("${total}")) { - template = template.replace("${total}", ""); - } - setMap(taskType, domainTemplateFields, map); - Map defaultRelatedUserMap = getDefaultRelatedUserMap(); - defaultRelatedUserMap.remove("FOLLOW_PEOPLE"); - map.putAll(defaultRelatedUserMap); - addCustomFiled(taskType, customFielddMap, map); - return getContent(template, map); + Field[] domainTemplateFields = getDomainTemplateFields(taskType); + Map map = new HashMap<>(); + if (StringUtils.isNotBlank(template) && template.contains("${OPERATOR}")) { + template = template.replace("${OPERATOR}", "<" + Translator.get("message.operator") + ">"); } + if (StringUtils.isNotBlank(template) && template.contains("${total}")) { + template = template.replace("${total}", ""); + } + setMap(taskType, domainTemplateFields, map); + Map defaultRelatedUserMap = getDefaultRelatedUserMap(); + defaultRelatedUserMap.remove("FOLLOW_PEOPLE"); + map.putAll(defaultRelatedUserMap); + addCustomFiled(taskType, customFielddMap, map); + return getContent(template, map); } private static void addCustomFiled(String taskType, Map> customFielddMap, Map map) { @@ -238,7 +231,7 @@ public class MessageTemplateUtils { putDescription(domainTemplateFields, map); case NoticeConstants.TaskType.API_SCENARIO_TASK -> putDescription(domainTemplateFields, map); case NoticeConstants.TaskType.API_REPORT_TASK -> putDescription(domainTemplateFields, map); - case NoticeConstants.TaskType.TEST_PLAN_TASK -> putDomainName(domainTemplateFields, map, "test_plan_"); + case NoticeConstants.TaskType.TEST_PLAN_TASK, NoticeConstants.TaskType.JENKINS_TASK -> putDomainName(domainTemplateFields, map, "test_plan_"); case NoticeConstants.TaskType.CASE_REVIEW_TASK -> putDomainName(domainTemplateFields, map, "case_review_"); case NoticeConstants.TaskType.BUG_TASK -> putDomainName(domainTemplateFields, map, "bug_"); case NoticeConstants.TaskType.SCHEDULE_TASK -> putDomainName(domainTemplateFields, map, "schedule_"); @@ -277,27 +270,20 @@ public class MessageTemplateUtils { } public static String getTranslateSubject(String taskType, String subject, Map> customFielddMap) { - if (StringUtils.equalsIgnoreCase(taskType, NoticeConstants.TaskType.JENKINS_TASK)) { - if (StringUtils.isNotBlank(subject) && subject.contains("${name}")) { - subject = subject.replace("${name}", "{{" + Translator.get("message.jenkins_name") + "}}"); - } - return subject; - } else { - Field[] domainTemplateFields = getDomainTemplateFields(taskType); - Map map = new HashMap<>(); - if (StringUtils.isNotBlank(subject) && subject.contains("${OPERATOR}")) { - subject = subject.replace("${OPERATOR}", Translator.get("message.operator")); - } - if (StringUtils.isNotBlank(subject) && subject.contains("${total}")) { - subject = subject.replace("${total}", "n"); - } - setMap(taskType, domainTemplateFields, map); - Map defaultRelatedUserMap = getDefaultRelatedUserMap(); - defaultRelatedUserMap.remove("FOLLOW_PEOPLE"); - map.putAll(defaultRelatedUserMap); - addCustomFiled(taskType, customFielddMap, map); - return getContent(subject, map); + Field[] domainTemplateFields = getDomainTemplateFields(taskType); + Map map = new HashMap<>(); + if (StringUtils.isNotBlank(subject) && subject.contains("${OPERATOR}")) { + subject = subject.replace("${OPERATOR}", Translator.get("message.operator")); } + if (StringUtils.isNotBlank(subject) && subject.contains("${total}")) { + subject = subject.replace("${total}", "n"); + } + setMap(taskType, domainTemplateFields, map); + Map defaultRelatedUserMap = getDefaultRelatedUserMap(); + defaultRelatedUserMap.remove("FOLLOW_PEOPLE"); + map.putAll(defaultRelatedUserMap); + addCustomFiled(taskType, customFielddMap, map); + return getContent(subject, map); }