fix:【pay】修复钱包流水生成逻辑,区分充值退款与消费支付情况,对应 https://t.zsxq.com/OJk9m

This commit is contained in:
YunaiV
2026-01-18 17:58:34 +08:00
parent 9fa9183f2e
commit 17ec78f68a

View File

@@ -174,7 +174,11 @@ public class PayWalletServiceImpl implements PayWalletService {
}
// 3. 生成钱包流水
Integer afterBalance = payWallet.getBalance() - price;
// 情况一充值退款balance 在冻结时已扣updateWhenRechargeRefund 只扣 freeze_price所以 afterBalance 不变。https://t.zsxq.com/OJk9m
// 情况二消费支付updateWhenConsumption 从 balance 扣,所以 afterBalance = balance - price
Integer afterBalance = bizType == PayWalletBizTypeEnum.RECHARGE_REFUND
? payWallet.getBalance()
: payWallet.getBalance() - price;
WalletTransactionCreateReqBO bo = new WalletTransactionCreateReqBO().setWalletId(payWallet.getId())
.setPrice(-price).setBalance(afterBalance).setBizId(String.valueOf(bizId))
.setBizType(bizType.getType()).setTitle(bizType.getDescription());