|
@@ -2,16 +2,10 @@ package com.sckw.freight.service;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.sckw.freight.entity.freight.KwpSettlementLogistics;
|
|
import com.sckw.freight.entity.freight.KwpSettlementLogistics;
|
|
|
-import com.sckw.freight.entity.payment.PayMemberWalletAp;
|
|
|
|
|
-import com.sckw.freight.entity.payment.PayOrder;
|
|
|
|
|
-import com.sckw.freight.entity.payment.PayOrderSub;
|
|
|
|
|
-import com.sckw.freight.entity.payment.PayWalletWithdrawOrder;
|
|
|
|
|
|
|
+import com.sckw.freight.entity.payment.*;
|
|
|
import com.sckw.freight.mapper.freight.KwpLedgerLogisticsMapper;
|
|
import com.sckw.freight.mapper.freight.KwpLedgerLogisticsMapper;
|
|
|
import com.sckw.freight.mapper.freight.KwpSettlementLogisticsMapper;
|
|
import com.sckw.freight.mapper.freight.KwpSettlementLogisticsMapper;
|
|
|
-import com.sckw.freight.mapper.payment.PayMemberWalletApMapper;
|
|
|
|
|
-import com.sckw.freight.mapper.payment.PayOrderMapper;
|
|
|
|
|
-import com.sckw.freight.mapper.payment.PayOrderSubMapper;
|
|
|
|
|
-import com.sckw.freight.mapper.payment.PayWalletWithdrawOrderMapper;
|
|
|
|
|
|
|
+import com.sckw.freight.mapper.payment.*;
|
|
|
import com.sckw.freight.model.dto.BusinessNo;
|
|
import com.sckw.freight.model.dto.BusinessNo;
|
|
|
import com.sckw.freight.model.dto.Order;
|
|
import com.sckw.freight.model.dto.Order;
|
|
|
import com.sckw.freight.model.dto.PatchPay;
|
|
import com.sckw.freight.model.dto.PatchPay;
|
|
@@ -61,7 +55,8 @@ public class JobService {
|
|
|
PayWalletWithdrawOrderMapper payWalletWithdrawOrderMapper;
|
|
PayWalletWithdrawOrderMapper payWalletWithdrawOrderMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
PayMemberWalletApMapper payMemberWalletApMapper;
|
|
PayMemberWalletApMapper payMemberWalletApMapper;
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ PayBatchAgentPayMapper payBatchAgentPayMapper;
|
|
|
/**
|
|
/**
|
|
|
* 【轮循程序】
|
|
* 【轮循程序】
|
|
|
* 1:根据未完成的单子组合查询信息(收款方uid、付款方uid、未付金额)到支付中台【充值记录清单】接口 /v2/wallet/recharge/orders(收款方uid、付款方uid,时间)
|
|
* 1:根据未完成的单子组合查询信息(收款方uid、付款方uid、未付金额)到支付中台【充值记录清单】接口 /v2/wallet/recharge/orders(收款方uid、付款方uid,时间)
|
|
@@ -131,7 +126,7 @@ public class JobService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//检查清分
|
|
//检查清分
|
|
|
- CheckResult checkAgentPay = checkAgentPay(_qf, _yp, settlementLogisticsInfo, logisticsAndBuySellInfo, money);
|
|
|
|
|
|
|
+ CheckResult checkAgentPay = checkAgentPay(_qf, settlementLogisticsInfo, logisticsAndBuySellInfo, money);
|
|
|
_qf = checkAgentPay.getBusinessNo();
|
|
_qf = checkAgentPay.getBusinessNo();
|
|
|
if (!checkAgentPay.isStatus()) {
|
|
if (!checkAgentPay.isStatus()) {
|
|
|
continue;
|
|
continue;
|
|
@@ -377,10 +372,10 @@ public class JobService {
|
|
|
try {
|
|
try {
|
|
|
if (StringUtils.isBlank(_yp)) {
|
|
if (StringUtils.isBlank(_yp)) {
|
|
|
// 发起预付
|
|
// 发起预付
|
|
|
- R<Order> orderR = payCenterService.advancePayApply(logisticsAndBuySellInfo.getBuyUid(), ChannelEnum.XW,
|
|
|
|
|
- logisticsAndBuySellInfo.getSellUid(), MoneyChange.bigMoney(money));
|
|
|
|
|
|
|
+ R<Order> orderR = payCenterService.advancePayApply(logisticsAndBuySellInfo.getSellUid (), ChannelEnum.XW,
|
|
|
|
|
+ logisticsAndBuySellInfo.getBuyUid(), MoneyChange.bigMoney(money));
|
|
|
if (orderR == null || !orderR.getStatus() || orderR.getData() == null) {
|
|
if (orderR == null || !orderR.getStatus() || orderR.getData() == null) {
|
|
|
- setCheckResult(checkResult, false, null, null);
|
|
|
|
|
|
|
+ setCheckResult(checkResult, false, " ", null);
|
|
|
return checkResult;
|
|
return checkResult;
|
|
|
}
|
|
}
|
|
|
_yp = orderR.getData().getOrderNo();
|
|
_yp = orderR.getData().getOrderNo();
|
|
@@ -403,24 +398,19 @@ public class JobService {
|
|
|
* @author: xj
|
|
* @author: xj
|
|
|
* @date: 2025/2/10 星期一 14:28
|
|
* @date: 2025/2/10 星期一 14:28
|
|
|
*/
|
|
*/
|
|
|
- private CheckResult<PayOrderSub> checkAgentPay(String _qf, String _yp, KwpSettlementLogistics settlementLogisticsInfo, LedgerLogisticsAndBuySellInfo logisticsAndBuySellInfo, BigDecimal money) {
|
|
|
|
|
- CheckResult<PayOrderSub> checkResult = new CheckResult<>();
|
|
|
|
|
|
|
+ private CheckResult<PayBatchAgentPay> checkAgentPay(String _qf, KwpSettlementLogistics settlementLogisticsInfo, LedgerLogisticsAndBuySellInfo logisticsAndBuySellInfo, BigDecimal money) {
|
|
|
|
|
+ CheckResult<PayBatchAgentPay> checkResult = new CheckResult<>();
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- // 根据预付单号查询清分单子
|
|
|
|
|
- LambdaQueryWrapper<PayOrderSub> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
- wrapper.eq(PayOrderSub::getBusinessNo, _yp);
|
|
|
|
|
- PayOrderSub orderSub = payOrderSubMapper.selectOne(wrapper);
|
|
|
|
|
-
|
|
|
|
|
- if (orderSub == null) { // 没有清分单子,发起清分请求
|
|
|
|
|
|
|
+ if (StringUtils.isBlank(_qf)) { // 没有清分单子,发起清分请求
|
|
|
List<PatchPay> list = new ArrayList<>();
|
|
List<PatchPay> list = new ArrayList<>();
|
|
|
PatchPay patchPay = new PatchPay();
|
|
PatchPay patchPay = new PatchPay();
|
|
|
- patchPay.setUid(logisticsAndBuySellInfo.getSellUid());
|
|
|
|
|
|
|
+ patchPay.setUid(logisticsAndBuySellInfo.getBuyUid());
|
|
|
patchPay.setMoney(MoneyChange.bigMoney(money));
|
|
patchPay.setMoney(MoneyChange.bigMoney(money));
|
|
|
patchPay.setRemark("对账单结算");
|
|
patchPay.setRemark("对账单结算");
|
|
|
list.add(patchPay);
|
|
list.add(patchPay);
|
|
|
|
|
|
|
|
- R<BusinessNo> businessNoR = payCenterService.payAgentPayV2(logisticsAndBuySellInfo.getBuyUid(), logisticsAndBuySellInfo.getSellUid(), ChannelEnum.XW,
|
|
|
|
|
|
|
+ R<BusinessNo> businessNoR = payCenterService.payAgentPayV2(logisticsAndBuySellInfo.getBuyUid (), logisticsAndBuySellInfo.getSellUid(), ChannelEnum.XW,
|
|
|
MoneyChange.bigMoney(money), list, settlementLogisticsInfo.getSlOrderNo(), "1");
|
|
MoneyChange.bigMoney(money), list, settlementLogisticsInfo.getSlOrderNo(), "1");
|
|
|
log.info("发起清分结果->{}", businessNoR);
|
|
log.info("发起清分结果->{}", businessNoR);
|
|
|
if (businessNoR == null || !businessNoR.getStatus() || businessNoR.getData() == null) {
|
|
if (businessNoR == null || !businessNoR.getStatus() || businessNoR.getData() == null) {
|
|
@@ -428,11 +418,14 @@ public class JobService {
|
|
|
return checkResult;
|
|
return checkResult;
|
|
|
}
|
|
}
|
|
|
_qf = businessNoR.getData().getBusinessNo();
|
|
_qf = businessNoR.getData().getBusinessNo();
|
|
|
- setCheckResult(checkResult, true, _qf, null);
|
|
|
|
|
- return checkResult;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- setCheckResult(checkResult, orderSub.getStatus().equals(1), orderSub.getApNo(), orderSub);
|
|
|
|
|
|
|
+ // 根据预付单号查询清分单子
|
|
|
|
|
+ LambdaQueryWrapper<PayBatchAgentPay> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ wrapper.eq(PayBatchAgentPay::getBusinessNo, _qf);
|
|
|
|
|
+ PayBatchAgentPay orderSub = payBatchAgentPayMapper.selectOne(wrapper);
|
|
|
|
|
+
|
|
|
|
|
+ setCheckResult(checkResult, orderSub.getStatus().equals(1), orderSub.getBusinessNo(), orderSub);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("检查清分异常, settlementLogisticsInfo: {}, logisticsAndBuySellInfo: {}, money: {}", settlementLogisticsInfo, logisticsAndBuySellInfo, money, e);
|
|
log.error("检查清分异常, settlementLogisticsInfo: {}, logisticsAndBuySellInfo: {}, money: {}", settlementLogisticsInfo, logisticsAndBuySellInfo, money, e);
|
|
|
setCheckResult(checkResult, false, null, null);
|
|
setCheckResult(checkResult, false, null, null);
|
|
@@ -476,7 +469,7 @@ public class JobService {
|
|
|
// 辅助方法:设置 CheckResult 的状态、业务编号和数据
|
|
// 辅助方法:设置 CheckResult 的状态、业务编号和数据
|
|
|
private <T> void setCheckResult(CheckResult<T> checkResult, boolean status, String businessNo, T data) {
|
|
private <T> void setCheckResult(CheckResult<T> checkResult, boolean status, String businessNo, T data) {
|
|
|
checkResult.setStatus(status);
|
|
checkResult.setStatus(status);
|
|
|
- checkResult.setBusinessNo(businessNo);
|
|
|
|
|
|
|
+ checkResult.setBusinessNo(StringUtils.isBlank(businessNo)? " " : businessNo);
|
|
|
checkResult.setData(data);
|
|
checkResult.setData(data);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|