From 96118de3ac74f5468cf5d4ac73d6ea3bec1da010 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期五, 20 十一月 2026 14:36:25 +0800
Subject: [PATCH] feat:新增销售指标 产品板块 重点工作 专项业务 产品收入和合同统计修改功能 feat:承兑新增承兑编号字段 feat:客商主数据更新名称 专项业务去年同月字段 机动车销售发票地址字段及判断 feat:银行流水更新客户id feat:机动车销售发票新增税务及代码字段 feat:流水更新按钮参数 feat:检索新增标的物运维按钮

---
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java |  111 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 105 insertions(+), 6 deletions(-)

diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java
index fe543dc..8844e4b 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java
@@ -1,5 +1,6 @@
 package com.by4cloud.platformx.business.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 
 import cn.hutool.core.util.ObjUtil;
@@ -8,20 +9,26 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.by4cloud.platformx.business.dto.BusinessCustomerAddDTO;
 import com.by4cloud.platformx.business.entity.BusinessCustomer;
+import com.by4cloud.platformx.business.entity.Contract;
 import com.by4cloud.platformx.business.mapper.BipBanklViewMapper;
 import com.by4cloud.platformx.business.mapper.BipViewMapper;
 import com.by4cloud.platformx.business.mapper.BusinessCustomerMapper;
+import com.by4cloud.platformx.business.mapper.ContractMapper;
 import com.by4cloud.platformx.business.service.BusinessCustomerService;
-import com.by4cloud.platformx.business.vo.BankNameVo;
-import com.by4cloud.platformx.business.vo.BusinessCustomerMainVo;
-import com.by4cloud.platformx.business.vo.CustBankVo;
-import com.by4cloud.platformx.business.vo.CustInfoVo;
+import com.by4cloud.platformx.business.vo.*;
 import com.by4cloud.platformx.common.core.util.R;
+import com.by4cloud.platformx.common.excel.vo.ErrorMessage;
+import com.by4cloud.platformx.common.security.util.SecurityUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.validation.BindingResult;
 
