Commit 9c14fa39c1bbfce9f87e90cf2c1fba5d59ff7013

Authored by 房远帅
1 parent eafa36ad

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

... ... @@ -63,6 +63,7 @@ public class CustomerCredit extends BaseEntity implements BaseDto {
63 63 /**
64 64 * 单位名称(非持久化字段)
65 65 */
  66 + @TableField(exist = false)
66 67 private String companyName;
67 68
68 69 /**
... ...
... ... @@ -3,11 +3,8 @@ package com.lframework.xingyun.sc.impl.customer;
3 3 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 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 6 import com.lframework.starter.bpm.service.FlowDefinitionWrapperService;
  7 +import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
11 8 import com.lframework.starter.web.core.components.security.SecurityUtil;
12 9 import com.lframework.starter.web.core.utils.*;
13 10 import com.lframework.starter.web.inner.bo.system.user.GetSysUserBo;
... ... @@ -16,7 +13,6 @@ import com.lframework.starter.web.inner.entity.SysUser;
16 13 import com.lframework.starter.web.inner.service.system.SysDeptService;
17 14 import com.lframework.starter.web.inner.service.system.SysUserService;
18 15 import com.lframework.starter.web.inner.vo.system.user.QuerySysUserVo;
19   -import com.lframework.xingyun.sc.bo.customer.credit.GetCustomerCreditBo;
20 16 import com.lframework.xingyun.sc.entity.CorePersonnel;
21 17 import com.lframework.xingyun.sc.entity.CustomerCredit;
22 18 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
... ... @@ -36,9 +32,6 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService;
36 32 import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
37 33 import com.lframework.xingyun.sc.vo.customer.credit.*;
38 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 35 import org.springframework.cache.annotation.CacheEvict;
43 36 import org.springframework.cache.annotation.Cacheable;
44 37 import org.springframework.stereotype.Service;
... ... @@ -72,7 +65,7 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
72 65 @Resource
73 66 private FlowDefinitionWrapperService flowDefinitionWrapperService;
74 67 @Resource
75   - private InsService insService;
  68 + private FlowInstanceWrapperService flowInstanceWrapperService;
76 69
77 70 @Override
78 71 public PageResult<CustomerCredit> query(Integer pageIndex, Integer pageSize, QueryCustomerCreditVo vo) {
... ... @@ -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 265 return data.getId();
282 266 }
... ... @@ -636,17 +620,8 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
636 620 OpLogUtil.setVariable("id", data.getId());
637 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 627 @OpLog(type = OtherOpLogType.class, name = "删除客户资信表,ID:{}", params = {"#id"})
... ... @@ -824,31 +799,6 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
824 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 802 @CacheEvict(value = CustomerCredit.CACHE_NAME, key = "@cacheVariables.tenantId() + #key")
853 803 @Override
854 804 public void cleanCacheByKey(Serializable key) {
... ...