From e4c15ba0a0411842dcee4af500e873d2280987b1 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 19 May 2025 10:30:23 +0800
Subject: [PATCH] feat(mall): 添加佣金修改功能并优化余额和积分修改

---
 src/main/java/cc/mrbird/febs/mall/vo/MallMemberVo.java                            |    3 +++
 src/main/resources/templates/febs/views/modules/mallMember/mallSystemPay.html     |    4 ++--
 src/main/resources/mapper/modules/MallMemberMapper.xml                            |    1 +
 src/main/java/cc/mrbird/febs/common/enumerates/ScoreFlowTypeEnum.java             |    1 +
 src/main/java/cc/mrbird/febs/mall/controller/member/ViewMallMemberController.java |    2 +-
 src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java    |   23 +++++++++++++++++------
 src/main/resources/templates/febs/views/modules/mallMember/mallMemberList.html    |   21 ++++++++++++---------
 7 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/common/enumerates/ScoreFlowTypeEnum.java b/src/main/java/cc/mrbird/febs/common/enumerates/ScoreFlowTypeEnum.java
index 283b00b..bbd082a 100644
--- a/src/main/java/cc/mrbird/febs/common/enumerates/ScoreFlowTypeEnum.java
+++ b/src/main/java/cc/mrbird/febs/common/enumerates/ScoreFlowTypeEnum.java
@@ -6,6 +6,7 @@
 public enum ScoreFlowTypeEnum {
 
 
+    SYSTEM(22,"系统操作{}"),
     WITHDRAWAL(21,"用户余额提现{}"),
     COMMISSION_TO_PRIZE_SCORE(20,"划转{}佣金到积分"),
     COMMISSION_TO_BALANCE(19,"划转{}佣金到余额"),
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/member/ViewMallMemberController.java b/src/main/java/cc/mrbird/febs/mall/controller/member/ViewMallMemberController.java
index 0057351..345f802 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/member/ViewMallMemberController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/member/ViewMallMemberController.java
@@ -77,7 +77,7 @@
      * @return
      */
     @GetMapping("mallSystemPay/{type}/{id}")
-    @RequiresPermissions("mallSystemPay:update")
+    @RequiresPermissions("wallet:update")
     public String systemPay(@PathVariable long id, @PathVariable Integer type, Model model) {
         MallMemberVo data = mallMemberService.getMallMemberInfoById(id);
         model.addAttribute("systemPay", data);
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
index ffb469b..ba81e08 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -2,11 +2,10 @@
 
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.common.entity.QueryRequest;
-import cc.mrbird.febs.common.enumerates.AgentLevelEnum;
-import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum;
-import cc.mrbird.febs.common.enumerates.StateUpDownEnum;
+import cc.mrbird.febs.common.enumerates.*;
 import cc.mrbird.febs.common.exception.FebsException;
 import cc.mrbird.febs.common.utils.AppContants;
+import cc.mrbird.febs.common.utils.MallUtils;
 import cc.mrbird.febs.common.utils.RedisUtils;
 import cc.mrbird.febs.mall.dto.*;
 import cc.mrbird.febs.mall.entity.*;
@@ -512,12 +511,16 @@
 
         Integer type = mallSystemPayDto.getType();
         String filedType = "";
+        Integer flowType = 0;
         if (type == 1) {
             filedType = "balance";
+            flowType = FlowTypeEnum.BALANCE.getValue();
         } else if (type == 2) {
-            filedType = "score";
-        } else if (type == 3) {
             filedType = "prizeScore";
+            flowType = FlowTypeEnum.PRIZE_SCORE.getValue();
+        } else if (type == 3) {
+            filedType = "commission";
+            flowType = FlowTypeEnum.COMMISSION.getValue();
         } else {
             throw new FebsException("参数错误");
         }
@@ -531,7 +534,15 @@
         } else {
             iApiMallMemberWalletService.add(mallSystemPayDto.getAddBalance(), mallSystemPayDto.getId(), filedType);
         }
-        mallMoneyFlowService.addMoneyFlow(memberId, bigDecimal, MoneyFlowTypeEnum.SYSTEM.getValue(), null, type);
+        mallMoneyFlowService.addMoneyFlow(
+                memberId,
+                bigDecimal,
+                ScoreFlowTypeEnum.SYSTEM.getValue(),
+                MallUtils.getOrderNum(),
+                flowType,
+                StrUtil.format(ScoreFlowTypeEnum.SYSTEM.getDesc(),bigDecimal),
+                2
+        );
         return new FebsResponse().success();
     }
 
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/MallMemberVo.java b/src/main/java/cc/mrbird/febs/mall/vo/MallMemberVo.java
index 41fa56a..b6dee58 100644
--- a/src/main/java/cc/mrbird/febs/mall/vo/MallMemberVo.java
+++ b/src/main/java/cc/mrbird/febs/mall/vo/MallMemberVo.java
@@ -38,6 +38,9 @@
     @ApiModelProperty(value = "余额")
     private BigDecimal balance;
 
