Commit 6e8ac083a79e5996bf3145cbcf1959a3e4c29111

Authored by 房远帅
2 parents b4575fc8 47340545

Merge branch 'master_after20' into master_cj_zq

... ... @@ -27,9 +27,7 @@ import com.lframework.starter.web.core.components.resp.InvokeResult;
27 27 import javax.annotation.Resource;
28 28 import javax.servlet.http.HttpServletResponse;
29 29 import javax.validation.constraints.NotBlank;
30   -import com.lframework.xingyun.sc.excel.customerCredit.AutoColumnWidthHandler;
31   -import com.lframework.xingyun.sc.excel.customerCredit.CustomerCreditImportListener;
32   -import com.lframework.xingyun.sc.excel.customerCredit.CustomerCreditImportModel;
  30 +import com.lframework.xingyun.sc.excel.customerCredit.*;
33 31 import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
34 32 import com.lframework.xingyun.sc.service.customer.CorePersonnelService;
35 33 import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
... ... @@ -552,4 +550,25 @@ public class CustomerCreditController extends DefaultBaseController {
552 550 }
553 551 return credit;
554 552 }
  553 +
  554 + @ApiOperation("下载变更导入模板")
  555 + @HasPermission({"customer-credit-manage:customer-credit-plan:change-import"})
  556 + @GetMapping("/import/changeTemplate")
  557 + public void downloadImportChangeTemplate(HttpServletResponse response) throws IOException {
  558 + ExcelUtil.exportXls("客户资信变更导入模板", CustomerCreditChangeImportModel.class);
  559 + }
  560 +
  561 + @ApiOperation("变更导入")
  562 + @HasPermission({"customer-credit-manage:customer-credit-plan:change-import"})
  563 + @PostMapping("/changeImport")
  564 + public InvokeResult<Void> changeImportExcel(@NotBlank(message = "ID不能为空") String id,
  565 + @NotNull(message = "请上传文件") MultipartFile file) {
  566 +
  567 + CustomerCreditChangeImportListener listener = new CustomerCreditChangeImportListener();
  568 + listener.setTaskId(id);
  569 + ExcelUtil.read(file, CustomerCreditChangeImportModel.class, listener).sheet().doRead();
  570 +
  571 + return InvokeResultBuilder.success();
  572 + }
  573 +
