From 9265a439968f7df5b93a9435f2dc958d8a9c45a3 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 16 May 2025 16:20:38 +0800
Subject: [PATCH] refactor(mall): 重构充值相关代码

---
 src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberWalletServiceImpl.java |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 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 92b12d7..6369962 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;
@@ -248,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("参数错误");
         }
 
-        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