Commit 17ec78f68a5a1eae7a985d7a1c207cf6a517e912
1 parent
9fa9183f
fix:【pay】修复钱包流水生成逻辑,区分充值退款与消费支付情况,对应 https://t.zsxq.com/OJk9m
Showing
1 changed file
with
5 additions
and
1 deletions
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
| ... | ... | @@ -174,7 +174,11 @@ public class PayWalletServiceImpl implements PayWalletService { |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | // 3. 生成钱包流水 |
| 177 | - Integer afterBalance = payWallet.getBalance() - price; | |
| 177 | + // 情况一:充值退款:balance 在冻结时已扣,updateWhenRechargeRefund 只扣 freeze_price,所以 afterBalance 不变。https://t.zsxq.com/OJk9m | |
| 178 | + // 情况二:消费支付:updateWhenConsumption 从 balance 扣,所以 afterBalance = balance - price | |
| 179 | + Integer afterBalance = bizType == PayWalletBizTypeEnum.RECHARGE_REFUND | |
| 180 | + ? payWallet.getBalance() | |
| 181 | + : payWallet.getBalance() - price; | |
| 178 | 182 | WalletTransactionCreateReqBO bo = new WalletTransactionCreateReqBO().setWalletId(payWallet.getId()) |
| 179 | 183 | .setPrice(-price).setBalance(afterBalance).setBizId(String.valueOf(bizId)) |
| 180 | 184 | .setBizType(bizType.getType()).setTitle(bizType.getDescription()); | ... | ... |