获取订单待分账信息

This commit is contained in:
Guoqs
2025-04-16 14:39:55 +08:00
parent f629b083d1
commit 42f828a812

View File

@@ -1966,6 +1966,8 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
// 选出需要分账的支付id
List<PaymentInfo> paymentInfos = Lists.newArrayList();
for (OrderPayRecord orderPayRecord : orderPayRecordList) {
String paymentId = orderPayRecord.getPaymentId(); // 汇付支付id
// TODO 根据paymentId查询支付金额, 退款金额, 未分账金额
BigDecimal payAmount = orderPayRecord.getPayAmount();
BigDecimal refundAmount = orderPayRecord.getRefundAmount() == null ? BigDecimal.ZERO : orderPayRecord.getRefundAmount();
// 如果相减等于0说明这笔支付单退完了就不用分账了
@@ -1973,7 +1975,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
if (subtract.compareTo(BigDecimal.ZERO) > 0) {
paymentInfos.addAll(orderPayRecordService.parseDeductionRecord(orderPayRecord.getDeductionRecord()));
} else {
logger.info("realTimeOrderSplit-订单:{}, 支付记录:{}, 支付金额({})与退款金额({})相等,不需要分账", orderCode, orderPayRecord.getPaymentId(), payAmount, refundAmount);
logger.info("realTimeOrderSplit-订单:{}, 支付记录:{}, 支付金额({})与退款金额({})相等,不需要分账", orderCode, paymentId, payAmount, refundAmount);
}
}
logger.info("根据订单号:{}, 查询出{}笔支付信息, 需要分账的支付信息为:{}", orderCode, paymentInfos.size(), JSON.toJSONString(paymentInfos));
@@ -2003,6 +2005,10 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
// 获取订单待分账信息
List<PaymentInfo> paymentInfos = getOrderPaymentInfoList(afterSettleOrderDTO);
if (CollectionUtils.isEmpty(paymentInfos)) {
logger.info("realTimeOrderSplit-订单[{}]没有待分账的支付记录", afterSettleOrderDTO.getOrderCode());
return null;
}
// 根据站点id查询分账配置(如果未配置则初始化)
List<StationSplitConfig> stationSplitConfigList = stationSplitConfigService.queryByStationIdWithInit(stationId);