Commit 6e7cbbf87b876ac193cbfcd9bae2917a14b98f84

Authored by yeqianyong
1 parent a2ec12c4

楚江ERP-客户开发审核流程相关逻辑开发

@@ -48,7 +48,7 @@ public class GetCustomerDevelopPlanBo extends BaseBo<CustomerDevelopPlan> { @@ -48,7 +48,7 @@ public class GetCustomerDevelopPlanBo extends BaseBo<CustomerDevelopPlan> {
48 * 客户类型 48 * 客户类型
49 */ 49 */
50 @ApiModelProperty("客户类型") 50 @ApiModelProperty("客户类型")
51 - private TypeInfo customerType; 51 + private String customerType;
52 52
53 /** 53 /**
54 * 产品品种 54 * 产品品种
@@ -141,10 +141,10 @@ public class GetCustomerDevelopPlanBo extends BaseBo<CustomerDevelopPlan> { @@ -141,10 +141,10 @@ public class GetCustomerDevelopPlanBo extends BaseBo<CustomerDevelopPlan> {
141 private Integer status; 141 private Integer status;
142 142
143 /** 143 /**
144 - * 状态字典值 144 + * 流程任务ID
145 */ 145 */
146 - @ApiModelProperty("状态字典值")  
147 - private String statusDicValue; 146 + @ApiModelProperty("流程任务ID")
  147 + private Long flowTaskId;
148 148
149 /** 149 /**
150 * 创建人 150 * 创建人
1 package com.lframework.xingyun.sc.controller.customer; 1 package com.lframework.xingyun.sc.controller.customer;
2 2
  3 +import com.lframework.starter.bpm.dto.FlowTaskDto;
  4 +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
  5 +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
3 import com.lframework.starter.web.core.annotations.security.HasPermission; 6 import com.lframework.starter.web.core.annotations.security.HasPermission;
  7 +import com.lframework.starter.web.core.components.security.SecurityUtil;
4 import com.lframework.starter.web.core.controller.DefaultBaseController; 8 import com.lframework.starter.web.core.controller.DefaultBaseController;
5 import com.lframework.starter.web.inner.entity.SysUser; 9 import com.lframework.starter.web.inner.entity.SysUser;
6 import com.lframework.starter.web.inner.service.system.SysUserService; 10 import com.lframework.starter.web.inner.service.system.SysUserService;
@@ -62,7 +66,7 @@ public class CustomerDevelopPlanController extends DefaultBaseController { @@ -62,7 +66,7 @@ public class CustomerDevelopPlanController extends DefaultBaseController {
62 @Resource 66 @Resource
63 private OfficeService officeService; 67 private OfficeService officeService;
64 @Resource 68 @Resource
65 - private TypeInfoService typeInfoService; 69 + private FlowTaskWrapperMapper flowTaskWrapperMapper;
66 @Resource 70 @Resource
67 private ProductVarietyService productVarietyService; 71 private ProductVarietyService productVarietyService;
68 @Resource 72 @Resource
@@ -160,14 +164,12 @@ public class CustomerDevelopPlanController extends DefaultBaseController { @@ -160,14 +164,12 @@ public class CustomerDevelopPlanController extends DefaultBaseController {
160 List<String> customerIds = new ArrayList<>(); 164 List<String> customerIds = new ArrayList<>();
161 List<String> workshopIds = new ArrayList<>(); 165 List<String> workshopIds = new ArrayList<>();
162 List<String> officeIds = new ArrayList<>(); 166 List<String> officeIds = new ArrayList<>();
163 - List<String> typeIds = new ArrayList<>();  
164 List<String> productVarietyIds = new ArrayList<>(); 167 List<String> productVarietyIds = new ArrayList<>();
165 List<String> chargeUserIds = new ArrayList<>(); 168 List<String> chargeUserIds = new ArrayList<>();
166 for (CustomerDevelopPlan plan : dataList) { 169 for (CustomerDevelopPlan plan : dataList) {
167 String customerId = plan.getCustomerId(); 170 String customerId = plan.getCustomerId();
168 String workshopId = plan.getWorkshopId(); 171 String workshopId = plan.getWorkshopId();
169 String officeId = plan.getOfficeId(); 172 String officeId = plan.getOfficeId();
170 - String customerTypeId = plan.getCustomerTypeId();  
171 String productVarietyId = plan.getProductVarietyId(); 173 String productVarietyId = plan.getProductVarietyId();
172 String chargeUserId = plan.getChargeUserId(); 174 String chargeUserId = plan.getChargeUserId();
173 if (StringUtils.isNotBlank(customerId) && !customerIds.contains(customerId)) { 175 if (StringUtils.isNotBlank(customerId) && !customerIds.contains(customerId)) {
@@ -179,9 +181,6 @@ public class CustomerDevelopPlanController extends DefaultBaseController { @@ -179,9 +181,6 @@ public class CustomerDevelopPlanController extends DefaultBaseController {
179 if (StringUtils.isNotBlank(officeId) && !officeIds.contains(officeId)) { 181 if (StringUtils.isNotBlank(officeId) && !officeIds.contains(officeId)) {
180 officeIds.add(officeId); 182 officeIds.add(officeId);
181 } 183 }
182 - if (StringUtils.isNotBlank(customerTypeId) && !typeIds.contains(customerTypeId)) {  
183 - typeIds.add(customerTypeId);  
184 - }  
185 if (StringUtils.isNotBlank(productVarietyId) && !productVarietyIds.contains(productVarietyId)) { 184 if (StringUtils.isNotBlank(productVarietyId) && !productVarietyIds.contains(productVarietyId)) {
186 productVarietyIds.add(productVarietyId); 185 productVarietyIds.add(productVarietyId);
187 } 186 }
@@ -207,11 +206,12 @@ public class CustomerDevelopPlanController extends DefaultBaseController { @@ -207,11 +206,12 @@ public class CustomerDevelopPlanController extends DefaultBaseController {
207 if (CollectionUtils.isNotEmpty(officeList)) { 206 if (CollectionUtils.isNotEmpty(officeList)) {
208 officeMap = officeList.stream().collect(Collectors.toMap(Office::getId, Function.identity())); 207 officeMap = officeList.stream().collect(Collectors.toMap(Office::getId, Function.identity()));
209 } 208 }
210 - // 获取客户类型信息  
211 - List<TypeInfo> typeInfoList = typeInfoService.listByIds(typeIds);  
212 - Map<String, TypeInfo> typeInfoMap = new HashMap<>();  
213 - if (CollectionUtils.isNotEmpty(typeInfoList)) {  
214 - typeInfoMap = typeInfoList.stream().collect(Collectors.toMap(TypeInfo::getId, Function.identity())); 209 + // 获取流程任务数据
  210 + List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo()
  211 + , SecurityUtil.getCurrentUser().getId());
  212 + Map<String, FlowTaskDto> flowTaskMap = new HashMap<>();
  213 + if (CollectionUtils.isNotEmpty(flowTaskList)) {
  214 + flowTaskMap = flowTaskList.stream().collect(Collectors.toMap(FlowTaskDto::getBusinessId, Function.identity()));
215 } 215 }
216 // 获取产品品种信息 216 // 获取产品品种信息
217 List<ProductVariety> productVarietyList = productVarietyService.listByIds(productVarietyIds); 217 List<ProductVariety> productVarietyList = productVarietyService.listByIds(productVarietyIds);
@@ -237,9 +237,9 @@ public class CustomerDevelopPlanController extends DefaultBaseController { @@ -237,9 +237,9 @@ public class CustomerDevelopPlanController extends DefaultBaseController {
237 // 办事处/科办 237 // 办事处/科办
238 Office office = officeMap.get(plan.getOfficeId()); 238 Office office = officeMap.get(plan.getOfficeId());
239 data.setOffice(office); 239 data.setOffice(office);
240 - // 客户类型  
241 - TypeInfo typeInfo = typeInfoMap.get(plan.getCustomerTypeId());  
242 - data.setCustomerType(typeInfo); 240 + // 流程任务
  241 + FlowTaskDto task = flowTaskMap.get(plan.getId());
  242 + data.setFlowTaskId(task == null ? null : task.getTaskId());
243 // 产品品种 243 // 产品品种
244 ProductVariety productVariety = productVarietyMap.get(plan.getProductVarietyId()); 244 ProductVariety productVariety = productVarietyMap.get(plan.getProductVarietyId());
245 data.setProductVariety(productVariety); 245 data.setProductVariety(productVariety);
@@ -264,7 +264,6 @@ public class CustomerDevelopPlanController extends DefaultBaseController { @@ -264,7 +264,6 @@ public class CustomerDevelopPlanController extends DefaultBaseController {
264 String customerId = plan.getCustomerId(); 264 String customerId = plan.getCustomerId();
265 String workshopId = plan.getWorkshopId(); 265 String workshopId = plan.getWorkshopId();
266 String officeId = plan.getOfficeId(); 266 String officeId = plan.getOfficeId();
267 - String customerTypeId = plan.getCustomerTypeId();  
268 String productVarietyId = plan.getProductVarietyId(); 267 String productVarietyId = plan.getProductVarietyId();
269 String chargeUserId = plan.getChargeUserId(); 268 String chargeUserId = plan.getChargeUserId();
270 269
@@ -278,9 +277,6 @@ public class CustomerDevelopPlanController extends DefaultBaseController { @@ -278,9 +277,6 @@ public class CustomerDevelopPlanController extends DefaultBaseController {
278 // 获取办事处/科办信息 277 // 获取办事处/科办信息
279 Office office = officeService.findById(officeId); 278 Office office = officeService.findById(officeId);
280 data.setOffice(office); 279 data.setOffice(office);
281 - // 获取客户类型信息  
282 - TypeInfo customerType = typeInfoService.findById(customerTypeId);  
283 - data.setCustomerType(customerType);  
284 // 获取产品品种信息 280 // 获取产品品种信息
285 ProductVariety productVariety = productVarietyService.findById(productVarietyId); 281 ProductVariety productVariety = productVarietyService.findById(productVarietyId);
286 data.setProductVariety(productVariety); 282 data.setProductVariety(productVariety);
@@ -48,7 +48,7 @@ public class CustomerDevelopPlan extends BaseEntity implements BaseDto { @@ -48,7 +48,7 @@ public class CustomerDevelopPlan extends BaseEntity implements BaseDto {
48 /** 48 /**
49 * 客户类型ID 49 * 客户类型ID
50 */ 50 */
51 - private String customerTypeId; 51 + private String customerType;
52 52
53 /** 53 /**
54 * 产品品种ID 54 * 产品品种ID
@@ -121,6 +121,11 @@ public class CustomerDevelopPlan extends BaseEntity implements BaseDto { @@ -121,6 +121,11 @@ public class CustomerDevelopPlan extends BaseEntity implements BaseDto {
121 private CustomerDevelopStatus status; 121 private CustomerDevelopStatus status;
122 122
123 /** 123 /**
  124 + * 关联的审批流程ID
  125 + */
  126 + private Long flowInstanceId;
  127 +
  128 + /**
124 * 创建人ID 129 * 创建人ID
125 */ 130 */
126 @TableField(fill = FieldFill.INSERT) 131 @TableField(fill = FieldFill.INSERT)
@@ -3,21 +3,32 @@ package com.lframework.xingyun.sc.impl.customer; @@ -3,21 +3,32 @@ 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.dto.FlowTaskDto;
  8 +import com.lframework.starter.bpm.entity.FlowDefinitionWrapper;
  9 +import com.lframework.starter.bpm.enums.FlowDefinitionExtBizType;
  10 +import com.lframework.starter.bpm.enums.FlowDefinitionIsPublish;
  11 +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
  12 +import com.lframework.starter.bpm.service.FlowDefinitionWrapperService;
  13 +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
  14 +import com.lframework.starter.web.core.components.security.SecurityUtil;
  15 +import com.lframework.starter.web.core.utils.*;
  16 +import com.lframework.xingyun.sc.bo.customer.develop.GetCustomerDevelopPlanBo;
6 import com.lframework.xingyun.sc.entity.CustomerDevelopPlan; 17 import com.lframework.xingyun.sc.entity.CustomerDevelopPlan;
7 import com.lframework.starter.web.core.impl.BaseMpServiceImpl; 18 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
8 -import com.lframework.starter.web.core.utils.PageResultUtil;  
9 import com.lframework.starter.web.core.components.resp.PageResult; 19 import com.lframework.starter.web.core.components.resp.PageResult;
10 -import com.lframework.starter.web.core.utils.OpLogUtil;  
11 import com.lframework.starter.common.utils.StringUtil; 20 import com.lframework.starter.common.utils.StringUtil;
12 import com.lframework.starter.common.exceptions.impl.DefaultClientException; 21 import com.lframework.starter.common.exceptions.impl.DefaultClientException;
13 -import com.lframework.starter.web.core.utils.IdUtil;  
14 import com.lframework.starter.common.utils.ObjectUtil; 22 import com.lframework.starter.common.utils.ObjectUtil;
15 import com.lframework.starter.web.core.annotations.oplog.OpLog; 23 import com.lframework.starter.web.core.annotations.oplog.OpLog;
16 -import com.lframework.starter.web.core.utils.PageHelperUtil;  
17 import com.lframework.starter.common.utils.Assert; 24 import com.lframework.starter.common.utils.Assert;
18 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; 25 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
19 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; 26 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
  27 +import org.apache.commons.collections4.CollectionUtils;
20 import org.apache.commons.lang3.StringUtils; 28 import org.apache.commons.lang3.StringUtils;
  29 +import org.dromara.warm.flow.core.dto.FlowParams;
  30 +import org.dromara.warm.flow.core.entity.Instance;
  31 +import org.dromara.warm.flow.core.service.InsService;
21 import org.springframework.transaction.annotation.Transactional; 32 import org.springframework.transaction.annotation.Transactional;
22 import com.lframework.xingyun.sc.mappers.CustomerDevelopPlanMapper; 33 import com.lframework.xingyun.sc.mappers.CustomerDevelopPlanMapper;
23 import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService; 34 import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService;
@@ -26,13 +37,26 @@ import com.lframework.xingyun.sc.vo.customer.develop.QueryCustomerDevelopPlanVo; @@ -26,13 +37,26 @@ import com.lframework.xingyun.sc.vo.customer.develop.QueryCustomerDevelopPlanVo;
26 import com.lframework.xingyun.sc.vo.customer.develop.UpdateCustomerDevelopPlanVo; 37 import com.lframework.xingyun.sc.vo.customer.develop.UpdateCustomerDevelopPlanVo;
27 import org.springframework.stereotype.Service; 38 import org.springframework.stereotype.Service;
28 39
  40 +import javax.annotation.Resource;
29 import java.util.ArrayList; 41 import java.util.ArrayList;
30 import java.util.List; 42 import java.util.List;
  43 +import java.util.stream.Collectors;
31 44
32 @Service 45 @Service
33 public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDevelopPlanMapper, CustomerDevelopPlan> implements CustomerDevelopPlanService { 46 public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDevelopPlanMapper, CustomerDevelopPlan> implements CustomerDevelopPlanService {
34 47
35 48
  49 + private static final String BPM_FLAG = "CustomerDevelop";
  50 +
  51 +
  52 + @Resource
  53 + private FlowDefinitionWrapperService flowDefinitionWrapperService;
  54 + @Resource
  55 + private InsService insService;
  56 + @Resource
  57 + private FlowTaskWrapperMapper flowTaskWrapperMapper;
  58 +
  59 +
36 60
37 @Override 61 @Override
38 public PageResult<CustomerDevelopPlan> query(Integer pageIndex, Integer pageSize, QueryCustomerDevelopPlanVo vo) { 62 public PageResult<CustomerDevelopPlan> query(Integer pageIndex, Integer pageSize, QueryCustomerDevelopPlanVo vo) {
@@ -58,12 +82,19 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe @@ -58,12 +82,19 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
58 workshopNameList.add("紫铜分厂"); 82 workshopNameList.add("紫铜分厂");
59 vo.setWorkshopNames(workshopNameList); 83 vo.setWorkshopNames(workshopNameList);
60 } 84 }
  85 + List<String> ids = new ArrayList<>();
61 // 待办类型 86 // 待办类型
62 String todoType = vo.getTodoType(); 87 String todoType = vo.getTodoType();
63 if ("COMPLETED".equals(todoType)) { 88 if ("COMPLETED".equals(todoType)) {
64 89
65 } else if ("WAIT".equals(todoType)) { 90 } else if ("WAIT".equals(todoType)) {
66 - 91 + // 获取当前人员的待办任务数据
  92 + List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
  93 + if (CollectionUtils.isEmpty(flowTaskList)) {
  94 + return PageResultUtil.convert(new PageInfo<>());
  95 + }
  96 + ids = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
  97 + vo.setIds(ids);
67 } 98 }
68 PageHelperUtil.startPage(pageIndex, pageSize); 99 PageHelperUtil.startPage(pageIndex, pageSize);
69 List<CustomerDevelopPlan> dataList = this.query(vo); 100 List<CustomerDevelopPlan> dataList = this.query(vo);
@@ -98,7 +129,8 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe @@ -98,7 +129,8 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
98 @Override 129 @Override
99 public String create(CreateCustomerDevelopPlanVo vo) { 130 public String create(CreateCustomerDevelopPlanVo vo) {
100 CustomerDevelopPlan data = new CustomerDevelopPlan(); 131 CustomerDevelopPlan data = new CustomerDevelopPlan();
101 - data.setId(IdUtil.getId()); 132 + String id = IdUtil.getId();
  133 + data.setId(id);
102 // 审核中 134 // 审核中
103 data.setStatus(CustomerDevelopStatus.AUDIT); 135 data.setStatus(CustomerDevelopStatus.AUDIT);
104 data.setCustomerId(vo.getCustomerId()); 136 data.setCustomerId(vo.getCustomerId());
@@ -108,9 +140,6 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe @@ -108,9 +140,6 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
108 if (!StringUtil.isBlank(vo.getOfficeId())) { 140 if (!StringUtil.isBlank(vo.getOfficeId())) {
109 data.setOfficeId(vo.getOfficeId()); 141 data.setOfficeId(vo.getOfficeId());
110 } 142 }
111 - if (!StringUtil.isBlank(vo.getCustomerTypeId())) {  
112 - data.setCustomerTypeId(vo.getCustomerTypeId());  
113 - }  
114 if (!StringUtil.isBlank(vo.getProductVarietyId())) { 143 if (!StringUtil.isBlank(vo.getProductVarietyId())) {
115 data.setProductVarietyId(vo.getProductVarietyId()); 144 data.setProductVarietyId(vo.getProductVarietyId());
116 } 145 }
@@ -148,6 +177,18 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe @@ -148,6 +177,18 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
148 data.setSettleDays(vo.getSettleDays()); 177 data.setSettleDays(vo.getSettleDays());
149 } 178 }
150 data.setChargeUserId(vo.getChargeUserId()); 179 data.setChargeUserId(vo.getChargeUserId());
  180 + // 流程处理
  181 + FlowDefinitionWrapper flowDefinitionWrapper = flowDefinitionWrapperService.getBaseMapper().selectOne(
  182 + Wrappers.<FlowDefinitionWrapper>query()
  183 + .eq("mode", "CUSTOMER_DEVELOP")
  184 + .eq("is_publish", FlowDefinitionIsPublish.Y.getCode())
  185 + .select("id", "flow_code")
  186 + );
  187 + if (flowDefinitionWrapper == null) {
  188 + throw new DefaultClientException("客户开发未设计审核流程或流程未发布!");
  189 + }
  190 + Instance instance = this.startCustomerDevelopInstance(flowDefinitionWrapper.getFlowCode(), id);
  191 + data.setFlowInstanceId(instance.getId());
151 192
152 getBaseMapper().insert(data); 193 getBaseMapper().insert(data);
153 194
@@ -168,7 +209,7 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe @@ -168,7 +209,7 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
168 .set(CustomerDevelopPlan::getCustomerId, vo.getCustomerId()) 209 .set(CustomerDevelopPlan::getCustomerId, vo.getCustomerId())
169 .set(CustomerDevelopPlan::getWorkshopId, StringUtil.isBlank(vo.getWorkshopId()) ? null : vo.getWorkshopId()) 210 .set(CustomerDevelopPlan::getWorkshopId, StringUtil.isBlank(vo.getWorkshopId()) ? null : vo.getWorkshopId())
170 .set(CustomerDevelopPlan::getOfficeId, StringUtil.isBlank(vo.getOfficeId()) ? null : vo.getOfficeId()) 211 .set(CustomerDevelopPlan::getOfficeId, StringUtil.isBlank(vo.getOfficeId()) ? null : vo.getOfficeId())
171 - .set(CustomerDevelopPlan::getCustomerTypeId, StringUtil.isBlank(vo.getCustomerTypeId()) ? null : vo.getCustomerTypeId()) 212 + .set(CustomerDevelopPlan::getCustomerType, StringUtil.isBlank(vo.getCustomerType()) ? null : vo.getCustomerType())
172 .set(CustomerDevelopPlan::getProductVarietyId, StringUtil.isBlank(vo.getProductVarietyId()) ? null : vo.getProductVarietyId()) 213 .set(CustomerDevelopPlan::getProductVarietyId, StringUtil.isBlank(vo.getProductVarietyId()) ? null : vo.getProductVarietyId())
173 .set(CustomerDevelopPlan::getMonthlyUsage, vo.getMonthlyUsage() == null ? null : vo.getMonthlyUsage()) 214 .set(CustomerDevelopPlan::getMonthlyUsage, vo.getMonthlyUsage() == null ? null : vo.getMonthlyUsage())
174 .set(CustomerDevelopPlan::getTargetQuantity, vo.getTargetQuantity() == null ? null : vo.getTargetQuantity()) 215 .set(CustomerDevelopPlan::getTargetQuantity, vo.getTargetQuantity() == null ? null : vo.getTargetQuantity())
@@ -209,4 +250,30 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe @@ -209,4 +250,30 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
209 .eq(CustomerDevelopPlan::getId, id); 250 .eq(CustomerDevelopPlan::getId, id);
210 getBaseMapper().update(updateWrapper); 251 getBaseMapper().update(updateWrapper);
211 } 252 }
  253 +
  254 +
  255 + /**
  256 + * 发起流程实例
  257 + *
  258 + * @param processCode 流程code
  259 + * @param businessId 业务ID
  260 + * @return Instance
  261 + */
  262 + public Instance startCustomerDevelopInstance(String processCode, String businessId) {
  263 + if (this.getById(businessId) != null) {
  264 + throw new DefaultClientException("客户开发已办理完成,无法重新发起!");
  265 + }
  266 + FlowParams flowParams = new FlowParams();
  267 + flowParams.flowCode(processCode);
  268 +
  269 + FlowInstanceExtDto ext = new FlowInstanceExtDto();
  270 + ext.setBizType(FlowDefinitionExtBizType.SYSTEM.getCode());
  271 + ext.setBizFlag(BPM_FLAG);
  272 + flowParams.ext(JsonUtil.toJsonString(ext));
  273 + // 需要传入表单变量
  274 + GetCustomerDevelopPlanBo detail = new GetCustomerDevelopPlanBo(this.findById(businessId));
  275 + flowParams.variable(JsonUtil.parseMap(JsonUtil.toJsonString(detail), String.class, Object.class));
  276 +
  277 + return insService.start(businessId, flowParams);
  278 + }
212 } 279 }
@@ -38,11 +38,11 @@ public class CreateCustomerDevelopPlanVo implements BaseVo, Serializable { @@ -38,11 +38,11 @@ public class CreateCustomerDevelopPlanVo implements BaseVo, Serializable {
38 private String officeId; 38 private String officeId;
39 39
40 /** 40 /**
41 - * 客户类型ID 41 + * 客户类型
42 */ 42 */
43 - @ApiModelProperty("客户类型ID")  
44 - @Length(message = "客户类型ID最多允许32个字符!")  
45 - private String customerTypeId; 43 + @ApiModelProperty("客户类型")
  44 + @Length(message = "客户类型最多允许20个字符!")
  45 + private String customerType;
46 46
47 /** 47 /**
48 * 产品品种ID 48 * 产品品种ID
@@ -19,6 +19,12 @@ public class QueryCustomerDevelopPlanVo extends SortPageVo implements BaseVo, Se @@ -19,6 +19,12 @@ public class QueryCustomerDevelopPlanVo extends SortPageVo implements BaseVo, Se
19 19
20 20
21 /** 21 /**
  22 + * ID集合
  23 + */
  24 + @ApiModelProperty("ID集合")
  25 + private List<String> ids;
  26 +
  27 + /**
22 * 客户ID 28 * 客户ID
23 */ 29 */
24 @ApiModelProperty("客户ID") 30 @ApiModelProperty("客户ID")
@@ -45,11 +45,11 @@ public class UpdateCustomerDevelopPlanVo implements BaseVo, Serializable { @@ -45,11 +45,11 @@ public class UpdateCustomerDevelopPlanVo implements BaseVo, Serializable {
45 private String officeId; 45 private String officeId;
46 46
47 /** 47 /**
48 - * 客户类型ID 48 + * 客户类型
49 */ 49 */
50 - @ApiModelProperty("客户类型ID")  
51 - @Length(message = "客户类型ID最多允许32个字符!")  
52 - private String customerTypeId; 50 + @ApiModelProperty("客户类型")
  51 + @Length(message = "客户类型最多允许20个字符!")
  52 + private String customerType;
53 53
54 /** 54 /**
55 * 产品品种ID 55 * 产品品种ID
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <result column="customer_id" property="customerId"/> 7 <result column="customer_id" property="customerId"/>
8 <result column="workshop_id" property="workshopId"/> 8 <result column="workshop_id" property="workshopId"/>
9 <result column="office_id" property="officeId"/> 9 <result column="office_id" property="officeId"/>
10 - <result column="customer_type_id" property="customerTypeId"/> 10 + <result column="customer_type" property="customerType"/>
11 <result column="product_variety_id" property="productVarietyId"/> 11 <result column="product_variety_id" property="productVarietyId"/>
12 <result column="monthly_usage" property="monthlyUsage"/> 12 <result column="monthly_usage" property="monthlyUsage"/>
13 <result column="target_quantity" property="targetQuantity"/> 13 <result column="target_quantity" property="targetQuantity"/>
@@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
22 <result column="settle_days" property="settleDays"/> 22 <result column="settle_days" property="settleDays"/>
23 <result column="charge_user_id" property="chargeUserId"/> 23 <result column="charge_user_id" property="chargeUserId"/>
24 <result column="status" property="status"/> 24 <result column="status" property="status"/>
  25 + <result column="flow_instance_id" property="flowInstanceId"/>
25 <result column="create_by_id" property="createById"/> 26 <result column="create_by_id" property="createById"/>
26 <result column="create_by" property="createBy"/> 27 <result column="create_by" property="createBy"/>
27 <result column="update_by_id" property="updateById"/> 28 <result column="update_by_id" property="updateById"/>
@@ -35,7 +36,7 @@ @@ -35,7 +36,7 @@
35 tb.customer_id, 36 tb.customer_id,
36 tb.workshop_id, 37 tb.workshop_id,
37 tb.office_id, 38 tb.office_id,
38 - tb.customer_type_id, 39 + tb.customer_type,
39 tb.product_variety_id, 40 tb.product_variety_id,
40 tb.monthly_usage, 41 tb.monthly_usage,
41 tb.target_quantity, 42 tb.target_quantity,
@@ -50,6 +51,7 @@ @@ -50,6 +51,7 @@
50 tb.settle_days, 51 tb.settle_days,
51 tb.charge_user_id, 52 tb.charge_user_id,
52 tb.status, 53 tb.status,
  54 + tb.flow_instance_id,
53 tb.create_by_id, 55 tb.create_by_id,
54 tb.create_by, 56 tb.create_by,
55 tb.update_by_id, 57 tb.update_by_id,
@@ -66,6 +68,12 @@ @@ -66,6 +68,12 @@
66 LEFT JOIN base_data_workshop w ON tb.workshop_id = w.id 68 LEFT JOIN base_data_workshop w ON tb.workshop_id = w.id
67 </if> 69 </if>
68 <where> 70 <where>
  71 + <if test="vo.ids != null and vo.ids.size() > 0">
  72 + AND tb.id in
  73 + <foreach collection="vo.ids" open="(" separator="," close=")" item="id">
  74 + #{id}
  75 + </foreach>
  76 + </if>
69 <if test="vo.customerId != null and vo.customerId != ''"> 77 <if test="vo.customerId != null and vo.customerId != ''">
70 AND tb.customer_id = #{vo.customerId} 78 AND tb.customer_id = #{vo.customerId}
71 </if> 79 </if>