From 6d745e73b713899ca9d04529c4b7fb8520050668 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 08 Sep 2022 11:28:16 +0800
Subject: [PATCH] 20220902

---
 src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java |   12 ++++--
 src/main/java/cc/mrbird/febs/mall/mapper/MallMemberWalletMapper.java   |   10 +++++
 src/main/resources/mapper/modules/MallMemberWalletMapper.xml           |   16 ++++++++
 src/main/resources/templates/febs/views/modules/system/indexData.html  |   45 ++++++++++++++++++++++
 4 files changed, 79 insertions(+), 4 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java b/src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java
index 1d17ea7..aa09f98 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java
@@ -12,10 +12,7 @@
 import cc.mrbird.febs.mall.dto.ScoreSettingDto;
 import cc.mrbird.febs.mall.entity.DataDictionaryCustom;
 import cc.mrbird.febs.mall.entity.MallMember;
-import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
-import cc.mrbird.febs.mall.mapper.MallAchieveRecordMapper;
-import cc.mrbird.febs.mall.mapper.MallMemberMapper;
-import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper;
+import cc.mrbird.febs.mall.mapper.*;
 import cc.mrbird.febs.monitor.service.ILoginLogService;
 import cc.mrbird.febs.system.service.IUserService;
 import cn.hutool.core.date.DateUtil;
@@ -28,6 +25,7 @@
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import java.math.BigDecimal;
 import java.util.*;
 
 
@@ -41,6 +39,7 @@
     private final MallMemberMapper mallMemberMapper;
     private final MallOrderInfoMapper mallOrderInfoMapper;
     private final MallAchieveRecordMapper mallAchieveRecordMapper;
+    private final MallMemberWalletMapper mallMemberWalletMapper;
     private final RedisUtils redisUtils;
 
     @GetMapping("profitSetting")
@@ -91,6 +90,11 @@
         data.put("lastMonth", mallAchieveRecordMapper.selectAchieveTotal("M", DateUtil.offsetMonth(new Date(), -1)));
         data.put("thisMonth", mallAchieveRecordMapper.selectAchieveTotal("M", new Date()));
 
+        data.put("totalBalance",mallMemberWalletMapper.selectSumBalance().setScale(2, BigDecimal.ROUND_DOWN));
+        data.put("totalScore",mallMemberWalletMapper.selectSumScore().setScale(2, BigDecimal.ROUND_DOWN));
+        data.put("totalPrizeScore",mallMemberWalletMapper.selectSumPrizeScore().setScale(2, BigDecimal.ROUND_DOWN));
+        data.put("totalCommission",mallMemberWalletMapper.selectSumCommission().setScale(2, BigDecimal.ROUND_DOWN));
+
         //会员数据
         data.put("totalMember",mallMemberMapper.selectCount(new QueryWrapper<>()) );
         QueryWrapper<MallMember> formalMember = new QueryWrapper<>();
diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/MallMemberWalletMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/MallMemberWalletMapper.java
index 3473eab..cea3a64 100644
--- a/src/main/java/cc/mrbird/febs/mall/mapper/MallMemberWalletMapper.java
+++ b/src/main/java/cc/mrbird/febs/mall/mapper/MallMemberWalletMapper.java
@@ -4,6 +4,8 @@
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
+
 public interface MallMemberWalletMapper extends BaseMapper<MallMemberWallet> {
 
     MallMemberWallet selectWalletByMemberId(@Param("memberId") Long memberId);
@@ -15,4 +17,12 @@
     int updateAmountWithVersion(@Param("record") MallMemberWallet wallet);
 
     void updateBalanceWithId(@Param("record")MallMemberWallet mallMemberWallet);
+
+    BigDecimal selectSumBalance();
+
+    BigDecimal selectSumScore();
+
+    BigDecimal selectSumPrizeScore();
+
+    BigDecimal selectSumCommission();
 }
diff --git a/src/main/resources/mapper/modules/MallMemberWalletMapper.xml b/src/main/resources/mapper/modules/MallMemberWalletMapper.xml
index eaa443b..35bbcb1 100644
--- a/src/main/resources/mapper/modules/MallMemberWalletMapper.xml
+++ b/src/main/resources/mapper/modules/MallMemberWalletMapper.xml
@@ -44,4 +44,20 @@
         </if>
         where id=#{record.id} and revision=#{record.revision}
     </update>
+
+    <select id="selectSumBalance" resultType="java.math.BigDecimal">
+        select ifnull(sum(balance),0) total from mall_member_wallet
+    </select>
+
+    <select id="selectSumScore" resultType="java.math.BigDecimal">
+        select ifnull(sum(score),0) total from mall_member_wallet
+    </select>
+
+    <select id="selectSumPrizeScore" resultType="java.math.BigDecimal">
+        select ifnull(sum(prize_score),0) total from mall_member_wallet
+    </select>
+
+    <select id="selectSumCommission" resultType="java.math.BigDecimal">
+        select ifnull(sum(commission),0) total from mall_member_wallet
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/templates/febs/views/modules/system/indexData.html b/src/main/resources/templates/febs/views/modules/system/indexData.html
index c52d99f..78107d9 100644
--- a/src/main/resources/templates/febs/views/modules/system/indexData.html
+++ b/src/main/resources/templates/febs/views/modules/system/indexData.html
@@ -147,6 +147,46 @@
 
                 <div class="layui-card-body layui-anim layui-anim-fadein">
                     <div class="layui-row">
+                        <div class="m-title">账户金额</div>
+                        <div class="layui-row layui-col-space15">
+                            <div class="layui-col-md3">
+                                <div class="layui-panel">
+                                    <div class="box">
+                                        <p class="name">总余额</p>
+                                        <p class="num"><span id="totalBalance"></span></p>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="layui-col-md3">
+                                <div class="layui-panel">
+                                    <div class="box">
+                                        <p class="name">总赠送积分</p>
+                                        <p class="num" ><span id="totalScore"></span></p>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="layui-col-md3">
+                                <div class="layui-panel">
+                                    <div class="box">
+                                        <p class="name">总竞猜积分</p>
+                                        <p class="num"><span id="totalPrizeScore"></span></p>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="layui-col-md3">
+                                <div class="layui-panel">
+                                    <div class="box">
+                                        <p class="name">总佣金</p>
+                                        <p class="num"><span id="totalCommission"></span></p>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="layui-card-body layui-anim layui-anim-fadein">
+                    <div class="layui-row">
                         <div class="m-title">业绩</div>
                         <div class="layui-row layui-col-space15">
                             <div class="layui-col-md3">
@@ -280,6 +320,11 @@
                 .find('#thisMonth').text(indexData.thisMonth).end()
                 .find('#lastMonth').text(indexData.lastMonth).end()
                 .find('#scorePool').text(indexData.scorePool).end()
+                //账户金额
+                .find('#totalBalance').text(indexData.totalBalance).end()
+                .find('#totalScore').text(indexData.totalScore).end()
+                .find('#totalPrizeScore').text(indexData.totalPrizeScore).end()
+                .find('#totalCommission').text(indexData.totalCommission).end()
                 //会员信息
                 .find('#totalMember').text(indexData.totalMember).end()
                 .find('#formalMember').text(indexData.formalMember).end()

--
Gitblit v1.9.1