diff --git a/src/main/java/neatlogic/module/autoexec/api/combop/AutoexecCombopImportApi.java b/src/main/java/neatlogic/module/autoexec/api/combop/AutoexecCombopImportApi.java index d69f4fa0a1a45a7c28ab04853c6ffa8dfe9f632e..9494b16ce4d2587ad80e81e020750ca8df07fb5b 100644 --- a/src/main/java/neatlogic/module/autoexec/api/combop/AutoexecCombopImportApi.java +++ b/src/main/java/neatlogic/module/autoexec/api/combop/AutoexecCombopImportApi.java @@ -16,12 +16,18 @@ package neatlogic.module.autoexec.api.combop; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; import neatlogic.framework.asynchronization.threadlocal.UserContext; import neatlogic.framework.auth.core.AuthAction; import neatlogic.framework.autoexec.auth.AUTOEXEC_COMBOP_ADD; import neatlogic.framework.autoexec.constvalue.CombopOperationType; import neatlogic.framework.autoexec.constvalue.ParamMappingMode; -import neatlogic.framework.autoexec.dto.AutoexecParamVo; +import neatlogic.framework.autoexec.dao.mapper.AutoexecCombopMapper; +import neatlogic.framework.autoexec.dao.mapper.AutoexecScriptMapper; +import neatlogic.framework.autoexec.dao.mapper.AutoexecToolMapper; +import neatlogic.framework.autoexec.dao.mapper.AutoexecTypeMapper; import neatlogic.framework.autoexec.dto.AutoexecToolVo; import neatlogic.framework.autoexec.dto.combop.*; import neatlogic.framework.autoexec.dto.global.param.AutoexecGlobalParamVo; @@ -41,23 +47,16 @@ import neatlogic.framework.notify.core.INotifyPolicyHandler; import neatlogic.framework.notify.core.NotifyPolicyHandlerFactory; import neatlogic.framework.notify.dao.mapper.NotifyMapper; import neatlogic.framework.notify.dto.InvokeNotifyPolicyConfigVo; -import neatlogic.framework.notify.dto.NotifyPolicyHandlerVo; import neatlogic.framework.notify.dto.NotifyPolicyVo; import neatlogic.framework.notify.exception.NotifyPolicyHandlerNotFoundException; import neatlogic.framework.restful.annotation.*; import neatlogic.framework.restful.constvalue.OperationTypeEnum; import neatlogic.framework.restful.core.privateapi.PrivateBinaryStreamApiComponentBase; -import neatlogic.framework.autoexec.dao.mapper.AutoexecCombopMapper; -import neatlogic.framework.autoexec.dao.mapper.AutoexecScriptMapper; -import neatlogic.framework.autoexec.dao.mapper.AutoexecToolMapper; -import neatlogic.framework.autoexec.dao.mapper.AutoexecTypeMapper; +import neatlogic.framework.util.$; import neatlogic.module.autoexec.dao.mapper.AutoexecCombopVersionMapper; import neatlogic.module.autoexec.dao.mapper.AutoexecGlobalParamMapper; import neatlogic.module.autoexec.dao.mapper.AutoexecProfileMapper; import neatlogic.module.autoexec.dao.mapper.AutoexecScenarioMapper; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.TypeReference; import neatlogic.module.autoexec.service.AutoexecCombopService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -280,17 +279,16 @@ public class AutoexecCombopImportApi extends PrivateBinaryStreamApiComponentBase if (notifyPolicyHandler == null) { throw new NotifyPolicyHandlerNotFoundException(notifyPolicyVo.getHandler()); } + String moduleGroup = NotifyPolicyHandlerFactory.getModuleGroupIdByHandler(notifyPolicyVo.getHandler()); + if (moduleGroup == null) { + throw new NotifyPolicyHandlerNotFoundException(notifyPolicyVo.getHandler()); + } String moduleGroupName = ""; - List notifyPolicyHandlerList = NotifyPolicyHandlerFactory.getNotifyPolicyHandlerList(); - for (NotifyPolicyHandlerVo notifyPolicyHandlerVo : notifyPolicyHandlerList) { - if (Objects.equals(notifyPolicyHandlerVo.getHandler(), notifyPolicyVo.getHandler())) { - ModuleGroupVo moduleGroupVo = ModuleUtil.getModuleGroup(notifyPolicyHandlerVo.getModuleGroup()); - if (moduleGroupVo != null) { - moduleGroupName = moduleGroupVo.getGroupName(); - } - } + ModuleGroupVo moduleGroupVo = ModuleUtil.getModuleGroup(moduleGroup); + if (moduleGroupVo != null) { + moduleGroupName = moduleGroupVo.getGroupName(); } - String handlerName = notifyPolicyHandler.getName(); + String handlerName = $.t(notifyPolicyHandler.getName()); notifyPolicyConfigVo.setPolicyPath(moduleGroupName + "/" + handlerName + "/" + notifyPolicyVo.getName()); notifyPolicyConfigVo.setPolicyId(notifyPolicyVo.getId()); } diff --git a/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecCombopNotifyPolicyHandler.java b/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecCombopNotifyPolicyHandler.java index 61b87de1aa528e7caa0af1a497eba73bbaade150..6e51d91f906d411b923eca18d7c16b10aa07aad5 100644 --- a/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecCombopNotifyPolicyHandler.java +++ b/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecCombopNotifyPolicyHandler.java @@ -21,12 +21,10 @@ import neatlogic.framework.autoexec.auth.AUTOEXEC_COMBOP_ADD; import neatlogic.framework.autoexec.constvalue.AutoexecJobNotifyParam; import neatlogic.framework.autoexec.constvalue.AutoexecJobNotifyTriggerType; import neatlogic.framework.dto.ConditionParamVo; -import neatlogic.framework.notify.core.INotifyPolicyHandlerGroup; import neatlogic.framework.notify.core.NotifyHandlerType; import neatlogic.framework.notify.core.NotifyPolicyHandlerBase; import neatlogic.framework.notify.dto.NotifyTriggerTemplateVo; import neatlogic.framework.notify.dto.NotifyTriggerVo; -import neatlogic.framework.util.I18nUtils; import org.springframework.stereotype.Component; import java.util.ArrayList; @@ -40,7 +38,7 @@ import java.util.List; public class AutoexecCombopNotifyPolicyHandler extends NotifyPolicyHandlerBase { @Override public String getName() { - return "组合工具"; + return "term.autoexec.combop"; } /** @@ -51,10 +49,10 @@ public class AutoexecCombopNotifyPolicyHandler extends NotifyPolicyHandlerBase { return AUTOEXEC_COMBOP_ADD.class.getSimpleName(); } - @Override - public INotifyPolicyHandlerGroup getGroup() { - return null; - } +// @Override +// public INotifyPolicyHandlerGroup getGroup() { +// return null; +// } @Override protected List myNotifyTriggerList() {