From e6839a670cb185de6c8af9c7abcbebccc8e64e15 Mon Sep 17 00:00:00 2001 From: Administrator <15274802129@163.com> Date: Mon, 19 May 2025 12:43:32 +0800 Subject: [PATCH] refactor(prod): 更新生产环境配置和微信小程序支付参数 --- src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberWalletServiceImpl.java | 35 +++++++++++++++++++++++++++++------ 1 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberWalletServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberWalletServiceImpl.java index 63a5806..d82582f 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberWalletServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberWalletServiceImpl.java @@ -2,8 +2,10 @@ import cc.mrbird.febs.common.enumerates.FlowTypeEnum; import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; +import cc.mrbird.febs.common.enumerates.ScoreFlowTypeEnum; import cc.mrbird.febs.common.exception.FebsException; import cc.mrbird.febs.common.utils.LoginUserUtil; +import cc.mrbird.febs.common.utils.MallUtils; import cc.mrbird.febs.mall.dto.CommissionChangeDto; import cc.mrbird.febs.mall.entity.MallMember; import cc.mrbird.febs.mall.entity.MallMemberWallet; @@ -196,6 +198,10 @@ BigDecimal balance = (BigDecimal) declaredField.get(wallet); if (amount.compareTo(balance) > 0) { + if (map == null) { + return 2; + } + // 判断 赠送积分,如果剩下赠送积分不等于0且小于amount, 则扣除所有赠送积分 if ("score".equals(field)) { if (balance.compareTo(BigDecimal.ZERO) == 0) { @@ -219,7 +225,7 @@ flag = false; } else { if (i > 2) { - throw new FebsException("余额修改失败"); + throw new FebsException("操作失败"); } } } @@ -244,20 +250,37 @@ // 佣金转余额 if (commissionChange.getType() == 1) { - type = MoneyFlowTypeEnum.COMMISSION_TO_BALANCE.getValue(); + type = ScoreFlowTypeEnum.COMMISSION_TO_BALANCE.getValue(); flowType = FlowTypeEnum.BALANCE.getValue(); this.add(commissionChange.getAmount(), member.getId(), "balance"); // 佣金转竞猜积分 } else if (commissionChange.getType() == 2){ - type = MoneyFlowTypeEnum.COMMISSION_TO_PRIZESCORE.getValue(); + type = ScoreFlowTypeEnum.COMMISSION_TO_PRIZE_SCORE.getValue(); flowType = FlowTypeEnum.PRIZE_SCORE.getValue(); this.add(commissionChange.getAmount(), member.getId(), "prizeScore"); } else { - throw new FebsException("参数错误"); + throw new FebsException("操作失败"); } - moneyFlowService.addMoneyFlow(member.getId(), commissionChange.getAmount().negate(), type, null, FlowTypeEnum.COMMISSION.getValue()); - moneyFlowService.addMoneyFlow(member.getId(), commissionChange.getAmount(), type, null, flowType); + moneyFlowService.addMoneyFlow( + member.getId(), + commissionChange.getAmount().negate(), + type, + MallUtils.getOrderNum(), + FlowTypeEnum.COMMISSION.getValue(), + String.format(ScoreFlowTypeEnum.getDescByValue(type), commissionChange.getAmount()), + 2 + ); + + moneyFlowService.addMoneyFlow( + member.getId(), + commissionChange.getAmount(), + type, + MallUtils.getOrderNum(), + flowType, + String.format(ScoreFlowTypeEnum.getDescByValue(type), commissionChange.getAmount()), + 2 + ); } } -- Gitblit v1.9.1