diff --git a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/Constants.java b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/Constants.java index 135ca0d6..93206287 100644 --- a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/Constants.java +++ b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/Constants.java @@ -128,18 +128,4 @@ public class Constants { return SYS_EVE_TALK_GROUP_USER_LIST + groupId; } - /** - * @param orderNum 获取工单派工内容字符串 - * @param userName 接收人 - * @return - */ - public static String getNoticeServiceUserContent(String orderNum, String userName) { - return "尊敬的" + userName + ",您好:
" + "您有一份待接单工单,工单号为:" + orderNum + ",请及时接单。"; - } - - // 协助人 - public static String getNoticeCooperationUserContent(String orderNum, String userName) { - return "尊敬的" + userName + ",您好:
" + "您有一份协助工单,工单号为:" + orderNum + ",请配合工单接收人完成该售后服务。"; - } - } diff --git a/skyeye-promote/skyeye-mq/src/main/java/com/skyeye/dao/MQUserEmailDao.java b/skyeye-promote/skyeye-mq/src/main/java/com/skyeye/dao/MQUserEmailDao.java deleted file mode 100644 index 45f36767..00000000 --- a/skyeye-promote/skyeye-mq/src/main/java/com/skyeye/dao/MQUserEmailDao.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye - ******************************************************************************/ - -package com.skyeye.dao; - -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -public interface MQUserEmailDao { - - Map queryServiceMationBySericeId(@Param("serviceId") String serviceId); - - List> queryCooperationUserNameById(@Param("serviceId") String serviceId); - - int insertNoticeListMation(List> notices); - -} diff --git a/skyeye-promote/skyeye-mq/src/main/java/com/skyeye/mq/job/impl/WatiWorkerSendServiceImpl.java b/skyeye-promote/skyeye-mq/src/main/java/com/skyeye/mq/job/impl/WatiWorkerSendServiceImpl.java deleted file mode 100644 index 8f787d38..00000000 --- a/skyeye-promote/skyeye-mq/src/main/java/com/skyeye/mq/job/impl/WatiWorkerSendServiceImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye - ******************************************************************************/ - -package com.skyeye.mq.job.impl; - -import cn.hutool.json.JSONUtil; -import com.skyeye.common.constans.CommonConstants; -import com.skyeye.common.constans.Constants; -import com.skyeye.common.constans.MqConstants; -import com.skyeye.common.util.DataCommonUtil; -import com.skyeye.common.util.MailUtil; -import com.skyeye.common.util.ToolUtil; -import com.skyeye.dao.MQUserEmailDao; -import com.skyeye.service.JobMateMationService; -import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; -import org.apache.rocketmq.spring.core.RocketMQListener; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @ClassName: WatiWorkerSendServiceImpl - * @Description: 派工通知 - * @author: skyeye云系列--卫志强 - * @date: 2021/7/6 22:56 - * @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved. - * 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的 - */ -@Component -@RocketMQMessageListener( - topic = "${topic.wati-worker-send-service}", - consumerGroup = "${topic.wati-worker-send-service}", - selectorExpression = "${spring.profiles.active}") -public class WatiWorkerSendServiceImpl implements RocketMQListener { - - private static final Logger LOGGER = LoggerFactory.getLogger(WatiWorkerSendServiceImpl.class); - - @Autowired - private MQUserEmailDao mqUserEmailDao; - - @Autowired - private JobMateMationService jobMateMationService; - - @Override - public void onMessage(String data) { - Map map = JSONUtil.toBean(data, null); - String jobId = map.get("jobMateId").toString(); - try { - // 任务开始 - jobMateMationService.comMQJobMation(jobId, MqConstants.JOB_TYPE_IS_PROCESSING, ""); - //工单id - String serviceId = map.get("serviceId").toString(); - //获取工单接收人和协助人id - Map mation = mqUserEmailDao.queryServiceMationBySericeId(serviceId); - //如果工单信息不为空 - if (mation != null) { - //调用消息系统添加通知 - List> notices = new ArrayList<>(); - String content; - //1.接收人通知 - if (!ToolUtil.isBlank(mation.get("userId").toString())) { - //1.1内部消息 - content = Constants.getNoticeServiceUserContent(mation.get("orderNum").toString(), mation.get("userName").toString()); - Map notice = new HashMap<>(); - notice.put("title", "工单派工提醒"); - notice.put("noticeDesc", "您有一条新的派工信息,请及时阅读。"); - notice.put("content", content); - // 未读消息 - notice.put("state", "1"); - notice.put("userId", mation.get("userId").toString()); - // 消息类型 - notice.put("type", "3"); - DataCommonUtil.setCommonData(notice, CommonConstants.ADMIN_USER_ID); - notices.add(notice); - //1.2发送邮件 - String email = mation.get("email").toString(); - if (ToolUtil.isEmail(email) && !ToolUtil.isBlank(email)) { - new MailUtil().send(email, "工单派工提醒", content); - } - } - //2.协助人通知 - if (!ToolUtil.isBlank(mation.get("cooperationUserId").toString())) { - //获取协助人 - List> cooperationUser = mqUserEmailDao.queryCooperationUserNameById(serviceId); - - for (Map user : cooperationUser) { - //2.1内部消息 - content = Constants.getNoticeCooperationUserContent(mation.get("orderNum").toString(), user.get("name").toString()); - Map notice = new HashMap<>(); - notice.put("title", "工单派工提醒"); - notice.put("noticeDesc", "您有一条新的派工信息,请及时阅读。"); - notice.put("content", content); - // 未读消息 - notice.put("state", "1"); - notice.put("userId", user.get("id").toString()); - // 消息类型 - notice.put("type", "3"); - DataCommonUtil.setCommonData(notice, CommonConstants.ADMIN_USER_ID); - notices.add(notice); - //2.2发送邮件 - String email = user.get("email").toString(); - if (ToolUtil.isEmail(email) && !ToolUtil.isBlank(email)) { - new MailUtil().send(email, "工单派工提醒", content); - } - } - } - if (!notices.isEmpty()) { - mqUserEmailDao.insertNoticeListMation(notices); - } - } - // 任务完成 - jobMateMationService.comMQJobMation(jobId, MqConstants.JOB_TYPE_IS_SUCCESS, ""); - } catch (Exception e) { - LOGGER.warn("Dispatch notice failed, reason is {}.", e); - // 任务失败 - jobMateMationService.comMQJobMation(jobId, MqConstants.JOB_TYPE_IS_FAIL, ""); - } - } - -} diff --git a/skyeye-promote/skyeye-mq/src/main/resources/mapper/mqmapper/MQUserEmailMapper.xml b/skyeye-promote/skyeye-mq/src/main/resources/mapper/mqmapper/MQUserEmailMapper.xml deleted file mode 100644 index 5e085df0..00000000 --- a/skyeye-promote/skyeye-mq/src/main/resources/mapper/mqmapper/MQUserEmailMapper.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - insert into sys_eve_user_notice - (id, title, `desc`, content, state, receive_id, type, create_id, create_time) - values - - (#{item.id}, #{item.title}, #{item.noticeDesc}, #{item.content}, #{item.state}, #{item.userId}, #{item.type}, #{item.createId}, #{item.createTime}) - - - - \ No newline at end of file diff --git a/skyeye-promote/skyeye-web/src/main/resources/bootstrap.yml b/skyeye-promote/skyeye-web/src/main/resources/bootstrap.yml index c0b5aebc..d5ebf68f 100644 --- a/skyeye-promote/skyeye-web/src/main/resources/bootstrap.yml +++ b/skyeye-promote/skyeye-web/src/main/resources/bootstrap.yml @@ -38,6 +38,4 @@ topic: # 邮件通知的topic ordinary-mail-delivery-service: ORDINARY_MAIL_DELIVERY_SERVICE # 消息通知的topic - notice-send-service: NOTICE_SEND_SERVICE - # 派工通知的topic - wati-worker-send-service: WATI_WORKER_SEND_SERVICE \ No newline at end of file + notice-send-service: NOTICE_SEND_SERVICE \ No newline at end of file