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/OutBoundServiceImpl.java |   45 +++++++++++++++++++++++----------------------
 1 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java
index 5f9b207..2a7809e 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java
@@ -1,9 +1,8 @@
 package com.by4cloud.platformx.business.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.date.DatePattern;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.ArrayUtil;
 import cn.hutool.core.util.ObjUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -26,6 +25,8 @@
 import java.math.RoundingMode;
 import java.util.*;
 import java.util.stream.Collectors;
+
+;
 
 /**
  * EPR鍑哄簱璁板綍
@@ -63,7 +64,7 @@
 
 	@Override
 	public R add(OutBoundAddDTO addDTO) {
-		if (ArrayUtil.isEmpty(addDTO.getSubjectMatterList().toArray())) {
+		if (CollUtil.isEmpty(addDTO.getSubjectMatterList())) {
 			return R.failed("鍑哄簱鏍囩殑鐗╀笉鑳戒负绌�");
 		}
 		MPJLambdaWrapper<ContractSubjectMatter> wrapper = new MPJLambdaWrapper<ContractSubjectMatter>()
@@ -79,7 +80,7 @@
 				)
 				.orderByAsc(ContractSubjectMatter::getCreateTime);
 		List<ContractSubjectMatter> subjectMatterList = contractSubjectMatterMapper.selectList(wrapper);
-		if (ArrayUtil.isEmpty(subjectMatterList.toArray())) {
+		if (CollUtil.isEmpty(subjectMatterList)) {
 			return R.failed("娌℃湁鏌ヨ鍒扮浉鍏冲悎鍚岃鍗�");
 		}
 		List<String> erpCodeList = subjectMatterList.stream().map(ContractSubjectMatter::getMaterialCode).collect(Collectors.toList());
@@ -185,7 +186,7 @@
 		});
 
 		//鍑哄簱搴旀敹娆炬槑缁�
-		if (ArrayUtil.isNotEmpty(currentOutMap.keySet())) {
+		if (CollUtil.isNotEmpty(currentOutMap.keySet())) {
 			for (Long contractId : currentOutMap.keySet()) {
 				//褰撳墠鍑哄簱鍚堝悓鍑哄簱鏍囩殑鐗�
 				List<ContractSubjectMatter> contractSubjectMatterList = contractSubjectMatterMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery()
@@ -264,7 +265,7 @@
 							//瀹㈡埛浠樻瀹屾垚鍚堝悓
 							List<Contract> customerCompleteContractList = contractMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getPartyAId, contract.getPartyAId())
 									.eq(Contract::getPartyBId, SecurityUtils.getUser().getCompId()).apply(" amount = paid_amount"));
-							if (ArrayUtil.isNotEmpty(customerCompleteContractList)) {
+							if (CollUtil.isNotEmpty(customerCompleteContractList)) {
 								List<BigDecimal> outAmountList = new ArrayList<>();
 								for (Contract completeContract : customerCompleteContractList
 								) {
@@ -283,7 +284,7 @@
 										outAmountList.add(outConfirm.getTransationAmount());
 									}
 								}
-								if (ArrayUtil.isNotEmpty(outAmountList.toArray())) {
+								if (CollUtil.isNotEmpty(outAmountList)) {
 									BigDecimal currentInSum = outAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
 									//鏂板褰撳墠鍚堝悓 璧勯噾杞叆
 									PaymentConfirm inConfirm = BeanUtil.copyProperties(paymentConfirm, PaymentConfirm.class, "id", "transationAmount",
@@ -316,7 +317,7 @@
 						//鏌ヨ鏄惁鏈夊悗缁樁娈�
 //						List<ContractPaymentSchedule> afterSchedule = scheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, contractId)
 //								.gt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder()));
-//						if (ArrayUtil.isEmpty(afterSchedule.toArray())) {
+//						if (.isEmpty(afterSchedule)) {
 //							schedule.setEffectiveEndDate(contract.getExpirationDate());
 //						}
 						scheduleMapper.updateById(schedule);
@@ -346,7 +347,7 @@
 							.eq(ContractPaymentSchedule::getContractId, schedule.getContractId())
 							.gt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder())
 							.orderByAsc(ContractPaymentSchedule::getCreateTime));
-					if (ArrayUtil.isNotEmpty(afterSchedule.toArray()) && afterSchedule.size() == 1) {
+					if (CollUtil.isNotEmpty(afterSchedule) && afterSchedule.size() == 1) {
 						//鏈�鍚庨樁娈电敓鏁堟椂闂�
 						ContractPaymentSchedule endSchedule = afterSchedule.get(0);
 						if (StrUtil.equals(endSchedule.getStageName(), "璐ㄤ繚閲�")) {
@@ -383,12 +384,12 @@
 						contract.setNextScheduleName(endSchedule.getStageName());
 						contractMapper.updateById(contract);
 					}
-					if (ArrayUtil.isNotEmpty(afterSchedule.toArray()) && afterSchedule.size() > 1) {
+					if (CollUtil.isNotEmpty(afterSchedule) && afterSchedule.size() > 1) {
 						//鏇存柊鍚堝悓涓嬩釜闃舵
 						contract.setNextScheduleName(afterSchedule.get(0).getStageName());
 						contractMapper.updateById(contract);
 					}
-					if (ArrayUtil.isEmpty(afterSchedule.toArray())) {
+					if (CollUtil.isEmpty(afterSchedule)) {
 //						schedule.setEffectiveEndDate(contract.getExpirationDate());
 //						scheduleMapper.updateById(schedule);
 						//鏇存柊鍚堝悓涓嬩釜闃舵
@@ -460,7 +461,7 @@
 
 	@Override
 	public R addContractOut(OutBoundAddDTO addDTO) {
-		if (ArrayUtil.isEmpty(addDTO.getSubjectMatterList().toArray())) {
+		if (CollUtil.isEmpty(addDTO.getSubjectMatterList())) {
 			return R.failed("鍑哄簱鏍囩殑鐗╀笉鑳戒负绌�");
 		}
 		// 1. 纭畾鏌ヨ鐢ㄧ殑鍚堝悓缂栧彿瀛楁鍊�
@@ -486,6 +487,10 @@
 		if (ObjUtil.isNull(contract)) {
 			return R.failed("鍚堝悓淇℃伅鏌ヨ澶辫触");
 		}
+		if (addDTO.getSubjectMatterList().stream().allMatch(item->item.getOutBoundNum().compareTo(new BigDecimal("0"))==0)){
+			return R.failed("鍑哄簱鏁伴噺涓嶈兘閮戒负涓�0");
+		}
+		addDTO.setSubjectMatterList(addDTO.getSubjectMatterList().stream().filter(item->item.getOutBoundNum().compareTo(new BigDecimal("0"))>0).collect(Collectors.toList()));
 		//鍑哄簱鏁伴噺鏍¢獙
 		for (OutSubjectMatterAddDTO outSubjectMatterAddDTO:	addDTO.getSubjectMatterList()) {
 			ContractSubjectMatter subjectMatter = contractSubjectMatterMapper.selectOne(Wrappers.<ContractSubjectMatter>lambdaQuery()
@@ -495,9 +500,6 @@
 					.last("limit 1"));
 			if (ObjUtil.isNull(subjectMatter)){
 				continue;
-			}
-			if (outSubjectMatterAddDTO.getOutBoundNum().compareTo(new BigDecimal("0"))==0){
-				return R.failed(outSubjectMatterAddDTO.getSubjectMatterCode()+"鍑哄簱鏁伴噺涓嶈兘涓�0");
 			}
 			if (subjectMatter.getDeliveryStatus()==0){
 				if (outSubjectMatterAddDTO.getOutBoundNum().compareTo(subjectMatter.getQuantity())>0){
@@ -644,7 +646,7 @@
 					//瀹㈡埛浠樻瀹屾垚鍚堝悓
 					List<Contract> customerCompleteContractList = contractMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getPartyAId, contract.getPartyAId())
 							.eq(Contract::getPartyBId, SecurityUtils.getUser().getCompId()).apply(" amount = paid_amount"));
-					if (ArrayUtil.isNotEmpty(customerCompleteContractList)) {
+					if (CollUtil.isNotEmpty(customerCompleteContractList)) {
 						List<BigDecimal> outAmountList = new ArrayList<>();
 						for (Contract completeContract : customerCompleteContractList
 						) {
@@ -663,7 +665,7 @@
 								outAmountList.add(outConfirm.getTransationAmount());
 							}
 						}
-						if (ArrayUtil.isNotEmpty(outAmountList.toArray())) {
+						if (CollUtil.isNotEmpty(outAmountList)) {
 							BigDecimal currentInSum = outAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
 							//鏂板褰撳墠鍚堝悓 璧勯噾杞叆
 							PaymentConfirm inConfirm = BeanUtil.copyProperties(paymentConfirm, PaymentConfirm.class, "id", "transationAmount",
@@ -711,14 +713,13 @@
 			List<ContractPaymentSchedule> afterSchedule = scheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
 					.eq(ContractPaymentSchedule::getContractId, schedule.getContractId())
 					.gt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder())
-					.gt(ContractPaymentSchedule::getPaymentRatio, 0)
 					.orderByAsc(ContractPaymentSchedule::getCreateTime));
-			if (ArrayUtil.isNotEmpty(afterSchedule.toArray())&&contract.getOutBoundAmout().compareTo(contract.getAmount())==0) {
+			if (CollUtil.isNotEmpty(afterSchedule)&&contract.getOutBoundAmout().compareTo(contract.getAmount())==0) {
 				contract.setNextScheduleName(afterSchedule.get(0).getStageName());
 				contractMapper.updateById(contract);
 			}
 
-			if (ArrayUtil.isEmpty(afterSchedule.toArray())) {
+			if (CollUtil.isEmpty(afterSchedule)) {
 				schedule.setEffectiveEndDate(contract.getExpirationDate());
 				scheduleMapper.updateById(schedule);
 				//鏇存柊鍚堝悓涓嬩釜闃舵
@@ -833,12 +834,12 @@
 	@Override
 	public R delOutBound(String batchNumber) {
 		List<OutBound> outBoundList = baseMapper.selectList(Wrappers.<OutBound>lambdaQuery().eq(OutBound::getBatchNumber,batchNumber));
-		if (ArrayUtil.isEmpty(outBoundList)){
+		if (CollUtil.isEmpty(outBoundList)){
 			return R.failed("鍑哄簱淇℃伅寮傚父锛岃鑱旂郴钀ラ攢绯荤粺绠$悊浜哄憳");
 		}
 		List<ContractOutBound> contractOutBoundList = contractOutBoundMapper.selectList(Wrappers.<ContractOutBound>lambdaQuery()
 				.in(ContractOutBound::getOutBoundId,outBoundList.stream().map(OutBound::getId).collect(Collectors.toList())));
-		if (ArrayUtil.isEmpty(contractOutBoundList)){
+		if (CollUtil.isEmpty(contractOutBoundList)){
 			return R.failed("鍑哄簱淇℃伅寮傚父锛岃鑱旂郴钀ラ攢绯荤粺绠$悊浜哄憳");
 		}
 		boolean allZero = true;

--
Gitblit v1.9.1