Compare commits

..

No commits in common. "0f7743abb18650722c9b5eac4cb2627cc285707a" and "7150bcf4951e25634f1ccbe692ab7864cb65bc1a" have entirely different histories.

2 changed files with 70 additions and 83 deletions

View File

@ -286,16 +286,7 @@ public class AliPayServiceImpl implements AliPayService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public R<String> fetch(String amount) throws AlipayApiException, FileNotFoundException { public R<String> fetch(String amount) throws AlipayApiException, FileNotFoundException {
String lock = redisCache.getCacheObject("alipay:fetch:user:" + SecurityUtils.getUserId());
if (!StrUtil.isEmpty(lock)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "请勿频繁点击");
}
try {
redisCache.setCacheObject("alipay:fetch:user:" + SecurityUtils.getUserId(), "1");
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
SysUser sysUser = sysUserService.selectUserById(userId); SysUser sysUser = sysUserService.selectUserById(userId);
if (sysUser.getWallet() < Double.parseDouble(amount)) { if (sysUser.getWallet() < Double.parseDouble(amount)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"钱包余额不足"); return R.fail(HttpStatus.SHOW_ERROR_MSG,"钱包余额不足");
@ -363,10 +354,6 @@ public class AliPayServiceImpl implements AliPayService {
} }
System.out.println("用户" + SecurityUtils.getLoginUser().getUser().getNickName() + "提现失败:" + response.getSubMsg()); System.out.println("用户" + SecurityUtils.getLoginUser().getUser().getNickName() + "提现失败:" + response.getSubMsg());
throw new ServiceException("提现失败", HttpStatus.SHOW_ERROR_MSG); throw new ServiceException("提现失败", HttpStatus.SHOW_ERROR_MSG);
} finally {
redisCache.deleteObject("alipay:fetch:user:" + SecurityUtils.getUserId());
}
} }
@Override @Override

View File

@ -123,8 +123,8 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
CommissionRatio commissionRatio2 = commissionRatioService.lambdaQuery() CommissionRatio commissionRatio2 = commissionRatioService.lambdaQuery()
.eq(CommissionRatio::getType, 1) .eq(CommissionRatio::getType, 1)
.one(); .one();
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_INVITER_USER.getName(), commissionRatio1.getRatio().toString()); redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_INVITER_USER.getName(), commissionRatio1);
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_MERCHANT.getName(), commissionRatio2.getRatio().toString()); redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_MERCHANT.getName(), commissionRatio2);
} }