Commit fb3b5d4c0cc9281c09776d145441624f80f11862

Authored by yeqianyong
1 parent afe422ce

楚江erp:订货单变更消息通知bug修复

1 1 package com.lframework.xingyun.sc.handlers;
2 2
3 3 import com.lframework.starter.mq.core.service.MqProducerService;
  4 +import com.lframework.starter.web.core.utils.IdUtil;
4 5 import com.lframework.starter.web.core.utils.JsonUtil;
5 6 import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto;
6 7 import com.lframework.starter.web.inner.service.system.SysUserRoleService;
... ... @@ -34,10 +35,10 @@ public class MessageHandler {
34 35 public void sendMsg(String userId, List<String> roleCodes, String businessType, String sendUserId) {
35 36 log.info("================== MessageHandler sendMsg invoke start, userId:{}, roleCodes:{}", userId, JsonUtil.toJsonString(roleCodes));
36 37 List<String> receiveUserIds = new ArrayList<>();
37   - if (StringUtils.isBlank(userId)) {
  38 + if (StringUtils.isNotBlank(userId)) {
38 39 receiveUserIds.add(userId);
39 40 }
40   - if (CollectionUtils.isEmpty(roleCodes)) {
  41 + if (CollectionUtils.isNotEmpty(roleCodes)) {
41 42 // 获取角色下人员ID
42 43 List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(roleCodes);
43 44 if (CollectionUtils.isNotEmpty(userIds)) {
... ... @@ -55,6 +56,9 @@ public class MessageHandler {
55 56 String content = "";
56 57 String bizKey = "";
57 58 if ("SPEC_CHANGE_SUBMIT".equals(businessType)) {
  59 + title = "已产出,有损消息通知";
  60 + content = "已产出,有损消息通知";
  61 + bizKey = IdUtil.getUUID();
58 62 }
59 63 sendMsg(receiveUserIds, title, content, bizKey, sendUserId);
60 64 log.info("================== MessageHandler sendMsg invoke end!");
... ...
... ... @@ -401,13 +401,24 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR
401 401 updateWrapper.set(OrderInfoChangeRecord::getOutput, true)
402 402 .eq(OrderInfoChangeRecord::getId, id);
403 403 getBaseMapper().update(updateWrapper);
404   - // 消息通知
  404 +
405 405 List<String> roleCodes = new ArrayList<>();
406   - // 各个分厂经营办计划员
407   - roleCodes.add("yfcjybjhy");
408   - roleCodes.add("efcjybjhy");
409   - roleCodes.add("sfcjybjhy");
410   - roleCodes.add("ztfcjybjhy");
  406 + // 获取分厂数据
  407 + String workshopId = record.getWorkshopId();
  408 + Workshop workshop = workshopService.findById(workshopId);
  409 + if (workshop != null) {
  410 + String code = workshop.getCode();
  411 + if ("yfc".equals(code)) {
  412 + roleCodes.add("yfcjybjhy");
  413 + } else if ("efc".equals(code)) {
  414 + roleCodes.add("efcjybjhy");
  415 + } else if ("sfc".equals(code)) {
  416 + roleCodes.add("sfcjybjhy");
  417 + } else if ("ztfc".equals(code)) {
  418 + roleCodes.add("ztfcjybjhy");
  419 + }
  420 + }
  421 + // 消息通知
411 422 messageHandler.sendMsg(record.getCreateById(), roleCodes, "SPEC_CHANGE_SUBMIT", null);
412 423 }
413 424
... ...
... ... @@ -368,7 +368,7 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr
368 368 } else if ("PART".equals(type)) {
369 369 title += "已部分发货!";
370 370 }
371   - messageHandler.sendMsg(userIds, title, "", "", null);
  371 + messageHandler.sendMsg(userIds, title, title, shipmentsOrderId, null);
372 372 }
373 373 }
374 374
... ...