fix(用例管理): 修复用例导入默认等级问题
--bug=1045255 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001045255 --bug=1045204 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001045204 --bug=1045201 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001045201
This commit is contained in:
parent
8fe7d869e8
commit
f7c86b7f23
|
@ -310,6 +310,10 @@ public class FunctionalCaseCheckEventListener extends AnalysisEventListener<Map<
|
||||||
* @param errMsg
|
* @param errMsg
|
||||||
*/
|
*/
|
||||||
private void validateTags(FunctionalCaseExcelData data, StringBuilder errMsg) {
|
private void validateTags(FunctionalCaseExcelData data, StringBuilder errMsg) {
|
||||||
|
if (StringUtils.isBlank(data.getTags())) {
|
||||||
|
data.setTags(StringUtils.EMPTY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
List<String> tags = functionalCaseService.handleImportTags(data.getTags());
|
List<String> tags = functionalCaseService.handleImportTags(data.getTags());
|
||||||
if (tags.size() > TAGS_COUNT) {
|
if (tags.size() > TAGS_COUNT) {
|
||||||
errMsg.append(Translator.get("tags_count"))
|
errMsg.append(Translator.get("tags_count"))
|
||||||
|
|
|
@ -1246,6 +1246,10 @@ public class FunctionalCaseService {
|
||||||
//需要保存的自定义字段
|
//需要保存的自定义字段
|
||||||
Map<String, Object> customData = functionalCaseExcelData.getCustomData();
|
Map<String, Object> customData = functionalCaseExcelData.getCustomData();
|
||||||
customFieldsMap.forEach((k, v) -> {
|
customFieldsMap.forEach((k, v) -> {
|
||||||
|
//用例等级如果没有默认值,则为P0
|
||||||
|
if (StringUtils.equalsIgnoreCase(v.getInternalFieldKey(), "functional_priority") && v.getDefaultValue()==null) {
|
||||||
|
v.setDefaultValue("P0");
|
||||||
|
}
|
||||||
Object value = customData.get(k);
|
Object value = customData.get(k);
|
||||||
FunctionalCaseCustomField caseCustomField = new FunctionalCaseCustomField();
|
FunctionalCaseCustomField caseCustomField = new FunctionalCaseCustomField();
|
||||||
caseCustomField.setCaseId(caseId);
|
caseCustomField.setCaseId(caseId);
|
||||||
|
|
|
@ -173,7 +173,7 @@ public class XMindCaseParser {
|
||||||
private boolean validateTags(FunctionalCaseExcelData data) {
|
private boolean validateTags(FunctionalCaseExcelData data) {
|
||||||
AtomicBoolean validate = new AtomicBoolean(true);
|
AtomicBoolean validate = new AtomicBoolean(true);
|
||||||
if (StringUtils.isBlank(data.getTags())) {
|
if (StringUtils.isBlank(data.getTags())) {
|
||||||
data.setTags("");
|
data.setTags(StringUtils.EMPTY);
|
||||||
return validate.get();
|
return validate.get();
|
||||||
}
|
}
|
||||||
List<String> tags = functionalCaseService.handleImportTags(data.getTags());
|
List<String> tags = functionalCaseService.handleImportTags(data.getTags());
|
||||||
|
@ -286,6 +286,8 @@ public class XMindCaseParser {
|
||||||
//如果是覆盖,那么有id的需要更新
|
//如果是覆盖,那么有id的需要更新
|
||||||
functionalCaseExcelData.setNum(checkResult);
|
functionalCaseExcelData.setNum(checkResult);
|
||||||
updateList.add(functionalCaseExcelData);
|
updateList.add(functionalCaseExcelData);
|
||||||
|
} else {
|
||||||
|
list.add(functionalCaseExcelData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list.add(functionalCaseExcelData);
|
list.add(functionalCaseExcelData);
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class NoticeTemplateService {
|
||||||
Field[] allFields = FieldUtils.getAllFields(ApiReportMessageDTO.class);
|
Field[] allFields = FieldUtils.getAllFields(ApiReportMessageDTO.class);
|
||||||
addOptionDto(messageTemplateFieldDTOList, allFields, null);
|
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);
|
Field[] allFields = FieldUtils.getAllFields(TestPlanMessageDTO.class);
|
||||||
addOptionDto(messageTemplateFieldDTOList, allFields, null);
|
addOptionDto(messageTemplateFieldDTOList, allFields, null);
|
||||||
}
|
}
|
||||||
|
@ -80,13 +80,6 @@ public class NoticeTemplateService {
|
||||||
Field[] allFields = FieldUtils.getAllFields(Schedule.class);
|
Field[] allFields = FieldUtils.getAllFields(Schedule.class);
|
||||||
addOptionDto(messageTemplateFieldDTOList, allFields, "schedule_");
|
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<>();
|
default -> messageTemplateFieldDTOList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,12 +140,12 @@ public class MessageTemplateUtils {
|
||||||
case NoticeConstants.TaskType.API_DEFINITION_TASK -> FieldUtils.getAllFields(ApiDefinitionCaseDTO.class);
|
case NoticeConstants.TaskType.API_DEFINITION_TASK -> FieldUtils.getAllFields(ApiDefinitionCaseDTO.class);
|
||||||
case NoticeConstants.TaskType.API_SCENARIO_TASK -> FieldUtils.getAllFields(ApiScenarioMessageDTO.class);
|
case NoticeConstants.TaskType.API_SCENARIO_TASK -> FieldUtils.getAllFields(ApiScenarioMessageDTO.class);
|
||||||
case NoticeConstants.TaskType.API_REPORT_TASK -> FieldUtils.getAllFields(ApiReportMessageDTO.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.CASE_REVIEW_TASK -> FieldUtils.getAllFields(CaseReview.class);
|
||||||
case NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK -> FieldUtils.getAllFields(FunctionalCaseMessageDTO.class);
|
case NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK -> FieldUtils.getAllFields(FunctionalCaseMessageDTO.class);
|
||||||
case NoticeConstants.TaskType.BUG_TASK -> FieldUtils.getAllFields(BugMessageDTO.class);
|
case NoticeConstants.TaskType.BUG_TASK -> FieldUtils.getAllFields(BugMessageDTO.class);
|
||||||
case NoticeConstants.TaskType.SCHEDULE_TASK -> FieldUtils.getAllFields(Schedule.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<String, List<CustomField>> customFielddMap) {
|
public static String getTranslateTemplate(String taskType, String template, Map<String, List<CustomField>> customFielddMap) {
|
||||||
if (StringUtils.equalsIgnoreCase(taskType, NoticeConstants.TaskType.JENKINS_TASK)) {
|
Field[] domainTemplateFields = getDomainTemplateFields(taskType);
|
||||||
if (StringUtils.isNotBlank(template) && template.contains("${name}")) {
|
Map<String, Object> map = new HashMap<>();
|
||||||
template = template.replace("${name}", "{{" + Translator.get("message.jenkins_name") + "}}");
|
if (StringUtils.isNotBlank(template) && template.contains("${OPERATOR}")) {
|
||||||
}
|
template = template.replace("${OPERATOR}", "<" + Translator.get("message.operator") + ">");
|
||||||
return template;
|
|
||||||
} else {
|
|
||||||
Field[] domainTemplateFields = getDomainTemplateFields(taskType);
|
|
||||||
Map<String, Object> 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}", "<n>");
|
|
||||||
}
|
|
||||||
setMap(taskType, domainTemplateFields, map);
|
|
||||||
Map<String, String> defaultRelatedUserMap = getDefaultRelatedUserMap();
|
|
||||||
defaultRelatedUserMap.remove("FOLLOW_PEOPLE");
|
|
||||||
map.putAll(defaultRelatedUserMap);
|
|
||||||
addCustomFiled(taskType, customFielddMap, map);
|
|
||||||
return getContent(template, map);
|
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(template) && template.contains("${total}")) {
|
||||||
|
template = template.replace("${total}", "<n>");
|
||||||
|
}
|
||||||
|
setMap(taskType, domainTemplateFields, map);
|
||||||
|
Map<String, String> defaultRelatedUserMap = getDefaultRelatedUserMap();
|
||||||
|
defaultRelatedUserMap.remove("FOLLOW_PEOPLE");
|
||||||
|
map.putAll(defaultRelatedUserMap);
|
||||||
|
addCustomFiled(taskType, customFielddMap, map);
|
||||||
|
return getContent(template, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addCustomFiled(String taskType, Map<String, List<CustomField>> customFielddMap, Map<String, Object> map) {
|
private static void addCustomFiled(String taskType, Map<String, List<CustomField>> customFielddMap, Map<String, Object> map) {
|
||||||
|
@ -238,7 +231,7 @@ public class MessageTemplateUtils {
|
||||||
putDescription(domainTemplateFields, map);
|
putDescription(domainTemplateFields, map);
|
||||||
case NoticeConstants.TaskType.API_SCENARIO_TASK -> putDescription(domainTemplateFields, map);
|
case NoticeConstants.TaskType.API_SCENARIO_TASK -> putDescription(domainTemplateFields, map);
|
||||||
case NoticeConstants.TaskType.API_REPORT_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.CASE_REVIEW_TASK -> putDomainName(domainTemplateFields, map, "case_review_");
|
||||||
case NoticeConstants.TaskType.BUG_TASK -> putDomainName(domainTemplateFields, map, "bug_");
|
case NoticeConstants.TaskType.BUG_TASK -> putDomainName(domainTemplateFields, map, "bug_");
|
||||||
case NoticeConstants.TaskType.SCHEDULE_TASK -> putDomainName(domainTemplateFields, map, "schedule_");
|
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<String, List<CustomField>> customFielddMap) {
|
public static String getTranslateSubject(String taskType, String subject, Map<String, List<CustomField>> customFielddMap) {
|
||||||
if (StringUtils.equalsIgnoreCase(taskType, NoticeConstants.TaskType.JENKINS_TASK)) {
|
Field[] domainTemplateFields = getDomainTemplateFields(taskType);
|
||||||
if (StringUtils.isNotBlank(subject) && subject.contains("${name}")) {
|
Map<String, Object> map = new HashMap<>();
|
||||||
subject = subject.replace("${name}", "{{" + Translator.get("message.jenkins_name") + "}}");
|
if (StringUtils.isNotBlank(subject) && subject.contains("${OPERATOR}")) {
|
||||||
}
|
subject = subject.replace("${OPERATOR}", Translator.get("message.operator"));
|
||||||
return subject;
|
|
||||||
} else {
|
|
||||||
Field[] domainTemplateFields = getDomainTemplateFields(taskType);
|
|
||||||
Map<String, Object> 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<String, String> defaultRelatedUserMap = getDefaultRelatedUserMap();
|
|
||||||
defaultRelatedUserMap.remove("FOLLOW_PEOPLE");
|
|
||||||
map.putAll(defaultRelatedUserMap);
|
|
||||||
addCustomFiled(taskType, customFielddMap, map);
|
|
||||||
return getContent(subject, map);
|
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(subject) && subject.contains("${total}")) {
|
||||||
|
subject = subject.replace("${total}", "n");
|
||||||
|
}
|
||||||
|
setMap(taskType, domainTemplateFields, map);
|
||||||
|
Map<String, String> defaultRelatedUserMap = getDefaultRelatedUserMap();
|
||||||
|
defaultRelatedUserMap.remove("FOLLOW_PEOPLE");
|
||||||
|
map.putAll(defaultRelatedUserMap);
|
||||||
|
addCustomFiled(taskType, customFielddMap, map);
|
||||||
|
return getContent(subject, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue