Showing
4 changed files
with
66 additions
and
8 deletions
| ... | ... | @@ -8,10 +8,7 @@ import com.lframework.starter.web.core.components.redis.RedisHandler; |
| 8 | 8 | import com.lframework.starter.web.core.utils.IdUtil; |
| 9 | 9 | import com.lframework.starter.web.core.utils.JsonUtil; |
| 10 | 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 | 12 | import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; |
| 16 | 13 | import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService; |
| 17 | 14 | import com.lframework.xingyun.sc.service.customer.CorePersonnelHistoryService; |
| ... | ... | @@ -162,6 +159,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic |
| 162 | 159 | if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus) |
| 163 | 160 | || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) { |
| 164 | 161 | customerDevelopPlanService.updateStatus(businessId, CustomerDevelopStatus.PASS); |
| 162 | + // 消息通知 | |
| 163 | + customerDevelopPlanService.sendMsg(businessId); | |
| 165 | 164 | } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus) |
| 166 | 165 | || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus) |
| 167 | 166 | || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) { | ... | ... |
| ... | ... | @@ -50,14 +50,31 @@ public class MessageHandler { |
| 50 | 50 | // 去重 |
| 51 | 51 | receiveUserIds = receiveUserIds.stream().distinct().collect(Collectors.toList()); |
| 52 | 52 | log.info("================== MessageHandler sendMsg receiveUserIds size:{}", receiveUserIds.size()); |
| 53 | - SysSiteMessageDto siteMessageDto = new SysSiteMessageDto(); | |
| 54 | - siteMessageDto.setUserIdList(receiveUserIds); | |
| 55 | 53 | // todo 完善消息标题、内容 |
| 56 | 54 | String title = ""; |
| 57 | 55 | String content = ""; |
| 58 | 56 | String bizKey = ""; |
| 59 | 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 | 78 | siteMessageDto.setTitle(title); |
| 62 | 79 | siteMessageDto.setContent(content); |
| 63 | 80 | siteMessageDto.setBizKey(bizKey); |
| ... | ... | @@ -67,8 +84,6 @@ public class MessageHandler { |
| 67 | 84 | } else { |
| 68 | 85 | siteMessageDto.setCreateUserId(sendUserId); |
| 69 | 86 | } |
| 70 | - | |
| 71 | 87 | mqProducerService.createSysSiteMessage(siteMessageDto); |
| 72 | - log.info("================== MessageHandler sendMsg invoke end!"); | |
| 73 | 88 | } |
| 74 | 89 | } | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/customer/CustomerDevelopPlanServiceImpl.java
| ... | ... | @@ -8,6 +8,7 @@ import com.lframework.starter.bpm.service.FlowInstanceWrapperService; |
| 8 | 8 | import com.lframework.starter.bpm.service.FlowTaskWrapperService; |
| 9 | 9 | import com.lframework.starter.web.core.components.security.SecurityUtil; |
| 10 | 10 | import com.lframework.starter.web.core.utils.*; |
| 11 | +import com.lframework.starter.web.inner.service.system.SysUserRoleService; | |
| 11 | 12 | import com.lframework.xingyun.basedata.entity.Workshop; |
| 12 | 13 | import com.lframework.xingyun.basedata.service.customer.CustomerService; |
| 13 | 14 | import com.lframework.xingyun.basedata.service.workshop.WorkshopService; |
| ... | ... | @@ -22,6 +23,7 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog; |
| 22 | 23 | import com.lframework.starter.common.utils.Assert; |
| 23 | 24 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 24 | 25 | import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; |
| 26 | +import com.lframework.xingyun.sc.handlers.MessageHandler; | |
| 25 | 27 | import lombok.extern.slf4j.Slf4j; |
| 26 | 28 | import org.apache.commons.collections4.CollectionUtils; |
| 27 | 29 | import org.apache.commons.lang3.StringUtils; |
| ... | ... | @@ -53,6 +55,10 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe |
| 53 | 55 | private FlowTaskWrapperService flowTaskWrapperService; |
| 54 | 56 | @Resource |
| 55 | 57 | private WorkshopService workshopService; |
| 58 | + @Resource | |
| 59 | + private MessageHandler messageHandler; | |
| 60 | + @Resource | |
| 61 | + private SysUserRoleService sysUserRoleService; | |
| 56 | 62 | |
| 57 | 63 | |
| 58 | 64 | @Override |
| ... | ... | @@ -341,4 +347,35 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe |
| 341 | 347 | |
| 342 | 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 | 92 | * @return List<CustomerDevelopPlan> |
| 93 | 93 | */ |
| 94 | 94 | List<CustomerDevelopPlan> listByCustomerId(String customerId); |
| 95 | + | |
| 96 | + /** | |
| 97 | + * 发送消息 | |
| 98 | + * | |
| 99 | + * @param id 主键ID | |
| 100 | + */ | |
| 101 | + void sendMsg(String id); | |
| 95 | 102 | } | ... | ... |