提现审核
This commit is contained in:
		
							parent
							
								
									3acdb7733e
								
							
						
					
					
						commit
						094212e6a2
					
				@ -220,6 +220,7 @@ public enum ResultCode {
 | 
			
		||||
    WALLET_NOT_EXIT_ERROR(34000, "钱包不存在,请联系管理员"),
 | 
			
		||||
    WALLET_INSUFFICIENT(34001, "余额不足以支付订单,请充值!"),
 | 
			
		||||
    WALLET_WITHDRAWAL_INSUFFICIENT(34002, "可提现金额不足!"),
 | 
			
		||||
    WALLET_WITHDRAWAL_FROZEN_AMOUNT_INSUFFICIENT(34006, "冻结金额不足,无法处理提现申请请求!"),
 | 
			
		||||
    WALLET_ERROR_INSUFFICIENT(34003, "零钱提现失败!"),
 | 
			
		||||
    WALLET_REMARK_ERROR(34004, "请填写审核备注!"),
 | 
			
		||||
    WALLET_APPLY_ERROR(34005, "提现申请异常!"),
 | 
			
		||||
 | 
			
		||||
@ -154,7 +154,7 @@ public class MemberWalletServiceImpl extends ServiceImpl<MemberWalletMapper, Mem
 | 
			
		||||
        if (0 > CurrencyUtil.sub(memberWallet.getMemberWallet(), money)) {
 | 
			
		||||
            throw new ServiceException(ResultCode.WALLET_WITHDRAWAL_INSUFFICIENT);
 | 
			
		||||
        }
 | 
			
		||||
        memberWallet.setMemberWallet(CurrencyUtil.sub(memberWallet.getMemberWallet(), money));
 | 
			
		||||
        memberWallet.setMemberFrozenWallet(CurrencyUtil.sub(memberWallet.getMemberFrozenWallet(), money));
 | 
			
		||||
        this.updateById(memberWallet);
 | 
			
		||||
        //新增预存款日志
 | 
			
		||||
        WalletLog walletLog = new WalletLog(memberWallet.getMemberId(), memberWallet.getMemberName(), -money, "提现金额已冻结,审核通过提现成功", serviceType);
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@ package cn.lili.modules.member.serviceimpl;
 | 
			
		||||
 | 
			
		||||
import cn.lili.common.enums.ResultCode;
 | 
			
		||||
import cn.lili.common.exception.ServiceException;
 | 
			
		||||
import cn.lili.common.utils.DateUtil;
 | 
			
		||||
import cn.lili.mybatis.util.PageUtil;
 | 
			
		||||
import cn.lili.common.utils.StringUtils;
 | 
			
		||||
import cn.lili.common.vo.PageVO;
 | 
			
		||||
@ -45,22 +46,23 @@ public class MemberWithdrawApplyServiceImpl extends ServiceImpl<MemberWithdrawAp
 | 
			
		||||
        //查询申请记录
 | 
			
		||||
        MemberWithdrawApply memberWithdrawApply = this.getById(applyId);
 | 
			
		||||
        memberWithdrawApply.setInspectRemark(remark);
 | 
			
		||||
        memberWithdrawApply.setInspectTime(new Date());
 | 
			
		||||
        if (memberWithdrawApply != null) {
 | 
			
		||||
            //写入备注
 | 
			
		||||
            memberWithdrawApply.setInspectRemark(remark);
 | 
			
		||||
           //获取账户余额
 | 
			
		||||
            MemberWalletVO memberWalletVO = memberWalletService.getMemberWallet(memberWithdrawApply.getMemberId());
 | 
			
		||||
            //校验金额是否满足提现,因为是从冻结金额扣减,所以校验的是冻结金额
 | 
			
		||||
            if (memberWalletVO.getMemberFrozenWallet() < memberWithdrawApply.getApplyMoney()) {
 | 
			
		||||
                throw new ServiceException(ResultCode.WALLET_WITHDRAWAL_FROZEN_AMOUNT_INSUFFICIENT);
 | 
			
		||||
            }
 | 
			
		||||
            //如果审核通过 则微信直接提现,反之则记录审核状态
 | 
			
		||||
            if (result) {
 | 
			
		||||
                //校验金额是否满足提现,因为是从冻结金额扣减,所以校验的是冻结金额
 | 
			
		||||
                MemberWalletVO memberWalletVO = memberWalletService.getMemberWallet(memberWithdrawApply.getMemberId());
 | 
			
		||||
                if (memberWalletVO.getMemberFrozenWallet() < memberWithdrawApply.getApplyMoney()) {
 | 
			
		||||
                    throw new ServiceException(ResultCode.WALLET_WITHDRAWAL_INSUFFICIENT);
 | 
			
		||||
                }
 | 
			
		||||
                memberWithdrawApply.setApplyStatus(WithdrawStatusEnum.VIA_AUDITING.name());
 | 
			
		||||
                //保存审核记录
 | 
			
		||||
                this.updateById(memberWithdrawApply);
 | 
			
		||||
                //提现,微信提现成功后扣减冻结金额
 | 
			
		||||
                Boolean bool = memberWalletService.withdrawal(memberWithdrawApply);
 | 
			
		||||
                if (bool) {
 | 
			
		||||
                    //保存修改审核记录
 | 
			
		||||
                    this.updateById(memberWithdrawApply);
 | 
			
		||||
                    //记录日志
 | 
			
		||||
                    memberWalletService.reduceFrozen(memberWithdrawApply.getApplyMoney(), memberWithdrawApply.getMemberId(), "审核通过,余额提现", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name());
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
@ -70,6 +72,7 @@ public class MemberWithdrawApplyServiceImpl extends ServiceImpl<MemberWithdrawAp
 | 
			
		||||
                    throw new ServiceException(ResultCode.WALLET_REMARK_ERROR);
 | 
			
		||||
                }
 | 
			
		||||
                memberWithdrawApply.setApplyStatus(WithdrawStatusEnum.FAIL_AUDITING.name());
 | 
			
		||||
                //保存修改审核记录
 | 
			
		||||
                this.updateById(memberWithdrawApply);
 | 
			
		||||
                //需要从冻结金额扣减到余额
 | 
			
		||||
                memberWalletService.increaseWithdrawal(memberWithdrawApply.getApplyMoney(), memberWithdrawApply.getMemberId(), "审核拒绝,提现金额解冻到余额", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name());
 | 
			
		||||
 | 
			
		||||
@ -22,4 +22,7 @@ INSERT INTO `lilishop`.`li_menu` (`id`, `create_by`, `create_time`, `delete_flag
 | 
			
		||||
alter table li_member_evaluation modify column reply_image text;
 | 
			
		||||
 | 
			
		||||
/** 修改售后图片字段类型 **/
 | 
			
		||||
alter table li_after_sale modify column after_sale_image text;
 | 
			
		||||
alter table li_after_sale modify column after_sale_image text;
 | 
			
		||||
 | 
			
		||||
/** 提现申请审核sql **/
 | 
			
		||||
INSERT INTO `lilishop`.`li_menu`(`id`, `create_by`, `create_time`, `delete_flag`, `update_by`, `update_time`, `description`, `front_route`, `icon`, `level`, `name`, `parent_id`, `path`, `sort_order`, `title`, `front_component`) VALUES (1367042804944994305, 'admin', '2021-03-03 09:22:58', b'0', NULL, NULL, NULL, 'member/advance/withdrawApply', 'ios-alert', 2, 'withdrawApply', '1367042490443497472', 'withdrawApply', 1.00, '提现申请', NULL);
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user