From 8a69aad45e20177ca4355f3ab3c7b32cc7c364c0 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Tue, 20 Aug 2024 20:51:08 +0800 Subject: [PATCH 1/4] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E9=80=9A=E7=9F=A5=E7=AD=96=E7=95=A5=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1227345283743744]自动化通知策略增加触发点 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1227345283743744 --- .../AutoexecJobNotifyCallbackHandler.java | 4 +- .../AutoexecCombopNotifyPolicyHandler.java | 21 +++--- .../handler/AutoexecNotifyPolicyHandler.java | 74 +++++++++++++++++++ .../component/CreateJobProcessComponent.java | 4 + .../CreateJobProcessUtilHandler.java | 4 +- .../component/AutoexecProcessComponent.java | 8 +- .../AutoexecProcessUtilHandler.java | 9 ++- 7 files changed, 102 insertions(+), 22 deletions(-) create mode 100644 src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecNotifyPolicyHandler.java diff --git a/src/main/java/neatlogic/module/autoexec/job/callback/AutoexecJobNotifyCallbackHandler.java b/src/main/java/neatlogic/module/autoexec/job/callback/AutoexecJobNotifyCallbackHandler.java index 2605fe32..1d15aaf2 100644 --- a/src/main/java/neatlogic/module/autoexec/job/callback/AutoexecJobNotifyCallbackHandler.java +++ b/src/main/java/neatlogic/module/autoexec/job/callback/AutoexecJobNotifyCallbackHandler.java @@ -65,7 +65,7 @@ public class AutoexecJobNotifyCallbackHandler extends AutoexecJobCallbackBase { @Override public Boolean getIsNeedCallback(AutoexecJobVo jobVo) { - AutoexecJobNotifyTriggerType trigger = AutoexecJobNotifyTriggerType.getTrigger(jobVo.getStatus()); + AutoexecJobNotifyTriggerType trigger = AutoexecJobNotifyTriggerType.getTriggerByStatus(jobVo.getStatus()); if (trigger != null) { AutoexecJobVo jobInfo; // 开启一个新事务来查询父事务提交前的作业状态,如果新事务查出来的状态与当前jobVo的状态不同,则表示该状态未通知过 @@ -86,7 +86,7 @@ public class AutoexecJobNotifyCallbackHandler extends AutoexecJobCallbackBase { @Override public void doService(Long invokeId, AutoexecJobVo jobVo) { - AutoexecJobNotifyTriggerType trigger = AutoexecJobNotifyTriggerType.getTrigger(jobVo.getStatus()); + AutoexecJobNotifyTriggerType trigger = AutoexecJobNotifyTriggerType.getTriggerByStatus(jobVo.getStatus()); if (trigger == null) { return; } 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 6cf7cdb2..8d706f6b 100644 --- a/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecCombopNotifyPolicyHandler.java +++ b/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecCombopNotifyPolicyHandler.java @@ -20,10 +20,8 @@ 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.NotifyPolicyHandlerBase; import neatlogic.framework.notify.dto.NotifyTriggerVo; -import neatlogic.framework.process.constvalue.ProcessTaskGroupSearch; -import neatlogic.framework.process.constvalue.ProcessUserType; -import neatlogic.framework.process.notify.core.ProcessTaskNotifyHandlerBase; import org.springframework.stereotype.Component; import java.util.ArrayList; @@ -34,7 +32,7 @@ import java.util.List; * @since: 2021/4/15 9:47 **/ @Component -public class AutoexecCombopNotifyPolicyHandler extends ProcessTaskNotifyHandlerBase { +public class AutoexecCombopNotifyPolicyHandler extends NotifyPolicyHandlerBase { @Override public String getName() { return "term.autoexec.combop"; @@ -49,7 +47,7 @@ public class AutoexecCombopNotifyPolicyHandler extends ProcessTaskNotifyHandlerB } @Override - protected List myCustomNotifyTriggerList() { + protected List myNotifyTriggerList() { List returnList = new ArrayList<>(); for (AutoexecJobNotifyTriggerType triggerType : AutoexecJobNotifyTriggerType.values()) { returnList.add(new NotifyTriggerVo(triggerType)); @@ -58,7 +56,7 @@ public class AutoexecCombopNotifyPolicyHandler extends ProcessTaskNotifyHandlerB } @Override - protected List myCustomSystemParamList() { + protected List mySystemParamList() { List notifyPolicyParamList = new ArrayList<>(); for (AutoexecJobNotifyParam param : AutoexecJobNotifyParam.values()) { notifyPolicyParamList.add(createConditionParam(param)); @@ -67,9 +65,12 @@ public class AutoexecCombopNotifyPolicyHandler extends ProcessTaskNotifyHandlerB } @Override - protected void myCustomAuthorityConfig(JSONObject config) { - List excludeList = config.getJSONArray("excludeList").toJavaList(String.class); - excludeList.add(ProcessTaskGroupSearch.PROCESSUSERTYPE.getValue() + "#" + ProcessUserType.MINOR.getValue()); - config.put("excludeList", excludeList); + protected List mySystemConditionOptionList() { + return new ArrayList<>(); + } + + @Override + protected void myAuthorityConfig(JSONObject config) { + } } diff --git a/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecNotifyPolicyHandler.java b/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecNotifyPolicyHandler.java new file mode 100644 index 00000000..441e1440 --- /dev/null +++ b/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecNotifyPolicyHandler.java @@ -0,0 +1,74 @@ +/*Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .*/ + +package neatlogic.module.autoexec.notify.handler; + +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.autoexec.auth.AUTOEXEC_COMBOP_ADD; +import neatlogic.framework.autoexec.constvalue.AutoexecNotifyTriggerType; +import neatlogic.framework.notify.dto.NotifyTriggerVo; +import neatlogic.framework.process.constvalue.ProcessTaskGroupSearch; +import neatlogic.framework.process.constvalue.ProcessUserType; +import neatlogic.framework.process.notify.core.ProcessTaskNotifyHandlerBase; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +@Component +public class AutoexecNotifyPolicyHandler extends ProcessTaskNotifyHandlerBase { + @Override + public String getName() { + return "term.autoexec.groupname"; + } + + /** + * 绑定权限,每种handler对应不同的权限 + */ + @Override + public String getAuthName() { + return AUTOEXEC_COMBOP_ADD.class.getSimpleName(); + } + + @Override + protected List myCustomNotifyTriggerList() { + List returnList = new ArrayList<>(); + for (AutoexecNotifyTriggerType triggerType : AutoexecNotifyTriggerType.values()) { + returnList.add(new NotifyTriggerVo(triggerType)); + } + return returnList; + } + +// @Override +// protected List myCustomSystemParamList() { +// List notifyPolicyParamList = new ArrayList<>(); +// for (AutoexecJobNotifyParam param : AutoexecJobNotifyParam.values()) { +// notifyPolicyParamList.add(createConditionParam(param)); +// } +// return notifyPolicyParamList; +// } + + @Override + protected void myCustomAuthorityConfig(JSONObject config) { + List excludeList = config.getJSONArray("excludeList").toJavaList(String.class); + excludeList.add(ProcessTaskGroupSearch.PROCESSUSERTYPE.getValue() + "#" + ProcessUserType.MINOR.getValue()); + config.put("excludeList", excludeList); + } + + @Override + public String getModuleGroup() { + return "process"; + } +} diff --git a/src/main/java/neatlogic/module/autoexec/process/stephandler/component/CreateJobProcessComponent.java b/src/main/java/neatlogic/module/autoexec/process/stephandler/component/CreateJobProcessComponent.java index 0577e74b..744ef48f 100644 --- a/src/main/java/neatlogic/module/autoexec/process/stephandler/component/CreateJobProcessComponent.java +++ b/src/main/java/neatlogic/module/autoexec/process/stephandler/component/CreateJobProcessComponent.java @@ -19,6 +19,7 @@ package neatlogic.module.autoexec.process.stephandler.component; import com.alibaba.fastjson.*; import neatlogic.framework.asynchronization.threadlocal.UserContext; +import neatlogic.framework.autoexec.constvalue.AutoexecNotifyTriggerType; import neatlogic.framework.autoexec.constvalue.JobStatus; import neatlogic.framework.autoexec.dao.mapper.AutoexecJobMapper; import neatlogic.framework.autoexec.dto.combop.AutoexecCombopVersionVo; @@ -256,6 +257,9 @@ public class CreateJobProcessComponent extends ProcessStepHandlerBase { } } } + IProcessStepHandlerCrossoverUtil processStepHandlerCrossoverUtil = CrossoverServiceFactory.getApi(IProcessStepHandlerCrossoverUtil.class); + /* 触发通知 **/ + processStepHandlerCrossoverUtil.notify(currentProcessTaskStepVo, AutoexecNotifyTriggerType.CREATE_JOB_FAILED); } } catch (Exception e) { logger.error(e.getMessage(), e); diff --git a/src/main/java/neatlogic/module/autoexec/process/stephandler/utilhandler/CreateJobProcessUtilHandler.java b/src/main/java/neatlogic/module/autoexec/process/stephandler/utilhandler/CreateJobProcessUtilHandler.java index f87951c6..c598af8c 100644 --- a/src/main/java/neatlogic/module/autoexec/process/stephandler/utilhandler/CreateJobProcessUtilHandler.java +++ b/src/main/java/neatlogic/module/autoexec/process/stephandler/utilhandler/CreateJobProcessUtilHandler.java @@ -30,7 +30,7 @@ import neatlogic.framework.process.crossover.IProcessTaskStepDataCrossoverMapper import neatlogic.framework.process.dto.ProcessTaskStepDataVo; import neatlogic.framework.process.dto.ProcessTaskStepVo; import neatlogic.framework.process.stephandler.core.ProcessStepInternalHandlerBase; -import neatlogic.module.autoexec.notify.handler.AutoexecCombopNotifyPolicyHandler; +import neatlogic.module.autoexec.notify.handler.AutoexecNotifyPolicyHandler; import neatlogic.module.autoexec.process.constvalue.CreateJobProcessStepHandlerType; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; @@ -146,7 +146,7 @@ public class CreateJobProcessUtilHandler extends ProcessStepInternalHandlerBase @Override public Class getNotifyPolicyHandlerClass() { - return AutoexecCombopNotifyPolicyHandler.class; + return AutoexecNotifyPolicyHandler.class; } @Override diff --git a/src/main/java/neatlogic/module/autoexec/stephandler/component/AutoexecProcessComponent.java b/src/main/java/neatlogic/module/autoexec/stephandler/component/AutoexecProcessComponent.java index 1a4ef88c..b950d7af 100644 --- a/src/main/java/neatlogic/module/autoexec/stephandler/component/AutoexecProcessComponent.java +++ b/src/main/java/neatlogic/module/autoexec/stephandler/component/AutoexecProcessComponent.java @@ -17,10 +17,7 @@ package neatlogic.module.autoexec.stephandler.component; import com.alibaba.fastjson.*; import neatlogic.framework.asynchronization.threadlocal.UserContext; -import neatlogic.framework.autoexec.constvalue.CombopOperationType; -import neatlogic.framework.autoexec.constvalue.JobStatus; -import neatlogic.framework.autoexec.constvalue.ParamMappingMode; -import neatlogic.framework.autoexec.constvalue.ParamType; +import neatlogic.framework.autoexec.constvalue.*; import neatlogic.framework.autoexec.dao.mapper.AutoexecJobMapper; import neatlogic.framework.autoexec.dto.combop.AutoexecCombopExecuteConfigVo; import neatlogic.framework.autoexec.dto.combop.AutoexecCombopExecuteNodeConfigVo; @@ -302,6 +299,9 @@ public class AutoexecProcessComponent extends ProcessStepHandlerBase { } } } + IProcessStepHandlerCrossoverUtil processStepHandlerCrossoverUtil = CrossoverServiceFactory.getApi(IProcessStepHandlerCrossoverUtil.class); + /* 触发通知 **/ + processStepHandlerCrossoverUtil.notify(currentProcessTaskStepVo, AutoexecNotifyTriggerType.CREATE_JOB_FAILED); } } catch (Exception e) { logger.error(e.getMessage(), e); diff --git a/src/main/java/neatlogic/module/autoexec/stephandler/utilhandler/AutoexecProcessUtilHandler.java b/src/main/java/neatlogic/module/autoexec/stephandler/utilhandler/AutoexecProcessUtilHandler.java index 206eb635..adb194a1 100644 --- a/src/main/java/neatlogic/module/autoexec/stephandler/utilhandler/AutoexecProcessUtilHandler.java +++ b/src/main/java/neatlogic/module/autoexec/stephandler/utilhandler/AutoexecProcessUtilHandler.java @@ -33,7 +33,7 @@ import neatlogic.framework.process.dto.processconfig.ActionConfigVo; import neatlogic.framework.process.stephandler.core.ProcessStepInternalHandlerBase; import neatlogic.framework.process.util.ProcessConfigUtil; import neatlogic.framework.util.SnowflakeUtil; -import neatlogic.module.autoexec.notify.handler.AutoexecCombopNotifyPolicyHandler; +import neatlogic.module.autoexec.notify.handler.AutoexecNotifyPolicyHandler; import neatlogic.module.autoexec.service.AutoexecJobService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; @@ -69,7 +69,8 @@ public class AutoexecProcessUtilHandler extends ProcessStepInternalHandlerBase { @Override public Object getNonStartStepInfo(ProcessTaskStepVo currentProcessTaskStepVo) { JSONObject resultObj = new JSONObject(); - List jobIdList = autoexecJobMapper.getJobIdListByInvokeId(currentProcessTaskStepVo.getId()); +// List jobIdList = autoexecJobMapper.getJobIdListByInvokeId(currentProcessTaskStepVo.getId()); + List jobIdList = autoexecJobMapper.getJobIdListByProcessTaskStepId(currentProcessTaskStepVo.getId()); if (CollectionUtils.isNotEmpty(jobIdList)) { int completed = 0, failed = 0, running = 0; Map> jobIdToAutoexecJobPhaseListMap = new HashMap<>(); @@ -185,7 +186,7 @@ public class AutoexecProcessUtilHandler extends ProcessStepInternalHandlerBase { /* 通知 **/ JSONObject notifyPolicyConfig = configObj.getJSONObject("notifyPolicyConfig"); INotifyServiceCrossoverService notifyServiceCrossoverService = CrossoverServiceFactory.getApi(INotifyServiceCrossoverService.class); - InvokeNotifyPolicyConfigVo invokeNotifyPolicyConfigVo = notifyServiceCrossoverService.regulateNotifyPolicyConfig(notifyPolicyConfig, AutoexecCombopNotifyPolicyHandler.class); + InvokeNotifyPolicyConfigVo invokeNotifyPolicyConfigVo = notifyServiceCrossoverService.regulateNotifyPolicyConfig(notifyPolicyConfig, AutoexecNotifyPolicyHandler.class); resultObj.put("notifyPolicyConfig", invokeNotifyPolicyConfigVo); /** 动作 **/ @@ -194,7 +195,7 @@ public class AutoexecProcessUtilHandler extends ProcessStepInternalHandlerBase { if (actionConfigVo == null) { actionConfigVo = new ActionConfigVo(); } - actionConfigVo.setHandler(AutoexecCombopNotifyPolicyHandler.class.getName()); + actionConfigVo.setHandler(AutoexecNotifyPolicyHandler.class.getName()); resultObj.put("actionConfig", actionConfigVo); /* 按钮映射列表 **/ -- Gitee From b0f32186f1c24872f72f58d98227618d0e8a322c Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Tue, 20 Aug 2024 20:52:34 +0800 Subject: [PATCH 2/4] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E9=80=9A=E7=9F=A5=E7=AD=96=E7=95=A5=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1227345283743744]自动化通知策略增加触发点 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1227345283743744 --- .../notify/handler/AutoexecNotifyPolicyHandler.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecNotifyPolicyHandler.java b/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecNotifyPolicyHandler.java index 441e1440..a5739f01 100644 --- a/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecNotifyPolicyHandler.java +++ b/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecNotifyPolicyHandler.java @@ -51,15 +51,6 @@ public class AutoexecNotifyPolicyHandler extends ProcessTaskNotifyHandlerBase { return returnList; } -// @Override -// protected List myCustomSystemParamList() { -// List notifyPolicyParamList = new ArrayList<>(); -// for (AutoexecJobNotifyParam param : AutoexecJobNotifyParam.values()) { -// notifyPolicyParamList.add(createConditionParam(param)); -// } -// return notifyPolicyParamList; -// } - @Override protected void myCustomAuthorityConfig(JSONObject config) { List excludeList = config.getJSONArray("excludeList").toJavaList(String.class); -- Gitee From 180ccdfe30d577f9a02bed9b6011d18ed8865d0f Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Wed, 21 Aug 2024 14:42:36 +0800 Subject: [PATCH 3/4] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E9=80=9A=E7=9F=A5=E7=AD=96=E7=95=A5=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1227345283743744]自动化通知策略增加触发点 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1227345283743744 --- .../handler/AutoexecNotifyPolicyHandler.java | 11 ++++ .../AutoexecCreateJobErrorParamHandler.java | 64 +++++++++++++++++++ .../process/util/CreateJobConfigUtil.java | 18 ++++++ .../component/AutoexecProcessComponent.java | 6 +- 4 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 src/main/java/neatlogic/module/autoexec/notify/handler/param/AutoexecCreateJobErrorParamHandler.java diff --git a/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecNotifyPolicyHandler.java b/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecNotifyPolicyHandler.java index a5739f01..bef46df4 100644 --- a/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecNotifyPolicyHandler.java +++ b/src/main/java/neatlogic/module/autoexec/notify/handler/AutoexecNotifyPolicyHandler.java @@ -17,7 +17,9 @@ package neatlogic.module.autoexec.notify.handler; import com.alibaba.fastjson.JSONObject; import neatlogic.framework.autoexec.auth.AUTOEXEC_COMBOP_ADD; +import neatlogic.framework.autoexec.constvalue.AutoexecNotifyParam; import neatlogic.framework.autoexec.constvalue.AutoexecNotifyTriggerType; +import neatlogic.framework.dto.ConditionParamVo; import neatlogic.framework.notify.dto.NotifyTriggerVo; import neatlogic.framework.process.constvalue.ProcessTaskGroupSearch; import neatlogic.framework.process.constvalue.ProcessUserType; @@ -51,6 +53,15 @@ public class AutoexecNotifyPolicyHandler extends ProcessTaskNotifyHandlerBase { return returnList; } + @Override + protected List myCustomSystemParamList() { + List notifyPolicyParamList = new ArrayList<>(); + for (AutoexecNotifyParam param : AutoexecNotifyParam.values()) { + notifyPolicyParamList.add(createConditionParam(param)); + } + return notifyPolicyParamList; + } + @Override protected void myCustomAuthorityConfig(JSONObject config) { List excludeList = config.getJSONArray("excludeList").toJavaList(String.class); diff --git a/src/main/java/neatlogic/module/autoexec/notify/handler/param/AutoexecCreateJobErrorParamHandler.java b/src/main/java/neatlogic/module/autoexec/notify/handler/param/AutoexecCreateJobErrorParamHandler.java new file mode 100644 index 00000000..31e5289f --- /dev/null +++ b/src/main/java/neatlogic/module/autoexec/notify/handler/param/AutoexecCreateJobErrorParamHandler.java @@ -0,0 +1,64 @@ +/*Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .*/ + +package neatlogic.module.autoexec.notify.handler.param; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.autoexec.constvalue.AutoexecNotifyParam; +import neatlogic.framework.autoexec.constvalue.AutoexecNotifyTriggerType; +import neatlogic.framework.crossover.CrossoverServiceFactory; +import neatlogic.framework.notify.core.INotifyTriggerType; +import neatlogic.framework.process.crossover.IProcessTaskStepDataCrossoverMapper; +import neatlogic.framework.process.dto.ProcessTaskStepDataVo; +import neatlogic.framework.process.dto.ProcessTaskStepVo; +import neatlogic.framework.process.notify.core.ProcessTaskNotifyParamHandlerBase; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; +import org.springframework.stereotype.Component; + +@Component +public class AutoexecCreateJobErrorParamHandler extends ProcessTaskNotifyParamHandlerBase { + @Override + public String getValue() { + return AutoexecNotifyParam.CREATE_JOB_FAILED_CONTENT.getValue(); + } + + @Override + public Object getMyText(ProcessTaskStepVo processTaskStepVo, INotifyTriggerType notifyTriggerType) { + if (!(notifyTriggerType == AutoexecNotifyTriggerType.CREATE_JOB_FAILED)) { + return null; + } + if (processTaskStepVo == null) { + return null; + } + IProcessTaskStepDataCrossoverMapper processTaskStepDataCrossoverMapper = CrossoverServiceFactory.getApi(IProcessTaskStepDataCrossoverMapper.class); + ProcessTaskStepDataVo searchVo = new ProcessTaskStepDataVo(); + searchVo.setProcessTaskId(processTaskStepVo.getProcessTaskId()); + searchVo.setProcessTaskStepId(processTaskStepVo.getId()); + searchVo.setType("autoexecCreateJobError"); + ProcessTaskStepDataVo processTaskStepDataVo = processTaskStepDataCrossoverMapper.getProcessTaskStepData(searchVo); + if (processTaskStepDataVo != null) { + JSONObject dataObj = processTaskStepDataVo.getData(); + if (MapUtils.isNotEmpty(dataObj)) { + JSONArray errorList = dataObj.getJSONArray("errorList"); + if (CollectionUtils.isNotEmpty(errorList)) { + return errorList.toJSONString(); + } + } + } + return null; + } +} diff --git a/src/main/java/neatlogic/module/autoexec/process/util/CreateJobConfigUtil.java b/src/main/java/neatlogic/module/autoexec/process/util/CreateJobConfigUtil.java index 51da6b9d..a6650901 100644 --- a/src/main/java/neatlogic/module/autoexec/process/util/CreateJobConfigUtil.java +++ b/src/main/java/neatlogic/module/autoexec/process/util/CreateJobConfigUtil.java @@ -342,6 +342,9 @@ public class CreateJobConfigUtil { scenarioNameToIdMap.put(combopScenarioVo.getScenarioName(), combopScenarioVo.getScenarioId()); } for (Object obj : jsonArray) { + if (obj == null) { + continue; + } if (obj instanceof Long) { Long scenarioId = (Long) obj; if (scenarioIdList.contains(scenarioId)) { @@ -377,6 +380,9 @@ public class CreateJobConfigUtil { } IResourceAccountCrossoverMapper resourceAccountCrossoverMapper = CrossoverServiceFactory.getApi(IResourceAccountCrossoverMapper.class); for (Object obj : jsonArray) { + if (obj == null) { + continue; + } if (obj instanceof Long) { Long protocolId = (Long) obj; AccountProtocolVo accountProtocolVo = resourceAccountCrossoverMapper.getAccountProtocolVoByProtocolId(protocolId); @@ -414,6 +420,9 @@ public class CreateJobConfigUtil { } IResourceAccountCrossoverMapper resourceAccountCrossoverMapper = CrossoverServiceFactory.getApi(IResourceAccountCrossoverMapper.class); for (Object obj : jsonArray) { + if (obj == null) { + continue; + } if (obj instanceof Long) { Long accountId = (Long) obj; AccountVo accountVo = resourceAccountCrossoverMapper.getAccountById(accountId); @@ -461,6 +470,9 @@ public class CreateJobConfigUtil { List inputNodeList = new ArrayList<>(); JSONObject filter = new JSONObject(); for (Object obj : jsonArray) { + if (obj == null) { + continue; + } if (obj instanceof String) { String str = (String) obj; if (str.startsWith("{") && str.endsWith("}")) { @@ -521,6 +533,9 @@ public class CreateJobConfigUtil { return resultList; } for (Object obj : jsonArray) { + if (obj == null) { + continue; + } if (obj instanceof String) { String str = (String) obj; if (str.startsWith("{") && str.endsWith("}")) { @@ -1238,6 +1253,9 @@ public class CreateJobConfigUtil { private static Object getJSONObjectOrJSONArray(JSONArray jsonArray) { JSONArray jsonList = new JSONArray(); for (Object obj : jsonArray) { + if (obj == null) { + continue; + } if (obj instanceof JSONObject) { jsonList.add(obj); } else if (obj instanceof JSONArray) { diff --git a/src/main/java/neatlogic/module/autoexec/stephandler/component/AutoexecProcessComponent.java b/src/main/java/neatlogic/module/autoexec/stephandler/component/AutoexecProcessComponent.java index b950d7af..cfe0651a 100644 --- a/src/main/java/neatlogic/module/autoexec/stephandler/component/AutoexecProcessComponent.java +++ b/src/main/java/neatlogic/module/autoexec/stephandler/component/AutoexecProcessComponent.java @@ -259,9 +259,7 @@ public class AutoexecProcessComponent extends ProcessStepHandlerBase { } } } - if (CollectionUtils.isEmpty(jobIdList)) { - processTaskStepComplete(currentProcessTaskStepVo.getId(), null); - } + // 如果有一个作业创建有异常,则根据失败策略执行操作 if (flag) { ProcessTaskStepDataVo processTaskStepDataVo = new ProcessTaskStepDataVo(); @@ -302,6 +300,8 @@ public class AutoexecProcessComponent extends ProcessStepHandlerBase { IProcessStepHandlerCrossoverUtil processStepHandlerCrossoverUtil = CrossoverServiceFactory.getApi(IProcessStepHandlerCrossoverUtil.class); /* 触发通知 **/ processStepHandlerCrossoverUtil.notify(currentProcessTaskStepVo, AutoexecNotifyTriggerType.CREATE_JOB_FAILED); + } else if (CollectionUtils.isEmpty(jobIdList)) { + processTaskStepComplete(currentProcessTaskStepVo.getId(), null); } } catch (Exception e) { logger.error(e.getMessage(), e); -- Gitee From db4814f4183086d1280351186679e3bbcd9bde54 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Wed, 21 Aug 2024 14:44:41 +0800 Subject: [PATCH 4/4] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E9=80=9A=E7=9F=A5=E7=AD=96=E7=95=A5=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1227345283743744]自动化通知策略增加触发点 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1227345283743744 --- ...ler.java => AutoexecCreateJobFailedContentParamHandler.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/main/java/neatlogic/module/autoexec/notify/handler/param/{AutoexecCreateJobErrorParamHandler.java => AutoexecCreateJobFailedContentParamHandler.java} (96%) diff --git a/src/main/java/neatlogic/module/autoexec/notify/handler/param/AutoexecCreateJobErrorParamHandler.java b/src/main/java/neatlogic/module/autoexec/notify/handler/param/AutoexecCreateJobFailedContentParamHandler.java similarity index 96% rename from src/main/java/neatlogic/module/autoexec/notify/handler/param/AutoexecCreateJobErrorParamHandler.java rename to src/main/java/neatlogic/module/autoexec/notify/handler/param/AutoexecCreateJobFailedContentParamHandler.java index 31e5289f..58d1b46e 100644 --- a/src/main/java/neatlogic/module/autoexec/notify/handler/param/AutoexecCreateJobErrorParamHandler.java +++ b/src/main/java/neatlogic/module/autoexec/notify/handler/param/AutoexecCreateJobFailedContentParamHandler.java @@ -30,7 +30,7 @@ import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Component; @Component -public class AutoexecCreateJobErrorParamHandler extends ProcessTaskNotifyParamHandlerBase { +public class AutoexecCreateJobFailedContentParamHandler extends ProcessTaskNotifyParamHandlerBase { @Override public String getValue() { return AutoexecNotifyParam.CREATE_JOB_FAILED_CONTENT.getValue(); -- Gitee