|
|
@@ -2,7 +2,6 @@ package org.dromara.server.consume.check;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
-import cn.hutool.json.JSONUtil;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.dromara.backstage.api.domain.vo.RemoteCardVo;
|
|
|
@@ -23,6 +22,7 @@ import org.dromara.server.consume.domain.convert.RemoteVoConvert;
|
|
|
import org.dromara.server.consume.domain.vo.XfCardLimitedVo;
|
|
|
import org.dromara.server.consume.domain.vo.XfConsumeDetailOriginalVo;
|
|
|
import org.dromara.server.consume.domain.vo.XfTermVo;
|
|
|
+import org.dromara.server.consume.service.IPtBagService;
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -33,7 +33,6 @@ import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
|
@@ -54,6 +53,7 @@ public class ConsumeRequestCheck {
|
|
|
private final CommonCheck commonCheck;
|
|
|
private final CardConsumeValidation cardConsumevalidation;
|
|
|
private final BaseBusiness baseBusiness;
|
|
|
+ private final IPtBagService bagService;
|
|
|
|
|
|
public R<ErrorInfo> checkConsume(ConsumptionBo bo, RemoteUserAccountVo userAccountVo,
|
|
|
RemoteCardVo userCardVo, XfTermVo useTermVo,
|
|
|
@@ -146,7 +146,7 @@ public class ConsumeRequestCheck {
|
|
|
private R<ErrorInfo> checkWalletBalance(ConsumptionBo bo) {
|
|
|
String userIdStr = bo.getUserId().toString();
|
|
|
BigDecimal consumeMoney = bo.getConsumeMoney();
|
|
|
- BigDecimal totalBalance = RedisUtils.getCacheMapValue(CacheNames.USER_TOTAL_BALANCE, userIdStr);
|
|
|
+ BigDecimal totalBalance = bagService.getUserTotalBalance(bo.getUserId());
|
|
|
if (ObjectUtil.isEmpty(totalBalance)) {
|
|
|
totalBalance = BigDecimal.ZERO;
|
|
|
}
|
|
|
@@ -157,10 +157,6 @@ public class ConsumeRequestCheck {
|
|
|
// 计算扣费后的余额
|
|
|
BigDecimal balance = totalBalance.subtract(consumeMoney);
|
|
|
bo.setBalance(balance);
|
|
|
-
|
|
|
- // 更新余额缓存
|
|
|
- RedisUtils.setCacheMapValue(CacheNames.USER_TOTAL_BALANCE, userIdStr, balance);
|
|
|
-
|
|
|
return R.ok();
|
|
|
}
|
|
|
|