Commit 0f32db3e5e1afa384dceec9c2f45597eab6a505d

Authored by yeqianyong
1 parent 63ca974a

楚江ERP-客户开发审核通过后消息通知功能开发

@@ -8,10 +8,7 @@ import com.lframework.starter.web.core.components.redis.RedisHandler; @@ -8,10 +8,7 @@ import com.lframework.starter.web.core.components.redis.RedisHandler;
8 import com.lframework.starter.web.core.utils.IdUtil; 8 import com.lframework.starter.web.core.utils.IdUtil;
9 import com.lframework.starter.web.core.utils.JsonUtil; 9 import com.lframework.starter.web.core.utils.JsonUtil;
10 import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto; 10 import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto;
11 -import com.lframework.xingyun.sc.entity.CorePersonnelHistory;  
12 -import com.lframework.xingyun.sc.entity.PurchaseOrderLine;  
13 -import com.lframework.xingyun.sc.entity.PurchaseOrderRevoke;  
14 -import com.lframework.xingyun.sc.entity.PurchaseOrderRevokeLine; 11 +import com.lframework.xingyun.sc.entity.*;
15 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; 12 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
16 import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService; 13 import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
17 import com.lframework.xingyun.sc.service.customer.CorePersonnelHistoryService; 14 import com.lframework.xingyun.sc.service.customer.CorePersonnelHistoryService;
@@ -162,6 +159,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -162,6 +159,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
162 if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus) 159 if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus)
163 || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) { 160 || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) {
164 customerDevelopPlanService.updateStatus(businessId, CustomerDevelopStatus.PASS); 161 customerDevelopPlanService.updateStatus(businessId, CustomerDevelopStatus.PASS);
  162 + // 消息通知
  163 + customerDevelopPlanService.sendMsg(businessId);
165 } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus) 164 } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus)
166 || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus) 165 || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus)
167 || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) { 166 || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) {
@@ -50,14 +50,31 @@ public class MessageHandler { @@ -50,14 +50,31 @@ public class MessageHandler {
50 // 去重 50 // 去重
51 receiveUserIds = receiveUserIds.stream().distinct().collect(Collectors.toList()); 51 receiveUserIds = receiveUserIds.stream().distinct().collect(Collectors.toList());
52 log.info("================== MessageHandler sendMsg receiveUserIds size:{}", receiveUserIds.size()); 52 log.info("================== MessageHandler sendMsg receiveUserIds size:{}", receiveUserIds.size());
53 - SysSiteMessageDto siteMessageDto = new SysSiteMessageDto();  
54 - siteMessageDto.setUserIdList(receiveUserIds);  
55 // todo 完善消息标题、内容 53 // todo 完善消息标题、内容
56 String title = ""; 54 String title = "";
57 String content = ""; 55 String content = "";
58 String bizKey = ""; 56 String bizKey = "";
59 if ("SPEC_CHANGE_SUBMIT".equals(businessType)) { 57 if ("SPEC_CHANGE_SUBMIT".equals(businessType)) {
60 } 58 }
  59 + sendMsg(receiveUserIds, title, content, bizKey, null);
  60 + log.info("================== MessageHandler sendMsg invoke end!");
  61 + }
  62 +
  63 +
  64 + /**
  65 + * 发送消息
  66 + *
  67 + * @param userIds 人员ID集合
  68 + * @param title 消息标题
  69 + * @param content 消息内容
  70 + * @param bizKey 业务Key
  71 + */
  72 + public void sendMsg(List<String> userIds, String title, String content, String bizKey, String sendUserId) {
  73 + if (CollectionUtils.isEmpty(userIds)) {
  74 + return;
  75 + }
  76 + SysSiteMessageDto siteMessageDto = new SysSiteMessageDto();
  77 + siteMessageDto.setUserIdList(userIds);
61 siteMessageDto.setTitle(title); 78 siteMessageDto.setTitle(title);
62 siteMessageDto.setContent(content); 79 siteMessageDto.setContent(content);
63 siteMessageDto.setBizKey(bizKey); 80 siteMessageDto.setBizKey(bizKey);
@@ -67,8 +84,6 @@ public class MessageHandler { @@ -67,8 +84,6 @@ public class MessageHandler {
67 } else { 84 } else {
68 siteMessageDto.setCreateUserId(sendUserId); 85 siteMessageDto.setCreateUserId(sendUserId);
69 } 86 }
70 -  
71 mqProducerService.createSysSiteMessage(siteMessageDto); 87 mqProducerService.createSysSiteMessage(siteMessageDto);
72 - log.info("================== MessageHandler sendMsg invoke end!");  
73 } 88 }
74 } 89 }
@@ -8,6 +8,7 @@ import com.lframework.starter.bpm.service.FlowInstanceWrapperService; @@ -8,6 +8,7 @@ import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
8 import com.lframework.starter.bpm.service.FlowTaskWrapperService; 8 import com.lframework.starter.bpm.service.FlowTaskWrapperService;
9 import com.lframework.starter.web.core.components.security.SecurityUtil; 9 import com.lframework.starter.web.core.components.security.SecurityUtil;
10 import com.lframework.starter.web.core.utils.*; 10 import com.lframework.starter.web.core.utils.*;
  11 +import com.lframework.starter.web.inner.service.system.SysUserRoleService;
