diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java index 78d27f04..093cb1f1 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java @@ -393,6 +393,10 @@ public class TransactionBillServiceImpl implements TransactionBillService { bill.setChannelCost(channel.getCostRate().multiply(bill.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP)); // 渠道成本 transactionTemplate.execute(status -> { + // 减少余额后的用户信息 + SmUserVo afterUser = smUserMapper.selectSimpleById(userId); + bill.setAfterBalance(afterUser.getBalance()); + // 提现申请 int insert = this.insertSmTransactionBill(bill); ServiceUtil.assertion(insert != 1, "提现申请失败"); @@ -400,10 +404,6 @@ public class TransactionBillServiceImpl implements TransactionBillService { // 减少余额,并判断提现金额是否超额(减少的是交易金额) userService.subtractBalance(userId, bill.getMoney(), String.format("提现申请:%s", bill.getBillNo()), RecordBalanceBstType.WITHDRAW, bill.getBillId()); - // 减少余额后的用户信息 - SmUserVo afterUser = smUserMapper.selectSimpleById(userId); - bill.setAfterBalance(afterUser.getBalance()); - return insert; });