555 574 }
... ...
  1 +package com.lframework.xingyun.sc.excel.customerCredit;
  2 +
  3 +import com.alibaba.excel.context.AnalysisContext;
  4 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  5 +import com.lframework.starter.common.utils.StringUtil;
  6 +import com.lframework.starter.web.core.components.excel.ExcelImportListener;
  7 +import com.lframework.starter.web.core.utils.ApplicationUtil;
  8 +import com.lframework.xingyun.sc.entity.CustomerCredit;
  9 +import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
  10 +import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditVo;
  11 +import com.lframework.xingyun.sc.vo.customer.credit.UpdateCustomerCreditVo;
  12 +import lombok.extern.slf4j.Slf4j;
  13 +import org.apache.commons.collections.CollectionUtils;
  14 +
  15 +import java.util.ArrayList;
  16 +import java.util.Arrays;
  17 +import java.util.List;
  18 +
  19 +@Slf4j
  20 +public class CustomerCreditChangeImportListener extends ExcelImportListener<CustomerCreditChangeImportModel> {
  21 +
  22 + private List<String> checkList = new ArrayList<>();
  23 +
  24 + @Override
  25 + protected void doInvoke(CustomerCreditChangeImportModel data, AnalysisContext context) {
  26 + List<String> validValues = Arrays.asList("AAA", "AA", "A", "BBB", "BB", "B", "C", "D");
  27 + if (StringUtil.isBlank(data.getCode())) {
  28 + throw new DefaultClientException(
  29 + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空");
  30 + }
  31 + if (StringUtil.isBlank(data.getAnnualTotalSales())) {
  32 + throw new DefaultClientException(
  33 + "第" + context.readRowHolder().getRowIndex() + "行“年度总销量”不能为空");
  34 + }
  35 + if (StringUtil.isBlank(data.getMainIndustry())) {
  36 + throw new DefaultClientException(
  37 + "第" + context.readRowHolder().getRowIndex() + "行“主要行业”不能为空");
  38 + }
  39 + if (StringUtil.isBlank(data.getOccupationDays())) {
  40 + throw new DefaultClientException(
  41 + "第" + context.readRowHolder().getRowIndex() + "行“占用天数”不能为空");
  42 + }
  43 + if (StringUtil.isBlank(data.getProfitPerTon())) {
  44 + throw new DefaultClientException(
  45 + "第" + context.readRowHolder().getRowIndex() + "行“吨盈利”不能为空");
  46 + }
  47 + if (StringUtil.isBlank(data.getCompanySettlementPeriod())) {
  48 + throw new DefaultClientException(
  49 + "第" + context.readRowHolder().getRowIndex() + "行“结算期限”不能为空");
  50 + }
  51 + if (StringUtil.isBlank(data.getCompanyCreditLimit())) {
  52 + throw new DefaultClientException(
  53 + "第" + context.readRowHolder().getRowIndex() + "行“授信额度”不能为空");
  54 + }
  55 + if (StringUtil.isBlank(data.getCompanyMaterialSupplyPlan())) {
  56 + throw new DefaultClientException(
  57 + "第" + context.readRowHolder().getRowIndex() + "行“加工操作方案”不能为空");
  58 + }
  59 + if (StringUtil.isBlank(data.getCompanySuggestedCategory())) {
  60 + throw new DefaultClientException(
  61 + "第" + context.readRowHolder().getRowIndex() + "行“客户分类”不能为空");
  62 + }
  63 + //客户分类
  64 + if (StringUtil.isNotEmpty(data.getCompanySuggestedCategory()) && !validValues.contains(data.getCompanySuggestedCategory())) {
  65 + throw new DefaultClientException(
  66 + "第" + context.readRowHolder().getRowIndex() + "行“客户分类”只能为:AAA、AA、A、BBB、BB、B、C、D");
  67 + }
  68 + if (checkList.contains(data.getCode())) {
  69 + throw new DefaultClientException(
  70 + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复");
  71 + }
  72 + checkList.add(data.getCode());
  73 + QueryCustomerCreditVo vo = new QueryCustomerCreditVo();
  74 + vo.setSerialNumber(data.getCode());
  75 + vo.setStatus("PASS");
  76 + CustomerCreditService customerCreditService = ApplicationUtil.getBean(CustomerCreditService.class);
  77 + List<CustomerCredit> query = customerCreditService.query(vo);
  78 + if (CollectionUtils.isEmpty(query)) {
  79 + throw new DefaultClientException(
  80 + "第" + context.readRowHolder().getRowIndex() + "行“编号”系统中不存在或未审核通过");
  81 + }
  82 +
  83 + }
  84 +
  85 + @Override
  86 + protected void afterAllAnalysed(AnalysisContext context) {
  87 + CustomerCreditService customerCreditService = ApplicationUtil.getBean(CustomerCreditService.class);
  88 + List<CustomerCreditChangeImportModel> datas = this.getDatas();
  89 + for (int i = 0; i < datas.size(); i++) {
  90 + CustomerCreditChangeImportModel data = datas.get(i);
  91 + QueryCustomerCreditVo vo = new QueryCustomerCreditVo();
  92 + vo.setSerialNumber(data.getCode());
  93 + vo.setStatus("PASS");
  94 + List<CustomerCredit> query = customerCreditService.query(vo);
  95 + CustomerCredit customerCredit = query.get(0);
  96 + UpdateCustomerCreditVo updateCustomerCreditVo = new UpdateCustomerCreditVo();
  97 + updateCustomerCreditVo.setId(customerCredit.getId());
  98 + updateCustomerCreditVo.setAnnualTotalSales(data.getAnnualTotalSales());
  99 + updateCustomerCreditVo.setMainIndustry(data.getMainIndustry());
  100 + //年度款料概况=占用天数+吨盈利
  101 + String str = "占用天数(天):" + data.getOccupationDays() + " | 吨盈利(元/吨):" + data.getProfitPerTon();
  102 + updateCustomerCreditVo.setAnnualMaterialOverview(str);
  103 + updateCustomerCreditVo.setCompanySettlementPeriod(data.getCompanySettlementPeriod());
  104 + updateCustomerCreditVo.setCompanyCreditLimit(data.getCompanyCreditLimit());
  105 + updateCustomerCreditVo.setCompanyMaterialSupplyPlan(data.getCompanyMaterialSupplyPlan());
  106 + updateCustomerCreditVo.setCompanySuggestedCategory(data.getCompanySuggestedCategory());
  107 + customerCreditService.updateChange(updateCustomerCreditVo);
  108 +
  109 + this.setSuccessProcess(i);
  110 + }
  111 + }
  112 +
  113 + @Override
  114 + protected void doComplete() {
  115 + }
  116 +}
... ...
  1 +package com.lframework.xingyun.sc.excel.customerCredit;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelIgnore;
  4 +import com.alibaba.excel.annotation.ExcelProperty;
  5 +import com.lframework.starter.web.core.annotations.excel.ExcelRequired;
  6 +import com.lframework.starter.web.core.components.excel.ExcelModel;
  7 +import lombok.Data;
  8 +
  9 +@Data
  10 +public class CustomerCreditChangeImportModel implements ExcelModel {
  11 +
  12 + /**
  13 + * 资信ID
  14 + */
  15 + @ExcelIgnore
  16 + private String id;
  17 +
  18 +
  19 + /**
  20 + * 编号
  21 + */
  22 + @ExcelRequired
  23 + @ExcelProperty("编号")
  24 + private String code;
  25 +
  26 + /**
  27 + * 客户名称
  28 + */
  29 + @ExcelProperty("客户名称")
  30 + private String name;
  31 +
  32 + /**
  33 + * 年度总销量
  34 + */
  35 + @ExcelRequired
  36 + @ExcelProperty("年度总销量(吨)")
  37 + private String annualTotalSales;
  38 +
  39 + /**
  40 + * 主要行业
  41 + */
  42 + @ExcelRequired
  43 + @ExcelProperty("主要行业")
  44 + private String mainIndustry;
  45 +
  46 + @ExcelRequired
  47 + @ExcelProperty("占用天数(天)")
  48 + private String occupationDays;
  49 +
  50 + @ExcelRequired
  51 + @ExcelProperty("吨盈利(元/吨)")
  52 + private String profitPerTon;
  53 +
  54 + /**
  55 + * 结算期限
  56 + */
  57 + @ExcelRequired
  58 + @ExcelProperty("结算期限")
  59 + private String companySettlementPeriod;
  60 +
  61 + /**
  62 + * 授信额度
  63 + */
  64 + @ExcelRequired
  65 + @ExcelProperty("授信额度(万元)")
  66 + private String companyCreditLimit;
  67 +
  68 + /**
  69 + * 加工操作方案
  70 + */
  71 + @ExcelRequired
  72 + @ExcelProperty("加工操作方案")
  73 + private String companyMaterialSupplyPlan;
  74 +
  75 + /**
  76 + * 客户分类
  77 + */
  78 + @ExcelRequired
  79 + @ExcelProperty("客户分类")
  80 + private String companySuggestedCategory;
  81 +}
... ...
... ... @@ -1614,6 +1614,456 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
1614 1614 .orElseThrow(() -> new DefaultClientException("办事处 " + prefix + " 的编号已用尽 (001-999)"));
1615 1615 }
1616 1616
  1617 + @OpLog(type = OtherOpLogType.class, name = "变更客户资信表,ID:{}", params = {"#id"})
  1618 + @Transactional(rollbackFor = Exception.class)
  1619 + @Override
  1620 + public void updateChange(UpdateCustomerCreditVo vo) {
  1621 +
  1622 + CustomerCredit data = customerCreditMapper.findById(vo.getId());
  1623 + if (ObjectUtil.isNull(data)) {
  1624 + throw new DefaultClientException("客户资信表不存在!");
  1625 + }
  1626 + //变更记录
  1627 + QueryCorePersonnelVo queryCorePersonnelVo = new QueryCorePersonnelVo();
  1628 + queryCorePersonnelVo.setCreditId(data.getId());
  1629 + List<CorePersonnel> corePersonnelList = corePersonnelService.query(queryCorePersonnelVo);
  1630 + String historyId = null;
  1631 + String sort = "1";
  1632 + CreateCustomerCreditHistoryVo historyVo = new CreateCustomerCreditHistoryVo();
  1633 + historyVo.setCreditId(data.getId());
  1634 + //第几次变更序号
  1635 + QueryCustomerCreditHistoryVo queryCustomerCreditHistoryVo = new QueryCustomerCreditHistoryVo();
  1636 + queryCustomerCreditHistoryVo.setCreditId(data.getId());
  1637 + queryCustomerCreditHistoryVo.setType("PART");
  1638 + List<CustomerCreditHistory> query = customerCreditHistoryService.query(queryCustomerCreditHistoryVo);
  1639 + if (CollectionUtils.isEmpty(query)) {
  1640 + historyVo.setSort("1");
  1641 + } else {
  1642 + int i = query.size() + 1;
  1643 + historyVo.setSort(String.valueOf(i));
  1644 + sort = String.valueOf(i);
  1645 + }
  1646 + historyVo.setSerialNumber(data.getSerialNumber());
  1647 + if (!StringUtil.isBlank(data.getRegion())) {
  1648 + historyVo.setRegion(data.getRegion());
  1649 + }
  1650 + if (!StringUtil.isBlank(data.getDeptId())) {
  1651 + historyVo.setDeptId(data.getDeptId());
  1652 + }
  1653 + if (data.getRegisterDate() != null) {
  1654 + historyVo.setRegisterDate(data.getRegisterDate());
  1655 + }
  1656 + if (!StringUtil.isBlank(data.getCustomerShortName())) {
  1657 + historyVo.setCustomerShortName(data.getCustomerShortName());
  1658 + }
  1659 + if (!StringUtil.isBlank(data.getEnterpriseType())) {
  1660 + historyVo.setEnterpriseType(data.getEnterpriseType());
  1661 + }
  1662 + if (!StringUtil.isBlank(data.getCompanyId())) {
  1663 + historyVo.setCompanyId(data.getCompanyId());
  1664 + }
  1665 + if (!StringUtil.isBlank(data.getCompanyNature())) {
  1666 + historyVo.setCompanyNature(data.getCompanyNature());
  1667 + }
  1668 + if (!StringUtil.isBlank(data.getCompanyAddress())) {
  1669 + historyVo.setCompanyAddress(data.getCompanyAddress());
  1670 + }
  1671 + if (data.getRegisteredCapital() != null) {
  1672 + historyVo.setRegisteredCapital(data.getRegisteredCapital());
  1673 + }
  1674 + if (!StringUtil.isBlank(data.getBankAccount())) {
  1675 + historyVo.setBankAccount(data.getBankAccount());
  1676 + }
  1677 + if (!StringUtil.isBlank(data.getBankName())) {
  1678 + historyVo.setBankName(data.getBankName());
  1679 + }
  1680 + if (!StringUtil.isBlank(data.getTaxNumber())) {
  1681 + historyVo.setTaxNumber(data.getTaxNumber());
  1682 + }
  1683 + if (data.getRegistrationTime() != null) {
  1684 + historyVo.setRegistrationTime(data.getRegistrationTime());
  1685 + }
  1686 + if (!StringUtil.isBlank(data.getBusinessYears())) {
  1687 + historyVo.setBusinessYears(data.getBusinessYears());
  1688 + }
  1689 + if (!StringUtil.isBlank(data.getBusinessScope())) {
  1690 + historyVo.setBusinessScope(data.getBusinessScope());
  1691 + }
  1692 + if (!StringUtil.isBlank(data.getBusinessProperty())) {
  1693 + historyVo.setBusinessProperty(data.getBusinessProperty());
  1694 + }
  1695 + if (!StringUtil.isBlank(data.getLandArea())) {
  1696 + historyVo.setLandArea(data.getLandArea());
  1697 + }
  1698 + if (!StringUtil.isBlank(data.getStorageConditions())) {
  1699 + historyVo.setStorageConditions(data.getStorageConditions());
  1700 + }
  1701 + if (data.getEmployeeCount() != null) {
  1702 + historyVo.setEmployeeCount(data.getEmployeeCount());
  1703 + }
  1704 + if (!StringUtil.isBlank(data.getEquipmentAttributes())) {
  1705 + historyVo.setEquipmentAttributes(data.getEquipmentAttributes());
  1706 + }
  1707 + if (!StringUtil.isBlank(data.getAssetEvaluation())) {
  1708 + historyVo.setAssetEvaluation(data.getAssetEvaluation());
  1709 + }
  1710 + if (!StringUtil.isBlank(data.getLastYearSales())) {
  1711 + historyVo.setLastYearSales(data.getLastYearSales());
  1712 + }
  1713 + if (!StringUtil.isBlank(data.getMonthlyAvgSales())) {
  1714 + historyVo.setMonthlyAvgSales(data.getMonthlyAvgSales());
  1715 + }
  1716 + if (!StringUtil.isBlank(data.getInvoiceItemUnit())) {
  1717 + historyVo.setInvoiceItemUnit(data.getInvoiceItemUnit());
  1718 + }
  1719 + if (!StringUtil.isBlank(data.getProductMatch())) {
  1720 + historyVo.setProductMatch(data.getProductMatch());
  1721 + }
  1722 + if (!StringUtil.isBlank(data.getMajorCustomers())) {
  1723 + historyVo.setMajorCustomers(data.getMajorCustomers());
  1724 + }
  1725 + if (!StringUtil.isBlank(data.getMainProjects())) {
  1726 + historyVo.setMainProjects(data.getMainProjects());
  1727 + }
  1728 + if (!StringUtil.isBlank(data.getIndustryInvolved())) {
  1729 + historyVo.setIndustryInvolved(data.getIndustryInvolved());
  1730 + }
  1731 + if (!StringUtil.isBlank(data.getIndustryExperience())) {
  1732 + historyVo.setIndustryExperience(data.getIndustryExperience());
  1733 + }
  1734 + if (!StringUtil.isBlank(data.getHasDispute())) {
  1735 + historyVo.setHasDispute(data.getHasDispute());
  1736 + }
  1737 + if (!StringUtil.isBlank(data.getCooperationStartDate())) {
  1738 + historyVo.setCooperationStartDate(data.getCooperationStartDate());
  1739 + }
  1740 + if (!StringUtil.isBlank(data.getMonthlyAvgVolume())) {
  1741 + historyVo.setMonthlyAvgVolume(data.getMonthlyAvgVolume());
  1742 + }
  1743 + if (!StringUtil.isBlank(data.getIsVerbalAgreement())) {
  1744 + historyVo.setIsVerbalAgreement(data.getIsVerbalAgreement());
  1745 + }
  1746 + if (!StringUtil.isBlank(data.getOtherAgreements())) {
  1747 + historyVo.setOtherAgreements(data.getOtherAgreements());
  1748 + }
  1749 + if (!StringUtil.isBlank(data.getHasLongTermContract())) {
  1750 + historyVo.setHasLongTermContract(data.getHasLongTermContract());
  1751 + }
  1752 + if (!StringUtil.isBlank(data.getContractType())) {
  1753 + historyVo.setContractType(data.getContractType());
  1754 + }
  1755 + if (!StringUtil.isBlank(data.getHasInterruption())) {
  1756 + historyVo.setHasInterruption(data.getHasInterruption());
  1757 + }
  1758 + if (!StringUtil.isBlank(data.getSettlementPeriod())) {
  1759 + historyVo.setSettlementPeriod(data.getSettlementPeriod());
  1760 + }
  1761 + if (!StringUtil.isBlank(data.getMaterialSupplyPlan())) {
  1762 + historyVo.setMaterialSupplyPlan(data.getMaterialSupplyPlan());
  1763 + }
  1764 + if (!StringUtil.isBlank(data.getSuggestedCategory())) {
  1765 + historyVo.setSuggestedCategory(data.getSuggestedCategory());
  1766 + }
  1767 + if (!StringUtil.isBlank(data.getCreditLimit())) {
  1768 + historyVo.setCreditLimit(data.getCreditLimit());
  1769 + }
  1770 + if (!StringUtil.isBlank(data.getInvestigator())) {
  1771 + historyVo.setInvestigator(data.getInvestigator());
  1772 + }
  1773 + if (!StringUtil.isBlank(data.getSupervisorReview())) {
  1774 + historyVo.setSupervisorReview(data.getSupervisorReview());
  1775 + }
  1776 + if (!StringUtil.isBlank(data.getAnnualTotalSales())) {
  1777 + historyVo.setAnnualTotalSales(data.getAnnualTotalSales());
  1778 + }
  1779 + if (!StringUtil.isBlank(data.getMainIndustry())) {
  1780 + historyVo.setMainIndustry(data.getMainIndustry());
  1781 + }
  1782 + if (!StringUtil.isBlank(data.getAnnualMaterialOverview())) {
  1783 + historyVo.setAnnualMaterialOverview(data.getAnnualMaterialOverview());
  1784 + }
  1785 + if (!StringUtil.isBlank(data.getCompanySettlementPeriod())) {
  1786 + historyVo.setCompanySettlementPeriod(data.getCompanySettlementPeriod());
  1787 + }
  1788 + if (!StringUtil.isBlank(data.getCompanyCreditLimit())) {
  1789 + historyVo.setCompanyCreditLimit(data.getCompanyCreditLimit());
  1790 + }
  1791 + if (!StringUtil.isBlank(data.getCompanyMaterialSupplyPlan())) {
  1792 + historyVo.setCompanyMaterialSupplyPlan(data.getCompanyMaterialSupplyPlan());
  1793 + }
  1794 + if (!StringUtil.isBlank(data.getCompanySuggestedCategory())) {
  1795 + historyVo.setCompanySuggestedCategory(data.getCompanySuggestedCategory());
  1796 + }
  1797 + if (!StringUtil.isBlank(data.getStatus())) {
  1798 + historyVo.setStatus(data.getStatus());
  1799 + }
  1800 + if (!StringUtil.isBlank(data.getCertificationCertificate())) {
  1801 + historyVo.setCertificationCertificate(data.getCertificationCertificate());
  1802 + }
  1803 + historyId = customerCreditHistoryService.create(historyVo);
  1804 + vo.setCreditHistoryId(historyId);
  1805 + if (CollectionUtils.isNotEmpty(corePersonnelList)) {
  1806 + for (CorePersonnel corePersonnel : corePersonnelList) {
  1807 + CreateCorePersonnelHistoryVo personnelHistoryVo = new CreateCorePersonnelHistoryVo();
  1808 + personnelHistoryVo.setPersonnelId(corePersonnel.getId());
  1809 + personnelHistoryVo.setCreditHistoryId(historyId);
  1810 + personnelHistoryVo.setName(corePersonnel.getName());
  1811 + if (!StringUtil.isBlank(corePersonnel.getSex())) {
  1812 + personnelHistoryVo.setSex(corePersonnel.getSex());
  1813 + }
  1814 + if (!StringUtil.isBlank(corePersonnel.getNativePlace())) {
  1815 + personnelHistoryVo.setNativePlace(corePersonnel.getNativePlace());
  1816 + }
  1817 + if (!StringUtil.isBlank(corePersonnel.getAge())) {
  1818 + personnelHistoryVo.setAge(corePersonnel.getAge());
  1819 + }
  1820 + if (!StringUtil.isBlank(corePersonnel.getPosition())) {
  1821 + personnelHistoryVo.setPosition(corePersonnel.getPosition());
  1822 + }
  1823 + if (!StringUtil.isBlank(corePersonnel.getMobile())) {
  1824 + personnelHistoryVo.setMobile(corePersonnel.getMobile());
  1825 + }
  1826 + if (!StringUtil.isBlank(corePersonnel.getPhone())) {
  1827 + personnelHistoryVo.setPhone(corePersonnel.getPhone());
  1828 + }
  1829 + if (!StringUtil.isBlank(corePersonnel.getEmail())) {
  1830 + personnelHistoryVo.setEmail(corePersonnel.getEmail());
  1831 + }
  1832 + if (!StringUtil.isBlank(corePersonnel.getAddress())) {
  1833 + personnelHistoryVo.setAddress(corePersonnel.getAddress());
  1834 + }
  1835 + if (!StringUtil.isBlank(corePersonnel.getPersonId())) {
  1836 + personnelHistoryVo.setPersonId(corePersonnel.getPersonId());
  1837 + }
  1838 + corePersonnelHistoryService.create(personnelHistoryVo);
  1839 + }
  1840 + }
  1841 +
  1842 + //保存变更后的数据
  1843 + CreateCustomerCreditHistoryVo historyVo1 = new CreateCustomerCreditHistoryVo();
  1844 + historyVo1.setId(historyId + "_01");
  1845 + historyVo1.setCreditId(data.getId());
  1846 + historyVo1.setSort(sort);
  1847 + historyVo1.setSerialNumber(data.getSerialNumber());
  1848 + if (!StringUtil.isBlank(data.getRegion())) {
  1849 + historyVo1.setRegion(data.getRegion());
  1850 + }
  1851 + if (!StringUtil.isBlank(data.getDeptId())) {
  1852 + historyVo1.setDeptId(data.getDeptId());
  1853 + }
  1854 + if (data.getRegisterDate() != null) {
  1855 + historyVo1.setRegisterDate(data.getRegisterDate());
  1856 + }
  1857 + if (!StringUtil.isBlank(data.getCustomerShortName())) {
  1858 + historyVo1.setCustomerShortName(data.getCustomerShortName());
  1859 + }
  1860 + if (!StringUtil.isBlank(data.getEnterpriseType())) {
  1861 + historyVo1.setEnterpriseType(data.getEnterpriseType());
  1862 + }
  1863 + if (!StringUtil.isBlank(data.getCompanyId())) {
  1864 + historyVo1.setCompanyId(data.getCompanyId());
  1865 + }
  1866 + if (!StringUtil.isBlank(data.getCompanyNature())) {
  1867 + historyVo1.setCompanyNature(data.getCompanyNature());
  1868 + }
  1869 + if (!StringUtil.isBlank(data.getCompanyAddress())) {
  1870 + historyVo1.setCompanyAddress(data.getCompanyAddress());
  1871 + }
  1872 + if (data.getRegisteredCapital() != null) {
  1873 + historyVo1.setRegisteredCapital(data.getRegisteredCapital());
  1874 + }
  1875 + if (!StringUtil.isBlank(data.getBankAccount())) {
  1876 + historyVo1.setBankAccount(data.getBankAccount());
  1877 + }
  1878 + if (!StringUtil.isBlank(data.getBankName())) {
  1879 + historyVo1.setBankName(data.getBankName());
  1880 + }
  1881 + if (!StringUtil.isBlank(data.getTaxNumber())) {
  1882 + historyVo1.setTaxNumber(data.getTaxNumber());
  1883 + }
  1884 + if (data.getRegistrationTime() != null) {
  1885 + historyVo1.setRegistrationTime(data.getRegistrationTime());
  1886 + }
  1887 + if (!StringUtil.isBlank(data.getBusinessYears())) {
  1888 + historyVo1.setBusinessYears(data.getBusinessYears());
  1889 + }
  1890 + if (!StringUtil.isBlank(data.getBusinessScope())) {
  1891 + historyVo1.setBusinessScope(data.getBusinessScope());
  1892 + }
  1893 + if (!StringUtil.isBlank(data.getBusinessProperty())) {
  1894 + historyVo1.setBusinessProperty(data.getBusinessProperty());
  1895 + }
  1896 + if (!StringUtil.isBlank(data.getLandArea())) {
  1897 + historyVo1.setLandArea(data.getLandArea());
  1898 + }
  1899 + if (!StringUtil.isBlank(data.getStorageConditions())) {
  1900 + historyVo1.setStorageConditions(data.getStorageConditions());
  1901 + }
  1902 + if (data.getEmployeeCount() != null) {
  1903 + historyVo1.setEmployeeCount(data.getEmployeeCount());
  1904 + }
  1905 + if (!StringUtil.isBlank(data.getEquipmentAttributes())) {
  1906 + historyVo1.setEquipmentAttributes(data.getEquipmentAttributes());
  1907 + }
  1908 + if (!StringUtil.isBlank(data.getAssetEvaluation())) {
  1909 + historyVo1.setAssetEvaluation(data.getAssetEvaluation());
  1910 + }
  1911 + if (!StringUtil.isBlank(data.getLastYearSales())) {
  1912 + historyVo1.setLastYearSales(data.getLastYearSales());
  1913 + }
  1914 + if (!StringUtil.isBlank(data.getMonthlyAvgSales())) {
  1915 + historyVo1.setMonthlyAvgSales(data.getMonthlyAvgSales());
  1916 + }
  1917 + if (!StringUtil.isBlank(data.getInvoiceItemUnit())) {
  1918 + historyVo1.setInvoiceItemUnit(data.getInvoiceItemUnit());
  1919 + }
  1920 + if (!StringUtil.isBlank(data.getProductMatch())) {
  1921 + historyVo1.setProductMatch(data.getProductMatch());
  1922 + }
  1923 + if (!StringUtil.isBlank(data.getMajorCustomers())) {
  1924 + historyVo1.setMajorCustomers(data.getMajorCustomers());
  1925 + }
  1926 + if (!StringUtil.isBlank(data.getMainProjects())) {
  1927 + historyVo1.setMainProjects(data.getMainProjects());
  1928 + }
  1929 + if (!StringUtil.isBlank(data.getIndustryInvolved())) {
  1930 + historyVo1.setIndustryInvolved(data.getIndustryInvolved());
  1931 + }
  1932 + if (!StringUtil.isBlank(data.getIndustryExperience())) {
  1933 + historyVo1.setIndustryExperience(data.getIndustryExperience());
  1934 + }
  1935 + if (!StringUtil.isBlank(data.getHasDispute())) {
  1936 + historyVo1.setHasDispute(data.getHasDispute());
  1937 + }
  1938 + if (!StringUtil.isBlank(data.getCooperationStartDate())) {
  1939 + historyVo1.setCooperationStartDate(data.getCooperationStartDate());
  1940 + }
  1941 + if (!StringUtil.isBlank(data.getMonthlyAvgVolume())) {
  1942 + historyVo1.setMonthlyAvgVolume(data.getMonthlyAvgVolume());
  1943 + }
  1944 + if (!StringUtil.isBlank(data.getIsVerbalAgreement())) {
  1945 + historyVo1.setIsVerbalAgreement(data.getIsVerbalAgreement());
  1946 + }
  1947 + if (!StringUtil.isBlank(data.getOtherAgreements())) {
  1948 + historyVo1.setOtherAgreements(data.getOtherAgreements());
  1949 + }
  1950 + if (!StringUtil.isBlank(data.getHasLongTermContract())) {
  1951 + historyVo1.setHasLongTermContract(data.getHasLongTermContract());
  1952 + }
  1953 + if (!StringUtil.isBlank(data.getContractType())) {
  1954 + historyVo1.setContractType(data.getContractType());
  1955 + }
  1956 + if (!StringUtil.isBlank(data.getHasInterruption())) {
  1957 + historyVo1.setHasInterruption(data.getHasInterruption());
  1958 + }
  1959 + if (!StringUtil.isBlank(data.getSettlementPeriod())) {
  1960 + historyVo1.setSettlementPeriod(data.getSettlementPeriod());
  1961 + }
  1962 + if (!StringUtil.isBlank(data.getMaterialSupplyPlan())) {
  1963 + historyVo1.setMaterialSupplyPlan(data.getMaterialSupplyPlan());
  1964 + }
  1965 + if (!StringUtil.isBlank(data.getSuggestedCategory())) {
  1966 + historyVo1.setSuggestedCategory(data.getSuggestedCategory());
  1967 + }
  1968 + if (!StringUtil.isBlank(data.getCreditLimit())) {
  1969 + historyVo1.setCreditLimit(data.getCreditLimit());
  1970 + }
  1971 + if (!StringUtil.isBlank(data.getInvestigator())) {
  1972 + historyVo1.setInvestigator(data.getInvestigator());
  1973 + }
  1974 + if (!StringUtil.isBlank(data.getSupervisorReview())) {
  1975 + historyVo1.setSupervisorReview(data.getSupervisorReview());
  1976 + }
  1977 + if (!StringUtil.isBlank(data.getStatus())) {
  1978 + historyVo1.setStatus(data.getStatus());
  1979 + }
  1980 + if (!StringUtil.isBlank(data.getCertificationCertificate())) {
  1981 + historyVo1.setCertificationCertificate(data.getCertificationCertificate());
  1982 + }
  1983 + if (!StringUtil.isBlank(vo.getAnnualTotalSales())) {
  1984 + historyVo1.setAnnualTotalSales(vo.getAnnualTotalSales());
  1985 + }
  1986 + if (!StringUtil.isBlank(vo.getMainIndustry())) {
  1987 + historyVo1.setMainIndustry(vo.getMainIndustry());
  1988 + }
  1989 + if (!StringUtil.isBlank(vo.getAnnualMaterialOverview())) {
  1990 + historyVo1.setAnnualMaterialOverview(vo.getAnnualMaterialOverview());
  1991 + }
  1992 + if (!StringUtil.isBlank(vo.getCompanySettlementPeriod())) {
  1993 + historyVo1.setCompanySettlementPeriod(vo.getCompanySettlementPeriod());
  1994 + }
  1995 + if (!StringUtil.isBlank(vo.getCompanyCreditLimit())) {
  1996 + historyVo1.setCompanyCreditLimit(vo.getCompanyCreditLimit());
  1997 + }
  1998 + if (!StringUtil.isBlank(vo.getCompanyMaterialSupplyPlan())) {
  1999 + historyVo1.setCompanyMaterialSupplyPlan(vo.getCompanyMaterialSupplyPlan());
  2000 + }
  2001 + if (!StringUtil.isBlank(vo.getCompanySuggestedCategory())) {
  2002 + historyVo1.setCompanySuggestedCategory(vo.getCompanySuggestedCategory());
  2003 + }
  2004 + String historyId1 = customerCreditHistoryService.create(historyVo1);
  2005 + //变更后的核心人员
  2006 + if (CollectionUtils.isNotEmpty(corePersonnelList)) {
  2007 + for (CorePersonnel corePersonnel : corePersonnelList) {
  2008 + CreateCorePersonnelHistoryVo personnelHistoryVo = new CreateCorePersonnelHistoryVo();
  2009 + if (StringUtil.isBlank(corePersonnel.getId())) {
  2010 + String id = IdUtil.getId();
  2011 + personnelHistoryVo.setPersonnelId(id);
  2012 + corePersonnel.setId(id);
  2013 + } else {
  2014 + personnelHistoryVo.setPersonnelId(corePersonnel.getId());
  2015 + }
  2016 + personnelHistoryVo.setCreditHistoryId(historyId1);
  2017 + personnelHistoryVo.setName(corePersonnel.getName());
  2018 + if (!StringUtil.isBlank(corePersonnel.getSex())) {
  2019 + personnelHistoryVo.setSex(corePersonnel.getSex());
  2020 + }
  2021 + if (!StringUtil.isBlank(corePersonnel.getNativePlace())) {
  2022 + personnelHistoryVo.setNativePlace(corePersonnel.getNativePlace());
  2023 + }
  2024 + if (!StringUtil.isBlank(corePersonnel.getAge())) {
  2025 + personnelHistoryVo.setAge(corePersonnel.getAge());
  2026 + }
  2027 + if (!StringUtil.isBlank(corePersonnel.getPosition())) {
  2028 + personnelHistoryVo.setPosition(corePersonnel.getPosition());
  2029 + }
  2030 + if (!StringUtil.isBlank(corePersonnel.getMobile())) {
  2031 + personnelHistoryVo.setMobile(corePersonnel.getMobile());
  2032 + }
  2033 + if (!StringUtil.isBlank(corePersonnel.getPhone())) {
  2034 + personnelHistoryVo.setPhone(corePersonnel.getPhone());
  2035 + }
  2036 + if (!StringUtil.isBlank(corePersonnel.getEmail())) {
  2037 + personnelHistoryVo.setEmail(corePersonnel.getEmail());
  2038 + }
  2039 + if (!StringUtil.isBlank(corePersonnel.getAddress())) {
  2040 + personnelHistoryVo.setAddress(corePersonnel.getAddress());
  2041 + }
  2042 + if (!StringUtil.isBlank(corePersonnel.getPersonId())) {
  2043 + personnelHistoryVo.setPersonId(corePersonnel.getPersonId());
  2044 + }
  2045 + corePersonnelHistoryService.create(personnelHistoryVo);
  2046 + }
  2047 + }
  2048 +
  2049 + LambdaUpdateWrapper<CustomerCredit> updateWrapper = Wrappers.lambdaUpdate(CustomerCredit.class)
  2050 + .set(CustomerCredit::getIsChange, "true")
  2051 + .set(CustomerCredit::getFrozenStatus, "NORMAL")
  2052 + .set(CustomerCredit::getAnnualTotalSales, StringUtil.isBlank(vo.getAnnualTotalSales()) ? null : vo.getAnnualTotalSales())
  2053 + .set(CustomerCredit::getMainIndustry, StringUtil.isBlank(vo.getMainIndustry()) ? null : vo.getMainIndustry())
  2054 + .set(CustomerCredit::getAnnualMaterialOverview, StringUtil.isBlank(vo.getAnnualMaterialOverview()) ? null : vo.getAnnualMaterialOverview())
  2055 + .set(CustomerCredit::getCompanySettlementPeriod, StringUtil.isBlank(vo.getCompanySettlementPeriod()) ? null : vo.getCompanySettlementPeriod())
  2056 + .set(CustomerCredit::getCompanyCreditLimit, StringUtil.isBlank(vo.getCompanyCreditLimit()) ? null : vo.getCompanyCreditLimit())
  2057 + .set(CustomerCredit::getCompanyMaterialSupplyPlan, StringUtil.isBlank(vo.getCompanyMaterialSupplyPlan()) ? null : vo.getCompanyMaterialSupplyPlan())
  2058 + .set(CustomerCredit::getCompanySuggestedCategory, StringUtil.isBlank(vo.getCompanySuggestedCategory()) ? null : vo.getCompanySuggestedCategory())
  2059 + .eq(CustomerCredit::getId, vo.getId());
  2060 +
  2061 + getBaseMapper().update(updateWrapper);
  2062 + OpLogUtil.setVariable("id", data.getId());
  2063 + OpLogUtil.setExtra(vo);
  2064 + }
  2065 +
  2066 +
1617 2067 @Override
1618 2068 public void cleanCacheByKey(Serializable key) {
1619 2069
... ...
... ... @@ -150,4 +150,11 @@ public interface CustomerCreditService extends BaseMpService<CustomerCredit> {
150 150 * @param customerId 客户ID
151 151 */
152 152 CustomerCredit getByCustomerId(String customerId);
  153 +
  154 + /**
  155 + * 变更导入修改
  156 + *
  157 + * @param vo
  158 + */
  159 + void updateChange(UpdateCustomerCreditVo vo);
153 160 }
... ...