11 import com.lframework.xingyun.basedata.entity.Workshop; 12 import com.lframework.xingyun.basedata.entity.Workshop;
12 import com.lframework.xingyun.basedata.service.customer.CustomerService; 13 import com.lframework.xingyun.basedata.service.customer.CustomerService;
13 import com.lframework.xingyun.basedata.service.workshop.WorkshopService; 14 import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
@@ -22,6 +23,7 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog; @@ -22,6 +23,7 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog;
22 import com.lframework.starter.common.utils.Assert; 23 import com.lframework.starter.common.utils.Assert;
23 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; 24 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
24 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; 25 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
  26 +import com.lframework.xingyun.sc.handlers.MessageHandler;
25 import lombok.extern.slf4j.Slf4j; 27 import lombok.extern.slf4j.Slf4j;
26 import org.apache.commons.collections4.CollectionUtils; 28 import org.apache.commons.collections4.CollectionUtils;
27 import org.apache.commons.lang3.StringUtils; 29 import org.apache.commons.lang3.StringUtils;
@@ -53,6 +55,10 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe @@ -53,6 +55,10 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
53 private FlowTaskWrapperService flowTaskWrapperService; 55 private FlowTaskWrapperService flowTaskWrapperService;
54 @Resource 56 @Resource
55 private WorkshopService workshopService; 57 private WorkshopService workshopService;
  58 + @Resource
  59 + private MessageHandler messageHandler;
  60 + @Resource
  61 + private SysUserRoleService sysUserRoleService;
56 62
57 63
58 @Override 64 @Override
@@ -341,4 +347,35 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe @@ -341,4 +347,35 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
341 347
342 return getBaseMapper().selectList(queryWrapper); 348 return getBaseMapper().selectList(queryWrapper);
343 } 349 }
  350 +
  351 + @Override
  352 + public void sendMsg(String id) {
  353 + CustomerDevelopPlan plan = findById(id);
  354 + if (plan == null) {
  355 + log.error("=================== customerDevelopApprovedNotice plan is null!");
  356 + return;
  357 + }
  358 + String userId = plan.getCreateById();
  359 + List<String> receiveUserIds = new ArrayList<>();
  360 + receiveUserIds.add(userId);
  361 +
  362 + List<String> roleCodeList = new ArrayList<>();
  363 + // 综合内勤
  364 + roleCodeList.add("zhnq");
  365 + // 办事处经理
  366 + roleCodeList.add("bscjl");
  367 + List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(roleCodeList, userId);
  368 + if (CollectionUtils.isNotEmpty(userIds)) {
  369 + receiveUserIds.addAll(userIds);
  370 + }
  371 + roleCodeList.clear();
  372 + // 营销部分管
  373 + roleCodeList.add("ssyxbfg");
  374 + // 市场科统计员
  375 + roleCodeList.add("scktjy");
  376 + // 运作科主管
  377 + roleCodeList.add("yzkzg");
  378 +
  379 + messageHandler.sendMsg(receiveUserIds, "", "", "", null);
  380 + }
344 } 381 }
@@ -92,4 +92,11 @@ public interface CustomerDevelopPlanService extends BaseMpService<CustomerDevelo @@ -92,4 +92,11 @@ public interface CustomerDevelopPlanService extends BaseMpService<CustomerDevelo
92 * @return List<CustomerDevelopPlan> 92 * @return List<CustomerDevelopPlan>
93 */ 93 */
94 List<CustomerDevelopPlan> listByCustomerId(String customerId); 94 List<CustomerDevelopPlan> listByCustomerId(String customerId);
  95 +
  96 + /**
  97 + * 发送消息
  98 + *
  99 + * @param id 主键ID
  100 + */
  101 + void sendMsg(String id);
95 } 102 }