From c99d452e02cc9203f1a49d032f9130be2ff6d869 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Fri, 23 Aug 2024 12:20:10 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E4=BC=98=E5=8C=96-=E9=9B=86=E6=88=90?= =?UTF-8?q?=E4=B8=8E=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1229092697899008]通知策略优化-集成与发布 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1229092697899008 --- .../callback/DeployJobNotifyCallbackHandler.java | 14 +++++++++++--- .../handler/DeployJobNotifyPolicyHandler.java | 6 +++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/neatlogic/module/deploy/job/callback/DeployJobNotifyCallbackHandler.java b/src/main/java/neatlogic/module/deploy/job/callback/DeployJobNotifyCallbackHandler.java index 221fad76..932a5f0c 100644 --- a/src/main/java/neatlogic/module/deploy/job/callback/DeployJobNotifyCallbackHandler.java +++ b/src/main/java/neatlogic/module/deploy/job/callback/DeployJobNotifyCallbackHandler.java @@ -15,12 +15,15 @@ along with this program. If not, see .*/ package neatlogic.module.deploy.job.callback; import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.autoexec.constvalue.JobUserType; import neatlogic.framework.autoexec.dao.mapper.AutoexecJobMapper; import neatlogic.framework.autoexec.dto.job.AutoexecJobVo; import neatlogic.framework.autoexec.job.callback.core.AutoexecJobCallbackBase; import neatlogic.framework.cmdb.crossover.IAppSystemMapper; import neatlogic.framework.cmdb.dto.resourcecenter.entity.AppModuleVo; import neatlogic.framework.cmdb.dto.resourcecenter.entity.AppSystemVo; +import neatlogic.framework.common.constvalue.GroupSearch; +import neatlogic.framework.common.constvalue.SystemUser; import neatlogic.framework.crossover.CrossoverServiceFactory; import neatlogic.framework.deploy.constvalue.DeployJobNotifyTriggerType; import neatlogic.framework.deploy.dto.job.DeployJobVo; @@ -28,6 +31,7 @@ import neatlogic.framework.notify.crossover.INotifyServiceCrossoverService; import neatlogic.framework.notify.dao.mapper.NotifyMapper; import neatlogic.framework.notify.dto.InvokeNotifyPolicyConfigVo; import neatlogic.framework.notify.dto.NotifyPolicyVo; +import neatlogic.framework.notify.dto.NotifyReceiverVo; import neatlogic.framework.transaction.util.TransactionUtil; import neatlogic.framework.util.NotifyPolicyUtil; import neatlogic.module.deploy.dao.mapper.DeployAppConfigMapper; @@ -40,8 +44,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.TransactionStatus; import javax.annotation.Resource; -import java.util.List; -import java.util.Objects; +import java.util.*; /** * @author longrf @@ -139,9 +142,14 @@ public class DeployJobNotifyCallbackHandler extends AutoexecJobCallbackBase { return; } try { + Map> receiverMap = new HashMap<>(); + if (!Objects.equals(jobInfo.getExecUser(), SystemUser.SYSTEM.getUserUuid())) { + receiverMap.computeIfAbsent(JobUserType.EXEC_USER.getValue(), k -> new ArrayList<>()) + .add(new NotifyReceiverVo(GroupSearch.USER.getValue(), jobInfo.getExecUser())); + } String notifyAuditMessage = jobInfo.getId() + "-" + jobInfo.getName(); NotifyPolicyUtil.execute(notifyPolicyVo.getHandler(), trigger, DeployJobMessageHandler.class - , notifyPolicyVo, null, null, null + , notifyPolicyVo, null, null, receiverMap , jobInfo, null, notifyAuditMessage); } catch (Exception ex) { logger.error("发布作业:" + jobInfo.getId() + "-" + jobInfo.getName() + "通知失败"); diff --git a/src/main/java/neatlogic/module/deploy/notify/handler/DeployJobNotifyPolicyHandler.java b/src/main/java/neatlogic/module/deploy/notify/handler/DeployJobNotifyPolicyHandler.java index 31efc12b..cc3a9bef 100644 --- a/src/main/java/neatlogic/module/deploy/notify/handler/DeployJobNotifyPolicyHandler.java +++ b/src/main/java/neatlogic/module/deploy/notify/handler/DeployJobNotifyPolicyHandler.java @@ -14,7 +14,9 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see .*/ package neatlogic.module.deploy.notify.handler; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.autoexec.constvalue.JobGroupSearch; import neatlogic.framework.deploy.auth.DEPLOY_MODIFY; import neatlogic.framework.deploy.constvalue.DeployJobNotifyParam; import neatlogic.framework.deploy.constvalue.DeployJobNotifyTriggerType; @@ -71,6 +73,8 @@ public class DeployJobNotifyPolicyHandler extends NotifyPolicyHandlerBase { @Override protected void myAuthorityConfig(JSONObject config) { - + List groupList = JSON.parseArray(config.getJSONArray("groupList").toJSONString(), String.class); + groupList.add(JobGroupSearch.JOBUSERTYPE.getValue()); + config.put("groupList", groupList); } } -- Gitee