Commit a81244c6c2899586292166c5cdd4785926671bd8

Authored by 房远帅
1 parent 1281fb2e

楚江ERP:客户资信-历史记录优化,变更记录审核通过后再更新数据

1 1 package com.lframework.xingyun.sc.controller.customer;
2 2
  3 +import com.fasterxml.jackson.core.JsonProcessingException;
  4 +import com.fasterxml.jackson.databind.ObjectMapper;
3 5 import com.lframework.starter.web.core.annotations.security.HasPermission;
  6 +import com.lframework.starter.web.core.components.redis.RedisHandler;
4 7 import com.lframework.starter.web.core.controller.DefaultBaseController;
5 8 import com.lframework.starter.web.core.utils.PageResultUtil;
6 9 import com.lframework.starter.web.core.components.resp.PageResult;
... ... @@ -17,12 +20,14 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService;
17 20 import com.lframework.xingyun.sc.vo.customer.credit.CreateCustomerCreditHistoryVo;
18 21 import com.lframework.xingyun.sc.vo.customer.credit.QueryCorePersonnelHistoryVo;
19 22 import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditHistoryVo;
  23 +import com.lframework.xingyun.sc.vo.customer.credit.UpdateCustomerCreditVo;
20 24 import io.swagger.annotations.ApiImplicitParam;
21 25 import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
22 26 import com.lframework.starter.common.exceptions.impl.DefaultClientException;
23 27 import io.swagger.annotations.ApiOperation;
24 28 import com.lframework.starter.common.utils.CollectionUtil;
25 29 import io.swagger.annotations.Api;
  30 +import org.springframework.beans.factory.annotation.Autowired;
