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/PaymentConfirmServiceImpl.java | 91 ++++++++++++++++++++++++---------------------
1 files changed, 48 insertions(+), 43 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 fb66342..2df9d21 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
@@ -1,7 +1,7 @@
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;
@@ -31,7 +31,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
@@ -43,6 +43,8 @@
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
+
+;
/**
* 鏀舵纭
@@ -66,7 +68,7 @@
private final MeterReadRecordMapper meterReadRecordMapper;
private final BankStatementMapper bankStatementMapper;
private final RemoteDeptService remoteDeptService;
- private final RedisTemplate redisTemplate;
+ private final StringRedisTemplate redisTemplate;
@Value("${bip.url}")
private String url;
@@ -112,6 +114,7 @@
slip.setPaymentTime(addDTO.getConfirmTime());
slip.setPaymentAmount(addDTO.getTransationAmount());
slip.setPayType(addDTO.getPayType());
+ slip.setContractId(contract.getId());
paymentSlipMapper.insert(slip);
BigDecimal newtotal = addDTO.getTransationAmount().add(lastTotal);
@@ -149,7 +152,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())) {
+ if (CollUtil.isNotEmpty(scheduleList)) {
BigDecimal remain = addDTO.getTransationAmount();
for (ContractPaymentSchedule schedule : scheduleList) {
BigDecimal lastRemain = remain;
@@ -217,7 +220,7 @@
List<MeterReadRecord> recordList = meterReadRecordMapper.selectList(Wrappers.<MeterReadRecord>lambdaQuery()
.eq(MeterReadRecord::getContractId,contract.getId())
.isNull(MeterReadRecord::getMeterReadNum));
- if (ArrayUtil.isEmpty(execDateList.toArray())&&ArrayUtil.isEmpty(recordList.toArray())){
+ if (CollUtil.isEmpty(execDateList)&&CollUtil.isEmpty(recordList)){
//鏇存柊鍚堝悓宸蹭粯娆�
BigDecimal paid = new BigDecimal("0");
if (ObjUtil.isNotNull(contract.getPaidAmount())) {
@@ -262,7 +265,7 @@
// List<Contract> customerContractList = contractService.list(Wrappers.<Contract>lambdaQuery().eq(Contract::getPartyAId, addDTO.getBusGuestId())
// .eq(Contract::getPartyBId, SecurityUtils.getUser().getCompId()).orderByAsc(Contract::getCreateTime)
// .apply(" ((contract_category != 'water_house' and amount != paid_amount) or contract_category = 'water_house')"));
-// if (ArrayUtil.isEmpty(customerContractList.toArray())) {
+// if (ArrayUtil.isEmpty(customerContractList)) {
// return R.failed("涓烘煡璇㈠埌鏈粯娆惧悎鍚�");
// }
// BusinessCustomer customer = businessCustomerService.getOne(Wrappers.<BusinessCustomer>lambdaQuery()
@@ -365,7 +368,7 @@
// .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2)
// .ne(ContractPaymentSchedule::getPaymentStatus, 3)
// .orderByAsc(ContractPaymentSchedule::getCreateTime));
-// if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
+// if (ArrayUtil.isNotEmpty(scheduleList)) {
// BigDecimal remain = transtionAmount;
// for (ContractPaymentSchedule schedule : scheduleList) {
// BigDecimal lastRemain = remain;
@@ -419,7 +422,7 @@
// 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())) {
+// if (ArrayUtil.isNotEmpty(payComScheduleList)) {
// BigDecimal payTotal = payComScheduleList.stream().map(item -> StrUtil.equals(item.getPaymentStatus() + "", "2") ? item.getPlannedAmount() :
// item.getActualAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
// contract.setPaidAmount(payTotal);
@@ -438,10 +441,10 @@
// if (StrUtil.isNotEmpty(contract.getContractCategory()) && StrUtil.equals(contract.getContractCategory(), "water_house")) {
// List<ContractExecDate> execDateList = contractExecDateMapper.selectList(Wrappers.<ContractExecDate>lambdaQuery()
// .eq(ContractExecDate::getContractId, contract.getId()).eq(ContractExecDate::getGenFlag, "0"));
-// if (ArrayUtil.isEmpty(execDateList.toArray())) {
+// if (ArrayUtil.isEmpty(execDateList)) {
// List<ContractPaymentSchedule> contractPaymentScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
// .eq(ContractPaymentSchedule::getContractId, contract.getId()));
-// if (ArrayUtil.isNotEmpty(contractPaymentScheduleList.toArray()) && contractPaymentScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) {
+// if (ArrayUtil.isNotEmpty(contractPaymentScheduleList) && contractPaymentScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) {
// contract.setContractStatus(3);
// contractService.updateById(contract);
// }
@@ -455,20 +458,20 @@
//瀹㈡埛棰勪粯鏈夊墿浣� 涓� 鏈夐浠樻鐨勫悎鍚�
// if (transtionRemainAmount.compareTo(new BigDecimal("0")) > 0) {
-// if (ArrayUtil.isNotEmpty(payNoCompleteContractList.toArray())){
+// if (ArrayUtil.isNotEmpty(payNoCompleteContractList)){
// //浣欓 鏀惧埌浠樻鏈畬鎴愬悎鍚� 棰勬敹
// Contract lastContract = payNoCompleteContractList.get(0);
// //淇濆瓨鏄庣粏
// saveNewPaymentConfirm(customer,null,lastContract,transtionRemainAmount,payDate);
// }
-// if (ArrayUtil.isEmpty(payNoCompleteContractList.toArray())&&ArrayUtil.isNotEmpty(advanceContractList.toArray())){
+// if (ArrayUtil.isEmpty(payNoCompleteContractList)&&ArrayUtil.isNotEmpty(advanceContractList)){
// //瀹㈡埛棰勪粯鏈夊墿浣� 娌℃湁棰勪粯娆剧殑鍚堝悓
// Contract lastContract = advanceContractList.get(0);
// //淇濆瓨鏄庣粏
// saveNewPaymentConfirm(customer,null,lastContract,transtionRemainAmount,payDate);
// }
-// if (ArrayUtil.isEmpty(payNoCompleteContractList.toArray())&&ArrayUtil.isEmpty(advanceContractList.toArray())
-// &&ArrayUtil.isNotEmpty(payCompleteContractList.toArray())) {
+// if (ArrayUtil.isEmpty(payNoCompleteContractList)&&ArrayUtil.isEmpty(advanceContractList)
+// &&ArrayUtil.isNotEmpty(payCompleteContractList)) {
// //瀹㈡埛棰勪粯鏈夊墿浣� 娌℃湁棰勪粯娆剧殑鍚堝悓
// Contract lastContract = payCompleteContractList.get(payCompleteContractList.size() - 1);
// //淇濆瓨鏄庣粏
@@ -486,7 +489,7 @@
if (redisTemplate.hasKey("BIP_TOKEN")) {
accessToken = (String) redisTemplate.opsForValue().get("BIP_TOKEN");
} else {
- getAccessToken(accessToken);
+ accessToken = getAccessToken(accessToken);
}
if (StrUtil.isEmpty(accessToken)) {
return R.failed("鑾峰彇token澶辫触");
@@ -495,6 +498,16 @@
for (String bipCode : bipCodeArr) {
//鍏ュ弬
JSONObject params = new JSONObject();
+ if (ObjUtil.isNotEmpty(dto.getPageSize())){
+ params.put("pageSize",dto.getPageSize());
+ }else {
+ params.put("pageSize",999);
+ }
+ if (ObjUtil.isNotEmpty(dto.getPageNum())){
+ params.put("pageNum",dto.getPageNum());
+ }else {
+ params.put("pageNum",1);
+ }
if (StrUtil.isNotBlank(dto.getStartDate())){
params.put("begindate",dto.getStartDate());
}else {
@@ -580,13 +593,13 @@
return;
}
SysDept dept = r.getData();
- JSONObject dataJson = JSONObject.parseObject(resultJson.getString("data"));
+ JSONObject dataJson = resultJson.getJSONObject("data");
if (ObjUtil.isNull(dataJson)) {
log.error("杩斿洖缁撴灉涓璬ata瑙f瀽澶辫触");
return;
}
- JSONArray recordList = JSONArray.parseArray(resultJson.getString("recordList"));
- if (ArrayUtil.isEmpty(recordList.toArray())) {
+ JSONArray recordList = dataJson.getJSONArray("recordList");
+ if (CollUtil.isEmpty(recordList)) {
log.error("杩斿洖缁撴灉涓璻ecordList涓虹┖");
return;
}
@@ -600,24 +613,13 @@
private void savePaymentConfirm(JSONObject record, SysDept dept) {
- if (record.containsKey("to_acct_name")){
- log.error("浠樻鍗昳d锛歿},浠樻鍏徃涓虹┖", record.getString("id"));
- return;
- }
+
BusinessCustomer customer = businessCustomerService.getOne(Wrappers.<BusinessCustomer>lambdaQuery()
.eq(BusinessCustomer::getCompanyName, record.getString("to_acct_name"))
.eq(BusinessCustomer::getCompId,dept.getDeptId())
);
- if (ObjUtil.isNull(customer)) {
- log.error("浠樻鍗昳d锛歿},瀹㈠晢鏌ヨ澶辫触锛岃妫�鏌ュ鍟�", record.getString("id"));
- return;
- }
- if (ObjUtil.isNull(record.getBigDecimal("tran_amt"))) {
- log.error("浠樻鍗昳d锛歿},浜ゆ槗閲戦寮傚父", record.getString("id"));
- return;
- }
- //淇濆瓨浠樻鍗�
- Boolean codeFlag = saveBankStatement(customer, record);
+ //淇濆瓨浠樻鍗�
+ Boolean codeFlag = saveBankStatement(customer, record,dept);
if (codeFlag) {
log.error("浠樻鍗昳d锛歿},浠樻鍗曞凡瀛樺湪");
return;
@@ -625,7 +627,7 @@
}
- private Boolean saveBankStatement(BusinessCustomer customer, JSONObject record) {
+ private Boolean saveBankStatement(BusinessCustomer customer, JSONObject record,SysDept dept) {
BankStatement bankStatement = new BankStatement();
bankStatement.setBankSeqNo(record.getString("bank_seq_no"));
bankStatement.setReceiveBankAcc(record.getString("bank_seq_no"));
@@ -637,12 +639,15 @@
bankStatement.setTranAmount(record.getBigDecimal("tran_amt"));
bankStatement.setDataId(record.getLong("id"));
bankStatement.setDataJson(record.toJSONString());
- bankStatement.setBusGuestId(customer.getId());
+ if (ObjUtil.isNotNull(customer)) {
+ bankStatement.setBusGuestId(customer.getId());
+ }
BankStatement statement = bankStatementMapper.selectOne(Wrappers.<BankStatement>lambdaQuery().eq(BankStatement::getDataId,record.getLong("id")));
if (ObjUtil.isNotNull(statement)){
return false;
}
- statement.setCompId(customer.getCompId());
+ bankStatement.setRemark(record.getString("remark"));
+ bankStatement.setCompId(dept.getDeptId());
bankStatementMapper.insert(bankStatement);
return true;
}
@@ -657,7 +662,7 @@
@Override
public R queryAging() {
List<AgingCompanyVo> companys = contractPaymentScheduleMapper.selectAgingCompany(null, DataScope.of("comp_id"));
- if (ArrayUtil.isEmpty(companys.toArray())) {
+ if (CollUtil.isEmpty(companys)) {
return R.failed("鏆傛棤璐﹂緞");
}
List<AgingAnalysisVo> result = new ArrayList<>();
@@ -670,7 +675,7 @@
queryDTO.setCompanyId(company.getCompanyId());
List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotal(queryDTO);
//琛ュ叏鏁版嵁
- if (ArrayUtil.isEmpty(companyAgingVo.toArray())) {
+ if (CollUtil.isEmpty(companyAgingVo)) {
companyAgingVo = new ArrayList<>();
AgingVo agingVo1 = new AgingVo(1L,"0-30澶�", new BigDecimal("0"), null);
AgingVo agingVo2 = new AgingVo(2L,"31-60澶�", new BigDecimal("0"), null);
@@ -686,27 +691,27 @@
companyAgingVo.add(agingVo6);
} else {
List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
- if (!ArrayUtil.contains(overdueRanges.toArray(), "0-30澶�")) {
+ if (!CollUtil.contains(overdueRanges, "0-30澶�")) {
AgingVo agingVo1 = new AgingVo(1L,"0-30澶�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo1);
}
- if (!ArrayUtil.contains(overdueRanges.toArray(), "31-60澶�")) {
+ if (!CollUtil.contains(overdueRanges, "31-60澶�")) {
AgingVo agingVo2 = new AgingVo(2L,"31-60澶�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo2);
}
- if (!ArrayUtil.contains(overdueRanges.toArray(), "61-90澶�")) {
+ if (!CollUtil.contains(overdueRanges, "61-90澶�")) {
AgingVo agingVo3 = new AgingVo(3L,"61-90澶�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo3);
}
- if (!ArrayUtil.contains(overdueRanges.toArray(), "91-180澶�")) {
+ if (!CollUtil.contains(overdueRanges, "91-180澶�")) {
AgingVo agingVo4 = new AgingVo(4L,"91-180澶�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo4);
}
- if (!ArrayUtil.contains(overdueRanges.toArray(), "181-365澶�")) {
+ if (!CollUtil.contains(overdueRanges, "181-365澶�")) {
AgingVo agingVo5 = new AgingVo(5L,"181-365澶�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo5);
}
- if (!ArrayUtil.contains(overdueRanges.toArray(), "1骞翠互涓�")) {
+ if (!CollUtil.contains(overdueRanges, "1骞翠互涓�")) {
AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo6);
}
--
Gitblit v1.9.1