+    @ApiModelProperty(value = "佣金")
+    private BigDecimal commission;
+
     @ApiModelProperty(value = "会员等级")
     private String levelName;
 
diff --git a/src/main/resources/mapper/modules/MallMemberMapper.xml b/src/main/resources/mapper/modules/MallMemberMapper.xml
index 1f1636b..57dd216 100644
--- a/src/main/resources/mapper/modules/MallMemberMapper.xml
+++ b/src/main/resources/mapper/modules/MallMemberMapper.xml
@@ -103,6 +103,7 @@
                IFNULL(c.balance,0) balance,
                IFNULL(c.score,0) score,
                IFNULL(c.prize_score,0) prizeScore,
+               IFNULL(c.commission,0) commission,
                d.description levelName,
                b.name
                FROM mall_member a
diff --git a/src/main/resources/templates/febs/views/modules/mallMember/mallMemberList.html b/src/main/resources/templates/febs/views/modules/mallMember/mallMemberList.html
index 1cd5474..8820abe 100644
--- a/src/main/resources/templates/febs/views/modules/mallMember/mallMemberList.html
+++ b/src/main/resources/templates/febs/views/modules/mallMember/mallMemberList.html
@@ -144,6 +144,9 @@
 <!--        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="updateReferer">修改推荐人</button>-->
         <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="updateMemberLevel:update" lay-event="updateMemberLevel">修改会员等级</button>
         <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="updateSaleLevel:update" lay-event="updateSaleLevel">修改分销等级</button>
+        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="wallet:update" lay-event="balance">余额修改</button>
+        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="wallet:update" lay-event="prizeScore">积分修改</button>
+        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="wallet:update" lay-event="commission">佣金修改</button>
 <!--        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="addCoupon">优惠券派送</button>-->
     </div>
 </script>
@@ -499,21 +502,21 @@
                 if (checkData.length > 1) {
                     febs.alert.warn('请选择一个用户');
                 }
-                systemPay("修改余额", checkData[0].id, 1);
-            }
-
-            if (layEvent === 'score') {
-                if (checkData.length > 1) {
-                    febs.alert.warn('请选择一个用户');
-                }
-                systemPay("修改赠送积分", checkData[0].id, 2);
+                systemPay("余额", checkData[0].id, 1);
             }
 
             if (layEvent === 'prizeScore') {
                 if (checkData.length > 1) {
                     febs.alert.warn('请选择一个用户');
                 }
-                systemPay("修改竞猜积分", checkData[0].id, 3);
+                systemPay("积分", checkData[0].id, 2);
+            }
+
+            if (layEvent === 'commission') {
+                if (checkData.length > 1) {
+                    febs.alert.warn('请选择一个用户');
+                }
+                systemPay("佣金", checkData[0].id, 3);
             }
 
             if (layEvent === 'agentLevel') {
diff --git a/src/main/resources/templates/febs/views/modules/mallMember/mallSystemPay.html b/src/main/resources/templates/febs/views/modules/mallMember/mallSystemPay.html
index 6cdd4de..de6d282 100644
--- a/src/main/resources/templates/febs/views/modules/mallMember/mallSystemPay.html
+++ b/src/main/resources/templates/febs/views/modules/mallMember/mallSystemPay.html
@@ -77,9 +77,9 @@
             if (type == 1) {
                 balance = systemPay.balance
             } else if (type == 2) {
-                balance = systemPay.score
-            } else if (type ==3) {
                 balance = systemPay.prizeScore
+            } else if (type ==3) {
+                balance = systemPay.commission
             } else {
 
             }

--
Gitblit v1.9.1