From 8dead25f399616d05805bb62836755441fa0439b Mon Sep 17 00:00:00 2001 From: qimingjin <459816669@qq.com> Date: Mon, 3 May 2021 20:21:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtab=E9=A1=B5=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/templates/system/user/add.html | 2 +- .../web/message/MessageEventHandler.java | 10 ++--- ...gy.java => SendMessageCenterStrategy.java} | 25 +++++------ .../producer/SysSendEmailStrategy.java | 41 ------------------- 4 files changed, 15 insertions(+), 63 deletions(-) rename snow-framework/src/main/java/com/snow/framework/web/message/producer/{SysSendVisitLogStrategy.java => SendMessageCenterStrategy.java} (56%) delete mode 100644 snow-framework/src/main/java/com/snow/framework/web/message/producer/SysSendEmailStrategy.java diff --git a/snow-admin/src/main/resources/templates/system/user/add.html b/snow-admin/src/main/resources/templates/system/user/add.html index 292d176..d8bd947 100644 --- a/snow-admin/src/main/resources/templates/system/user/add.html +++ b/snow-admin/src/main/resources/templates/system/user/add.html @@ -296,7 +296,7 @@ /*用户管理-新增-选择部门树*/ function selectDeptTree() { var treeId = $("#treeId").val(); - var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val(); + var deptId = $.common.isEmpty(treeId) ? "1" : $("#treeId").val(); var url = ctx + "system/dept/selectDeptTree/" + deptId; var options = { title: '选择部门', diff --git a/snow-framework/src/main/java/com/snow/framework/web/message/MessageEventHandler.java b/snow-framework/src/main/java/com/snow/framework/web/message/MessageEventHandler.java index e00bd3d..e55ce96 100644 --- a/snow-framework/src/main/java/com/snow/framework/web/message/MessageEventHandler.java +++ b/snow-framework/src/main/java/com/snow/framework/web/message/MessageEventHandler.java @@ -3,8 +3,7 @@ package com.snow.framework.web.message; import com.snow.common.utils.StringUtils; import com.snow.framework.web.domain.common.MessageEventDTO; import com.snow.framework.web.message.consumer.SysMarkReadedStrategy; -import com.snow.framework.web.message.producer.SysSendEmailStrategy; -import com.snow.framework.web.message.producer.SysSendVisitLogStrategy; +import com.snow.framework.web.message.producer.SendMessageCenterStrategy; import lombok.extern.slf4j.Slf4j; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; @@ -34,14 +33,12 @@ public class MessageEventHandler implements ApplicationListener messageEventContext.setMessageEventTypeStrategy(new TaskTodoStrategy()); break; case "SEND_EMAIL": - messageEventContext.setMessageEventTypeStrategy(new SysSendEmailStrategy()); + case "SEND_VISIT_LOG": + messageEventContext.setMessageEventTypeStrategy(new SendMessageCenterStrategy()); break; case "MARK_READED": messageEventContext.setMessageEventTypeStrategy(new SysMarkReadedStrategy()); break; - case "SEND_VISIT_LOG": - messageEventContext.setMessageEventTypeStrategy(new SysSendVisitLogStrategy()); - break; default: @@ -50,4 +47,5 @@ public class MessageEventHandler implements ApplicationListener //执行 messageEventContext.messageHandle(messageEvent); } + } diff --git a/snow-framework/src/main/java/com/snow/framework/web/message/producer/SysSendVisitLogStrategy.java b/snow-framework/src/main/java/com/snow/framework/web/message/producer/SendMessageCenterStrategy.java similarity index 56% rename from snow-framework/src/main/java/com/snow/framework/web/message/producer/SysSendVisitLogStrategy.java rename to snow-framework/src/main/java/com/snow/framework/web/message/producer/SendMessageCenterStrategy.java index 32ac67f..73b693f 100644 --- a/snow-framework/src/main/java/com/snow/framework/web/message/producer/SysSendVisitLogStrategy.java +++ b/snow-framework/src/main/java/com/snow/framework/web/message/producer/SendMessageCenterStrategy.java @@ -1,36 +1,31 @@ package com.snow.framework.web.message.producer; import cn.hutool.core.bean.BeanUtil; -import com.snow.common.enums.MessageEventType; import com.snow.common.utils.spring.SpringUtils; import com.snow.framework.web.domain.common.MessageEventDTO; import com.snow.framework.web.message.MessageEventStrategy; import com.snow.system.domain.SysMessageTransition; import com.snow.system.service.ISysMessageTransitionService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import javax.annotation.Resource; import java.util.Set; /** - * @program: snow - * @description - * @author: 没用的阿吉 - * @create: 2021-04-17 12:46 - **/ + * 发送消息到消息中心策略 + */ @Component -public class SysSendVisitLogStrategy implements MessageEventStrategy { - - @Autowired - private ISysMessageTransitionService messageTransitionService=SpringUtils.getBean(ISysMessageTransitionService.class); +public class SendMessageCenterStrategy implements MessageEventStrategy { + @Resource + private ISysMessageTransitionService messageTransitionService= SpringUtils.getBean(ISysMessageTransitionService.class); @Override - public void messageHandle(MessageEventDTO messageEvent) { + public void messageHandle(MessageEventDTO messageEventDTO) { SysMessageTransition sysMessageTransition=new SysMessageTransition(); - BeanUtil.copyProperties(messageEvent,sysMessageTransition); - sysMessageTransition.setMessageType(MessageEventType.SEND_VISIT_LOG.getCode()); + BeanUtil.copyProperties(messageEventDTO,sysMessageTransition); + sysMessageTransition.setMessageType(messageEventDTO.getMessageEventType().getCode()); - Set consumerId = messageEvent.getConsumerIds(); + Set consumerId = messageEventDTO.getConsumerIds(); consumerId.forEach(t->{ sysMessageTransition.setConsumerId(t); messageTransitionService.insertSysMessageTransition(sysMessageTransition); diff --git a/snow-framework/src/main/java/com/snow/framework/web/message/producer/SysSendEmailStrategy.java b/snow-framework/src/main/java/com/snow/framework/web/message/producer/SysSendEmailStrategy.java deleted file mode 100644 index 70bb7b7..0000000 --- a/snow-framework/src/main/java/com/snow/framework/web/message/producer/SysSendEmailStrategy.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.snow.framework.web.message.producer; - -import cn.hutool.core.bean.BeanUtil; -import com.snow.common.enums.MessageEventType; -import com.snow.common.utils.spring.SpringUtils; -import com.snow.framework.web.domain.common.MessageEventDTO; -import com.snow.framework.web.message.MessageEventStrategy; -import com.snow.system.domain.SysMessageTransition; -import com.snow.system.service.ISysMessageTransitionService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.Set; - -/** - * @program: snow - * @description 系统发送邮件 - * @author: 没用的阿吉 - * @create: 2021-03-30 14:11 - **/ -@Component -public class SysSendEmailStrategy implements MessageEventStrategy { - - - @Autowired - private ISysMessageTransitionService messageTransitionService=SpringUtils.getBean(ISysMessageTransitionService.class); - - @Override - public void messageHandle(MessageEventDTO messageEvent) { - SysMessageTransition sysMessageTransition=new SysMessageTransition(); - BeanUtil.copyProperties(messageEvent,sysMessageTransition); - sysMessageTransition.setMessageType(MessageEventType.SEND_EMAIL.getCode()); - - Set consumerId = messageEvent.getConsumerIds(); - consumerId.forEach(t->{ - sysMessageTransition.setConsumerId(t); - messageTransitionService.insertSysMessageTransition(sysMessageTransition); - }); - - } -}