From b967d23ae6c1f7761feb3c5328e3b591df6a735d Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期三, 26 八月 2026 10:51:41 +0800
Subject: [PATCH] feat:进行中合同导入
---
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java | 49 +++++++++++++++++++++++++++----------------------
1 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java
index d653e4e..1bb9245 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java
@@ -1,8 +1,8 @@
package com.by4cloud.platformx.business.service.impl;
import cn.hutool.core.bean.BeanUtil;
+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.toolkit.Wrappers;
@@ -12,7 +12,6 @@
import com.by4cloud.platformx.business.mapper.*;
import com.by4cloud.platformx.business.service.ContractPaymentScheduleProcessService;
import com.by4cloud.platformx.business.vo.ContractPaymentScheduleVo;
-import com.by4cloud.platformx.business.vo.ScheduleProcessVo;
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.security.util.SecurityUtils;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
@@ -45,13 +44,13 @@
if (ObjUtil.isNull(schedule)) {
return R.failed("灞ョ害闃舵涓庡悎鍚屼笉涓�鑷达紝璇疯仈绯绘妧鏈汉鍛�");
}
- if (schedule.getStageName().equals("璐у埌绛炬敹") && ArrayUtil.isEmpty(addDTO.getContractOutBoundIds().toArray())) {
+ if (schedule.getStageName().equals("璐у埌绛炬敹") && CollUtil.isEmpty(addDTO.getContractOutBoundIds())) {
return R.failed("璇烽�夋嫨鍒拌揣鐨勫嚭搴撲俊鎭�");
}
//鍚堝悓
Contract contract = contractMapper.selectById(schedule.getContractId());
List<ContractSubjectMatter> subjectMatterList = subjectMatterMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery().eq(ContractSubjectMatter::getContractId, contract.getId()));
- if (ArrayUtil.isEmpty(subjectMatterList.toArray())) {
+ if (CollUtil.isEmpty(subjectMatterList)) {
return R.failed("璇ュ悎鍚屾爣鐨勭墿寮傚父锛岃鑱旂郴鎶�鏈汉鍛�");
}
// if (!subjectMatterList.stream().allMatch(item -> item.getDeliveryStatus() == 2)) {
@@ -96,8 +95,8 @@
List<ContractOutBound> contractOutBoundList = contractOutBoundMapper.selectList(Wrappers.<ContractOutBound>lambdaQuery().eq(ContractOutBound::getContractId, contract.getId())
.isNotNull(ContractOutBound::getArrivalTime));
if (schedule.getStageName().equals("璐у埌绛炬敹")) {
- if (ArrayUtil.isNotEmpty(contractOutBoundList.toArray())
- && ArrayUtil.isNotEmpty(subjectMatterList.toArray())) {
+ if (CollUtil.isNotEmpty(contractOutBoundList)
+ && CollUtil.isNotEmpty(subjectMatterList)) {
Map<String, BigDecimal> sumMap = contractOutBoundList.stream()
.collect(Collectors.groupingBy(
ContractOutBound::getSubjectMatterCode,
@@ -132,14 +131,15 @@
//瀹㈡埛浠樻瀹屾垚鍚堝悓
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
) {
PaymentConfirm contractLastConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId,completeContract.getId())
.orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
//鏌ヨ瀹㈡埛浠樻瀹屾垚鍚堝悓涓渶鍚庢槑缁嗛噾棰� 鏈夐鏀惰浆鍏ュ綋鍓嶅悎鍚�
- if (contractLastConfirm.getTotalAmount().compareTo(new BigDecimal("0"))>0){
+ if (contractLastConfirm.getTotalAmount().compareTo(new BigDecimal("0"))>0&&
+ contract.getContractNo().startsWith("ZB-")){
//鏂板瀹屾垚浠樻鍚堝悓 璧勯噾杞嚭
PaymentConfirm outConfirm = BeanUtil.copyProperties(contractLastConfirm,PaymentConfirm.class,"id","transationAmount",
"advanceAmount","receivableAmount","overdueAmount","totalAmount");
@@ -151,7 +151,7 @@
outAmountList.add(outConfirm.getTransationAmount());
}
}
- if (ArrayUtil.isNotEmpty(outAmountList.toArray())){
+ if (CollUtil.isNotEmpty(outAmountList)){
BigDecimal currentSum = new BigDecimal("0");
for (BigDecimal currentAmount:outAmountList
) {
@@ -168,13 +168,16 @@
}else if (inConfirm.getTotalAmount().compareTo(new BigDecimal("0"))<0){
inConfirm.setReceivableAmount(inConfirm.getTotalAmount().multiply(new BigDecimal("-1")));
}
- paymentConfirmMapper.insert(inConfirm);
+ if (contract.getContractNo().startsWith("ZB-")) {
+ paymentConfirmMapper.insert(inConfirm);
+ }
}
}
}
}
currentConfim.setTotalAmount(lastTotal.subtract(currentConfim.getReceivableAmount()));
- if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
+ if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0&&
+ contract.getContractNo().startsWith("ZB-")) {
paymentConfirmMapper.insert(currentConfim);
//鏇存柊褰撳墠闃舵浠樻鎯呭喌
if (lastTotal.compareTo(new BigDecimal("0"))>0){
@@ -194,7 +197,7 @@
List<ContractPaymentSchedule> afterSchedule = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
.eq(ContractPaymentSchedule::getContractId, schedule.getContractId())
.gt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder()));
- 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(), "璐ㄤ繚閲�")) {
@@ -223,7 +226,7 @@
lastNewTotal = lastNewConfirm.getTotalAmount();
}
newConfim.setTotalAmount(lastNewTotal.subtract(newConfim.getReceivableAmount()));
- if (endSchedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
+ if (endSchedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0&&contract.getContractNo().startsWith("ZB-")){
paymentConfirmMapper.insert(newConfim);
}
@@ -233,12 +236,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());
// contractPaymentScheduleMapper.updateById(schedule);
//鏇存柊鍚堝悓涓嬩釜闃舵
@@ -247,7 +250,8 @@
//褰撳墠涓哄悎鍚屾渶鍚庨樁娈�
PaymentConfirm lastNewConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
.orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
- if (lastNewConfirm.getTotalAmount().compareTo(new BigDecimal("0")) >= 0) {
+ if (lastNewConfirm.getTotalAmount().compareTo(new BigDecimal("0")) >= 0
+ &&contract.getBillingAmout().compareTo(contract.getAmount())==0) {
//鏈夐浠樹笖瓒呰繃搴旀敹 鍏抽棴鍚堝悓鐘舵��
contract.setContractStatus(3);
contractMapper.updateById(contract);
@@ -276,7 +280,7 @@
lastTotal = lastConfirm.getTotalAmount();
}
currentConfim.setTotalAmount(lastTotal.subtract(currentConfim.getReceivableAmount()));
- if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
+ if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0&&contract.getContractNo().startsWith("ZB-")){
paymentConfirmMapper.insert(currentConfim);
//鏇存柊褰撳墠闃舵浠樻鎯呭喌
if (lastTotal.compareTo(new BigDecimal("0"))>0){
@@ -296,7 +300,7 @@
.eq(ContractPaymentSchedule::getContractId, schedule.getContractId())
.gt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder())
.gt(ContractPaymentSchedule::getPaymentRatio,"0"));
- 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(), "璐ㄤ繚閲�")) {
@@ -345,12 +349,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());
// contractPaymentScheduleMapper.updateById(schedule);
//鏇存柊鍚堝悓涓嬩釜闃舵
@@ -359,7 +363,8 @@
//褰撳墠涓哄悎鍚屾渶鍚庨樁娈�
PaymentConfirm lastNewConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
.orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
- if (lastNewConfirm.getTotalAmount().compareTo(new BigDecimal("0")) >= 0) {
+ if (lastNewConfirm.getTotalAmount().compareTo(new BigDecimal("0")) >= 0
+ &&contract.getBillingAmout().compareTo(contract.getAmount())==0) {
//鏈夐浠樹笖瓒呰繃搴旀敹 鍏抽棴鍚堝悓鐘舵��
contract.setContractStatus(3);
contractMapper.updateById(contract);
@@ -387,7 +392,7 @@
lastNewTotal = lastNewConfirm.getTotalAmount();
}
newConfim.setTotalAmount(lastNewTotal.subtract(newConfim.getReceivableAmount()));
- if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
+ if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0&&contract.getContractNo().startsWith("ZB-")) {
paymentConfirmMapper.insert(newConfim);
//鏇存柊褰撳墠闃舵浠樻鎯呭喌
if (lastNewTotal.compareTo(new BigDecimal("0"))>0){
--
Gitblit v1.9.1