Commit 9c14fa39c1bbfce9f87e90cf2c1fba5d59ff7013

Authored by 房远帅
1 parent eafa36ad

楚江ERP:客户资信审核流程

@@ -63,6 +63,7 @@ public class CustomerCredit extends BaseEntity implements BaseDto { @@ -63,6 +63,7 @@ public class CustomerCredit extends BaseEntity implements BaseDto {
63 /** 63 /**
64 * 单位名称(非持久化字段) 64 * 单位名称(非持久化字段)
65 */ 65 */
  66 + @TableField(exist = false)
66 private String companyName; 67 private String companyName;
67 68
68 /** 69 /**
@@ -3,11 +3,8 @@ package com.lframework.xingyun.sc.impl.customer; @@ -3,11 +3,8 @@ package com.lframework.xingyun.sc.impl.customer;
3 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 3 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
4 import com.baomidou.mybatisplus.core.toolkit.Wrappers; 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 import com.github.pagehelper.PageInfo; 5 import com.github.pagehelper.PageInfo;
6 -import com.lframework.starter.bpm.dto.FlowInstanceExtDto;  
7 -import com.lframework.starter.bpm.entity.FlowDefinitionWrapper;  
8 -import com.lframework.starter.bpm.enums.FlowDefinitionExtBizType;  
9 -import com.lframework.starter.bpm.enums.FlowDefinitionIsPublish;  
10 import com.lframework.starter.bpm.service.FlowDefinitionWrapperService; 6 import com.lframework.starter.bpm.service.FlowDefinitionWrapperService;
  7 +import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
11 import com.lframework.starter.web.core.components.security.SecurityUtil; 8 import com.lframework.starter.web.core.components.security.SecurityUtil;
12 import com.lframework.starter.web.core.utils.*; 9 import com.lframework.starter.web.core.utils.*;
13 import com.lframework.starter.web.inner.bo.system.user.GetSysUserBo; 10 import com.lframework.starter.web.inner.bo.system.user.GetSysUserBo;
@@ -16,7 +13,6 @@ import com.lframework.starter.web.inner.entity.SysUser; @@ -16,7 +13,6 @@ import com.lframework.starter.web.inner.entity.SysUser;
16 import com.lframework.starter.web.inner.service.system.SysDeptService; 13 import com.lframework.starter.web.inner.service.system.SysDeptService;
17 import com.lframework.starter.web.inner.service.system.SysUserService; 14 import com.lframework.starter.web.inner.service.system.SysUserService;
18 import com.lframework.starter.web.inner.vo.system.user.QuerySysUserVo; 15 import com.lframework.starter.web.inner.vo.system.user.QuerySysUserVo;
19 -import com.lframework.xingyun.sc.bo.customer.credit.GetCustomerCreditBo;  
20 import com.lframework.xingyun.sc.entity.CorePersonnel; 16 import com.lframework.xingyun.sc.entity.CorePersonnel;
21 import com.lframework.xingyun.sc.entity.CustomerCredit; 17 import com.lframework.xingyun.sc.entity.CustomerCredit;
22 import com.lframework.starter.web.core.impl.BaseMpServiceImpl; 18 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
@@ -36,9 +32,6 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService; @@ -36,9 +32,6 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService;
36 import com.lframework.xingyun.sc.service.customer.CustomerCreditService; 32 import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
37 import com.lframework.xingyun.sc.vo.customer.credit.*; 33 import com.lframework.xingyun.sc.vo.customer.credit.*;
38 import org.apache.commons.collections.CollectionUtils; 34 import org.apache.commons.collections.CollectionUtils;
39 -import org.dromara.warm.flow.core.dto.FlowParams;  
40 -import org.dromara.warm.flow.core.entity.Instance;  
41 -import org.dromara.warm.flow.core.service.InsService;  
42 import org.springframework.cache.annotation.CacheEvict; 35 import org.springframework.cache.annotation.CacheEvict;
43 import org.springframework.cache.annotation.Cacheable; 36 import org.springframework.cache.annotation.Cacheable;
44 import org.springframework.stereotype.Service; 37 import org.springframework.stereotype.Service;
@@ -72,7 +65,7 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM @@ -72,7 +65,7 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
72 @Resource 65 @Resource
73 private FlowDefinitionWrapperService flowDefinitionWrapperService; 66 private FlowDefinitionWrapperService flowDefinitionWrapperService;
74 @Resource 67 @Resource
75 - private InsService insService; 68 + private FlowInstanceWrapperService flowInstanceWrapperService;
76 69
77 @Override 70 @Override
78 public PageResult<CustomerCredit> query(Integer pageIndex, Integer pageSize, QueryCustomerCreditVo vo) { 71 public PageResult<CustomerCredit> query(Integer pageIndex, Integer pageSize, QueryCustomerCreditVo vo) {
@@ -266,17 +259,8 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM @@ -266,17 +259,8 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
266 } 259 }
267 } 260 }
268 261
269 - // 流程处理  
270 - FlowDefinitionWrapper flowDefinitionWrapper = flowDefinitionWrapperService.getBaseMapper().selectOne(  
271 - Wrappers.<FlowDefinitionWrapper>query()  
272 - .eq("mode", "CUSTOMER_CREDIT")  
273 - .eq("is_publish", FlowDefinitionIsPublish.Y.getCode())  
274 - .select("id", "flow_code")  
275 - );  
276 - if (flowDefinitionWrapper == null) {  
277 - throw new DefaultClientException("客户资信未设计审核流程或流程未发布!");  
278 - }  
279 - this.startCustomerCreditInstance(flowDefinitionWrapper.getFlowCode(), data.getId()); 262 + // 开启审核
  263 + flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, data);
280 264
281 return data.getId(); 265 return data.getId();
282 } 266 }
@@ -636,17 +620,8 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM @@ -636,17 +620,8 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
636 OpLogUtil.setVariable("id", data.getId()); 620 OpLogUtil.setVariable("id", data.getId());
637 OpLogUtil.setExtra(vo); 621 OpLogUtil.setExtra(vo);
638 622
639 - // 流程处理  
640 - FlowDefinitionWrapper flowDefinitionWrapper = flowDefinitionWrapperService.getBaseMapper().selectOne(  
641 - Wrappers.<FlowDefinitionWrapper>query()  
642 - .eq("mode", "CUSTOMER_CREDIT")  
643 - .eq("is_publish", FlowDefinitionIsPublish.Y.getCode())  
644 - .select("id", "flow_code")  
645 - );  
646 - if (flowDefinitionWrapper == null) {  
647 - throw new DefaultClientException("客户资信未设计审核流程或流程未发布!");  
648 - }  
649 - this.startCustomerCreditInstance(flowDefinitionWrapper.getFlowCode(), data.getId()); 623 + //开启审核
  624 + flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, vo);
650 } 625 }
651 626
652 @OpLog(type = OtherOpLogType.class, name = "删除客户资信表,ID:{}", params = {"#id"}) 627 @OpLog(type = OtherOpLogType.class, name = "删除客户资信表,ID:{}", params = {"#id"})
@@ -824,31 +799,6 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM @@ -824,31 +799,6 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
824 .orElseThrow(() -> new RuntimeException("办事处 " + prefix + " 的编号已用尽 (001-999)")); 799 .orElseThrow(() -> new RuntimeException("办事处 " + prefix + " 的编号已用尽 (001-999)"));
825 } 800 }
826 801
827 - /**  
828 - * 发起流程实例  
829 - *  
830 - * @param processCode 流程code  
831 - * @param businessId 业务ID  
832 - * @return Instance  
833 - */  
834 - public Instance startCustomerCreditInstance(String processCode, String businessId) {  
835 - if (this.getById(businessId) != null) {  
836 - throw new DefaultClientException("客户资信已办理完成,无法重新发起!");  
837 - }  
838 - FlowParams flowParams = new FlowParams();  
839 - flowParams.flowCode(processCode);  
840 -  
841 - FlowInstanceExtDto ext = new FlowInstanceExtDto();  
842 - ext.setBizType(FlowDefinitionExtBizType.SYSTEM.getCode());  
843 - ext.setBizFlag(BPM_FLAG);  
844 - flowParams.ext(JsonUtil.toJsonString(ext));  
845 - // 需要传入表单变量  
846 - GetCustomerCreditBo detail = new GetCustomerCreditBo(this.findById(businessId));  
847 - flowParams.variable(JsonUtil.parseMap(JsonUtil.toJsonString(detail), String.class, Object.class));  
848 -  
849 - return insService.start(businessId, flowParams);  
850 - }  
851 -  
852 @CacheEvict(value = CustomerCredit.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") 802 @CacheEvict(value = CustomerCredit.CACHE_NAME, key = "@cacheVariables.tenantId() + #key")
853 @Override 803 @Override
854 public void cleanCacheByKey(Serializable key) { 804 public void cleanCacheByKey(Serializable key) {