From 2db76f2066701cbe292f206ad49a7f8523b8aa9f Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期五, 14 八月 2026 16:30:25 +0800
Subject: [PATCH] feat:银行流水关联多个合同,新增预收款开票,所有List校验调整为ColUtil

---
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java |   63 +++++++++++++++++++++----------
 1 files changed, 42 insertions(+), 21 deletions(-)

diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java
index a0d71bb..8b4e1b6 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java
@@ -1,6 +1,7 @@
 package com.by4cloud.platformx.business.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.date.DatePattern;
 import cn.hutool.core.date.DateUtil;
@@ -54,6 +55,8 @@
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 
+;
+
 /**
  * @author cd
  * @description
@@ -80,6 +83,7 @@
 	private final PaymentSlipMapper paymentSlipMapper;
 	private final ContractInvoiceMapper contractInvoiceMapper;
 	private final StringRedisTemplate redisTemplate;
+	private final ContractOutBoundMapper contractOutBoundMapper;
 
 	@Value("${erp.ymj}")
 	private String ymjErp;
@@ -155,7 +159,7 @@
 			}
 		}
 
-		if (ArrayUtil.isEmpty(addDTO.getContractSubjectMatter().toArray())){
+		if (CollUtil.isEmpty(addDTO.getContractSubjectMatter())){
 			return R.failed("鏍囩殑鐗╀笉鑳戒负绌�");
 		}
 
@@ -183,7 +187,7 @@
 		}
 		baseMapper.insert(contract);
 
-		if (ArrayUtil.isNotEmpty(addDTO.getContractSubjectMatter())) {
+		if (CollUtil.isNotEmpty(addDTO.getContractSubjectMatter())) {
 			addDTO.getContractSubjectMatter().stream().forEach(contractSubjectMatterAddDTO -> {
 				ContractSubjectMatter subjectMatter = BeanUtil.copyProperties(contractSubjectMatterAddDTO, ContractSubjectMatter.class);
 				subjectMatter.setContractId(contract.getId());
@@ -214,7 +218,7 @@
 
 		}
 
-		if (ArrayUtil.isNotEmpty(addDTO.getContractPaymentSchedule())) {
+		if (CollUtil.isNotEmpty(addDTO.getContractPaymentSchedule())) {
 			AtomicInteger index = new AtomicInteger(1);
 			addDTO.getContractPaymentSchedule().stream().forEach(contractPaymentScheduleAddDTO -> {
 				int currentIndex = index.getAndIncrement();
@@ -323,7 +327,7 @@
 		}
 		baseMapper.updateById(contract);
 
-		if (ArrayUtil.isNotEmpty(updateDTO.getContractSubjectMatter())) {
+		if (CollUtil.isNotEmpty(updateDTO.getContractSubjectMatter())) {
 			contractSubjectMatterMapper.delete(Wrappers.<ContractSubjectMatter>lambdaQuery().eq(ContractSubjectMatter::getContractId, contract.getId()));
 
 			updateDTO.getContractSubjectMatter().stream().forEach(contractSubjectMatterAddDTO -> {
@@ -350,7 +354,7 @@
 			});
 		}
 
-		if (ArrayUtil.isNotEmpty(updateDTO.getContractPaymentSchedule())) {
+		if (CollUtil.isNotEmpty(updateDTO.getContractPaymentSchedule())) {
 			contractPaymentScheduleMapper.delete(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, contract.getId()));
 
 			AtomicInteger index = new AtomicInteger(1);
@@ -398,6 +402,21 @@
 		if (ObjUtil.isNotNull(a)){
 			detailVo.setPartyAOrgCode(a.getCreditCode());
 		}
+		List<ContractOutBound> outBoundList = contractOutBoundMapper.selectList(Wrappers.<ContractOutBound>lambdaQuery()
+				.eq(ContractOutBound::getContractId,id).orderByAsc(ContractOutBound::getOutBoundTime));
+		if (CollUtil.isNotEmpty(outBoundList)){
+			detailVo.setContractOutBound(outBoundList);
+		}
+		List<ContractInvoice> invoiceList = contractInvoiceMapper.selectList(Wrappers.<ContractInvoice>lambdaQuery()
+				.eq(ContractInvoice::getContractId,id).orderByAsc(ContractInvoice::getCreateTime));
+		if (CollUtil.isNotEmpty(invoiceList)){
+			detailVo.setContractInvoice(invoiceList);
+		}
+		List<PaymentSlip> slipList = paymentSlipMapper.selectList(Wrappers.<PaymentSlip>lambdaQuery()
+				.eq(PaymentSlip::getContractId,id).orderByAsc(PaymentSlip::getPaymentTime));
+		if (CollUtil.isNotEmpty(slipList)){
+			detailVo.setPaymentSlip(slipList);
+		}
 		return detailVo;
 	}
 
@@ -426,7 +445,7 @@
 		List<ContractSubjectMatter> subjectMatterList = contractSubjectMatterMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery()
 				.eq(ContractSubjectMatter::getContractId,id));
 		if (StrUtil.isNotEmpty(contract.getContractCategory()) && StrUtil.equals(contract.getContractCategory(), "water_house")) {
-			if (ArrayUtil.isNotEmpty(subjectMatterList.toArray())) {
+			if (CollUtil.isNotEmpty(subjectMatterList)) {
 				for (ContractSubjectMatter contractSubjectMatter: subjectMatterList)  {
 					if (StrUtil.equals(contract.getExecFrequency(), "1")) {
 						Long weeksTrue = DateUtil.betweenWeek(DateUtil.beginOfWeek(contract.getEffectiveDate()),
@@ -576,7 +595,7 @@
 					.eq(ContractPaymentSchedule::getContractId, fitstSchedule.getContractId())
 					.gt(ContractPaymentSchedule::getStageOrder, fitstSchedule.getStageOrder())
 					.orderByAsc(ContractPaymentSchedule::getCreateTime));
-			if (ArrayUtil.isNotEmpty(afterSchedule.toArray()) && afterSchedule.size() == 1) {
+			if (ArrayUtil.isNotEmpty(afterSchedule) && afterSchedule.size() == 1) {
 				//鏈�鍚庨樁娈电敓鏁堟椂闂�
 				ContractPaymentSchedule endSchedule = afterSchedule.get(0);
 				if (StrUtil.equals(endSchedule.getStageName(), "璐ㄤ繚閲�")) {
@@ -610,7 +629,7 @@
 				contract.setNextScheduleName(endSchedule.getStageName());
 				baseMapper.updateById(contract);
 			}
-			if (ArrayUtil.isNotEmpty(afterSchedule.toArray()) && afterSchedule.size() > 1) {
+			if (ArrayUtil.isNotEmpty(afterSchedule) && afterSchedule.size() > 1) {
 				//绗竴闃舵鐢熸晥鏃堕棿
 //			fitstSchedule.setEffectiveEndDate(DateUtil.offsetDay(contract.getSignDate(),fitstSchedule.getAgreedDays()));
 //			contractPaymentScheduleMapper.updateById(fitstSchedule);
@@ -619,7 +638,7 @@
 				baseMapper.updateById(contract);
 			}
 			//鍙湁褰撳墠鍚堝悓绛惧瓧闃舵
-//		if(ArrayUtil.isEmpty(afterSchedule.toArray())){
+//		if(ArrayUtil.isEmpty(afterSchedule)){
 //			fitstSchedule.setEffectiveEndDate(DateUtil.offsetDay(contract.getSignDate(),fitstSchedule.getAgreedDays()));
 //			contractPaymentScheduleMapper.updateById(fitstSchedule);
 //		}
@@ -641,7 +660,7 @@
 					request.put("moneySum",contract.getAmount());
 					request.put("signManner","闈㈢");
 					request.put("salesman","");
-					if (ArrayUtil.isNotEmpty(subjectMatterList.toArray())){
+					if (ArrayUtil.isNotEmpty(subjectMatterList)){
 						JSONArray subjectMatter = new JSONArray();
 						subjectMatterList.stream().forEach(contractSubjectMatter -> {
 							JSONObject subjectMatterItem = new JSONObject();
@@ -834,7 +853,7 @@
 					outAmountList.add(outConfirm.getTransationAmount());
 				}
 			}
-			if (ArrayUtil.isNotEmpty(outAmountList.toArray())) {
+			if (ArrayUtil.isNotEmpty(outAmountList)) {
 				BigDecimal currentInSum = outAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
 				//鏂板褰撳墠鍚堝悓 璧勯噾杞叆
 				PaymentConfirm inConfirm = BeanUtil.copyProperties(paymentConfirm, PaymentConfirm.class, "id", "transationAmount",
@@ -870,7 +889,7 @@
 				.lt(ContractPaymentSchedule::getEffectiveEndDate, DateUtil.today())
 				.ne(ContractPaymentSchedule::getPaymentStatus, "2")
 				.ne(ContractPaymentSchedule::getPaymentStatus, 3));
-		if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
+		if (ArrayUtil.isNotEmpty(scheduleList)) {
 			scheduleList.stream().forEach(contractPaymentSchedule -> {
 				Contract contract = baseMapper.selectById(contractPaymentSchedule.getContractId());
 				if (ObjUtil.isNotNull(contract)) {
@@ -1077,7 +1096,7 @@
 	public R genCycleReceiced() {
 		List<ContractExecDate> execDateList = contractExecDateMapper.selectList(Wrappers.<ContractExecDate>lambdaQuery()
 				.le(ContractExecDate::getExecDate, DateUtil.today()).eq(ContractExecDate::getGenFlag,"0"));
-		if (ArrayUtil.isNotEmpty(execDateList.toArray())) {
+		if (ArrayUtil.isNotEmpty(execDateList)) {
 			execDateList.stream().forEach(contractExecDate -> {
 				Contract contract = baseMapper.selectById(contractExecDate.getContractId());
 				ContractSubjectMatter subjectMatter = contractSubjectMatterMapper.selectOne(Wrappers.<ContractSubjectMatter>lambdaQuery()
@@ -1587,10 +1606,10 @@
 
 	@Override
 	public R addContractSgb(ContractAddDTO addDTO) {
-		if (ArrayUtil.isEmpty(addDTO.getContractSubjectMatter().toArray())){
+		if (ArrayUtil.isEmpty(addDTO.getContractSubjectMatter())){
 			return R.failed("璇锋坊鍔犳爣鐨勭墿");
 		}
-		if (ArrayUtil.isEmpty(addDTO.getContractPaymentSchedule().toArray())){
+		if (ArrayUtil.isEmpty(addDTO.getContractPaymentSchedule())){
 			return R.failed("璇锋坊鍔犱粯娆鹃樁娈垫垨浠樻闃舵缂哄皯");
 		}
 		if (!isValidPaymentStages(addDTO.getContractPaymentSchedule())){
@@ -1710,10 +1729,10 @@
 
 	@Override
 	public R updateContractSgb(ContractUpdateDTO updateDTO) {
-		if (ArrayUtil.isEmpty(updateDTO.getContractSubjectMatter().toArray())){
+		if (ArrayUtil.isEmpty(updateDTO.getContractSubjectMatter())){
 			return R.failed("璇锋坊鍔犳爣鐨勭墿");
 		}
-		if (ArrayUtil.isEmpty(updateDTO.getContractPaymentSchedule().toArray())){
+		if (ArrayUtil.isEmpty(updateDTO.getContractPaymentSchedule())){
 			return R.failed("璇锋坊鍔犱粯娆鹃樁娈垫垨浠樻闃舵缂哄皯");
 		}
 		if (!isValidPaymentStages(updateDTO.getContractPaymentSchedule())){
@@ -1964,20 +1983,22 @@
 	@Override
 	public Page fourAssociation(Page page,ContractQueryDTO queryDTO) {
 		Page<FourAssociationPageVo> page1 = baseMapper.fourAssociation(page,queryDTO,DataScope.of("comp_id"));
-		if (ArrayUtil.isNotEmpty(page1.getRecords().toArray())){
+		if (ArrayUtil.isNotEmpty(page1.getRecords())){
 			page1.getRecords().stream().forEach(fourAssociationPageVo -> {
 				List<PaymentSlip> slips = paymentSlipMapper.selectList(Wrappers.<PaymentSlip>lambdaQuery().eq(PaymentSlip::getContractId,fourAssociationPageVo.getId())
 						.orderByAsc(PaymentSlip::getPaymentTime));
-				if (ArrayUtil.isNotEmpty(slips.toArray())){
+				if (ArrayUtil.isNotEmpty(slips)){
 					fourAssociationPageVo.setSlipVoList(BeanUtil.copyToList(slips,ContractSlipVo.class));
 				}
 				List<ContractInvoice> invoices = contractInvoiceMapper.selectList(Wrappers.<ContractInvoice>lambdaQuery().eq(ContractInvoice::getContractId,fourAssociationPageVo.getId())
 						.orderByAsc(ContractInvoice::getInvoiceTime));
-				if (ArrayUtil.isNotEmpty(invoices.toArray())){
+				if (ArrayUtil.isNotEmpty(invoices)){
 					fourAssociationPageVo.setInvoiceVoList(BeanUtil.copyToList(invoices, ContractInvoiceVo.class));
 				}
 				if (fourAssociationPageVo.getAmount().compareTo(fourAssociationPageVo.getPaidAmount())==0&&
-						fourAssociationPageVo.getAmount().compareTo(fourAssociationPageVo.getBillingAmout())==0){
+						fourAssociationPageVo.getAmount().compareTo(fourAssociationPageVo.getBillingAmout())==0&&
+					ArrayUtil.isNotEmpty(slips)&&ArrayUtil.isNotEmpty(invoices)
+				){
 					fourAssociationPageVo.setAssociation("宸插畬鎴�");
 				}
 			});

--
Gitblit v1.9.1