From 633a003d232e37c79b7135ccda35eda1c69952c6 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期一, 25 五月 2026 17:28:01 +0800
Subject: [PATCH] feat:统计数据测试调整

---
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java |   38 +++++++++++++++++++++++++++-----------
 1 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java
index 81b05af..851c239 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java
@@ -120,7 +120,7 @@
 				}
 				//鏇存柊浠樻闃舵浠樻
 				List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
-						.eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2)
+						.eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2).ne(ContractPaymentSchedule::getPaymentStatus, 3)
 						.orderByAsc(ContractPaymentSchedule::getCreateTime));
 				if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
 					BigDecimal remain = addDTO.getTransationAmount();
@@ -217,6 +217,7 @@
 				;
 			}
 		}else {
+
 			List<Contract> customerContractList = contractService.list(Wrappers.<Contract>lambdaQuery().eq(Contract::getPartyAId, addDTO.getBusGuestId())
 					.eq(Contract::getPartyBId,SecurityUtils.getUser().getCompId()).orderByAsc(Contract::getCreateTime).apply(" amount != paid_amount"));
 			if (ArrayUtil.isEmpty(customerContractList.toArray())) {
@@ -229,6 +230,15 @@
 			if (ObjUtil.isNull(customer)) {
 				return  R.failed("瀹㈠晢鏌ヨ澶辫触");
 			}
+			//鏂板浠樻鍗�
+			PaymentSlip slip = new PaymentSlip();
+			slip.setBusGuestId(customer.getId());
+			slip.setBusGuestName(customer.getCompanyName());
+			slip.setPayeeCompId(SecurityUtils.getUser().getCompId());
+			slip.setPaymentTime(addDTO.getConfirmTime());
+			slip.setPaymentAmount(addDTO.getTransationAmount());
+			slip.setPayType(addDTO.getPayType());
+			paymentSlipMapper.insert(slip);
 
 			BigDecimal transtionAmount = addDTO.getTransationAmount();
 			//鍓╀綑浠樻
@@ -285,7 +295,8 @@
 					break;
 				} else {
 					entity.setTransationAmount(transtionRemainAmount.subtract(lastTotal));
-					entity.setTotalAmount(transtionAmount);
+					entity.setReceivableAmount(transtionRemainAmount.multiply(new BigDecimal("-1")));
+					entity.setTotalAmount(transtionRemainAmount);
 					entity.setConfirmTime(payDate);
 					baseMapper.insert(entity);
 					payContractList.add(contract);
@@ -297,6 +308,7 @@
 				//鏇存柊浠樻闃舵浠樻
 				List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
 						.eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2)
+						.ne(ContractPaymentSchedule::getPaymentStatus, 3)
 						.orderByAsc(ContractPaymentSchedule::getCreateTime));
 				if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
 					BigDecimal remain = transtionAmount;
@@ -351,16 +363,18 @@
 				//鍚堝悓鎵�鏈変粯娆鹃樁娈�
 				List<ContractPaymentSchedule> payComScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
 						.eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 0)
-						);
+						.ne(ContractPaymentSchedule::getPaymentStatus, 3));
 				if (ArrayUtil.isNotEmpty(payComScheduleList.toArray())){
-					BigDecimal payTotal = payComScheduleList.stream().map(item->StrUtil.equals(item.getPaymentStatus() + "", "0") ? item.getPlannedAmount() :
+					BigDecimal payTotal = payComScheduleList.stream().map(item->StrUtil.equals(item.getPaymentStatus() + "", "2") ? item.getPlannedAmount() :
 							item.getActualAmount()).reduce(BigDecimal.ZERO,BigDecimal::add);
 					contract.setPaidAmount(payTotal);
-					if (payComScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) {
-						contract.setContractStatus(3);
-					}
+//					if (payComScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) {
+//						contract.setContractStatus(3);
+//					}
 					contractService.updateById(contract);
 					if (contract.getAmount().compareTo(contract.getPaidAmount()) == 0) {
+						contract.setBillingStatus("2");
+						contract.setContractStatus(3);
 						payCompleteContractList.add(contract);
 					}
 					//浠樻 涓� 浠樻鏈叏浠�
@@ -537,7 +551,7 @@
 			return;
 		}
 		//淇濆瓨浠樻鍗�
-		Boolean codeFlag = savePaymentSlip(customer,record);
+		Boolean codeFlag = savePaymentSlip(customer,record,dept);
 		if (codeFlag){
 			log.error("浠樻鍗昳d锛歿},浠樻鍗曞凡瀛樺湪");
 			return;
@@ -609,7 +623,7 @@
 		payContractList.stream().forEach(contract -> {
 			//鏇存柊浠樻闃舵浠樻
 			List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
-					.eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2)
+					.eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2).ne(ContractPaymentSchedule::getPaymentStatus, 3)
 					.orderByAsc(ContractPaymentSchedule::getCreateTime));
 			if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
 				BigDecimal remain = transtionAmount;
@@ -663,7 +677,7 @@
 			}
 			//鍚堝悓鎵�鏈変粯娆鹃樁娈�
 			List<ContractPaymentSchedule> payComScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
-					.eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 0)
+					.eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 0).ne(ContractPaymentSchedule::getPaymentStatus,3)
 			);
 			if (ArrayUtil.isNotEmpty(payComScheduleList.toArray())){
 				BigDecimal payTotal = payComScheduleList.stream().map(item->StrUtil.equals(item.getPaymentStatus() + "", "0") ? item.getPlannedAmount() :
@@ -708,10 +722,12 @@
 		}
 	}
 
-	private Boolean savePaymentSlip(BusinessCustomer customer, JSONObject record) {
+	private Boolean savePaymentSlip(BusinessCustomer customer, JSONObject record,SysDept dept) {
 		PaymentSlip slip = new PaymentSlip();
 		slip.setBusGuestId(customer.getId());
 		slip.setBusGuestName(customer.getCompanyName());
+		slip.setPayee(dept.getName());
+		slip.setPayeeCompId(dept.getDeptId());
 		slip.setPaymentTime(ObjUtil.isNotNull(record.get("billDate"))?
 				DateUtil.parse(record.getString("billDate"), DatePattern.NORM_DATETIME_FORMAT):new Date());
 		slip.setPaymentAmount(ObjUtil.isNotNull(record.get("bodyItemOriTaxExcludedAmount"))?record.getBigDecimal("bodyItemOriTaxExcludedAmount"):new BigDecimal("0"));

--
Gitblit v1.9.1