From ac31041d27ed40b16fd1dc74ea4e6f4e292e9709 Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Tue, 31 Oct 2023 17:44:21 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20=E7=BB=84=E5=90=88?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E5=AF=BC=E5=85=A5-=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E5=BC=95=E7=94=A8=E9=80=9A=E7=9F=A5=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E6=97=B6=EF=BC=8C=E6=B2=A1=E6=9C=89=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=87=BA=E9=80=9A=E7=9F=A5=E7=AD=96=E7=95=A5=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1014494958944256]组合工具导入-提示缺少引用通知策略时,没有显示出通知策略路径 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1014494958944256 --- .../notify/service/NotifyServiceImpl.java | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/main/java/neatlogic/module/framework/notify/service/NotifyServiceImpl.java b/src/main/java/neatlogic/module/framework/notify/service/NotifyServiceImpl.java index 105ee1ba4..6b7d90063 100644 --- a/src/main/java/neatlogic/module/framework/notify/service/NotifyServiceImpl.java +++ b/src/main/java/neatlogic/module/framework/notify/service/NotifyServiceImpl.java @@ -17,17 +17,24 @@ package neatlogic.module.framework.notify.service; import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.common.util.ModuleUtil; +import neatlogic.framework.dto.module.ModuleGroupVo; import neatlogic.framework.notify.core.INotifyPolicyHandler; +import neatlogic.framework.notify.core.NotifyPolicyHandlerFactory; import neatlogic.framework.notify.crossover.INotifyServiceCrossoverService; 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.notify.exception.NotifyPolicyNotFoundException; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.List; +import java.util.Objects; @Service public class NotifyServiceImpl implements NotifyService, INotifyServiceCrossoverService { @@ -49,7 +56,7 @@ public class NotifyServiceImpl implements NotifyService, INotifyServiceCrossover } String handler = clazz.getName(); invokeNotifyPolicyConfigVo.setHandler(handler); - return regulateNotifyPolicyConfig2(invokeNotifyPolicyConfigVo); + return doRegulateNotifyPolicyConfig(invokeNotifyPolicyConfigVo); } @Override @@ -59,10 +66,10 @@ public class NotifyServiceImpl implements NotifyService, INotifyServiceCrossover } String handler = clazz.getName(); invokeNotifyPolicyConfigVo.setHandler(handler); - return regulateNotifyPolicyConfig2(invokeNotifyPolicyConfigVo); + return doRegulateNotifyPolicyConfig(invokeNotifyPolicyConfigVo); } - private InvokeNotifyPolicyConfigVo regulateNotifyPolicyConfig2(InvokeNotifyPolicyConfigVo invokeNotifyPolicyConfigVo) { + private InvokeNotifyPolicyConfigVo doRegulateNotifyPolicyConfig(InvokeNotifyPolicyConfigVo invokeNotifyPolicyConfigVo) { NotifyPolicyVo notifyPolicyVo = null; if (invokeNotifyPolicyConfigVo.getIsCustom() == 1) { if (invokeNotifyPolicyConfigVo.getPolicyId() != null) { @@ -77,6 +84,22 @@ public class NotifyServiceImpl implements NotifyService, INotifyServiceCrossover } else { invokeNotifyPolicyConfigVo.setPolicyId(notifyPolicyVo.getId()); invokeNotifyPolicyConfigVo.setPolicyName(notifyPolicyVo.getName()); + INotifyPolicyHandler notifyPolicyHandler = NotifyPolicyHandlerFactory.getHandler(notifyPolicyVo.getHandler()); + if (notifyPolicyHandler == 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(); + } + } + } + String handlerName = notifyPolicyHandler.getName(); + invokeNotifyPolicyConfigVo.setPolicyPath(moduleGroupName + "/" + handlerName + "/" + notifyPolicyVo.getName()); } return invokeNotifyPolicyConfigVo; } @@ -108,7 +131,7 @@ public class NotifyServiceImpl implements NotifyService, INotifyServiceCrossover if (StringUtils.isBlank(handler)) { return null; } - return regulateNotifyPolicyConfig2(invokeNotifyPolicyConfigVo); + return doRegulateNotifyPolicyConfig(invokeNotifyPolicyConfigVo); } /** -- Gitee