From 742452d530eb37c1990996a5d625a3fb56d2b59c Mon Sep 17 00:00:00 2001 From: Hentua <wangdoubleone@gmail.com> Date: Tue, 25 Apr 2023 23:03:10 +0800 Subject: [PATCH] fix --- src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java | 12 +++--------- src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java | 8 ++++---- src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java | 9 +-------- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java index f90c10c..e3865fc 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java @@ -460,15 +460,8 @@ public BigDecimal canMoney() { Long memberId = LoginUserUtil.getLoginUser().getId(); MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); - BigDecimal profit = mallMoneyFlowMapper.selectProfitByDateAndMemberId(memberId); - BigDecimal canMoney = wallet.getCommission(); - if (profit != null) { - if(canMoney.compareTo(BigDecimal.ZERO) > 0) { - canMoney = canMoney.subtract(profit); - } - } - return canMoney.compareTo(BigDecimal.ZERO) < 1 ? BigDecimal.ZERO : canMoney; + return wallet.getBalance(); } @Override diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java index ca2d8fe..21e8f88 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java @@ -80,19 +80,13 @@ } MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); - BigDecimal profit = mallMoneyFlowMapper.selectProfitByDateAndMemberId(memberId); BigDecimal serviceFeePercent = cashOutSettingVo.getServiceFee().multiply(BigDecimal.valueOf(0.01)); BigDecimal serviceFee = serviceFeePercent.multiply(withdrawalDto.getAmount()); // 可提现 - BigDecimal canMoney = wallet.getCommission(); - if (profit != null) { - if(canMoney.subtract(serviceFee).compareTo(BigDecimal.ZERO) > 0) { - canMoney = canMoney.subtract(profit); - } - } + BigDecimal canMoney = wallet.getBalance(); - if(withdrawalDto.getAmount().compareTo(canMoney) > 0) { + if(withdrawalDto.getAmount().add(serviceFee).compareTo(canMoney) > 0) { throw new FebsException("提现金额不足"); } @@ -109,6 +103,6 @@ withdraw.setRemark(AppContants.MEMBER_WITHDRAW_NORMAL); this.baseMapper.insert(withdraw); - mallMemberService.addMoneyFlow(memberId, withdrawalDto.getAmount().add(serviceFee).negate(), MoneyFlowTypeEnum.WITHDRAWAL.getValue(), orderNo, null, null, null, 1, FlowTypeEnum.COMMISSION.getValue()); + mallMemberService.addMoneyFlow(memberId, withdrawalDto.getAmount().add(serviceFee).negate(), MoneyFlowTypeEnum.WITHDRAWAL.getValue(), orderNo, null, null, null, 1, FlowTypeEnum.BALANCE.getValue()); } } diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java index 4781fdc..89c6fbd 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java @@ -182,8 +182,8 @@ continue; } - walletService.add(direct, parent.getId(), "commission"); - moneyFlowService.addMoneyFlow(parent.getId(), direct, MoneyFlowTypeEnum.RECOMMEND_BONUS.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.COMMISSION.getValue()); + walletService.add(direct, parent.getId(), "balance"); + moneyFlowService.addMoneyFlow(parent.getId(), direct, MoneyFlowTypeEnum.RECOMMEND_BONUS.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.BALANCE.getValue()); moneyFlowService.addMoneyFlow(parent.getId(), direct.negate(), MoneyFlowTypeEnum.RECOMMEND_BONUS.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.SCORE.getValue()); } // =======隔代奖== end ===== @@ -364,8 +364,8 @@ } income = map.get("amount"); - walletService.add(income, memberId, "commission"); - moneyFlowService.addMoneyFlow(memberId, income, type, orderNo, FlowTypeEnum.COMMISSION.getValue()); + walletService.add(income, memberId, "balance"); + moneyFlowService.addMoneyFlow(memberId, income, type, orderNo, FlowTypeEnum.BALANCE.getValue()); moneyFlowService.addMoneyFlow(memberId, income.negate(), type, orderNo, FlowTypeEnum.SCORE.getValue()); return income; } -- Gitblit v1.9.1