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 | 141 +++++++++++++++++++++++++++++++++-------------
1 files changed, 100 insertions(+), 41 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 437d9ca..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;
@@ -24,6 +25,7 @@
import com.by4cloud.platformx.business.mapper.*;
import com.by4cloud.platformx.business.service.ContractService;
import com.by4cloud.platformx.business.utils.ItemGeneratorUtil;
+import com.by4cloud.platformx.business.utils.NetworkFileToBase64;
import com.by4cloud.platformx.business.vo.ContractDetailVo;
import com.by4cloud.platformx.business.vo.ContractInvoiceVo;
import com.by4cloud.platformx.business.vo.ContractSlipVo;
@@ -53,6 +55,8 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
+;
+
/**
* @author cd
* @description
@@ -79,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;
@@ -154,7 +159,7 @@
}
}
- if (ArrayUtil.isEmpty(addDTO.getContractSubjectMatter().toArray())){
+ if (CollUtil.isEmpty(addDTO.getContractSubjectMatter())){
return R.failed("鏍囩殑鐗╀笉鑳戒负绌�");
}
@@ -182,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());
@@ -213,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();
@@ -267,7 +272,7 @@
if (StrUtil.isEmpty(updateDTO.getPartyA())){
BusinessCustomer bc = businessCustomerMapper.selectById(updateDTO.getPartyAId());
if (ObjUtil.isNotNull(bc)){
- updateDTO.setPartyA(bc.getRegisterName());
+ updateDTO.setPartyA(bc.getCompanyName());
}
if (StrUtil.isEmpty(bc.getErpCompanyCode())||StrUtil.isEmpty(bc.getRegisterName())||
StrUtil.isEmpty(bc.getBankName())||StrUtil.isEmpty(bc.getBankAccount())){
@@ -322,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 -> {
@@ -349,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);
@@ -397,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;
}
@@ -425,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()),
@@ -575,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(), "璐ㄤ繚閲�")) {
@@ -609,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);
@@ -618,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);
// }
@@ -640,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();
@@ -719,25 +739,60 @@
//鍚堝悓涓績鎺ㄩ��
new Thread(()->{
try {
- JSONObject request = new JSONObject();
- request.put("fd_docNumber",contract.getContractNo());
- request.put("fd_singer",contract.getNickName());
- request.put("fd_signTime",DateUtil.formatDate(contract.getSignDate()));
- request.put("fd_linkPerson","");
- request.put("fd_linkPhone","");
- request.put("fd_address",contract.getSignPlace());
- request.put("fd_receivedTime",DateUtil.format(contract.getCreateTime(),DatePattern.NORM_DATETIME_PATTERN));
- request.put("fd_receivedNum",1);
- request.put("fd_effedate",DateUtil.formatDate(contract.getEffectiveDate()));
- request.put("fd_enddate",DateUtil.formatDate(contract.getExpirationDate()));
- request.put("fd_reviewerNo",contract.getNickName());
- request.put("fd_docStatus","20");
- request.put("fd_templateId","");
- request.put("fd_attName",contract.getAttachmentName());
- request.put("fd_attcontent",contract.getAttachmentName());
- log.info("鍚堝悓涓績鍚屾鍚堝悓鎺ュ彛鍏ュ弬锛歿}",request.toJSONString());
- String resp = HttpUtil.post("https://oatest.res.jzeg.cn/ekp/api/km-agreement/kmAgreementWebService/addContractReview",request.toJSONString());
- log.info("鍚堝悓涓績鍚屾鍚堝悓鎺ュ彛鍥炲弬锛歿}",resp);
+ JSONObject requestApply = new JSONObject();
+ requestApply.put("fd_selectionmethod","鍏紑鎷涙爣");
+ requestApply.put("fd_isrelated","鏄�");
+ requestApply.put("fd_bizId",contract.getId());
+ requestApply.put("fd_remark",contract.getRemark());
+ requestApply.put("fd_MainContent","");
+ requestApply.put("fd_settlementType","00");
+ requestApply.put("fd_applyType","澶栭攢");
+ requestApply.put("fd_contractsubject ",subjectMatterList.stream().map(item->item.getMaterialName()).collect(Collectors.joining(",")));
+ requestApply.put("fd_docNumber",contract.getContractNo());
+ requestApply.put("fd_templateId","19e39bb6c1edadbdb162c434274a8a18");
+ requestApply.put("fd_name",contract.getContractName());
+ requestApply.put("fd_signDate",DateUtil.formatDate(contract.getSignDate()));
+ requestApply.put("fd_endDate",DateUtil.formatDate(contract.getExpirationDate()));
+ requestApply.put("fd_contractCreater",contract.getNickName());
+ requestApply.put("fd_currency","浜烘皯甯�");
+ requestApply.put("fd_ContractAmount",contract.getAmount());
+ requestApply.put("fd_finAmount",contract.getAmount().divide(new BigDecimal("113"),2,RoundingMode.HALF_UP)
+ .multiply(new BigDecimal("87")));
+ requestApply.put("fd_docStatus","20");
+ requestApply.put("fd_taxRates",13);
+ requestApply.put("fd_customerName",contract.getPartyA());
+ requestApply.put("fd_systemSource","闈炵叅閿�鍞郴缁�");
+ requestApply.put("fd_type","00");
+ log.info("鍚堝悓涓績鍚堝悓璧疯崏鎺ュ彛鍏ュ弬锛歿}",requestApply.toJSONString());
+ String respApply = HttpUtil.post("https://oatest.res.jzeg.cn/ekp/api/km-agreement/kmAgreementWebService/addSupplyContractApply",requestApply.toJSONString());
+ log.info("鍚堝悓涓績鍚堝悓璧疯崏鎺ュ彛鍥炲弬锛歿}",respApply);
+ JSONObject applyResp = JSONObject.parseObject(respApply);
+ if (applyResp.getString("code").equals("00")) {
+ JSONObject request = new JSONObject();
+ request.put("fd_docNumber", contract.getContractNo());
+ request.put("fd_singer", contract.getNickName());
+ request.put("fd_signTime", DateUtil.formatDate(contract.getSignDate()));
+ request.put("fd_linkPerson", "");
+ request.put("fd_linkPhone", "");
+ request.put("fd_address", contract.getSignPlace());
+ request.put("fd_receivedTime", DateUtil.format(contract.getCreateTime(), DatePattern.NORM_DATETIME_PATTERN));
+ request.put("fd_receivedNum", 1);
+ request.put("fd_effedate", DateUtil.formatDate(contract.getSignDate()));
+ request.put("fd_enddate", DateUtil.formatDate(contract.getExpirationDate()));
+ request.put("fd_reviewerNo", contract.getNickName());
+ request.put("fd_docStatus", "20");
+ request.put("fd_templateId", "19e39bb6c1edadbdb162c434274a8a18");
+ request.put("fd_attName", contract.getAttachmentName());
+ request.put("fd_attcontent", NetworkFileToBase64.convertNetworkFileToBase64("https://zbjt.res.jzeg.cn/api" + contract.getAttachmentUrl()));
+ log.info("鍚堝悓涓績鍚屾鍚堝悓鎺ュ彛鍏ュ弬锛歿}", request.toJSONString());
+ String resp = HttpUtil.post("https://oatest.res.jzeg.cn/ekp/api/km-agreement/kmAgreementWebService/addContractReview", request.toJSONString());
+ log.info("鍚堝悓涓績鍚屾鍚堝悓鎺ュ彛鍥炲弬锛歿}", resp);
+ JSONObject respJson = JSONObject.parseObject(resp);
+ if (respJson.getString("code").equals("00")) {
+ contract.setCenterPushFlag("1");
+ baseMapper.updateById(contract);
+ }
+ }
} catch (Exception e) {
e.printStackTrace();
}
@@ -798,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",
@@ -834,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)) {
@@ -907,6 +962,7 @@
public R copyNewContract(Long id) {
Contract oldContract = baseMapper.selectById(id);
Contract newContract = BeanUtil.copyProperties(oldContract, Contract.class, "id", "createTime");
+ newContract.setOutBoundAmout(new BigDecimal("0"));
newContract.setPaidAmount(new BigDecimal("0"));
newContract.setBillingStatus("1");
newContract.setErpPushFlag("0");
@@ -1040,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()
@@ -1550,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())){
@@ -1579,6 +1635,7 @@
return R.failed("erp瀹㈡埛缂栫爜涓嶅瓨鍦�");
}
contract.setPartyAId(bc.getId());
+ contract.setPartyA(bc.getCompanyName());
if (ObjUtil.isNotNull(addDTO.getDeliveryCycle())){
contract.setExpirationDate(DateUtil.offsetDay(addDTO.getSignDate(),addDTO.getDeliveryCycle()));
}
@@ -1672,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())){
@@ -1926,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