充值模块优化
This commit is contained in:
parent
5ddedc3b6f
commit
ab0eee51d0
@ -33,6 +33,7 @@ import cn.iocoder.yudao.module.pay.framework.pay.config.PayProperties;
|
||||
import cn.iocoder.yudao.module.pay.service.app.PayAppService;
|
||||
import cn.iocoder.yudao.module.pay.service.channel.PayChannelService;
|
||||
import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService;
|
||||
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -49,6 +50,7 @@ import java.util.Objects;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum.RECHARGE;
|
||||
|
||||
/**
|
||||
* 支付订单 Service 实现类
|
||||
@ -78,6 +80,8 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
private PayNotifyService notifyService;
|
||||
@Resource
|
||||
private PayWalletRechargeMapper walletRechargeMapper;
|
||||
@Resource
|
||||
private PayWalletService payWalletService;
|
||||
|
||||
@Override
|
||||
public PayOrderDO getOrder(Long id) {
|
||||
@ -264,6 +268,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
walletRechargeDO.setPayStatus(true);
|
||||
walletRechargeDO.setPayTime(LocalDateTime.now());
|
||||
walletRechargeMapper.updateById(walletRechargeDO);
|
||||
payWalletService.addWalletBalance(walletRechargeDO.getWalletId(),walletRechargeDO.getPayOrderId().toString(),RECHARGE,walletRechargeDO.getTotalPrice());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
|
||||
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum;
|
||||
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
|
||||
import cn.iocoder.yudao.module.pay.service.refund.PayRefundService;
|
||||
import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -34,6 +35,7 @@ import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString
|
||||
import static cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargeConvert.INSTANCE;
|
||||
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum.*;
|
||||
import static cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum.RECHARGE;
|
||||
|
||||
/**
|
||||
* 钱包充值 Service 实现类
|
||||
@ -61,6 +63,8 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
||||
private PayRefundService payRefundService;
|
||||
@Resource
|
||||
private PayWalletRechargePackageService payWalletRechargePackageService;
|
||||
@Resource
|
||||
private PayWalletTransactionService payWalletTransactionService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ -91,6 +95,15 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
||||
// 2.2 更新钱包充值记录中支付订单
|
||||
walletRechargeMapper.updateById(new PayWalletRechargeDO().setId(recharge.getId()).setPayOrderId(payOrderId));
|
||||
recharge.setPayOrderId(payOrderId);
|
||||
// WalletTransactionCreateReqBO reqBO = new WalletTransactionCreateReqBO();
|
||||
// reqBO.setBalance(wallet.getBalance()+recharge.getTotalPrice());
|
||||
// reqBO.setBizId(recharge.getPayOrderId().toString());
|
||||
// reqBO.setBizType(1);
|
||||
// reqBO.setPrice(recharge.getTotalPrice());
|
||||
// reqBO.setTitle("充值");
|
||||
// reqBO.setWalletId(recharge.getWalletId());
|
||||
// payWalletTransactionService.createWalletTransaction(reqBO);
|
||||
// payWalletService.addWalletBalance(recharge.getWalletId(),recharge.getPayOrderId().toString(),RECHARGE,recharge.getTotalPrice());
|
||||
return recharge;
|
||||
}
|
||||
|
||||
@ -125,7 +138,7 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
||||
// TODO @jason:这样的话,未来提现会不会把充值的,也提现走哈。类似先充 100,送 110;然后提现 110;
|
||||
// TODO 需要钱包中加个可提现余额
|
||||
payWalletService.addWalletBalance(walletRecharge.getWalletId(), String.valueOf(id),
|
||||
PayWalletBizTypeEnum.RECHARGE, walletRecharge.getTotalPrice());
|
||||
RECHARGE, walletRecharge.getTotalPrice());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user