Commit dfe33c7ddb7523b56101e23b392e5bbea78336a6

Authored by 房远帅
1 parent e851a082

楚江ERP:客户资信-保存审核人

@@ -402,6 +402,42 @@ public class GetCustomerCreditBo extends BaseBo<CustomerCredit> implements BaseD @@ -402,6 +402,42 @@ public class GetCustomerCreditBo extends BaseBo<CustomerCredit> implements BaseD
402 private String shareholderFileId; 402 private String shareholderFileId;
403 403
404 /** 404 /**
  405 + * 所属营销部分管
  406 + */
  407 + @ApiModelProperty(value = "所属营销部分管")
  408 + private String marketingDepartmentManagement;
  409 +
  410 + /**
  411 + * 所属营销部分管名称(非持久化字段)
  412 + */
  413 + @ApiModelProperty(value = "所属营销部分管名称")
  414 + private String marketingDepartmentManagementName;
  415 +
  416 + /**
  417 + * 营销部主管
  418 + */
  419 + @ApiModelProperty(value = "营销部主管")
  420 + private String marketingDepartmentSupervisor;
  421 +
  422 + /**
  423 + * 营销部主管名称(非持久化字段)
  424 + */
  425 + @ApiModelProperty(value = "营销部主管名称")
  426 + private String marketingDepartmentSupervisorName;
  427 +
  428 + /**
  429 + * 营销中心主管
  430 + */
  431 + @ApiModelProperty(value = "营销中心主管")
  432 + private String marketingCenterSupervisor;
  433 +
  434 + /**
  435 + * 营销中心主管名称(非持久化字段)
  436 + */
  437 + @ApiModelProperty(value = "营销中心主管名称")
  438 + private String marketingCenterSupervisorName;
  439 +
  440 + /**
405 * 核心人员 441 * 核心人员
406 */ 442 */
407 @ApiModelProperty("核心人员") 443 @ApiModelProperty("核心人员")
@@ -112,9 +112,9 @@ public class CustomerCreditController extends DefaultBaseController { @@ -112,9 +112,9 @@ public class CustomerCreditController extends DefaultBaseController {
112 /** 112 /**
113 * 根据ID查询变更审核的数据 113 * 根据ID查询变更审核的数据
114 */ 114 */
115 - @ApiOperation("根据ID查询") 115 + @ApiOperation("根据ID查询变更审核的数据")
116 @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) 116 @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
117 - @HasPermission({"customer-credit-manage:customer-credit-plan:examine"}) 117 + @HasPermission({"customer-credit-manage:customer-credit-plan:approve", "customer-credit-manage:customer-credit-plan:review"})
118 @GetMapping("/getExamineById") 118 @GetMapping("/getExamineById")
119 public InvokeResult<GetCustomerCreditBo> getExamineById(@NotBlank(message = "id不能为空!") String id) { 119 public InvokeResult<GetCustomerCreditBo> getExamineById(@NotBlank(message = "id不能为空!") String id) {
120 120
@@ -176,7 +176,7 @@ public class CustomerCreditController extends DefaultBaseController { @@ -176,7 +176,7 @@ public class CustomerCreditController extends DefaultBaseController {
176 * 取消 176 * 取消
177 */ 177 */
178 @ApiOperation("取消") 178 @ApiOperation("取消")
179 - @HasPermission({"customer-credit-manage:customer-credit-plan:modify"}) 179 + @HasPermission({"customer-credit-manage:customer-credit-plan:close"})
180 @GetMapping("/cancel") 180 @GetMapping("/cancel")
181 public InvokeResult<Void> cancel(@NotBlank(message = "id不能为空!") String id) { 181 public InvokeResult<Void> cancel(@NotBlank(message = "id不能为空!") String id) {
182 182
@@ -317,6 +317,21 @@ public class CustomerCredit extends BaseEntity implements BaseDto { @@ -317,6 +317,21 @@ public class CustomerCredit extends BaseEntity implements BaseDto {
317 private String shareholderFileId; 317 private String shareholderFileId;
318 318
319 /** 319 /**
  320 + * 所属营销部分管
  321 + */
  322 + private String marketingDepartmentManagement;
  323 +
  324 + /**
  325 + * 营销部主管
  326 + */
  327 + private String marketingDepartmentSupervisor;
  328 +
  329 + /**
  330 + * 营销中心主管
  331 + */
  332 + private String marketingCenterSupervisor;
  333 +
  334 + /**
320 * 创建人ID 335 * 创建人ID
321 */ 336 */
322 @TableField(fill = FieldFill.INSERT) 337 @TableField(fill = FieldFill.INSERT)
@@ -727,6 +727,8 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM @@ -727,6 +727,8 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
727 } 727 }
728 String jsonString = JsonUtil.toJsonString(vo); 728 String jsonString = JsonUtil.toJsonString(vo);
729 redisHandler.set(vo.getId(), jsonString); 729 redisHandler.set(vo.getId(), jsonString);
  730 + //修改状态
  731 + updateStatus(vo.getId(), "AUDIT");
730 } else { 732 } else {
731 //变更审核通过后再修改入库 733 //变更审核通过后再修改入库
732 LambdaUpdateWrapper<CustomerCredit> updateWrapper = Wrappers.lambdaUpdate(CustomerCredit.class) 734 LambdaUpdateWrapper<CustomerCredit> updateWrapper = Wrappers.lambdaUpdate(CustomerCredit.class)
@@ -1065,6 +1067,37 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM @@ -1065,6 +1067,37 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
1065 cleanCacheByKey(id); 1067 cleanCacheByKey(id);
1066 } 1068 }
1067 1069
  1070 + @OpLog(type = OtherOpLogType.class, name = "更新审核人,ID:{}", params = {"#id"})
  1071 + @Transactional(rollbackFor = Exception.class)
  1072 + @Override
  1073 + public void updateExamineUser(UpdateCustomerCreditVo vo) {
  1074 + if (vo == null) {
  1075 + return;
  1076 + }
  1077 + if (StringUtil.isNotEmpty(vo.getSupervisorReview())) {
  1078 + LambdaUpdateWrapper<CustomerCredit> updateWrapper = Wrappers.lambdaUpdate(CustomerCredit.class)
  1079 + .set(CustomerCredit::getSupervisorReview, vo.getSupervisorReview())
  1080 + .eq(CustomerCredit::getId, vo.getId());
  1081 + getBaseMapper().update(updateWrapper);
  1082 + } else if (StringUtil.isNotEmpty(vo.getMarketingDepartmentManagement())) {
  1083 + LambdaUpdateWrapper<CustomerCredit> updateWrapper = Wrappers.lambdaUpdate(CustomerCredit.class)
  1084 + .set(CustomerCredit::getMarketingDepartmentManagement, vo.getMarketingDepartmentManagement())
  1085 + .eq(CustomerCredit::getId, vo.getId());
  1086 + getBaseMapper().update(updateWrapper);
  1087 + } else if (StringUtil.isNotEmpty(vo.getMarketingDepartmentSupervisor())) {
  1088 + LambdaUpdateWrapper<CustomerCredit> updateWrapper = Wrappers.lambdaUpdate(CustomerCredit.class)
  1089 + .set(CustomerCredit::getMarketingDepartmentSupervisor, vo.getMarketingDepartmentSupervisor())
  1090 + .eq(CustomerCredit::getId, vo.getId());
  1091 + getBaseMapper().update(updateWrapper);
  1092 + } else if (StringUtil.isNotEmpty(vo.getMarketingCenterSupervisor())) {
  1093 + LambdaUpdateWrapper<CustomerCredit> updateWrapper = Wrappers.lambdaUpdate(CustomerCredit.class)
  1094 + .set(CustomerCredit::getMarketingCenterSupervisor, vo.getMarketingCenterSupervisor())
  1095 + .eq(CustomerCredit::getId, vo.getId());
  1096 + getBaseMapper().update(updateWrapper);
  1097 + }
  1098 + cleanCacheByKey(vo.getId());
  1099 + }
  1100 +
1068 @OpLog(type = OtherOpLogType.class, name = "取消,ID:{}", params = {"#id"}) 1101 @OpLog(type = OtherOpLogType.class, name = "取消,ID:{}", params = {"#id"})
1069 @Transactional(rollbackFor = Exception.class) 1102 @Transactional(rollbackFor = Exception.class)
1070 @Override 1103 @Override
@@ -1237,7 +1270,7 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM @@ -1237,7 +1270,7 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
1237 } 1270 }
1238 dataModel.put("enterpriseType", enterpriseType); 1271 dataModel.put("enterpriseType", enterpriseType);
1239 } 1272 }
1240 - 1273 +
1241 // 核心人员列表 - 确保放入数据模型供模板遍历 1274 // 核心人员列表 - 确保放入数据模型供模板遍历
1242 List<GetCorePersonnelBo> corePersonnelBoList = new ArrayList<>(); 1275 List<GetCorePersonnelBo> corePersonnelBoList = new ArrayList<>();
1243 if (CollectionUtils.isNotEmpty(corePersonnelList)) { 1276 if (CollectionUtils.isNotEmpty(corePersonnelList)) {
1 package com.lframework.xingyun.sc.listeners.flow; 1 package com.lframework.xingyun.sc.listeners.flow;
2 2
3 -import com.lframework.starter.bpm.enums.FlowInstanceStatus;  
4 -import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; 3 +import com.lframework.starter.bpm.dto.FlowInstanceExtDto;
  4 +import com.lframework.starter.web.core.components.security.SecurityUtil;
  5 +import com.lframework.starter.web.core.utils.JsonUtil;
5 import com.lframework.xingyun.sc.service.customer.CustomerCreditService; 6 import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
6 -import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService; 7 +import com.lframework.xingyun.sc.vo.customer.credit.UpdateCustomerCreditVo;
7 import lombok.extern.slf4j.Slf4j; 8 import lombok.extern.slf4j.Slf4j;
8 import org.apache.commons.collections4.MapUtils; 9 import org.apache.commons.collections4.MapUtils;
  10 +import org.apache.commons.lang3.StringUtils;
9 import org.dromara.warm.flow.core.entity.Instance; 11 import org.dromara.warm.flow.core.entity.Instance;
  12 +import org.dromara.warm.flow.core.entity.Node;
10 import org.dromara.warm.flow.core.listener.Listener; 13 import org.dromara.warm.flow.core.listener.Listener;
11 import org.dromara.warm.flow.core.listener.ListenerVariable; 14 import org.dromara.warm.flow.core.listener.ListenerVariable;
12 import org.springframework.stereotype.Component; 15 import org.springframework.stereotype.Component;
@@ -18,9 +21,6 @@ import java.util.Map; @@ -18,9 +21,6 @@ import java.util.Map;
18 @Slf4j 21 @Slf4j
19 public class NodeFinishListener implements Listener { 22 public class NodeFinishListener implements Listener {
20 23
21 -  
22 - @Resource  
23 - private CustomerDevelopPlanService customerDevelopPlanService;  
24 @Resource 24 @Resource
25 private CustomerCreditService customerCreditService; 25 private CustomerCreditService customerCreditService;
26 26
@@ -38,48 +38,66 @@ public class NodeFinishListener implements Listener { @@ -38,48 +38,66 @@ public class NodeFinishListener implements Listener {
38 if (MapUtils.isEmpty(variable)) { 38 if (MapUtils.isEmpty(variable)) {
39 return; 39 return;
40 } 40 }
  41 + Node node = listenerVariable.getNode();
  42 + String nodeCode = null;
  43 + if (node != null) {
  44 + nodeCode = node.getNodeCode();
  45 + }
  46 + log.info("nodeCode==" + nodeCode);
41 String businessId = instance.getBusinessId(); 47 String businessId = instance.getBusinessId();
42 - String businessType = (String) variable.get("businessType");  
43 - // 获取审核结果  
44 - String flowStatus = listenerVariable.getFlowParams().getFlowStatus();  
45 - // 更新业务数据  
46 - switch (businessType) {  
47 - case "CUSTOMER_DEVELOP":  
48 - handleCustomerDevelopData(flowStatus, businessId);  
49 - break;  
50 - case "CUSTOMER_CREDIT":  
51 - handleCustomerCreditData(flowStatus, businessId);  
52 - break;  
53 - default:  
54 - break; 48 + // 获取业务数据标识
  49 + String ext = instance.getExt();
  50 + String businessType = null;
  51 + if (StringUtils.isNotBlank(ext)) {
  52 + FlowInstanceExtDto flowInstanceExtDto = JsonUtil.parseObject(ext, FlowInstanceExtDto.class);
  53 + businessType = flowInstanceExtDto.getBizFlag();
  54 + }
  55 + if ("CUSTOMER_CREDIT".equals(businessType)) {
  56 + // 更新业务数据
  57 + switch (nodeCode) {
  58 + //办事处主管审核
  59 + case "customer_credit_office_manager":
  60 + handleCustomerCreditData(businessId, nodeCode);
  61 + break;
  62 + //所属营销部分管审核
  63 + case "customer_credit_marketing_department_management":
  64 + handleCustomerCreditData(businessId, nodeCode);
  65 + break;
  66 + //营销部主管审核
  67 + case "customer_credit_marketing_department_supervisor":
  68 + handleCustomerCreditData(businessId, nodeCode);
  69 + break;
  70 + //营销中心主管
  71 + case "customer_credit_marketing_center_supervisor":
  72 + handleCustomerCreditData(businessId, nodeCode);
  73 + break;
  74 + default:
  75 + break;
  76 + }
55 } 77 }
56 log.info("==================== 流程节点完成监听器结束......"); 78 log.info("==================== 流程节点完成监听器结束......");
57 } 79 }
58 80
59 -  
60 /** 81 /**
61 - * 客户开发业务数据处理 82 + * 客户资信-办事处主管审核人存储数据处理
62 * 83 *
63 * @param businessId 业务ID 84 * @param businessId 业务ID
64 */ 85 */
65 - private void handleCustomerDevelopData(String flowStatus, String businessId) {  
66 - if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus)) {  
67 - customerDevelopPlanService.updateStatus(businessId, CustomerDevelopStatus.PASS);  
68 - } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus)) {  
69 - customerDevelopPlanService.updateStatus(businessId, CustomerDevelopStatus.REFUSE); 86 + private void handleCustomerCreditData(String businessId, String nodeCode) {
  87 + UpdateCustomerCreditVo vo = new UpdateCustomerCreditVo();
  88 + String currentUserId = SecurityUtil.getCurrentUser().getId();
  89 + log.info("当前人id:" + currentUserId);
  90 + if ("customer_credit_office_manager".equals(nodeCode)) {
  91 + vo.setSupervisorReview(currentUserId);
  92 + } else if ("customer_credit_marketing_department_management".equals(nodeCode)) {
  93 + vo.setMarketingDepartmentManagement(currentUserId);
  94 + } else if ("customer_credit_marketing_department_supervisor".equals(nodeCode)) {
  95 + vo.setMarketingDepartmentSupervisor(currentUserId);
  96 + } else if ("customer_credit_marketing_center_supervisor".equals(nodeCode)) {
  97 + vo.setMarketingCenterSupervisor(currentUserId);
70 } 98 }
71 - } 99 + vo.setId(businessId);
72 100
73 - /**  
74 - * 客户资信业务数据处理  
75 - *  
76 - * @param businessId 业务ID  
77 - */  
78 - private void handleCustomerCreditData(String flowStatus, String businessId) {  
79 - if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus)) {  
80 - customerCreditService.updateStatus(businessId, "PASS");  
81 - } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus)) {  
82 - customerCreditService.updateStatus(businessId, "REFUSE");  
83 - } 101 + customerCreditService.updateExamineUser(vo);
84 } 102 }
85 } 103 }
@@ -74,6 +74,13 @@ public interface CustomerCreditService extends BaseMpService<CustomerCredit> { @@ -74,6 +74,13 @@ public interface CustomerCreditService extends BaseMpService<CustomerCredit> {
74 void updateStatus(String id, String status); 74 void updateStatus(String id, String status);
75 75
76 /** 76 /**
  77 + * 更新审核人
  78 + *
  79 + * @param vo
  80 + */
  81 + void updateExamineUser(UpdateCustomerCreditVo vo);
  82 +
  83 + /**
77 * 取消 84 * 取消
78 * 85 *
79 * @param id 86 * @param id
@@ -434,4 +434,22 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable { @@ -434,4 +434,22 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable {
434 @ApiModelProperty(value = "客户资信历史记录id") 434 @ApiModelProperty(value = "客户资信历史记录id")
435 private String creditHistoryId; 435 private String creditHistoryId;
436 436
  437 + /**
  438 + * 所属营销部分管
  439 + */
  440 + @ApiModelProperty(value = "所属营销部分管")
  441 + private String marketingDepartmentManagement;
  442 +
  443 + /**
  444 + * 营销部主管
  445 + */
  446 + @ApiModelProperty(value = "营销部主管")
  447 + private String marketingDepartmentSupervisor;
  448 +
  449 + /**
  450 + * 营销中心主管
  451 + */
  452 + @ApiModelProperty(value = "营销中心主管")
  453 + private String marketingCenterSupervisor;
  454 +
437 } 455 }
@@ -60,6 +60,9 @@ @@ -60,6 +60,9 @@
60 <result column="business_file_id" property="businessFileId"/> 60 <result column="business_file_id" property="businessFileId"/>
61 <result column="shareholder_file_name" property="shareholderFileName"/> 61 <result column="shareholder_file_name" property="shareholderFileName"/>
62 <result column="shareholder_file_id" property="shareholderFileId"/> 62 <result column="shareholder_file_id" property="shareholderFileId"/>
  63 + <result column="marketing_department_management" property="marketingDepartmentManagement"/>
  64 + <result column="marketing_department_supervisor" property="marketingDepartmentSupervisor"/>
  65 + <result column="marketing_center_supervisor" property="marketingCenterSupervisor"/>
63 <result column="status" property="status"/> 66 <result column="status" property="status"/>
64 <result column="create_by_id" property="createById"/> 67 <result column="create_by_id" property="createById"/>
65 <result column="create_by" property="createBy"/> 68 <result column="create_by" property="createBy"/>
@@ -128,6 +131,9 @@ @@ -128,6 +131,9 @@
128 tb.business_file_name, 131 tb.business_file_name,
129 tb.business_file_id, 132 tb.business_file_id,
130 tb.shareholder_file_name, 133 tb.shareholder_file_name,
  134 + tb.marketing_department_management,
  135 + tb.marketing_department_supervisor,
  136 + tb.marketing_center_supervisor,
131 tb.shareholder_file_id, 137 tb.shareholder_file_id,
132 tb.create_by_id, 138 tb.create_by_id,
133 tb.create_by, 139 tb.create_by,