This commit is contained in:
zt
2025-01-10 14:53:47 +08:00
parent af67ff401b
commit fed32ee0ea

View File

@ -469,15 +469,15 @@ public class DeductionServiceImpl implements DeductionService {
synchronized (getUserLock(userId)) {
MemberUserDO user = userService.getUser(userId);
MoneyDO moneyDO = moneyService.getMoney(userId, storeId);
if (user.getMoney().compareTo(money) < 0) {
BigDecimal total = moneyDO.getCashAmount().add(user.getWxAmount()).add(user.getGiftAmount());
if (total.compareTo(money) < 0) {
if (CHECK_LIST.contains(type)) {
throw exception(CASH_AMOUNT_NOT_ENOUGH);
}
user.setWxAmount(BigDecimal.ZERO);
moneyDO.setCashAmount(BigDecimal.ZERO);
user.setGiftAmount(BigDecimal.ZERO);
moneyDO.setDebtAmount(total.subtract(money));
} else {
BigDecimal wxAmount = user.getWxAmount();
BigDecimal giftAmount = user.getGiftAmount();