fix(mcwl-pay): 修复支付宝提现功能
parent
196ba38b15
commit
ccd4372a68
|
@ -286,10 +286,19 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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();
|
||||
|
||||
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
if (sysUser.getWallet() < Double.parseDouble(amount)) {
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"钱包余额不足");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG, "钱包余额不足");
|
||||
}
|
||||
|
||||
// 初始化SDK
|
||||
|
@ -320,7 +329,7 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
.eq(SysUserPayAccount::getType, 0)
|
||||
.one();
|
||||
if (Objects.isNull(sysUserPayAccount)) {
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"请先绑定支付宝账号");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG, "请先绑定支付宝账号");
|
||||
}
|
||||
|
||||
// 收款方信息
|
||||
|
@ -354,6 +363,10 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
}
|
||||
System.out.println("用户" + SecurityUtils.getLoginUser().getUser().getNickName() + "提现失败:" + response.getSubMsg());
|
||||
throw new ServiceException("提现失败", HttpStatus.SHOW_ERROR_MSG);
|
||||
} finally {
|
||||
redisCache.deleteObject("alipay:fetch:user:" + SecurityUtils.getUserId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -377,7 +390,7 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
|
||||
// 如果数据库中不存在该订单, 则返回订单不存在
|
||||
if (Objects.isNull(orderTrade)) {
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"订单不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG, "订单不存在");
|
||||
}
|
||||
|
||||
|
||||
|
@ -404,7 +417,7 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
Map<String, String> params = new HashMap<>();
|
||||
params.put("buyer_pay_amount", tradStatus.getBuyerPayAmount());
|
||||
params.put("out_trade_no", tradStatus.getOutTradeNo());
|
||||
params.put("gmt_payment",DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, tradStatus.getSendPayDate()));
|
||||
params.put("gmt_payment", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, tradStatus.getSendPayDate()));
|
||||
params.put("total_amount", tradStatus.getTotalAmount());
|
||||
params.put("trade_no", tradStatus.getTradeNo());
|
||||
String code = orderTrade.getCode();
|
||||
|
|
|
@ -123,8 +123,8 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
|
|||
CommissionRatio commissionRatio2 = commissionRatioService.lambdaQuery()
|
||||
.eq(CommissionRatio::getType, 1)
|
||||
.one();
|
||||
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_INVITER_USER.getName(), commissionRatio1);
|
||||
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_MERCHANT.getName(), commissionRatio2);
|
||||
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_INVITER_USER.getName(), commissionRatio1.getRatio().toString());
|
||||
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_MERCHANT.getName(), commissionRatio2.getRatio().toString());
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue