【功能优化】支付:钱包余额变化,增加 @Transactional 注解

This commit is contained in:
YunaiV 2024-09-17 15:56:08 +08:00
parent a6e5b2880b
commit 639ce7bb31
2 changed files with 2 additions and 1 deletions

View File

@ -180,7 +180,6 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
.setReason("想退钱").setPrice(walletRecharge.getPayPrice())); .setReason("想退钱").setPrice(walletRecharge.getPayPrice()));
// 4. 更新充值记录退款单号 // 4. 更新充值记录退款单号
// TODO @jaosn一般新建这种 update 对象建议是第一个 set id 属性容易知道以它为更新
walletRechargeMapper.updateById(new PayWalletRechargeDO().setPayRefundId(payRefundId) walletRechargeMapper.updateById(new PayWalletRechargeDO().setPayRefundId(payRefundId)
.setRefundStatus(WAITING.getStatus()).setId(walletRecharge.getId())); .setRefundStatus(WAITING.getStatus()).setId(walletRecharge.getId()));
} }

View File

@ -121,6 +121,7 @@ public class PayWalletServiceImpl implements PayWalletService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public PayWalletTransactionDO reduceWalletBalance(Long walletId, Long bizId, public PayWalletTransactionDO reduceWalletBalance(Long walletId, Long bizId,
PayWalletBizTypeEnum bizType, Integer price) { PayWalletBizTypeEnum bizType, Integer price) {
// 1. 获取钱包 // 1. 获取钱包
@ -158,6 +159,7 @@ public class PayWalletServiceImpl implements PayWalletService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public PayWalletTransactionDO addWalletBalance(Long walletId, String bizId, public PayWalletTransactionDO addWalletBalance(Long walletId, String bizId,
PayWalletBizTypeEnum bizType, Integer price) { PayWalletBizTypeEnum bizType, Integer price) {
// 1.1 获取钱包 // 1.1 获取钱包