Commit ed5604fb5127e5c4c1f7fb794112bb8b6073d005

Authored by yeqianyong
1 parent f55f42d2

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

... ... @@ -97,7 +97,7 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
97 97 // 更新业务数据
98 98 switch (businessType) {
99 99 case "CUSTOMER_DEVELOP":
100   - handleCustomerDevelopData(flowStatus, businessId);
  100 + handleCustomerDevelopData(flowStatus, businessId, String.valueOf(instance.getId()));
101 101 break;
102 102 case "CUSTOMER_CREDIT":
103 103 handleCustomerCreditData(flowStatus, businessId);
... ... @@ -155,12 +155,12 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
155 155 *
156 156 * @param businessId 业务ID
157 157 */
158   - private void handleCustomerDevelopData(String flowStatus, String businessId) {
  158 + private void handleCustomerDevelopData(String flowStatus, String businessId, String instanceId) {
159 159 if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus)
160 160 || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) {
161 161 customerDevelopPlanService.updateStatus(businessId, CustomerDevelopStatus.PASS);
162 162 // 消息通知
163   - customerDevelopPlanService.sendMsg(businessId);
  163 + customerDevelopPlanService.sendMsg(businessId, instanceId);
164 164 } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus)
165 165 || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus)
166 166 || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) {
... ...
... ... @@ -56,7 +56,7 @@ public class MessageHandler {
56 56 String bizKey = "";
57 57 if ("SPEC_CHANGE_SUBMIT".equals(businessType)) {
58 58 }
59   - sendMsg(receiveUserIds, title, content, bizKey, null);
  59 + sendMsg(receiveUserIds, title, content, bizKey, sendUserId);
60 60 log.info("================== MessageHandler sendMsg invoke end!");
61 61 }
62 62
... ...
... ... @@ -61,12 +61,13 @@ public class TransactorHandler {
61 61 * 根据角色code和厂房类型来获取办理人数据
62 62 * 客户开发
63 63 *
64   - * @param roleCode 角色编号
  64 + * @param roleCodes 角色编号集合
65 65 * @param workshopType 厂房类型
66 66 * @return List<String>
67 67 */
68   - public List<String> listByRoleAndWorkshop(String roleCode, String workshopType, String workshopId) {
69   - log.info("================== listByRoleAndWorkshop invoke start, roleCode:{}, workshopType:{}, workshopId:{}", roleCode, workshopType, workshopId);
  68 + public List<String> listByRoleAndWorkshop(List<String> roleCodes, String workshopType, String workshopId) {
  69 + log.info("================== listByRoleAndWorkshop invoke start, roleCodes:{}, workshopType:{}, workshopId:{}",
  70 + JsonUtil.toJsonString(roleCodes), workshopType, workshopId);
70 71 // 获取厂房数据
71 72 Workshop workshop = workshopService.findById(workshopId);
72 73 if (workshop == null) {
... ... @@ -75,7 +76,7 @@ public class TransactorHandler {
75 76 }
76 77 String workshopName = workshop.getName();
77 78 // 获取角色下人员
78   - List<String> userIdList = sysUserRoleService.listUserIdByRoleCodes(Collections.singletonList(roleCode));
  79 + List<String> userIdList = sysUserRoleService.listUserIdByRoleCodes(roleCodes);
79 80 if (CollectionUtils.isEmpty(userIdList)) {
80 81 return new ArrayList<>();
81 82 }
... ...
... ... @@ -9,6 +9,7 @@ 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 11 import com.lframework.starter.web.inner.service.system.SysUserRoleService;
  12 +import com.lframework.xingyun.basedata.entity.Customer;
12 13 import com.lframework.xingyun.basedata.entity.Workshop;
13 14 import com.lframework.xingyun.basedata.service.customer.CustomerService;
14 15 import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
... ... @@ -59,6 +60,8 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
59 60 private MessageHandler messageHandler;
60 61 @Resource
61 62 private SysUserRoleService sysUserRoleService;
  63 + @Resource
  64 + private CustomerService customerService;
62 65
63 66
64 67 @Override
... ... @@ -349,7 +352,7 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
349 352 }
350 353
351 354 @Override
352   - public void sendMsg(String id) {
  355 + public void sendMsg(String id, String bizKey) {
353 356 CustomerDevelopPlan plan = findById(id);
354 357 if (plan == null) {
355 358 log.error("=================== customerDevelopApprovedNotice plan is null!");
... ... @@ -370,12 +373,59 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
370 373 }
371 374 roleCodeList.clear();
372 375 // 营销部分管
373   - roleCodeList.add("ssyxbfg");
  376 + roleCodeList.add("yxbfg");
374 377 // 市场科统计员
375 378 roleCodeList.add("scktjy");
376 379 // 运作科主管
377 380 roleCodeList.add("yzkzg");
  381 + // 获取厂房信息
  382 + Workshop workshop = workshopService.findById(plan.getWorkshopId());
  383 + String workshopName = workshop.getName();
  384 + if ("一分厂".equals(workshopName)) {
  385 + // 市场科主管
  386 + roleCodeList.add("yfcsckzg");
  387 + // 经营办主管
  388 + roleCodeList.add("yfcjybzg");
  389 + // 生产经理
  390 + roleCodeList.add("yfcscjl");
  391 + // 品质经理
  392 + roleCodeList.add("yfcpzjl");
  393 + } else if ("二分厂".equals(workshopName)) {
  394 + // 市场科主管
  395 + roleCodeList.add("efcsckzg");
  396 + // 经营办主管
  397 + roleCodeList.add("efcjybzg");
  398 + // 生产经理
  399 + roleCodeList.add("efcscjl");
  400 + // 品质经理
  401 + roleCodeList.add("efcpzjl");
  402 + } else if ("三分厂".equals(workshopName)) {
  403 + // 市场科主管
  404 + roleCodeList.add("sfcsckzg");
  405 + // 经营办主管
  406 + roleCodeList.add("sfcjybzg");
  407 + // 生产经理
  408 + roleCodeList.add("sfcscjl");
  409 + // 品质经理
  410 + roleCodeList.add("sfcpzjl");
  411 + } else if ("四分厂".equals(workshopName) || "紫铜厂".equals(workshopName)) {
  412 + // 市场科主管
  413 + roleCodeList.add("ztcsckzg");
  414 + // 经营办主管
  415 + roleCodeList.add("ztcjybzg");
  416 + // 生产经理
  417 + roleCodeList.add("ztcscjl");
  418 + // 品质经理
  419 + roleCodeList.add("ztcpzjl");
  420 + }
  421 + userIds = sysUserRoleService.listUserIdByRoleCodes(roleCodeList);
  422 + if (CollectionUtils.isNotEmpty(userIds)) {
  423 + receiveUserIds.addAll(userIds);
  424 + }
  425 + // 获取客户信息
  426 + Customer customer = customerService.findById(plan.getCustomerId());
378 427
379   - messageHandler.sendMsg(receiveUserIds, "", "", "", null);
  428 + messageHandler.sendMsg(receiveUserIds, customer.getName() + "开发审核通过消息通知测试"
  429 + , customer.getName() +"开发审核通过消息通知测试", bizKey, null);
380 430 }
381 431 }
... ...
... ... @@ -98,5 +98,5 @@ public interface CustomerDevelopPlanService extends BaseMpService<CustomerDevelo
98 98 *
99 99 * @param id 主键ID
100 100 */
101   - void sendMsg(String id);
  101 + void sendMsg(String id, String bizKey);
102 102 }
... ...