26 31 import org.springframework.web.bind.annotation.DeleteMapping;
27 32 import org.springframework.validation.annotation.Validated;
28 33 import org.springframework.web.bind.annotation.*;
... ... @@ -47,6 +52,8 @@ public class CustomerCreditHistoryController extends DefaultBaseController {
47 52 private CustomerCreditHistoryService customerCreditHistoryService;
48 53 @Resource
49 54 private CorePersonnelHistoryService corePersonnelHistoryService;
  55 + @Autowired
  56 + private RedisHandler redisHandler;
50 57
51 58 /**
52 59 * 查询列表
... ... @@ -80,6 +87,59 @@ public class CustomerCreditHistoryController extends DefaultBaseController {
80 87
81 88 List<GetCustomerCreditHistoryBo> results = null;
82 89
  90 + ObjectMapper objectMapper = new ObjectMapper();
  91 + Object o = redisHandler.get(vo.getCreditId());
  92 + UpdateCustomerCreditVo updateCustomerCreditVo = null;
  93 + if (o != null) {
  94 + String jsonString = o.toString();
  95 + try {
  96 + // 2. 反序列化为 UpdateCustomerCreditVo 对象
  97 + updateCustomerCreditVo = objectMapper.readValue(jsonString, UpdateCustomerCreditVo.class);
  98 + } catch (JsonProcessingException e) {
  99 + e.printStackTrace(); // 或使用日志
  100 + throw new RuntimeException("JSON 反序列化失败", e);
  101 + }
  102 + }
  103 +
  104 + if (!CollectionUtil.isEmpty(query)) {
  105 + results = query.stream().map(GetCustomerCreditHistoryBo::new).collect(Collectors.toList());
  106 + }
  107 + if (!CollectionUtil.isEmpty(results)) {
  108 + Iterator<GetCustomerCreditHistoryBo> iterator = results.iterator();
  109 + while (iterator.hasNext()) {
  110 + GetCustomerCreditHistoryBo bo = iterator.next();
  111 + // 条件移除
  112 + if (updateCustomerCreditVo != null
  113 + && updateCustomerCreditVo.getCreditHistoryId() != null
  114 + && updateCustomerCreditVo.getCreditHistoryId().equals(bo.getId())) {
  115 + iterator.remove(); // 安全删除
  116 + continue; // 跳过后续处理
  117 + }
  118 +
  119 + String sort = bo.getSort();
  120 + LocalDateTime createTime = bo.getCreateTime();
  121 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
  122 + String newDate = createTime.format(formatter);
  123 + String title = "第" + sort + "次变更,变更时间:" + newDate;
  124 + bo.setTitle(title);
  125 + }
  126 + }
  127 +
  128 + return InvokeResultBuilder.success(results);
  129 + }
  130 +
  131 + /**
  132 + * 查询列表
  133 + */
  134 + @ApiOperation("查询列表")
  135 + @HasPermission({"customerCreditHistory:customercredithistory:query"})
  136 + @GetMapping("/examineCustomerCreditHistoryList")
  137 + public InvokeResult<List<GetCustomerCreditHistoryBo>> examineCustomerCreditHistoryList(@Valid QueryCustomerCreditHistoryVo vo) {
  138 + vo.setType("PART");
  139 + List<CustomerCreditHistory> query = customerCreditHistoryService.query(vo);
  140 +
  141 + List<GetCustomerCreditHistoryBo> results = null;
  142 +
83 143 if (!CollectionUtil.isEmpty(query)) {
84 144 results = query.stream().map(GetCustomerCreditHistoryBo::new).collect(Collectors.toList());
85 145 }
... ...
1 1 package com.lframework.xingyun.sc.handlers;
2 2
  3 +import com.fasterxml.jackson.core.JsonProcessingException;
  4 +import com.fasterxml.jackson.databind.ObjectMapper;
3 5 import com.lframework.starter.bpm.dto.FlowInstanceExtDto;
4 6 import com.lframework.starter.bpm.enums.FlowInstanceStatus;
5 7 import com.lframework.starter.bpm.service.BusinessDataHandlerService;
  8 +import com.lframework.starter.web.core.components.redis.RedisHandler;
6 9 import com.lframework.starter.web.core.utils.JsonUtil;
  10 +import com.lframework.xingyun.sc.entity.CorePersonnelHistory;
7 11 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
  12 +import com.lframework.xingyun.sc.service.customer.CorePersonnelHistoryService;
  13 +import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService;
8 14 import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
9 15 import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService;
  16 +import com.lframework.xingyun.sc.vo.customer.credit.QueryCorePersonnelHistoryVo;
  17 +import com.lframework.xingyun.sc.vo.customer.credit.UpdateCustomerCreditVo;
10 18 import lombok.extern.slf4j.Slf4j;
  19 +import org.apache.commons.collections.CollectionUtils;
11 20 import org.apache.commons.collections4.MapUtils;
12 21 import org.apache.commons.lang3.StringUtils;
13 22 import org.dromara.warm.flow.core.entity.Instance;
14 23 import org.dromara.warm.flow.core.listener.ListenerVariable;
  24 +import org.springframework.beans.factory.annotation.Autowired;
15 25 import org.springframework.stereotype.Component;
16 26
17 27 import javax.annotation.Resource;
  28 +import java.util.ArrayList;
  29 +import java.util.List;
18 30 import java.util.Map;
19 31
20 32 @Component
... ... @@ -26,6 +38,12 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
26 38 private CustomerDevelopPlanService customerDevelopPlanService;
27 39 @Resource
28 40 private CustomerCreditService customerCreditService;
  41 + @Resource
  42 + private CustomerCreditHistoryService customerCreditHistoryService;
  43 + @Resource
  44 + private CorePersonnelHistoryService corePersonnelHistoryService;
  45 + @Autowired
  46 + private RedisHandler redisHandler;
29 47
30 48
31 49 /**
... ... @@ -91,9 +109,59 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
91 109 * @param businessId 业务ID
92 110 */
93 111 private void handleCustomerCreditData(String flowStatus, String businessId) {
  112 + ObjectMapper objectMapper = new ObjectMapper();
  113 + Object o = redisHandler.get(businessId);
  114 + UpdateCustomerCreditVo vo = null;
  115 + if (o != null) {
  116 + String jsonString = o.toString();
  117 + try {
  118 + // 2. 反序列化为 UpdateCustomerCreditVo 对象
  119 + vo = objectMapper.readValue(jsonString, UpdateCustomerCreditVo.class);
  120 + } catch (JsonProcessingException e) {
  121 + e.printStackTrace(); // 或使用日志
  122 + throw new RuntimeException("JSON 反序列化失败", e);
  123 + }
  124 + }
94 125 if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus)) {
95   - customerCreditService.updateStatus(businessId, "PASS");
  126 + //变更通过,更新数据
  127 + if (vo != null) {
  128 + vo.setStatus("PASS");
  129 + customerCreditService.updateNoFlowInstance(vo);
  130 + //清除缓存
  131 + redisHandler.del(businessId);
  132 + } else {
  133 + //非变更审核
  134 + customerCreditService.updateStatus(businessId, "PASS");
  135 + }
96 136 } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus)) {
  137 + //变更拒绝,回退历史记录数据
  138 + if (vo != null) {
  139 + String creditHistoryId = vo.getCreditHistoryId();
  140 + //删除资信历史记录
  141 + customerCreditHistoryService.deleteById(creditHistoryId);
  142 + customerCreditHistoryService.deleteById(creditHistoryId + "_01");
  143 + //删除核心人员历史记录
  144 + QueryCorePersonnelHistoryVo personnelHistoryVo = new QueryCorePersonnelHistoryVo();
  145 + personnelHistoryVo.setCreditHistoryId(creditHistoryId);
  146 + List<CorePersonnelHistory> query = corePersonnelHistoryService.query(personnelHistoryVo);
  147 + QueryCorePersonnelHistoryVo personnelHistoryVo1 = new QueryCorePersonnelHistoryVo();
  148 + personnelHistoryVo1.setCreditHistoryId(creditHistoryId + "_01");
  149 + List<CorePersonnelHistory> query1 = corePersonnelHistoryService.query(personnelHistoryVo1);
  150 + List<CorePersonnelHistory> combinedList = new ArrayList<>();
  151 + if (CollectionUtils.isNotEmpty(query)) {
  152 + combinedList.addAll(query);
  153 + }
  154 + if (CollectionUtils.isNotEmpty(query1)) {
  155 + combinedList.addAll(query1);
  156 + }
  157 + if (CollectionUtils.isNotEmpty(combinedList)) {
  158 + for (CorePersonnelHistory corePersonnelHistory : combinedList) {
  159 + corePersonnelHistoryService.deleteById(corePersonnelHistory.getId());
  160 + }
  161 + }
  162 + //清除缓存
  163 + redisHandler.del(businessId);
  164 + }
97 165 customerCreditService.updateStatus(businessId, "REFUSE");
98 166 }
99 167 }
... ...
... ... @@ -63,7 +63,11 @@ public class CorePersonnelServiceImpl extends BaseMpServiceImpl<CorePersonnelMap
63 63 public String create(CreateCorePersonnelVo vo) {
64 64
65 65 CorePersonnel data = new CorePersonnel();
66   - data.setId(IdUtil.getId());
  66 + if (!StringUtil.isBlank(vo.getId())) {
  67 + data.setId(vo.getId());
  68 + } else {
  69 + data.setId(IdUtil.getId());
  70 + }
67 71 data.setCreditId(vo.getCreditId());
68 72 if (!StringUtil.isBlank(vo.getPersonId())) {
69 73 data.setPersonId(vo.getPersonId());
... ...
... ... @@ -2,9 +2,12 @@ package com.lframework.xingyun.sc.impl.customer;
2 2
3 3 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.fasterxml.jackson.core.JsonProcessingException;
  6 +import com.fasterxml.jackson.databind.ObjectMapper;
5 7 import com.github.pagehelper.PageInfo;
6 8 import com.lframework.starter.bpm.service.FlowDefinitionWrapperService;
7 9 import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
  10 +import com.lframework.starter.web.core.components.redis.RedisHandler;
8 11 import com.lframework.starter.web.core.components.security.SecurityUtil;
9 12 import com.lframework.starter.web.core.utils.*;
10 13 import com.lframework.starter.web.inner.bo.system.user.GetSysUserBo;
... ... @@ -13,12 +16,13 @@ import com.lframework.starter.web.inner.entity.SysUser;
13 16 import com.lframework.starter.web.inner.service.system.SysDeptService;
14 17 import com.lframework.starter.web.inner.service.system.SysUserService;
15 18 import com.lframework.starter.web.inner.vo.system.user.QuerySysUserVo;
  19 +import com.lframework.xingyun.sc.bo.customer.credit.GetCustomerCreditBo;
16 20 import com.lframework.xingyun.sc.entity.CorePersonnel;
17 21 import com.lframework.xingyun.sc.entity.CustomerCredit;
18 22 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
19 23 import com.lframework.starter.web.core.components.resp.PageResult;
20 24 import com.lframework.starter.common.utils.StringUtil;
21   -import java.io.Serializable;
  25 +import java.io.*;
22 26 import com.lframework.starter.common.exceptions.impl.DefaultClientException;
23 27 import com.lframework.starter.common.utils.ObjectUtil;
24 28 import com.lframework.starter.web.core.annotations.oplog.OpLog;
... ... @@ -31,8 +35,13 @@ import com.lframework.xingyun.sc.service.customer.CorePersonnelService;
31 35 import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService;
32 36 import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
33 37 import com.lframework.xingyun.sc.vo.customer.credit.*;
  38 +import freemarker.template.Configuration;
  39 +import freemarker.template.Template;
  40 +import freemarker.template.TemplateException;
  41 +import freemarker.template.TemplateExceptionHandler;
34 42 import org.apache.commons.collections.CollectionUtils;
35 43 import org.apache.commons.lang3.StringUtils;
  44 +import org.springframework.beans.factory.annotation.Autowired;
36 45 import org.springframework.cache.annotation.CacheEvict;
37 46 import org.springframework.cache.annotation.Cacheable;
38 47 import org.springframework.stereotype.Service;
... ... @@ -40,12 +49,16 @@ import org.springframework.transaction.annotation.Transactional;
40 49 import net.sourceforge.pinyin4j.PinyinHelper;
41 50
42 51 import javax.annotation.Resource;
43   -import java.util.HashSet;
44   -import java.util.List;
45   -import java.util.Map;
46   -import java.util.Set;
  52 +import java.nio.charset.StandardCharsets;
  53 +import java.nio.file.Files;
  54 +import java.nio.file.Path;
  55 +import java.nio.file.Paths;
  56 +import java.util.*;
47 57 import java.util.stream.Collectors;
48 58 import java.util.stream.IntStream;
  59 +import java.util.zip.ZipEntry;
  60 +import java.util.zip.ZipInputStream;
  61 +import java.util.zip.ZipOutputStream;
49 62
50 63 @Service
51 64 public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditMapper, CustomerCredit> implements CustomerCreditService {
... ... @@ -67,6 +80,8 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
67 80 private FlowDefinitionWrapperService flowDefinitionWrapperService;
68 81 @Resource
69 82 private FlowInstanceWrapperService flowInstanceWrapperService;
  83 + @Autowired
  84 + private RedisHandler redisHandler;
70 85
71 86 @Override
72 87 public PageResult<CustomerCredit> query(Integer pageIndex, Integer pageSize, QueryCustomerCreditVo vo) {
... ... @@ -463,6 +478,7 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
463 478 historyVo.setCertificationCertificate(data.getCertificationCertificate());
464 479 }
465 480 historyId = customerCreditHistoryService.create(historyVo);
  481 + vo.setCreditHistoryId(historyId);
466 482 if (CollectionUtils.isNotEmpty(corePersonnelList)) {
467 483 for (CorePersonnel corePersonnel : corePersonnelList) {
468 484 CreateCorePersonnelHistoryVo personnelHistoryVo = new CreateCorePersonnelHistoryVo();
... ... @@ -499,8 +515,380 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
499 515 corePersonnelHistoryService.create(personnelHistoryVo);
500 516 }
501 517 }
  518 +
  519 + //保存变更后的数据
  520 + CreateCustomerCreditHistoryVo historyVo1 = new CreateCustomerCreditHistoryVo();
  521 + historyVo1.setId(historyId + "_01");
  522 + historyVo1.setCreditId(data.getId());
  523 + historyVo1.setSort(sort);
  524 + historyVo1.setSerialNumber(data.getSerialNumber());
  525 + if (!StringUtil.isBlank(vo.getRegion())) {
  526 + historyVo1.setRegion(vo.getRegion());
  527 + }
  528 + if (vo.getRegisterDate() != null) {
  529 + historyVo1.setRegisterDate(vo.getRegisterDate());
  530 + }
  531 + if (!StringUtil.isBlank(vo.getCustomerShortName())) {
  532 + historyVo1.setCustomerShortName(vo.getCustomerShortName());
  533 + }
  534 + if (!StringUtil.isBlank(vo.getEnterpriseType())) {
  535 + historyVo1.setEnterpriseType(vo.getEnterpriseType());
  536 + }
  537 + if (!StringUtil.isBlank(vo.getCompanyId())) {
  538 + historyVo1.setCompanyId(vo.getCompanyId());
  539 + }
  540 + if (!StringUtil.isBlank(vo.getCompanyNature())) {
  541 + historyVo1.setCompanyNature(vo.getCompanyNature());
  542 + }
  543 + if (!StringUtil.isBlank(vo.getCompanyAddress())) {
  544 + historyVo1.setCompanyAddress(vo.getCompanyAddress());
  545 + }
  546 + if (vo.getRegisteredCapital() != null) {
  547 + historyVo1.setRegisteredCapital(vo.getRegisteredCapital());
  548 + }
  549 + if (!StringUtil.isBlank(vo.getBankAccount())) {
  550 + historyVo1.setBankAccount(vo.getBankAccount());
  551 + }
  552 + if (!StringUtil.isBlank(vo.getBankName())) {
  553 + historyVo1.setBankName(vo.getBankName());
  554 + }
  555 + if (!StringUtil.isBlank(vo.getTaxNumber())) {
  556 + historyVo1.setTaxNumber(vo.getTaxNumber());
  557 + }
  558 + if (vo.getRegistrationTime() != null) {
  559 + historyVo1.setRegistrationTime(vo.getRegistrationTime());
  560 + }
  561 + if (!StringUtil.isBlank(vo.getBusinessYears())) {
  562 + historyVo1.setBusinessYears(vo.getBusinessYears());
  563 + }
  564 + if (!StringUtil.isBlank(vo.getBusinessScope())) {
  565 + historyVo1.setBusinessScope(vo.getBusinessScope());
  566 + }
  567 + if (!StringUtil.isBlank(vo.getBusinessProperty())) {
  568 + historyVo1.setBusinessProperty(vo.getBusinessProperty());
  569 + }
  570 + if (!StringUtil.isBlank(vo.getLandArea())) {
  571 + historyVo1.setLandArea(vo.getLandArea());
  572 + }
  573 + if (!StringUtil.isBlank(vo.getStorageConditions())) {
  574 + historyVo1.setStorageConditions(vo.getStorageConditions());
  575 + }
  576 + if (vo.getEmployeeCount() != null) {
  577 + historyVo1.setEmployeeCount(vo.getEmployeeCount());
  578 + }
  579 + if (!StringUtil.isBlank(vo.getEquipmentAttributes())) {
  580 + historyVo1.setEquipmentAttributes(vo.getEquipmentAttributes());
  581 + }
  582 + if (!StringUtil.isBlank(vo.getAssetEvaluation())) {
  583 + historyVo1.setAssetEvaluation(vo.getAssetEvaluation());
  584 + }
  585 + if (!StringUtil.isBlank(vo.getLastYearSales())) {
  586 + historyVo1.setLastYearSales(vo.getLastYearSales());
  587 + }
  588 + if (!StringUtil.isBlank(vo.getMonthlyAvgSales())) {
  589 + historyVo1.setMonthlyAvgSales(vo.getMonthlyAvgSales());
  590 + }
  591 + if (!StringUtil.isBlank(vo.getInvoiceItemUnit())) {
  592 + historyVo1.setInvoiceItemUnit(vo.getInvoiceItemUnit());
  593 + }
  594 + if (!StringUtil.isBlank(vo.getProductMatch())) {
  595 + historyVo1.setProductMatch(vo.getProductMatch());
  596 + }
  597 + if (!StringUtil.isBlank(vo.getMajorCustomers())) {
  598 + historyVo1.setMajorCustomers(vo.getMajorCustomers());
  599 + }
  600 + if (!StringUtil.isBlank(vo.getMainProjects())) {
  601 + historyVo1.setMainProjects(vo.getMainProjects());
  602 + }
  603 + if (!StringUtil.isBlank(vo.getIndustryInvolved())) {
  604 + historyVo1.setIndustryInvolved(vo.getIndustryInvolved());
  605 + }
  606 + if (!StringUtil.isBlank(vo.getIndustryExperience())) {
  607 + historyVo1.setIndustryExperience(vo.getIndustryExperience());
  608 + }
  609 + if (!StringUtil.isBlank(vo.getHasDispute())) {
  610 + historyVo1.setHasDispute(vo.getHasDispute());
  611 + }
  612 + if (!StringUtil.isBlank(vo.getCooperationStartDate())) {
  613 + historyVo1.setCooperationStartDate(vo.getCooperationStartDate());
  614 + }
  615 + if (!StringUtil.isBlank(vo.getMonthlyAvgVolume())) {
  616 + historyVo1.setMonthlyAvgVolume(vo.getMonthlyAvgVolume());
  617 + }
  618 + if (!StringUtil.isBlank(vo.getIsVerbalAgreement())) {
  619 + historyVo1.setIsVerbalAgreement(vo.getIsVerbalAgreement());
  620 + }
  621 + if (!StringUtil.isBlank(vo.getOtherAgreements())) {
  622 + historyVo1.setOtherAgreements(vo.getOtherAgreements());
  623 + }
  624 + if (!StringUtil.isBlank(vo.getHasLongTermContract())) {
  625 + historyVo1.setHasLongTermContract(vo.getHasLongTermContract());
  626 + }
  627 + if (!StringUtil.isBlank(vo.getContractType())) {
  628 + historyVo1.setContractType(vo.getContractType());
  629 + }
  630 + if (!StringUtil.isBlank(vo.getHasInterruption())) {
  631 + historyVo1.setHasInterruption(vo.getHasInterruption());
  632 + }
  633 + if (!StringUtil.isBlank(vo.getSettlementPeriod())) {
  634 + historyVo1.setSettlementPeriod(vo.getSettlementPeriod());
  635 + }
  636 + if (!StringUtil.isBlank(vo.getMaterialSupplyPlan())) {
  637 + historyVo1.setMaterialSupplyPlan(vo.getMaterialSupplyPlan());
  638 + }
  639 + if (!StringUtil.isBlank(vo.getSuggestedCategory())) {
  640 + historyVo1.setSuggestedCategory(vo.getSuggestedCategory());
  641 + }
  642 + if (!StringUtil.isBlank(vo.getCreditLimit())) {
  643 + historyVo1.setCreditLimit(vo.getCreditLimit());
  644 + }
  645 + if (!StringUtil.isBlank(vo.getInvestigator())) {
  646 + historyVo1.setInvestigator(vo.getInvestigator());
  647 + }
  648 + if (!StringUtil.isBlank(vo.getSupervisorReview())) {
  649 + historyVo1.setSupervisorReview(vo.getSupervisorReview());
  650 + }
  651 + if (!StringUtil.isBlank(vo.getAnnualTotalSales())) {
  652 + historyVo1.setAnnualTotalSales(vo.getAnnualTotalSales());
  653 + }
  654 + if (!StringUtil.isBlank(vo.getMainIndustry())) {
  655 + historyVo1.setMainIndustry(vo.getMainIndustry());
  656 + }
  657 + if (!StringUtil.isBlank(vo.getAnnualMaterialOverview())) {
  658 + historyVo1.setAnnualMaterialOverview(vo.getAnnualMaterialOverview());
  659 + }
  660 + if (!StringUtil.isBlank(vo.getCompanySettlementPeriod())) {
  661 + historyVo1.setCompanySettlementPeriod(vo.getCompanySettlementPeriod());
  662 + }
  663 + if (!StringUtil.isBlank(vo.getCompanyCreditLimit())) {
  664 + historyVo1.setCompanyCreditLimit(vo.getCompanyCreditLimit());
  665 + }
  666 + if (!StringUtil.isBlank(vo.getCompanyMaterialSupplyPlan())) {
  667 + historyVo1.setCompanyMaterialSupplyPlan(vo.getCompanyMaterialSupplyPlan());
  668 + }
  669 + if (!StringUtil.isBlank(vo.getCompanySuggestedCategory())) {
  670 + historyVo1.setCompanySuggestedCategory(vo.getCompanySuggestedCategory());
  671 + }
  672 + if (!StringUtil.isBlank(vo.getStatus())) {
  673 + historyVo1.setStatus(vo.getStatus());
  674 + }
  675 + if (!StringUtil.isBlank(vo.getCertificationCertificate())) {
  676 + historyVo1.setCertificationCertificate(vo.getCertificationCertificate());
  677 + }
  678 + String historyId1 = customerCreditHistoryService.create(historyVo1);
  679 + //变更后的核心人员
  680 + List<UpdateCorePersonnelVo> corePersonnelList1 = vo.getCorePersonnelList();
  681 + if (CollectionUtils.isNotEmpty(corePersonnelList1)) {
  682 + for (UpdateCorePersonnelVo updateCorePersonnelVo : corePersonnelList1) {
  683 + CreateCorePersonnelHistoryVo personnelHistoryVo = new CreateCorePersonnelHistoryVo();
  684 + if (StringUtil.isBlank(updateCorePersonnelVo.getId())) {
  685 + String id = IdUtil.getId();
  686 + personnelHistoryVo.setPersonnelId(id);
  687 + updateCorePersonnelVo.setId(id);
  688 + } else {
  689 + personnelHistoryVo.setPersonnelId(updateCorePersonnelVo.getId());
  690 + }
  691 + personnelHistoryVo.setCreditHistoryId(historyId1);
  692 + personnelHistoryVo.setName(updateCorePersonnelVo.getName());
  693 + if (!StringUtil.isBlank(updateCorePersonnelVo.getSex())) {
  694 + personnelHistoryVo.setSex(updateCorePersonnelVo.getSex());
  695 + }
  696 + if (!StringUtil.isBlank(updateCorePersonnelVo.getNativePlace())) {
  697 + personnelHistoryVo.setNativePlace(updateCorePersonnelVo.getNativePlace());
  698 + }
  699 + if (!StringUtil.isBlank(updateCorePersonnelVo.getAge())) {
  700 + personnelHistoryVo.setAge(updateCorePersonnelVo.getAge());
  701 + }
  702 + if (!StringUtil.isBlank(updateCorePersonnelVo.getPosition())) {
  703 + personnelHistoryVo.setPosition(updateCorePersonnelVo.getPosition());
  704 + }
  705 + if (!StringUtil.isBlank(updateCorePersonnelVo.getMobile())) {
  706 + personnelHistoryVo.setMobile(updateCorePersonnelVo.getMobile());
  707 + }
  708 + if (!StringUtil.isBlank(updateCorePersonnelVo.getPhone())) {
  709 + personnelHistoryVo.setPhone(updateCorePersonnelVo.getPhone());
  710 + }
  711 + if (!StringUtil.isBlank(updateCorePersonnelVo.getEmail())) {
  712 + personnelHistoryVo.setEmail(updateCorePersonnelVo.getEmail());
  713 + }
  714 + if (!StringUtil.isBlank(updateCorePersonnelVo.getAddress())) {
  715 + personnelHistoryVo.setAddress(updateCorePersonnelVo.getAddress());
  716 + }
  717 + if (!StringUtil.isBlank(updateCorePersonnelVo.getPersonId())) {
  718 + personnelHistoryVo.setPersonId(updateCorePersonnelVo.getPersonId());
  719 + }
  720 + corePersonnelHistoryService.create(personnelHistoryVo);
  721 + }
  722 + vo.setCorePersonnelList(corePersonnelList1);
  723 + }
  724 + ObjectMapper objectMapper = new ObjectMapper();
  725 + try {
  726 + String jsonString = objectMapper.writeValueAsString(vo);
  727 + redisHandler.set(vo.getId(), jsonString);
  728 + } catch (JsonProcessingException e) {
  729 + e.printStackTrace();
  730 + }
  731 + } else {
  732 + //变更审核通过后再修改入库
  733 + LambdaUpdateWrapper<CustomerCredit> updateWrapper = Wrappers.lambdaUpdate(CustomerCredit.class)
  734 + .set(CustomerCredit::getRegion, StringUtil.isBlank(vo.getRegion()) ? null : vo.getRegion())
  735 + .set(CustomerCredit::getRegisterDate, vo.getRegisterDate() == null ? null : vo.getRegisterDate())
  736 + .set(CustomerCredit::getCustomerShortName, StringUtil.isBlank(vo.getCustomerShortName()) ? null : vo.getCustomerShortName())
  737 + .set(CustomerCredit::getEnterpriseType, vo.getEnterpriseType())
  738 + .set(CustomerCredit::getCompanyId, vo.getCompanyId())
  739 + .set(CustomerCredit::getCompanyNature, StringUtil.isBlank(vo.getCompanyNature()) ? null : vo.getCompanyNature())
  740 + .set(CustomerCredit::getCompanyAddress, StringUtil.isBlank(vo.getCompanyAddress()) ? null : vo.getCompanyAddress())
  741 + .set(CustomerCredit::getRegisteredCapital, vo.getRegisteredCapital() == null ? null : vo.getRegisteredCapital())
  742 + .set(CustomerCredit::getBankAccount, StringUtil.isBlank(vo.getBankAccount()) ? null : vo.getBankAccount())
  743 + .set(CustomerCredit::getBankName, StringUtil.isBlank(vo.getBankName()) ? null : vo.getBankName())
  744 + .set(CustomerCredit::getTaxNumber, StringUtil.isBlank(vo.getTaxNumber()) ? null : vo.getTaxNumber())
  745 + .set(CustomerCredit::getRegistrationTime, vo.getRegistrationTime() == null ? null : vo.getRegistrationTime())
  746 + .set(CustomerCredit::getBusinessYears, StringUtil.isBlank(vo.getBusinessYears()) ? null : vo.getBusinessYears())
  747 + .set(CustomerCredit::getBusinessScope, StringUtil.isBlank(vo.getBusinessScope()) ? null : vo.getBusinessScope())
  748 + .set(CustomerCredit::getBusinessProperty, StringUtil.isBlank(vo.getBusinessProperty()) ? null : vo.getBusinessProperty())
  749 + .set(CustomerCredit::getLandArea, vo.getLandArea() == null ? null : vo.getLandArea())
  750 + .set(CustomerCredit::getStorageConditions, StringUtil.isBlank(vo.getStorageConditions()) ? null : vo.getStorageConditions())
  751 + .set(CustomerCredit::getEmployeeCount, vo.getEmployeeCount() == null ? null : vo.getEmployeeCount())
  752 + .set(CustomerCredit::getEquipmentAttributes, StringUtil.isBlank(vo.getEquipmentAttributes()) ? null : vo.getEquipmentAttributes())
  753 + .set(CustomerCredit::getAssetEvaluation, StringUtil.isBlank(vo.getAssetEvaluation()) ? null : vo.getAssetEvaluation())
  754 + .set(CustomerCredit::getLastYearSales, StringUtil.isBlank(vo.getLastYearSales()) ? null : vo.getLastYearSales())
  755 + .set(CustomerCredit::getMonthlyAvgSales, StringUtil.isBlank(vo.getMonthlyAvgSales()) ? null : vo.getMonthlyAvgSales())
  756 + .set(CustomerCredit::getInvoiceItemUnit, StringUtil.isBlank(vo.getInvoiceItemUnit()) ? null : vo.getInvoiceItemUnit())
  757 + .set(CustomerCredit::getCertificationCertificate, StringUtil.isBlank(vo.getCertificationCertificate()) ? null : vo.getCertificationCertificate())
  758 + .set(CustomerCredit::getProductMatch, StringUtil.isBlank(vo.getProductMatch()) ? null : vo.getProductMatch())
  759 + .set(CustomerCredit::getMajorCustomers, StringUtil.isBlank(vo.getMajorCustomers()) ? null : vo.getMajorCustomers())
  760 + .set(CustomerCredit::getMainProjects, StringUtil.isBlank(vo.getMainProjects()) ? null : vo.getMainProjects())
  761 + .set(CustomerCredit::getIndustryInvolved, StringUtil.isBlank(vo.getIndustryInvolved()) ? null : vo.getIndustryInvolved())
  762 + .set(CustomerCredit::getIndustryExperience, StringUtil.isBlank(vo.getIndustryExperience()) ? null : vo.getIndustryExperience())
  763 + .set(CustomerCredit::getHasDispute, StringUtil.isBlank(vo.getHasDispute()) ? null : vo.getHasDispute())
  764 + .set(CustomerCredit::getCooperationStartDate, StringUtil.isBlank(vo.getCooperationStartDate()) ? null : vo.getCooperationStartDate())
  765 + .set(CustomerCredit::getMonthlyAvgVolume, StringUtil.isBlank(vo.getMonthlyAvgVolume()) ? null : vo.getMonthlyAvgVolume())
  766 + .set(CustomerCredit::getIsVerbalAgreement, StringUtil.isBlank(vo.getIsVerbalAgreement()) ? null : vo.getIsVerbalAgreement())
  767 + .set(CustomerCredit::getOtherAgreements, StringUtil.isBlank(vo.getOtherAgreements()) ? null : vo.getOtherAgreements())
  768 + .set(CustomerCredit::getHasLongTermContract, StringUtil.isBlank(vo.getHasLongTermContract()) ? null : vo.getHasLongTermContract())
  769 + .set(CustomerCredit::getContractType, StringUtil.isBlank(vo.getContractType()) ? null : vo.getContractType())
  770 + .set(CustomerCredit::getHasInterruption, StringUtil.isBlank(vo.getHasInterruption()) ? null : vo.getHasInterruption())
  771 + .set(CustomerCredit::getSettlementPeriod, StringUtil.isBlank(vo.getSettlementPeriod()) ? null : vo.getSettlementPeriod())
  772 + .set(CustomerCredit::getMaterialSupplyPlan, StringUtil.isBlank(vo.getMaterialSupplyPlan()) ? null : vo.getMaterialSupplyPlan())
  773 + .set(CustomerCredit::getSuggestedCategory, vo.getSuggestedCategory())
  774 + .set(CustomerCredit::getCreditLimit, StringUtil.isBlank(vo.getCreditLimit()) ? null : vo.getCreditLimit())
  775 + .set(CustomerCredit::getInvestigator, StringUtil.isBlank(vo.getInvestigator()) ? null : vo.getInvestigator())
  776 + .set(CustomerCredit::getSupervisorReview, StringUtil.isBlank(vo.getSupervisorReview()) ? null : vo.getSupervisorReview())
  777 + .set(CustomerCredit::getAnnualTotalSales, StringUtil.isBlank(vo.getAnnualTotalSales()) ? null : vo.getAnnualTotalSales())
  778 + .set(CustomerCredit::getMainIndustry, StringUtil.isBlank(vo.getMainIndustry()) ? null : vo.getMainIndustry())
  779 + .set(CustomerCredit::getAnnualMaterialOverview, StringUtil.isBlank(vo.getAnnualMaterialOverview()) ? null : vo.getAnnualMaterialOverview())
  780 + .set(CustomerCredit::getCompanySettlementPeriod, StringUtil.isBlank(vo.getCompanySettlementPeriod()) ? null : vo.getCompanySettlementPeriod())
  781 + .set(CustomerCredit::getCompanyCreditLimit, StringUtil.isBlank(vo.getCompanyCreditLimit()) ? null : vo.getCompanyCreditLimit())
  782 + .set(CustomerCredit::getCompanyMaterialSupplyPlan, StringUtil.isBlank(vo.getCompanyMaterialSupplyPlan()) ? null : vo.getCompanyMaterialSupplyPlan())
  783 + .set(CustomerCredit::getCompanySuggestedCategory, vo.getCompanySuggestedCategory())
  784 + .set(CustomerCredit::getStatus, "AUDIT")
  785 + .set(CustomerCredit::getBusinessFileName, StringUtil.isBlank(vo.getBusinessFileName()) ? null : vo.getBusinessFileName())
  786 + .set(CustomerCredit::getBusinessFileId, StringUtil.isBlank(vo.getBusinessFileId()) ? null : vo.getBusinessFileId())
  787 + .set(CustomerCredit::getShareholderFileName, StringUtil.isBlank(vo.getShareholderFileName()) ? null : vo.getShareholderFileName())
  788 + .set(CustomerCredit::getShareholderFileId, StringUtil.isBlank(vo.getShareholderFileId()) ? null : vo.getShareholderFileId())
  789 + .eq(CustomerCredit::getId, vo.getId());
  790 +
  791 + getBaseMapper().update(updateWrapper);
  792 + //更新核心人员
  793 + List<UpdateCorePersonnelVo> corePersonnelListNew = vo.getCorePersonnelList();
  794 + if (CollectionUtils.isNotEmpty(corePersonnelListNew)) {
  795 + Set<String> oldIds = corePersonnelList.stream().map(CorePersonnel::getId).collect(Collectors.toSet());
  796 + Set<String> newIds = corePersonnelListNew.stream().map(UpdateCorePersonnelVo::getId).collect(Collectors.toSet());
  797 + // 计算差异
  798 + Set<String> addedIds = new HashSet<>(newIds);
  799 + addedIds.removeAll(oldIds); // 新增:new 有,old 没有
  800 +
  801 + Set<String> removedIds = new HashSet<>(oldIds);
  802 + removedIds.removeAll(newIds); // 删除:old 有,new 没有
  803 +
  804 + Set<String> unchangedIds = new HashSet<>(oldIds);
  805 + unchangedIds.retainAll(newIds); // 不变:交集
  806 +
  807 + // 如果需要获取对应的实体对象(注意:id 唯一)
  808 + Map<String, CorePersonnel> oldMap = corePersonnelList.stream().collect(Collectors.toMap(CorePersonnel::getId, e -> e));
  809 + Map<String, UpdateCorePersonnelVo> newMap = corePersonnelListNew.stream().collect(Collectors.toMap(UpdateCorePersonnelVo::getId, e -> e));
  810 +
  811 + List<UpdateCorePersonnelVo> added = addedIds.stream().map(newMap::get).collect(Collectors.toList());
  812 + List<CorePersonnel> removed = removedIds.stream().map(oldMap::get).collect(Collectors.toList());
  813 + List<UpdateCorePersonnelVo> updated = unchangedIds.stream().map(newMap::get).collect(Collectors.toList());
  814 + // 输出结果
  815 + System.out.println("新增: " + added);
  816 + System.out.println("删除: " + removed);
  817 + System.out.println("修改: " + updated);
  818 + //新增
  819 + for (UpdateCorePersonnelVo updateCorePersonnelVo : added) {
  820 + CreateCorePersonnelVo createCorePersonnelVo = new CreateCorePersonnelVo();
  821 + if (!StringUtil.isBlank(updateCorePersonnelVo.getId())) {
  822 + createCorePersonnelVo.setId(updateCorePersonnelVo.getId());
  823 + }
  824 + createCorePersonnelVo.setCreditId(vo.getId());
  825 + if (!StringUtil.isBlank(updateCorePersonnelVo.getPersonId())) {
  826 + createCorePersonnelVo.setPersonId(updateCorePersonnelVo.getPersonId());
  827 + }
  828 + if (!StringUtil.isBlank(updateCorePersonnelVo.getName())) {
  829 + createCorePersonnelVo.setName(updateCorePersonnelVo.getName());
  830 + }
  831 + if (!StringUtil.isBlank(updateCorePersonnelVo.getSex())) {
  832 + createCorePersonnelVo.setSex(updateCorePersonnelVo.getSex());
  833 + }
  834 + if (!StringUtil.isBlank(updateCorePersonnelVo.getNativePlace())) {
  835 + createCorePersonnelVo.setNativePlace(updateCorePersonnelVo.getNativePlace());
  836 + }
  837 + if (!StringUtil.isBlank(updateCorePersonnelVo.getAge())) {
  838 + createCorePersonnelVo.setAge(updateCorePersonnelVo.getAge());
  839 + }
  840 + if (!StringUtil.isBlank(updateCorePersonnelVo.getPosition())) {
  841 + createCorePersonnelVo.setPosition(updateCorePersonnelVo.getPosition());
  842 + }
  843 + if (!StringUtil.isBlank(updateCorePersonnelVo.getMobile())) {
  844 + createCorePersonnelVo.setMobile(updateCorePersonnelVo.getMobile());
  845 + }
  846 + if (!StringUtil.isBlank(updateCorePersonnelVo.getPhone())) {
  847 + createCorePersonnelVo.setPhone(updateCorePersonnelVo.getPhone());
  848 + }
  849 + if (!StringUtil.isBlank(updateCorePersonnelVo.getEmail())) {
  850 + createCorePersonnelVo.setEmail(updateCorePersonnelVo.getEmail());
  851 + }
  852 + if (!StringUtil.isBlank(updateCorePersonnelVo.getAddress())) {
  853 + createCorePersonnelVo.setAddress(updateCorePersonnelVo.getAddress());
  854 + }
  855 + corePersonnelService.create(createCorePersonnelVo);
  856 + }
  857 + //删除
  858 + for (CorePersonnel corePersonnel : removed) {
  859 + corePersonnelService.deleteById(corePersonnel.getId());
  860 + }
  861 + //修改
  862 + for (UpdateCorePersonnelVo updateCorePersonnelVo : updated) {
  863 + corePersonnelService.update(updateCorePersonnelVo);
  864 + }
  865 + } else {
  866 + if (CollectionUtils.isNotEmpty(corePersonnelList)) {
  867 + for (CorePersonnel corePersonnel : corePersonnelList) {
  868 + corePersonnelService.deleteById(corePersonnel.getId());
  869 + }
  870 + }
  871 + }
502 872 }
  873 + OpLogUtil.setVariable("id", data.getId());
  874 + OpLogUtil.setExtra(vo);
  875 +
  876 + //开启审核
  877 + flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, vo);
  878 + }
  879 +
  880 + @OpLog(type = OtherOpLogType.class, name = "修改客户资信表不走审核,ID:{}", params = {"#id"})
  881 + @Transactional(rollbackFor = Exception.class)
  882 + @Override
  883 + public void updateNoFlowInstance(UpdateCustomerCreditVo vo) {
503 884
  885 + CustomerCredit data = customerCreditMapper.findById(vo.getId());
  886 + if (ObjectUtil.isNull(data)) {
  887 + throw new DefaultClientException("客户资信表不存在!");
  888 + }
  889 + QueryCorePersonnelVo queryCorePersonnelVo = new QueryCorePersonnelVo();
  890 + queryCorePersonnelVo.setCreditId(data.getId());
  891 + List<CorePersonnel> corePersonnelList = corePersonnelService.query(queryCorePersonnelVo);
504 892 LambdaUpdateWrapper<CustomerCredit> updateWrapper = Wrappers.lambdaUpdate(CustomerCredit.class)
505 893 .set(CustomerCredit::getRegion, StringUtil.isBlank(vo.getRegion()) ? null : vo.getRegion())
506 894 .set(CustomerCredit::getRegisterDate, vo.getRegisterDate() == null ? null : vo.getRegisterDate())
... ... @@ -552,7 +940,7 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
552 940 .set(CustomerCredit::getCompanyCreditLimit, StringUtil.isBlank(vo.getCompanyCreditLimit()) ? null : vo.getCompanyCreditLimit())
553 941 .set(CustomerCredit::getCompanyMaterialSupplyPlan, StringUtil.isBlank(vo.getCompanyMaterialSupplyPlan()) ? null : vo.getCompanyMaterialSupplyPlan())
554 942 .set(CustomerCredit::getCompanySuggestedCategory, vo.getCompanySuggestedCategory())
555   - .set(CustomerCredit::getStatus, "AUDIT")
  943 + .set(CustomerCredit::getStatus, StringUtil.isBlank(vo.getStatus()) ? "AUDIT" : vo.getStatus())
556 944 .set(CustomerCredit::getBusinessFileName, StringUtil.isBlank(vo.getBusinessFileName()) ? null : vo.getBusinessFileName())
557 945 .set(CustomerCredit::getBusinessFileId, StringUtil.isBlank(vo.getBusinessFileId()) ? null : vo.getBusinessFileId())
558 946 .set(CustomerCredit::getShareholderFileName, StringUtil.isBlank(vo.getShareholderFileName()) ? null : vo.getShareholderFileName())
... ... @@ -589,6 +977,9 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
589 977 //新增
590 978 for (UpdateCorePersonnelVo updateCorePersonnelVo : added) {
591 979 CreateCorePersonnelVo createCorePersonnelVo = new CreateCorePersonnelVo();
  980 + if (!StringUtil.isBlank(updateCorePersonnelVo.getId())) {
  981 + createCorePersonnelVo.setId(updateCorePersonnelVo.getId());
  982 + }
592 983 createCorePersonnelVo.setCreditId(vo.getId());
593 984 if (!StringUtil.isBlank(updateCorePersonnelVo.getPersonId())) {
594 985 createCorePersonnelVo.setPersonId(updateCorePersonnelVo.getPersonId());
... ... @@ -637,215 +1028,8 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
637 1028 }
638 1029 }
639 1030 }
640   - //
641   - //再保存一次变更后的数据
642   - if ("CHANGE".equals(type)) {
643   - CustomerCredit customerCredit = customerCreditMapper.findById(vo.getId());
644   - CreateCustomerCreditHistoryVo historyVo1 = new CreateCustomerCreditHistoryVo();
645   - historyVo1.setId(historyId + "_01");
646   - historyVo1.setCreditId(data.getId());
647   - historyVo1.setSort(sort);
648   - historyVo1.setSerialNumber(data.getSerialNumber());
649   - if (!StringUtil.isBlank(customerCredit.getRegion())) {
650   - historyVo1.setRegion(customerCredit.getRegion());
651   - }
652   - if (customerCredit.getRegisterDate() != null) {
653   - historyVo1.setRegisterDate(customerCredit.getRegisterDate());
654   - }
655   - if (!StringUtil.isBlank(customerCredit.getCustomerShortName())) {
656   - historyVo1.setCustomerShortName(customerCredit.getCustomerShortName());
657   - }
658   - if (!StringUtil.isBlank(customerCredit.getEnterpriseType())) {
659   - historyVo1.setEnterpriseType(customerCredit.getEnterpriseType());
660   - }
661   - if (!StringUtil.isBlank(customerCredit.getCompanyId())) {
662   - historyVo1.setCompanyId(customerCredit.getCompanyId());
663   - }
664   - if (!StringUtil.isBlank(customerCredit.getCompanyNature())) {
665   - historyVo1.setCompanyNature(customerCredit.getCompanyNature());
666   - }
667   - if (!StringUtil.isBlank(customerCredit.getCompanyAddress())) {
668   - historyVo1.setCompanyAddress(customerCredit.getCompanyAddress());
669   - }
670   - if (customerCredit.getRegisteredCapital() != null) {
671   - historyVo1.setRegisteredCapital(customerCredit.getRegisteredCapital());
672   - }
673   - if (!StringUtil.isBlank(customerCredit.getBankAccount())) {
674   - historyVo1.setBankAccount(customerCredit.getBankAccount());
675   - }
676   - if (!StringUtil.isBlank(customerCredit.getBankName())) {
677   - historyVo1.setBankName(customerCredit.getBankName());
678   - }
679   - if (!StringUtil.isBlank(customerCredit.getTaxNumber())) {
680   - historyVo1.setTaxNumber(customerCredit.getTaxNumber());
681   - }
682   - if (customerCredit.getRegistrationTime() != null) {
683   - historyVo1.setRegistrationTime(customerCredit.getRegistrationTime());
684   - }
685   - if (!StringUtil.isBlank(customerCredit.getBusinessYears())) {
686   - historyVo1.setBusinessYears(customerCredit.getBusinessYears());
687   - }
688   - if (!StringUtil.isBlank(customerCredit.getBusinessScope())) {
689   - historyVo1.setBusinessScope(customerCredit.getBusinessScope());
690   - }
691   - if (!StringUtil.isBlank(customerCredit.getBusinessProperty())) {
692   - historyVo1.setBusinessProperty(customerCredit.getBusinessProperty());
693   - }
694   - if (!StringUtil.isBlank(customerCredit.getLandArea())) {
695   - historyVo1.setLandArea(customerCredit.getLandArea());
696   - }
697   - if (!StringUtil.isBlank(customerCredit.getStorageConditions())) {
698   - historyVo1.setStorageConditions(customerCredit.getStorageConditions());
699   - }
700   - if (customerCredit.getEmployeeCount() != null) {
701   - historyVo1.setEmployeeCount(customerCredit.getEmployeeCount());
702   - }
703   - if (!StringUtil.isBlank(customerCredit.getEquipmentAttributes())) {
704   - historyVo1.setEquipmentAttributes(customerCredit.getEquipmentAttributes());
705   - }
706   - if (!StringUtil.isBlank(customerCredit.getAssetEvaluation())) {
707   - historyVo1.setAssetEvaluation(customerCredit.getAssetEvaluation());
708   - }
709   - if (!StringUtil.isBlank(customerCredit.getLastYearSales())) {
710   - historyVo1.setLastYearSales(customerCredit.getLastYearSales());
711   - }
712   - if (!StringUtil.isBlank(customerCredit.getMonthlyAvgSales())) {
713   - historyVo1.setMonthlyAvgSales(customerCredit.getMonthlyAvgSales());
714   - }
715   - if (!StringUtil.isBlank(customerCredit.getInvoiceItemUnit())) {
716   - historyVo1.setInvoiceItemUnit(customerCredit.getInvoiceItemUnit());
717   - }
718   - if (!StringUtil.isBlank(customerCredit.getProductMatch())) {
719   - historyVo1.setProductMatch(customerCredit.getProductMatch());
720   - }
721   - if (!StringUtil.isBlank(customerCredit.getMajorCustomers())) {
722   - historyVo1.setMajorCustomers(customerCredit.getMajorCustomers());
723   - }
724   - if (!StringUtil.isBlank(customerCredit.getMainProjects())) {
725   - historyVo1.setMainProjects(customerCredit.getMainProjects());
726   - }
727   - if (!StringUtil.isBlank(customerCredit.getIndustryInvolved())) {
728   - historyVo1.setIndustryInvolved(customerCredit.getIndustryInvolved());
729   - }
730   - if (!StringUtil.isBlank(customerCredit.getIndustryExperience())) {
731   - historyVo1.setIndustryExperience(customerCredit.getIndustryExperience());
732   - }
733   - if (!StringUtil.isBlank(customerCredit.getHasDispute())) {
734   - historyVo1.setHasDispute(customerCredit.getHasDispute());
735   - }
736   - if (!StringUtil.isBlank(customerCredit.getCooperationStartDate())) {
737   - historyVo1.setCooperationStartDate(customerCredit.getCooperationStartDate());
738   - }
739   - if (!StringUtil.isBlank(customerCredit.getMonthlyAvgVolume())) {
740   - historyVo1.setMonthlyAvgVolume(customerCredit.getMonthlyAvgVolume());
741   - }
742   - if (!StringUtil.isBlank(customerCredit.getIsVerbalAgreement())) {
743   - historyVo1.setIsVerbalAgreement(customerCredit.getIsVerbalAgreement());
744   - }
745   - if (!StringUtil.isBlank(customerCredit.getOtherAgreements())) {
746   - historyVo1.setOtherAgreements(customerCredit.getOtherAgreements());
747   - }
748   - if (!StringUtil.isBlank(customerCredit.getHasLongTermContract())) {
749   - historyVo1.setHasLongTermContract(customerCredit.getHasLongTermContract());
750   - }
751   - if (!StringUtil.isBlank(customerCredit.getContractType())) {
752   - historyVo1.setContractType(customerCredit.getContractType());
753   - }
754   - if (!StringUtil.isBlank(customerCredit.getHasInterruption())) {
755   - historyVo1.setHasInterruption(customerCredit.getHasInterruption());
756   - }
757   - if (!StringUtil.isBlank(customerCredit.getSettlementPeriod())) {
758   - historyVo1.setSettlementPeriod(customerCredit.getSettlementPeriod());
759   - }
760   - if (!StringUtil.isBlank(customerCredit.getMaterialSupplyPlan())) {
761   - historyVo1.setMaterialSupplyPlan(customerCredit.getMaterialSupplyPlan());
762   - }
763   - if (!StringUtil.isBlank(customerCredit.getSuggestedCategory())) {
764   - historyVo1.setSuggestedCategory(customerCredit.getSuggestedCategory());
765   - }
766   - if (!StringUtil.isBlank(customerCredit.getCreditLimit())) {
767   - historyVo1.setCreditLimit(customerCredit.getCreditLimit());
768   - }
769   - if (!StringUtil.isBlank(customerCredit.getInvestigator())) {
770   - historyVo1.setInvestigator(customerCredit.getInvestigator());
771   - }
772   - if (!StringUtil.isBlank(customerCredit.getSupervisorReview())) {
773   - historyVo1.setSupervisorReview(customerCredit.getSupervisorReview());
774   - }
775   - if (!StringUtil.isBlank(customerCredit.getAnnualTotalSales())) {
776   - historyVo1.setAnnualTotalSales(customerCredit.getAnnualTotalSales());
777   - }
778   - if (!StringUtil.isBlank(customerCredit.getMainIndustry())) {
779   - historyVo1.setMainIndustry(customerCredit.getMainIndustry());
780   - }
781   - if (!StringUtil.isBlank(customerCredit.getAnnualMaterialOverview())) {
782   - historyVo1.setAnnualMaterialOverview(customerCredit.getAnnualMaterialOverview());
783   - }
784   - if (!StringUtil.isBlank(customerCredit.getCompanySettlementPeriod())) {
785   - historyVo1.setCompanySettlementPeriod(customerCredit.getCompanySettlementPeriod());
786   - }
787   - if (!StringUtil.isBlank(customerCredit.getCompanyCreditLimit())) {
788   - historyVo1.setCompanyCreditLimit(customerCredit.getCompanyCreditLimit());
789   - }
790   - if (!StringUtil.isBlank(customerCredit.getCompanyMaterialSupplyPlan())) {
791   - historyVo1.setCompanyMaterialSupplyPlan(customerCredit.getCompanyMaterialSupplyPlan());
792   - }
793   - if (!StringUtil.isBlank(customerCredit.getCompanySuggestedCategory())) {
794   - historyVo1.setCompanySuggestedCategory(customerCredit.getCompanySuggestedCategory());
795   - }
796   - if (!StringUtil.isBlank(customerCredit.getStatus())) {
797   - historyVo1.setStatus(customerCredit.getStatus());
798   - }
799   - if (!StringUtil.isBlank(customerCredit.getCertificationCertificate())) {
800   - historyVo1.setCertificationCertificate(customerCredit.getCertificationCertificate());
801   - }
802   - String historyId1 = customerCreditHistoryService.create(historyVo1);
803   - //变更后的核心人员
804   - QueryCorePersonnelVo queryCorePersonnelVo1 = new QueryCorePersonnelVo();
805   - queryCorePersonnelVo1.setCreditId(data.getId());
806   - List<CorePersonnel> corePersonnelList1 = corePersonnelService.query(queryCorePersonnelVo1);
807   - if (CollectionUtils.isNotEmpty(corePersonnelList1)) {
808   - for (CorePersonnel corePersonnel : corePersonnelList1) {
809   - CreateCorePersonnelHistoryVo personnelHistoryVo = new CreateCorePersonnelHistoryVo();
810   - personnelHistoryVo.setPersonnelId(corePersonnel.getId());
811   - personnelHistoryVo.setCreditHistoryId(historyId1);
812   - personnelHistoryVo.setName(corePersonnel.getName());
813   - if (!StringUtil.isBlank(corePersonnel.getSex())) {
814   - personnelHistoryVo.setSex(corePersonnel.getSex());
815   - }
816   - if (!StringUtil.isBlank(corePersonnel.getNativePlace())) {
817   - personnelHistoryVo.setNativePlace(corePersonnel.getNativePlace());
818   - }
819   - if (!StringUtil.isBlank(corePersonnel.getAge())) {
820   - personnelHistoryVo.setAge(corePersonnel.getAge());
821   - }
822   - if (!StringUtil.isBlank(corePersonnel.getPosition())) {
823   - personnelHistoryVo.setPosition(corePersonnel.getPosition());
824   - }
825   - if (!StringUtil.isBlank(corePersonnel.getMobile())) {
826   - personnelHistoryVo.setMobile(corePersonnel.getMobile());
827   - }
828   - if (!StringUtil.isBlank(corePersonnel.getPhone())) {
829   - personnelHistoryVo.setPhone(corePersonnel.getPhone());
830   - }
831   - if (!StringUtil.isBlank(corePersonnel.getEmail())) {
832   - personnelHistoryVo.setEmail(corePersonnel.getEmail());
833   - }
834   - if (!StringUtil.isBlank(corePersonnel.getAddress())) {
835   - personnelHistoryVo.setAddress(corePersonnel.getAddress());
836   - }
837   - if (!StringUtil.isBlank(corePersonnel.getPersonId())) {
838   - personnelHistoryVo.setPersonId(corePersonnel.getPersonId());
839   - }
840   - corePersonnelHistoryService.create(personnelHistoryVo);
841   - }
842   - }
843   - }
844 1031 OpLogUtil.setVariable("id", data.getId());
845 1032 OpLogUtil.setExtra(vo);
846   -
847   - //开启审核
848   - flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, vo);
849 1033 }
850 1034
851 1035 @OpLog(type = OtherOpLogType.class, name = "更新状态,ID:{}", params = {"#id"})
... ...
... ... @@ -7,7 +7,9 @@ import com.lframework.starter.web.core.components.resp.PageResult;
7 7 import com.lframework.xingyun.sc.vo.customer.credit.CreateCustomerCreditVo;
8 8 import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditVo;
9 9 import com.lframework.xingyun.sc.vo.customer.credit.UpdateCustomerCreditVo;
  10 +import freemarker.template.TemplateException;
