From 21dfddd6e09d32a50a636fff62a3d8a2ed362d5a Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期四, 20 八月 2026 16:29:49 +0800
Subject: [PATCH] feat:合同标的物新增导入 银行流水强制确认 简易合同新增 发票重开 合同标的物导入
---
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java | 56 +++++++++++++++++++++++++++++++++-----------------------
1 files changed, 33 insertions(+), 23 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 c0a5002..32a829d 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;
@@ -27,6 +26,8 @@
import java.util.*;
import java.util.stream.Collectors;
+;
+
/**
* EPR鍑哄簱璁板綍
*
@@ -49,6 +50,12 @@
@Value("${dept.smj}")
private String smj;
+ @Value("${dept.smjsc}")
+ private String smjsc;
+
+ @Value("${dept.smjzt}")
+ private String smjzt;
+
@Value("${dept.sgb}")
private String sgb;
@@ -63,7 +70,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 +86,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());
@@ -101,7 +108,8 @@
//鍑哄簱
addDTO.getSubjectMatterList().stream().forEach(outSubjectMatterAddDTO -> {
OutBound outBound = BeanUtil.copyProperties(outSubjectMatterAddDTO, OutBound.class);
- if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smj)){
+ if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smj)||StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smjsc)||
+ StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smjzt)){
outBound.setBatchNumber(generateSMJContractCKNo());
}
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",sgb)){
@@ -185,7 +193,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 +272,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 +291,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 +324,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 +354,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 +391,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 +468,7 @@
@Override
public R addContractOut(OutBoundAddDTO addDTO) {
- if (ArrayUtil.isEmpty(addDTO.getSubjectMatterList().toArray())) {
+ if (CollUtil.isEmpty(addDTO.getSubjectMatterList())) {
return R.failed("鍑哄簱鏍囩殑鐗╀笉鑳戒负绌�");
}
// 1. 纭畾鏌ヨ鐢ㄧ殑鍚堝悓缂栧彿瀛楁鍊�
@@ -486,6 +494,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 +507,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){
@@ -543,7 +552,8 @@
contractSubjectMatterMapper.updateById(subjectMatter);
//
OutBound outBound = new OutBound();
- if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smj)){
+ if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smj)||StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smjsc)||
+ StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smjzt)){
outBound.setBatchNumber(generateSMJContractCKNo());
}
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",sgb)){
@@ -644,7 +654,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 +673,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",
@@ -712,12 +722,12 @@
.eq(ContractPaymentSchedule::getContractId, schedule.getContractId())
.gt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder())
.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);
//鏇存柊鍚堝悓涓嬩釜闃舵
@@ -832,12 +842,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