2
0

fix: 修复流量计费

This commit is contained in:
caiyuchao
2025-01-16 18:40:52 +08:00
parent c8b3720947
commit 7466dcfdd7
3 changed files with 7 additions and 3 deletions

View File

@@ -108,9 +108,9 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
account.setBalance(BigDecimal.ZERO);
}
if (account.getBalance().compareTo(account.getBalanceUsed()) <= 0) {
cancelUserIds.add(account.getUserId());
} else {
account.setBalanceUsed(BigDecimal.ZERO);
account.setBalance(BigDecimal.ZERO);
cancelUserIds.add(account.getUserId());
}
this.updateById(account);
}
@@ -135,6 +135,7 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
account.setBalance(account.getBalance().subtract(bill.getAmount()));
} else {
account.setBalance(BigDecimal.ZERO);
account.setBalanceUsed(BigDecimal.ZERO);
cancelUserIds.add(account.getUserId());
}
this.updateById(account);

View File

@@ -101,6 +101,7 @@ public class UOrderServiceImpl extends ServiceImpl<UOrderMapper, UOrder> impleme
account = new UAccount();
account.setUserId(order.getUserId());
account.setBalance(BigDecimal.ZERO);
account.setBalanceUsed(BigDecimal.ZERO);
} else {
accountId = account.getId();
isValid = AccountUtil.isValid(account, new Date());