refactor(消息管理): 获取模版列表接口内容国际化
This commit is contained in:
parent
889ac1d1f9
commit
a0165f2dd6
|
@ -44,52 +44,52 @@ public class NoticeTemplateService {
|
|||
switch (taskType) {
|
||||
case NoticeConstants.TaskType.API_DEFINITION_TASK -> {
|
||||
Field[] allFields = FieldUtils.getAllFields(ApiDefinitionCaseDTO.class);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields, null);
|
||||
addCustomFiled(messageTemplateFieldDTOList, projectId, TemplateScene.API.toString());
|
||||
//TODO:获取报告
|
||||
}
|
||||
case NoticeConstants.TaskType.API_SCENARIO_TASK -> {
|
||||
Field[] allFields = FieldUtils.getAllFields(ApiScenario.class);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields, "api_scenario_");
|
||||
//TODO:获取报告
|
||||
}
|
||||
case NoticeConstants.TaskType.TEST_PLAN_TASK -> {
|
||||
Field[] allFields = FieldUtils.getAllFields(TestPlan.class);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields, "test_plan_");
|
||||
addCustomFiled(messageTemplateFieldDTOList, projectId, TemplateScene.TEST_PLAN.toString());
|
||||
//TODO:获取报告
|
||||
}
|
||||
case NoticeConstants.TaskType.CASE_REVIEW_TASK -> {
|
||||
Field[] allFields = FieldUtils.getAllFields(CaseReview.class);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields, "case_review_");
|
||||
//TODO:获取报告
|
||||
}
|
||||
case NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK -> {
|
||||
Field[] allFields = FieldUtils.getAllFields(FunctionalCaseMessageDTO.class);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields, null);
|
||||
addCustomFiled(messageTemplateFieldDTOList, projectId, TemplateScene.FUNCTIONAL.toString());
|
||||
//TODO:获取报告
|
||||
}
|
||||
case NoticeConstants.TaskType.BUG_TASK -> {
|
||||
Field[] allFields = FieldUtils.getAllFields(Bug.class);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields, "bug_");
|
||||
addCustomFiled(messageTemplateFieldDTOList, projectId, TemplateScene.BUG.toString());
|
||||
//TODO:获取报告
|
||||
}
|
||||
case NoticeConstants.TaskType.UI_SCENARIO_TASK -> {
|
||||
Field[] allFields = FieldUtils.getAllFields(UiScenario.class);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields, "ui_");
|
||||
addCustomFiled(messageTemplateFieldDTOList, projectId, TemplateScene.UI.toString());
|
||||
//TODO:获取报告
|
||||
}
|
||||
case NoticeConstants.TaskType.LOAD_TEST_TASK -> {
|
||||
Field[] allFields = FieldUtils.getAllFields(LoadTest.class);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields, "load_");
|
||||
//TODO:获取报告
|
||||
}
|
||||
case NoticeConstants.TaskType.SCHEDULE_TASK -> {
|
||||
Field[] allFields = FieldUtils.getAllFields(Schedule.class);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields);
|
||||
addOptionDto(messageTemplateFieldDTOList, allFields, "schedule_");
|
||||
//TODO:获取报告
|
||||
}
|
||||
case NoticeConstants.TaskType.JENKINS_TASK -> {
|
||||
|
@ -132,7 +132,7 @@ public class NoticeTemplateService {
|
|||
* @param messageTemplateFieldDTOS messageTemplateFieldDTOS
|
||||
* @param allFields allFields
|
||||
*/
|
||||
private static void addOptionDto(List<MessageTemplateFieldDTO> messageTemplateFieldDTOS, Field[] allFields) {
|
||||
private static void addOptionDto(List<MessageTemplateFieldDTO> messageTemplateFieldDTOS, Field[] allFields, String tableName) {
|
||||
Field[] sensitiveFields = FieldUtils.getAllFields(NoticeConstants.SensitiveField.class);
|
||||
ArrayList<Field> sensitiveFieldList = new ArrayList<>(sensitiveFields.length);
|
||||
Collections.addAll(sensitiveFieldList, sensitiveFields);
|
||||
|
@ -146,7 +146,12 @@ public class NoticeTemplateService {
|
|||
Schema annotation = allField.getAnnotation(Schema.class);
|
||||
if (annotation != null) {
|
||||
messageTemplateFieldDTO.setId(allField.getName());
|
||||
String description = annotation.description();
|
||||
String description;
|
||||
if (StringUtils.isBlank(tableName)) {
|
||||
description = Translator.get(annotation.description());
|
||||
} else {
|
||||
description = Translator.get("message.domain." + tableName + allField.getName());
|
||||
}
|
||||
messageTemplateFieldDTO.setName(description);
|
||||
messageTemplateFieldDTO.setFieldSource(NoticeConstants.FieldSource.CASE_FIELD);
|
||||
messageTemplateFieldDTOS.add(messageTemplateFieldDTO);
|
||||
|
@ -184,4 +189,5 @@ public class NoticeTemplateService {
|
|||
messageTemplateResultDTO.setFieldSourceList(optionDTOList);
|
||||
return messageTemplateResultDTO;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue