From e02812df9217d3e50a368a8234c07c60c64c0ff4 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期三, 05 八月 2026 08:34:26 +0800
Subject: [PATCH] feat:新增石煤机 机械厂模版合同/客户数据主数据同步接口/合同履约进度新增质保结束操作/合同开票状态 修改为待开 可开 已开/出库逻辑完善

---
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java |   57 +++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 45 insertions(+), 12 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 fcdd569..0767e4d 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
@@ -11,6 +11,7 @@
 import com.by4cloud.platformx.business.mapper.BusinessCustomerMapper;
 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.common.core.util.R;
@@ -35,11 +36,15 @@
 	private final BipBanklViewMapper bipBanklViewMapper;
 
 	@Override
-	public R syncMainBusCus() {
-		List<BusinessCustomer> bcList = baseMapper.selectList(Wrappers.<BusinessCustomer>lambdaQuery().isNull(BusinessCustomer::getCreditCode)
-				.or().isNull(BusinessCustomer::getLegalPerson).or().isNull(BusinessCustomer::getLegalPerson)
-				.or().isNull(BusinessCustomer::getBankName).or().isNull(BusinessCustomer::getBankAccount)
-				.or().isNull(BusinessCustomer::getRegisterName));
+	public R syncMainBusCus(String compId) {
+		List<BusinessCustomer> bcList = baseMapper.selectList(Wrappers.<BusinessCustomer>lambdaQuery()
+				.eq(StrUtil.isNotEmpty(compId),BusinessCustomer::getCompId,compId)
+				.and(wrapper -> wrapper.isNull(BusinessCustomer::getCreditCode)
+				.or().isNull(BusinessCustomer::getLegalPerson)
+				.or().isNull(BusinessCustomer::getBankName)
+				.or().isNull(BusinessCustomer::getBankAccount)
+				.or().isNull(BusinessCustomer::getRegisterName))
+		);
 		if (ArrayUtil.isNotEmpty(bcList.toArray())){
 			for (BusinessCustomer bc:bcList
 				 ) {
@@ -48,21 +53,21 @@
 				if (ObjUtil.isNotNull(custInfo)){
 					bc.setCreditCode(custInfo.getCertificateId());
 					bc.setRegisterName(custInfo.getCustName());
-					bc.setLegalPerson(custInfo.getLegalGerson());
+					bc.setLegalPerson(custInfo.getLegalPerson());
 					bc.setAddress(custInfo.getRegistrationAddress());
 					baseMapper.updateById(bc);
 					log.info("{}鍚屾鍚嶇О銆佹硶浜恒�佸湴鍧�銆佷俊鐢ㄧ爜淇℃伅鎴愬姛",bc.getCompanyName());
 				}
-				CustBankVo bankVo = bipViewMapper.selectBankByCustName(bc.getCompanyName());
-				if (ObjUtil.isNotNull(bankVo)){
+				List<CustBankVo> bankVoList = bipViewMapper.selectBankByCustName(bc.getCompanyName());
+				if (ArrayUtil.isNotEmpty(bankVoList.toArray())){
 					if (StrUtil.isEmpty(bc.getBankAccount())){
-						bc.setBankAccount(bankVo.getBankAccount());
+						bc.setBankAccount(bankVoList.get(0).getBankAccount());
 						baseMapper.updateById(bc);
 						log.info("{}鍚屾閾惰鍗″彿淇℃伅鎴愬姛",bc.getCompanyName());
 					}
-					BankNameVo bankNameVo = bipBanklViewMapper.selectBankByCode(bankVo.getBankName());
-					if (ObjUtil.isNotNull(bankVo)){
-						bc.setBankName(bankNameVo.getBankNameName());
+					List<BankNameVo> bankNameVoList = bipBanklViewMapper.selectBankByCode(bankVoList.get(0).getBankName());
+					if (ArrayUtil.isNotEmpty(bankNameVoList.toArray())){
+						bc.setBankName(bankNameVoList.get(0).getBankNameName());
 						baseMapper.updateById(bc);
 						log.info("{}鍚屾閾惰鍚嶇О淇℃伅鎴愬姛",bc.getCompanyName());
 					}
@@ -72,4 +77,32 @@
 		}
 		return R.ok();
 	}
+
+	@Override
+	public BusinessCustomerMainVo queryMainBC(String companyName) {
+		BusinessCustomerMainVo bc = new BusinessCustomerMainVo();
+		bc.setCompanyName(companyName);
+		log.info("涓绘暟鎹煡璇}淇℃伅",companyName);
+		CustInfoVo custInfo = bipViewMapper.selectBaseInfoByCustName(companyName);
+		if (ObjUtil.isNotNull(custInfo)){
+			bc.setCreditCode(custInfo.getCertificateId());
+			bc.setRegisterName(custInfo.getCustName());
+			bc.setLegalPerson(custInfo.getLegalPerson());
+			bc.setAddress(custInfo.getRegistrationAddress());
+			log.info("{}涓绘暟鎹煡璇㈠悕绉般�佹硶浜恒�佸湴鍧�銆佷俊鐢ㄧ爜淇℃伅鎴愬姛",companyName);
+		}
+		List<CustBankVo> bankVoList = bipViewMapper.selectBankByCustName(bc.getCompanyName());
+		if (ArrayUtil.isNotEmpty(bankVoList.toArray())){
+			if (StrUtil.isEmpty(bc.getBankAccount())){
+				bc.setBankAccount(bankVoList.get(0).getBankAccount());
+				log.info("{}涓绘暟鎹煡璇㈤摱琛屽崱鍙蜂俊鎭垚鍔�",companyName);
+			}
+			List<BankNameVo> bankNameVoList = bipBanklViewMapper.selectBankByCode(bankVoList.get(0).getBankName());
+			if (ArrayUtil.isNotEmpty(bankNameVoList.toArray())){
+				bc.setBankName(bankNameVoList.get(0).getBankNameName());
+				log.info("{}涓绘暟鎹煡璇㈤摱琛屽悕绉颁俊鎭垚鍔�",companyName);
+			}
+		}
+		return bc;
+	}
 }
\ No newline at end of file

--
Gitblit v1.9.1