交易分账 重构

This commit is contained in:
2023-08-28 17:17:54 +08:00
parent e435d3b379
commit 38dbafa116

View File

@@ -3119,14 +3119,16 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
// 记录支订单付流水
List<OrderPayRecord> payRecordList = Lists.newArrayList();
for (BalanceDeductionAmountVO balanceDeductionAmountVO : list) {
String paymentId = balanceDeductionAmountVO.getPaymentId();
BigDecimal deductionAmount = balanceDeductionAmountVO.getDeductionAmount();
JSONObject json = new JSONObject();
json.put("paymentId", balanceDeductionAmountVO.getPaymentId());
json.put("amount", balanceDeductionAmountVO.getDeductionAmount());
json.put("paymentId", paymentId);
json.put("amount", deductionAmount);
// 记录流水
payRecordList.add(OrderPayRecord.builder()
.orderCode(orderCode)
.payMode(OrderPayRecordEnum.PRINCIPAL_BALANCE_PAYMENT.getValue())
.payAmount(balanceDeductionAmountVO.getDeductionAmount())
.payAmount(deductionAmount)
.acquirer(AcquirerEnum.LOCAL.getValue())
.deductionRecord(json.toJSONString())
.createBy(dto.getMemberId())
@@ -3135,6 +3137,14 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
// 订单支付流水入库
if (CollectionUtils.isNotEmpty(payRecordList)) {
orderPayRecordService.batchInsert(payRecordList);
for (OrderPayRecord record : payRecordList) {
String deductionRecord = record.getDeductionRecord();
JSONObject jsonObject = JSON.parseObject(deductionRecord);
String paymentId = jsonObject.getString("paymentId");
BigDecimal amount = jsonObject.getBigDecimal("amount");
// 余额支付 临时冻结金额
memberAdapayRecordService.updateFreezeAmount(paymentId, amount);
}
}
// 余额支付可以直接调支付回调方法