+import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 /**
  * 瀹㈠晢淇℃伅
@@ -34,8 +41,15 @@
 @Service
 public class BusinessCustomerServiceImpl extends ServiceImpl<BusinessCustomerMapper, BusinessCustomer> implements BusinessCustomerService {
 
+	@Value("${dept.smj}")
+	private String smj;
+
+	@Value("${dept.smjhw}")
+	private String smjhw;
+
 	private final BipViewMapper bipViewMapper;
 	private final BipBanklViewMapper bipBanklViewMapper;
+	private final ContractMapper contractMapper;
 
 	@Override
 	public R syncMainBusCus(String compId) {
@@ -121,12 +135,15 @@
 		if (StrUtil.isBlank(addDTO.getCompanyName())||StrUtil.isBlank(addDTO.getCreditCode())){
 			return R.failed("瀹㈠晢鍚嶇О鎴栫ぞ浼氫俊鐢ㄤ唬鐮佷笉鑳戒负绌�");
 		}
-		BusinessCustomer bc = baseMapper.selectOne(Wrappers.<BusinessCustomer>lambdaQuery().eq(BusinessCustomer::getCompanyName,addDTO.getCompanyName())
-				.eq(BusinessCustomer::getCreditCode,addDTO.getCreditCode()).last("limit 1"));
+		BusinessCustomer bc = baseMapper.selectOne(Wrappers.<BusinessCustomer>lambdaQuery()
+				.eq(BusinessCustomer::getCreditCode,addDTO.getCreditCode())
+				.eq(BusinessCustomer::getCompId, SecurityUtils.getUser().getCompId())
+				.last("limit 1"));
 		if (ObjUtil.isNotNull(bc)){
 			return R.failed("瀹㈠晢宸插瓨鍦�");
 		}
 		BusinessCustomer customer = new BusinessCustomer();
+		customer.setErpCompanyCode(addDTO.getErpCompanyCode());
 		log.info("涓绘暟鎹煡璇}淇℃伅",addDTO.getCompanyName());
 		CustInfoVo custInfo = bipViewMapper.selectBaseInfoByCustName(addDTO.getCompanyName());
 		if (ObjUtil.isNotNull(custInfo)){
@@ -161,9 +178,91 @@
 				}
 			}
 			customer.setRegisterName(custInfo.getCustName());
+			customer.setBipCode(custInfo.getCertificateId());
 			baseMapper.insert(customer);
 			return R.ok();
 		}
 		return R.failed("涓绘暟鎹鍟嗕俊鎭笉瀛樺湪");
 	}
+
+	@Override
+	public R importBusinessCustomer(List<BusinessCustomerImportVo> excelVOList, BindingResult bindingResult) {
+		List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
+		if (CollUtil.isNotEmpty(excelVOList)) {
+			Long line = 0L;
+			for (BusinessCustomerImportVo excelVO : excelVOList
+			) {
+				Set<String> errorMsg = new HashSet<>();
+				if (StrUtil.isBlank(excelVO.getCreditCode())||StrUtil.isBlank(excelVO.getErpCompanyCode())){
+					errorMsg.add(excelVO.getCompanyName()+"绀句細淇$敤浠g爜鎴朎RP瀹㈡埛缂栫爜涓嶈兘涓虹┖");
+					errorMessageList.add(new ErrorMessage(line++, errorMsg));
+					continue;
+				}
+				BusinessCustomer customer = null;
+				if (StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smj) || StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smjhw)) {
+					List<String> smjList = new ArrayList<>();
+					smjList.add(smj);
+					smjList.add(smjhw);
+					customer = baseMapper.selectOne(Wrappers.<BusinessCustomer>lambdaQuery()
+							.eq(BusinessCustomer::getCreditCode, excelVO.getCreditCode())
+							.in(BusinessCustomer::getCompId, smjList)
+							.last("limit 1"));
+				}else {
+					customer = baseMapper.selectOne(Wrappers.<BusinessCustomer>lambdaQuery()
+							.eq(BusinessCustomer::getCreditCode, excelVO.getCreditCode())
+							.last("limit 1"));
+				}
+				if (ObjUtil.isNull(customer)) {
+					customer = BeanUtil.copyProperties(excelVO, BusinessCustomer.class);
+					CustInfoVo custInfo = bipViewMapper.selectBaseInfoByCertId(excelVO.getCreditCode());
+					if (ObjUtil.isNotNull(custInfo)) {
+						customer.setCreditCode(custInfo.getCertificateId());
+						customer.setRegisterName(custInfo.getCustName());
+						customer.setLegalPerson(custInfo.getLegalPerson());
+						customer.setAddress(custInfo.getRegistrationAddress());
+						customer.setProvince(customer.getCreditCode().substring(2, 4));
+						customer.setInvoiceType("01");
+						log.info("{}涓绘暟鎹煡璇㈠悕绉般�佹硶浜恒�佸湴鍧�銆佷俊鐢ㄧ爜淇℃伅鎴愬姛", excelVO.getCompanyName());
+						List<CustBankVo> bankVoList = bipViewMapper.selectBankByCustName(excelVO.getCompanyName());
+						if (CollUtil.isNotEmpty(bankVoList)) {
+							customer.setBankAccount(bankVoList.get(0).getBankAccount());
+							log.info("{}涓绘暟鎹煡璇㈤摱琛屽崱鍙蜂俊鎭垚鍔�", excelVO.getCompanyName());
+							List<BankNameVo> bankNameVoList = bipBanklViewMapper.selectBankByCode(bankVoList.get(0).getBankName());
+							if (CollUtil.isNotEmpty(bankNameVoList)) {
+								customer.setBankName(bankNameVoList.get(0).getBankNameName());
+								log.info("{}涓绘暟鎹煡璇㈤摱琛屽悕绉颁俊鎭垚鍔�", excelVO.getCompanyName());
+							}
+						}
+						customer.setRegisterName(custInfo.getCustName());
+						baseMapper.insert(customer);
+					}
+				}
+			}
+		}
+		return R.ok();
+	}
+
+	@Override
+	public R syncCustomer(Long id) {
+		BusinessCustomer customer = baseMapper.selectById(id);
+		if (ObjUtil.isNull(customer)||StrUtil.isBlank(customer.getCreditCode())){
+			return R.failed("瀹㈡埛淇℃伅寮傚父");
+		}
+		CustInfoVo custInfo = bipViewMapper.selectBaseInfoByCertId(customer.getCreditCode());
+		if (ObjUtil.isNull(custInfo)) {
+			return R.failed("涓绘暟鎹棤璇ュ鎴蜂俊鎭紝鏃犳硶鏇存柊");
+		}
+		customer.setCreditCode(custInfo.getCertificateId());
+		baseMapper.updateById(customer);
+		List<Contract> contractList = contractMapper.selectList(Wrappers.<Contract>lambdaQuery()
+				.eq(Contract::getPartyAId,id)
+				.eq(Contract::getContractStatus,2));
+		if (CollUtil.isNotEmpty(contractList)){
+			contractList.stream().forEach(contract -> {
+				contract.setPartyA(customer.getCompanyName());
+				contractMapper.updateById(contract);
+			});
+		}
+		return R.ok();
+	}
 }
\ No newline at end of file

--
Gitblit v1.9.1