10 11
  12 +import java.io.IOException;
11 13 import java.util.List;
12 14
13 15 /**
... ... @@ -48,6 +50,13 @@ public interface CustomerCreditService extends BaseMpService<CustomerCredit> {
48 50 */
49 51 void update(UpdateCustomerCreditVo vo);
50 52
  53 + /**
  54 + * 修改不走审核流
  55 + *
  56 + * @param vo
  57 + */
  58 + void updateNoFlowInstance(UpdateCustomerCreditVo vo);
  59 +
51 60
52 61 /**
53 62 * 更新状态
... ...
... ... @@ -13,6 +13,12 @@ public class CreateCorePersonnelVo implements BaseVo, Serializable {
13 13 private static final long serialVersionUID = 1L;
14 14
15 15 /**
  16 + * Id
  17 + */
  18 + @ApiModelProperty("Id")
  19 + private String Id;
  20 +
  21 + /**
16 22 * personId前端自用id
17 23 */
18 24 @ApiModelProperty("personId")
... ...
... ... @@ -420,4 +420,10 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable {
420 420 @ApiModelProperty(value = "股东信息文件ID")
421 421 private String shareholderFileId;
422 422
  423 + /**
  424 + * 客户资信历史记录id
  425 + */
  426 + @ApiModelProperty(value = "客户资信历史记录id")
  427 + private String creditHistoryId;
  428 +
423 429 }
... ...