优化规范余额相关模型传递问题

This commit is contained in:
Chopper 2021-12-01 09:58:21 +08:00
parent 6184ba9b82
commit c224ad568e
8 changed files with 122 additions and 83 deletions

View File

@ -2,6 +2,7 @@ package cn.lili.modules.distribution.serviceimpl;
import cn.lili.common.enums.ResultCode; import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException; import cn.lili.common.exception.ServiceException;
import cn.lili.modules.wallet.entity.dto.MemberWalletUpdateDTO;
import cn.lili.modules.wallet.entity.enums.WithdrawStatusEnum; import cn.lili.modules.wallet.entity.enums.WithdrawStatusEnum;
import cn.lili.rocketmq.RocketmqSendCallbackBuilder; import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
import cn.lili.rocketmq.tags.MemberTagsEnum; import cn.lili.rocketmq.tags.MemberTagsEnum;
@ -130,7 +131,7 @@ public class DistributionCashServiceImpl extends ServiceImpl<DistributionCashMap
distributorCash.setDistributionCashStatus(WithdrawStatusEnum.VIA_AUDITING.name()); distributorCash.setDistributionCashStatus(WithdrawStatusEnum.VIA_AUDITING.name());
distributorCash.setPayTime(new Date()); distributorCash.setPayTime(new Date());
//提现到余额 //提现到余额
memberWalletService.increase(distributorCash.getPrice(), distribution.getMemberId(), "分销[" + distributorCash.getSn() + "]佣金提现到余额[" + distributorCash.getPrice() + "]", DepositServiceTypeEnum.WALLET_COMMISSION.name()); memberWalletService.increase(new MemberWalletUpdateDTO(distributorCash.getPrice(), distribution.getMemberId(), "分销[" + distributorCash.getSn() + "]佣金提现到余额[" + distributorCash.getPrice() + "]", DepositServiceTypeEnum.WALLET_COMMISSION.name()));
} else { } else {
memberWithdrawalMessage.setStatus(WithdrawStatusEnum.FAIL_AUDITING.name()); memberWithdrawalMessage.setStatus(WithdrawStatusEnum.FAIL_AUDITING.name());
//分销员可提现金额退回 //分销员可提现金额退回

View File

@ -5,6 +5,7 @@ import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException; import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.context.UserContext; import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage; import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.wallet.entity.dto.MemberWalletUpdateDTO;
import cn.lili.modules.wallet.service.MemberWalletService; import cn.lili.modules.wallet.service.MemberWalletService;
import cn.lili.modules.wallet.entity.enums.DepositServiceTypeEnum; import cn.lili.modules.wallet.entity.enums.DepositServiceTypeEnum;
import cn.lili.modules.payment.entity.RefundLog; import cn.lili.modules.payment.entity.RefundLog;
@ -95,10 +96,10 @@ public class WalletPlugin implements Payment {
public void cancel(RefundLog refundLog) { public void cancel(RefundLog refundLog) {
try { try {
memberWalletService.increase(refundLog.getTotalAmount(), memberWalletService.increase(new MemberWalletUpdateDTO(refundLog.getTotalAmount(),
refundLog.getMemberId(), refundLog.getMemberId(),
"取消[" + refundLog.getOrderSn() + "]订单,退还金额[" + refundLog.getTotalAmount() + "]", "取消[" + refundLog.getOrderSn() + "]订单,退还金额[" + refundLog.getTotalAmount() + "]",
DepositServiceTypeEnum.WALLET_REFUND.name()); DepositServiceTypeEnum.WALLET_REFUND.name()));
refundLog.setIsRefund(true); refundLog.setIsRefund(true);
refundLogService.save(refundLog); refundLogService.save(refundLog);
} catch (Exception e) { } catch (Exception e) {
@ -120,9 +121,10 @@ public class WalletPlugin implements Payment {
@Override @Override
public void refund(RefundLog refundLog) { public void refund(RefundLog refundLog) {
try { try {
memberWalletService.increase(refundLog.getTotalAmount(), memberWalletService.increase(new MemberWalletUpdateDTO(refundLog.getTotalAmount(),
refundLog.getMemberId(), refundLog.getMemberId(),
"售后[" + refundLog.getAfterSaleNo() + "]审批,退还金额[" + refundLog.getTotalAmount() + "]", DepositServiceTypeEnum.WALLET_REFUND.name()); "售后[" + refundLog.getAfterSaleNo() + "]审批,退还金额[" + refundLog.getTotalAmount() + "]",
DepositServiceTypeEnum.WALLET_REFUND.name()));
refundLog.setIsRefund(true); refundLog.setIsRefund(true);
refundLogService.save(refundLog); refundLogService.save(refundLog);
} catch (Exception e) { } catch (Exception e) {
@ -143,11 +145,12 @@ public class WalletPlugin implements Payment {
if (UserContext.getCurrentUser() == null) { if (UserContext.getCurrentUser() == null) {
throw new ServiceException(ResultCode.USER_NOT_LOGIN); throw new ServiceException(ResultCode.USER_NOT_LOGIN);
} }
boolean result = memberWalletService.reduce( boolean result = memberWalletService.reduce(new MemberWalletUpdateDTO(
cashierParam.getPrice(), cashierParam.getPrice(),
UserContext.getCurrentUser().getId(), UserContext.getCurrentUser().getId(),
"订单[" + cashierParam.getOrderSns() + "]支付金额[" + cashierParam.getPrice() + "]", "订单[" + cashierParam.getOrderSns() + "]支付金额[" + cashierParam.getPrice() + "]",
DepositServiceTypeEnum.WALLET_PAY.name() DepositServiceTypeEnum.WALLET_PAY.name()
)
); );
if (result) { if (result) {
try { try {
@ -162,11 +165,11 @@ public class WalletPlugin implements Payment {
log.info("支付回调通知:余额支付:{}", payParam); log.info("支付回调通知:余额支付:{}", payParam);
} catch (ServiceException e) { } catch (ServiceException e) {
//业务异常则支付手动回滚 //业务异常则支付手动回滚
memberWalletService.increase( memberWalletService.increase(new MemberWalletUpdateDTO(
cashierParam.getPrice(), cashierParam.getPrice(),
UserContext.getCurrentUser().getId(), UserContext.getCurrentUser().getId(),
"订单[" + cashierParam.getOrderSns() + "]支付异常,余额返还[" + cashierParam.getPrice() + "]", "订单[" + cashierParam.getOrderSns() + "]支付异常,余额返还[" + cashierParam.getPrice() + "]",
DepositServiceTypeEnum.WALLET_REFUND.name() DepositServiceTypeEnum.WALLET_REFUND.name())
); );
throw e; throw e;
} }

View File

@ -1,5 +1,6 @@
package cn.lili.modules.wallet.entity.dos; package cn.lili.modules.wallet.entity.dos;
import cn.lili.modules.wallet.entity.dto.MemberWalletUpdateDTO;
import cn.lili.modules.wallet.entity.enums.DepositServiceTypeEnum; import cn.lili.modules.wallet.entity.enums.DepositServiceTypeEnum;
import cn.lili.mybatis.BaseIdEntity; import cn.lili.mybatis.BaseIdEntity;
import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.FieldFill;
@ -64,17 +65,30 @@ public class WalletLog extends BaseIdEntity {
/** /**
* 构建新的预存款日志对象 * 构建新的预存款日志对象
* *
* @param memberId 会员id
* @param memberName 会员名称 * @param memberName 会员名称
* @param money 金额 * @param memberWalletUpdateDTO 变动模型
* @param detail 备注
*/ */
public WalletLog(String memberId, String memberName, Double money, String detail, String serviceType) { public WalletLog(String memberName, MemberWalletUpdateDTO memberWalletUpdateDTO) {
this.setMemberId(memberId); this.setMemberId(memberWalletUpdateDTO.getMemberId());
this.setMemberName(memberName); this.setMemberName(memberName);
this.setMoney(money); this.setMoney(memberWalletUpdateDTO.getMoney());
this.setDetail(detail); this.setDetail(memberWalletUpdateDTO.getDetail());
this.setServiceType(serviceType); this.setServiceType(memberWalletUpdateDTO.getServiceType());
}
/**
* 构建新的预存款日志对象
*
* @param memberName 会员名称
* @param memberWalletUpdateDTO 变动模型
* @param isReduce 是否是消费
*/
public WalletLog(String memberName, MemberWalletUpdateDTO memberWalletUpdateDTO, boolean isReduce) {
this.setMemberId(memberWalletUpdateDTO.getMemberId());
this.setMemberName(memberName);
this.setMoney(isReduce ? -memberWalletUpdateDTO.getMoney() : memberWalletUpdateDTO.getMoney());
this.setDetail(memberWalletUpdateDTO.getDetail());
this.setServiceType(memberWalletUpdateDTO.getServiceType());
} }
} }

View File

@ -0,0 +1,30 @@
package cn.lili.modules.wallet.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* 会员余额变动模型
*
* @author Chopper
* @version v1.0
* 2021-12-01 09:35
*/
@Data
@AllArgsConstructor
public class MemberWalletUpdateDTO {
@ApiModelProperty(value = "变动金额")
private Double money;
@ApiModelProperty(value = "变动会员id")
private String memberId;
@ApiModelProperty(value = "日志详情")
private String detail;
/**
* @see cn.lili.modules.wallet.entity.enums.DepositServiceTypeEnum
*/
@ApiModelProperty(value = "变动业务原因")
private String serviceType;
}

View File

@ -4,6 +4,7 @@ package cn.lili.modules.wallet.service;
import cn.lili.modules.member.entity.dos.Member; import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.wallet.entity.dos.MemberWallet; import cn.lili.modules.wallet.entity.dos.MemberWallet;
import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply; import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply;
import cn.lili.modules.wallet.entity.dto.MemberWalletUpdateDTO;
import cn.lili.modules.wallet.entity.vo.MemberWalletVO; import cn.lili.modules.wallet.entity.vo.MemberWalletVO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@ -26,57 +27,42 @@ public interface MemberWalletService extends IService<MemberWallet> {
/** /**
* 增加用户预存款余额 * 增加用户预存款余额
* *
* @param money 金额 * @param memberWalletUpdateDTO 变动模型
* @param memberId 会员id * @return 返回增加结果 true:成功 false:失败
* @param serviceType 业务类型 @see DepositServiceTypeEnum
* @param detail 操作描述
* @return 返回增加结果 true:增加成功 false:增加失败
*/ */
Boolean increase(Double money, String memberId, String detail, String serviceType); Boolean increase(MemberWalletUpdateDTO memberWalletUpdateDTO);
/** /**
* 从冻结金额到余额 * 从冻结金额到余额
* *
* @param money 金额 * @param memberWalletUpdateDTO 变动模型
* @param memberId 会员id * @return 返回冻结结果 true:成功 false:失败
* @param serviceType 业务类型 @see DepositServiceTypeEnum
* @param detail 操作描述
* @return 返回增加结果 true:增加成功 false:增加失败
*/ */
Boolean increaseWithdrawal(Double money, String memberId, String detail, String serviceType); Boolean increaseWithdrawal(MemberWalletUpdateDTO memberWalletUpdateDTO);
/** /**
* 扣减用户预存款余额 * 扣减用户预存款余额
* *
* @param money 金额 * @param memberWalletUpdateDTO 变动模型
* @param memberId 会员id * @return 操作状态 true:成功 false:失败
* @param detail 操作描述
* @param serviceType 业务类型 @see DepositServiceTypeEnum
* @return 操作状态
*/ */
Boolean reduce(Double money, String memberId, String detail, String serviceType); Boolean reduce(MemberWalletUpdateDTO memberWalletUpdateDTO);
/** /**
* 提现扣减余额到冻结金额 * 提现扣减余额到冻结金额
* *
* @param money 金额 * @param memberWalletUpdateDTO 变动模型
* @param memberId 会员id * @return 操作状态 true:成功 false:失败
* @param detail 操作描述
* @param serviceType 业务类型 @see DepositServiceTypeEnum
* @return 操作状态
*/ */
Boolean reduceWithdrawal(Double money, String memberId, String detail, String serviceType); Boolean reduceWithdrawal(MemberWalletUpdateDTO memberWalletUpdateDTO);
/** /**
* 提现扣减冻结金额 * 提现扣减冻结金额
* *
* @param money 金额 * @param memberWalletUpdateDTO 变动模型
* @param memberId 会员id
* @param detail 操作描述
* @param serviceType 类型
* @return 操作状态 * @return 操作状态
*/ */
Boolean reduceFrozen(Double money, String memberId, String detail, String serviceType); Boolean reduceFrozen(MemberWalletUpdateDTO memberWalletUpdateDTO);
/** /**
* 设置支付密码 * 设置支付密码

View File

@ -12,6 +12,7 @@ import cn.lili.common.utils.StringUtils;
import cn.lili.modules.member.entity.dos.Member; import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.wallet.entity.dos.MemberWallet; import cn.lili.modules.wallet.entity.dos.MemberWallet;
import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply; import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply;
import cn.lili.modules.wallet.entity.dto.MemberWalletUpdateDTO;
import cn.lili.modules.wallet.entity.dto.MemberWithdrawalMessage; import cn.lili.modules.wallet.entity.dto.MemberWithdrawalMessage;
import cn.lili.modules.wallet.entity.enums.MemberWithdrawalDestinationEnum; import cn.lili.modules.wallet.entity.enums.MemberWithdrawalDestinationEnum;
import cn.lili.modules.wallet.entity.enums.WithdrawStatusEnum; import cn.lili.modules.wallet.entity.enums.WithdrawStatusEnum;
@ -94,82 +95,82 @@ public class MemberWalletServiceImpl extends ServiceImpl<MemberWalletMapper, Mem
} }
@Override @Override
public Boolean increaseWithdrawal(Double money, String memberId, String detail, String serviceType) { public Boolean increaseWithdrawal(MemberWalletUpdateDTO memberWalletUpdateDTO) {
//检测会员预存款讯息是否存在如果不存在则新建 //检测会员预存款讯息是否存在如果不存在则新建
MemberWallet memberWallet = this.checkMemberWallet(memberId); MemberWallet memberWallet = this.checkMemberWallet(memberWalletUpdateDTO.getMemberId());
//余额变动 //余额变动
memberWallet.setMemberWallet(CurrencyUtil.add(memberWallet.getMemberWallet(), money)); memberWallet.setMemberWallet(CurrencyUtil.add(memberWallet.getMemberWallet(), memberWalletUpdateDTO.getMoney()));
memberWallet.setMemberFrozenWallet(CurrencyUtil.sub(memberWallet.getMemberFrozenWallet(), money)); memberWallet.setMemberFrozenWallet(CurrencyUtil.sub(memberWallet.getMemberFrozenWallet(), memberWalletUpdateDTO.getMoney()));
this.updateById(memberWallet); this.updateById(memberWallet);
//新增预存款日志 //新增预存款日志
WalletLog walletLog = new WalletLog(memberWallet.getMemberId(), memberWallet.getMemberName(), money, detail, serviceType); WalletLog walletLog = new WalletLog(memberWallet.getMemberName(), memberWalletUpdateDTO);
walletLogService.save(walletLog); walletLogService.save(walletLog);
return true; return true;
} }
@Override @Override
public Boolean increase(Double money, String memberId, String detail, String serviceType) { public Boolean increase(MemberWalletUpdateDTO memberWalletUpdateDTO) {
//检测会员预存款讯息是否存在如果不存在则新建 //检测会员预存款讯息是否存在如果不存在则新建
MemberWallet memberWallet = this.checkMemberWallet(memberId); MemberWallet memberWallet = this.checkMemberWallet(memberWalletUpdateDTO.getMemberId());
//新增预存款 //新增预存款
memberWallet.setMemberWallet(CurrencyUtil.add(memberWallet.getMemberWallet(), money)); memberWallet.setMemberWallet(CurrencyUtil.add(memberWallet.getMemberWallet(), memberWalletUpdateDTO.getMoney()));
this.baseMapper.updateById(memberWallet); this.baseMapper.updateById(memberWallet);
//新增预存款日志 //新增预存款日志
WalletLog walletLog = new WalletLog(memberWallet.getMemberId(), memberWallet.getMemberName(), money, detail, serviceType); WalletLog walletLog = new WalletLog(memberWallet.getMemberName(), memberWalletUpdateDTO);
walletLogService.save(walletLog); walletLogService.save(walletLog);
return true; return true;
} }
@Override @Override
public Boolean reduce(Double money, String memberId, String detail, String serviceType) { public Boolean reduce(MemberWalletUpdateDTO memberWalletUpdateDTO) {
//检测会员预存款讯息是否存在如果不存在则新建 //检测会员预存款讯息是否存在如果不存在则新建
MemberWallet memberWallet = this.checkMemberWallet(memberId); MemberWallet memberWallet = this.checkMemberWallet(memberWalletUpdateDTO.getMemberId());
//减少预存款需要校验 如果不够扣减预存款 //减少预存款需要校验 如果不够扣减预存款
if (0 > CurrencyUtil.sub(memberWallet.getMemberWallet(), money)) { if (0 > CurrencyUtil.sub(memberWallet.getMemberWallet(), memberWalletUpdateDTO.getMoney())) {
return false; return false;
} }
memberWallet.setMemberWallet(CurrencyUtil.sub(memberWallet.getMemberWallet(), money)); memberWallet.setMemberWallet(CurrencyUtil.sub(memberWallet.getMemberWallet(), memberWalletUpdateDTO.getMoney()));
//保存记录 //保存记录
this.updateById(memberWallet); this.updateById(memberWallet);
//新增预存款日志 //新增预存款日志
WalletLog walletLog = new WalletLog(memberWallet.getMemberId(), memberWallet.getMemberName(), -money, detail, serviceType); WalletLog walletLog = new WalletLog(memberWallet.getMemberName(), memberWalletUpdateDTO, true);
walletLogService.save(walletLog); walletLogService.save(walletLog);
return true; return true;
} }
@Override @Override
public Boolean reduceWithdrawal(Double money, String memberId, String detail, String serviceType) { public Boolean reduceWithdrawal(MemberWalletUpdateDTO memberWalletUpdateDTO) {
//检测会员预存款讯息是否存在如果不存在则新建 //检测会员预存款讯息是否存在如果不存在则新建
MemberWallet memberWallet = this.checkMemberWallet(memberId); MemberWallet memberWallet = this.checkMemberWallet(memberWalletUpdateDTO.getMemberId());
//减少预存款需要校验 如果不够扣减预存款 //减少预存款需要校验 如果不够扣减预存款
if (0 > CurrencyUtil.sub(memberWallet.getMemberWallet(), money)) { if (0 > CurrencyUtil.sub(memberWallet.getMemberWallet(), memberWalletUpdateDTO.getMoney())) {
throw new ServiceException(ResultCode.WALLET_WITHDRAWAL_INSUFFICIENT); throw new ServiceException(ResultCode.WALLET_WITHDRAWAL_INSUFFICIENT);
} }
memberWallet.setMemberWallet(CurrencyUtil.sub(memberWallet.getMemberWallet(), money)); memberWallet.setMemberWallet(CurrencyUtil.sub(memberWallet.getMemberWallet(), memberWalletUpdateDTO.getMoney()));
memberWallet.setMemberFrozenWallet(CurrencyUtil.add(memberWallet.getMemberFrozenWallet(), money)); memberWallet.setMemberFrozenWallet(CurrencyUtil.add(memberWallet.getMemberFrozenWallet(), memberWalletUpdateDTO.getMoney()));
//修改余额 //修改余额
this.updateById(memberWallet); this.updateById(memberWallet);
//新增预存款日志 //新增预存款日志
WalletLog walletLog = new WalletLog(memberWallet.getMemberId(), memberWallet.getMemberName(), -money, detail, serviceType); WalletLog walletLog = new WalletLog(memberWallet.getMemberName(), memberWalletUpdateDTO, true);
walletLogService.save(walletLog); walletLogService.save(walletLog);
return true; return true;
} }
@Override @Override
public Boolean reduceFrozen(Double money, String memberId, String detail, String serviceType) { public Boolean reduceFrozen(MemberWalletUpdateDTO memberWalletUpdateDTO) {
//检测会员预存款讯息是否存在如果不存在则新建 //检测会员预存款讯息是否存在如果不存在则新建
MemberWallet memberWallet = this.checkMemberWallet(memberId); MemberWallet memberWallet = this.checkMemberWallet(memberWalletUpdateDTO.getMemberId());
//校验此金额是否超过冻结金额 //校验此金额是否超过冻结金额
if (0 > CurrencyUtil.sub(memberWallet.getMemberWallet(), money)) { if (0 > CurrencyUtil.sub(memberWallet.getMemberWallet(), memberWalletUpdateDTO.getMoney())) {
throw new ServiceException(ResultCode.WALLET_WITHDRAWAL_INSUFFICIENT); throw new ServiceException(ResultCode.WALLET_WITHDRAWAL_INSUFFICIENT);
} }
memberWallet.setMemberFrozenWallet(CurrencyUtil.sub(memberWallet.getMemberFrozenWallet(), money)); memberWallet.setMemberFrozenWallet(CurrencyUtil.sub(memberWallet.getMemberFrozenWallet(), memberWalletUpdateDTO.getMoney()));
this.updateById(memberWallet); this.updateById(memberWallet);
//新增预存款日志 //新增预存款日志
WalletLog walletLog = new WalletLog(memberWallet.getMemberId(), memberWallet.getMemberName(), -money, "提现金额已冻结,审核通过提现成功", serviceType); WalletLog walletLog = new WalletLog(memberWallet.getMemberName(), memberWalletUpdateDTO, true);
walletLogService.save(walletLog); walletLogService.save(walletLog);
return true; return true;
} }
@ -273,12 +274,12 @@ public class MemberWalletServiceImpl extends ServiceImpl<MemberWalletMapper, Mem
//微信零钱提现 //微信零钱提现
Boolean result = withdrawal(memberWithdrawApply); Boolean result = withdrawal(memberWithdrawApply);
if (result) { if (result) {
this.reduce(price, authUser.getId(), "余额提现成功", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()); this.reduce(new MemberWalletUpdateDTO(price, authUser.getId(), "余额提现成功", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()));
} }
} else { } else {
memberWithdrawalMessage.setStatus(WithdrawStatusEnum.APPLY.name()); memberWithdrawalMessage.setStatus(WithdrawStatusEnum.APPLY.name());
//扣减余额到冻结金额 //扣减余额到冻结金额
this.reduceWithdrawal(price, authUser.getId(), "提现金额已冻结,审核成功后到账", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()); this.reduceWithdrawal(new MemberWalletUpdateDTO(price, authUser.getId(), "提现金额已冻结,审核成功后到账", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()));
} }
//发送余额提现申请消息 //发送余额提现申请消息

View File

@ -4,6 +4,7 @@ package cn.lili.modules.wallet.serviceimpl;
import cn.lili.common.enums.ResultCode; import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException; import cn.lili.common.exception.ServiceException;
import cn.lili.common.properties.RocketmqCustomProperties; import cn.lili.common.properties.RocketmqCustomProperties;
import cn.lili.modules.wallet.entity.dto.MemberWalletUpdateDTO;
import cn.lili.modules.wallet.entity.dto.MemberWithdrawalMessage; import cn.lili.modules.wallet.entity.dto.MemberWithdrawalMessage;
import cn.lili.modules.wallet.entity.enums.MemberWithdrawalDestinationEnum; import cn.lili.modules.wallet.entity.enums.MemberWithdrawalDestinationEnum;
import cn.lili.mybatis.util.PageUtil; import cn.lili.mybatis.util.PageUtil;
@ -75,7 +76,9 @@ public class MemberWithdrawApplyServiceImpl extends ServiceImpl<MemberWithdrawAp
//保存修改审核记录 //保存修改审核记录
this.updateById(memberWithdrawApply); this.updateById(memberWithdrawApply);
//记录日志 //记录日志
memberWalletService.reduceFrozen(memberWithdrawApply.getApplyMoney(), memberWithdrawApply.getMemberId(), "审核通过,余额提现", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()); memberWalletService.reduceFrozen(
new MemberWalletUpdateDTO(memberWithdrawApply.getApplyMoney(), memberWithdrawApply.getMemberId(), "审核通过,余额提现", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()))
;
} else { } else {
//如果提现失败则无法审核 //如果提现失败则无法审核
throw new ServiceException(ResultCode.WALLET_APPLY_ERROR); throw new ServiceException(ResultCode.WALLET_APPLY_ERROR);
@ -90,7 +93,7 @@ public class MemberWithdrawApplyServiceImpl extends ServiceImpl<MemberWithdrawAp
//保存修改审核记录 //保存修改审核记录
this.updateById(memberWithdrawApply); this.updateById(memberWithdrawApply);
//需要从冻结金额扣减到余额 //需要从冻结金额扣减到余额
memberWalletService.increaseWithdrawal(memberWithdrawApply.getApplyMoney(), memberWithdrawApply.getMemberId(), "审核拒绝,提现金额解冻到余额", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()); memberWalletService.increaseWithdrawal(new MemberWalletUpdateDTO(memberWithdrawApply.getApplyMoney(), memberWithdrawApply.getMemberId(), "审核拒绝,提现金额解冻到余额", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()));
} }
//发送审核消息 //发送审核消息
memberWithdrawalMessage.setMemberId(memberWithdrawApply.getMemberId()); memberWithdrawalMessage.setMemberId(memberWithdrawApply.getMemberId());

View File

@ -5,6 +5,7 @@ import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException; import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.AuthUser; import cn.lili.common.security.AuthUser;
import cn.lili.common.security.context.UserContext; import cn.lili.common.security.context.UserContext;
import cn.lili.modules.wallet.entity.dto.MemberWalletUpdateDTO;
import cn.lili.mybatis.util.PageUtil; import cn.lili.mybatis.util.PageUtil;
import cn.lili.common.utils.SnowFlake; import cn.lili.common.utils.SnowFlake;
import cn.lili.common.utils.StringUtils; import cn.lili.common.utils.StringUtils;
@ -90,7 +91,7 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
//执行保存操作 //执行保存操作
this.updateById(recharge); this.updateById(recharge);
//增加预存款余额 //增加预存款余额
memberWalletService.increase(recharge.getRechargeMoney(), recharge.getMemberId(), "会员余额充值,充值单号为:" + recharge.getRechargeSn(), DepositServiceTypeEnum.WALLET_RECHARGE.name()); memberWalletService.increase(new MemberWalletUpdateDTO(recharge.getRechargeMoney(), recharge.getMemberId(), "会员余额充值,充值单号为:" + recharge.getRechargeSn(), DepositServiceTypeEnum.WALLET_RECHARGE.name()));
} }
} }