From a417f43386a312b4ebf92c09f3197e3dd8309275 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Tue, 13 May 2025 18:04:58 +0800
Subject: [PATCH] feat(mall): 添加用户余额和积分查询功能

---
 src/main/java/cc/mrbird/febs/mall/controller/member/ApiMallMemberController.java |   10 ++++++++++
 src/main/java/cc/mrbird/febs/mall/vo/ApiMoneyFlowHeaderVo.java                   |   20 ++++++++++++++++++++
 src/main/java/cc/mrbird/febs/mall/entity/MallMemberWallet.java                   |   12 ++++++------
 src/main/java/cc/mrbird/febs/mall/service/IApiMallMemberService.java             |    2 ++
 src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java     |   11 +++++++++++
 5 files changed, 49 insertions(+), 6 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/controller/member/ApiMallMemberController.java b/src/main/java/cc/mrbird/febs/mall/controller/member/ApiMallMemberController.java
index b877d7e..9047f78 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/member/ApiMallMemberController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/member/ApiMallMemberController.java
@@ -89,6 +89,16 @@
         return memberService.teamList(teamListDto);
     }
 
+
+    @ApiOperation(value = "头部(积分,余额充值)")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "success", response = ApiMoneyFlowHeaderVo.class)
+    })
+    @PostMapping(value = "/flowHeader")
+    public FebsResponse flowHeader() {
+        return memberService.flowHeader();
+    }
+
     @ApiOperation(value = "积分明细,余额明细,佣金明细,会员经验明细")
     @ApiResponses({
             @ApiResponse(code = 200, message = "success", response = ApiMoneyFlowVo.class)
diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MallMemberWallet.java b/src/main/java/cc/mrbird/febs/mall/entity/MallMemberWallet.java
index f59bcdc..fac5ba8 100644
--- a/src/main/java/cc/mrbird/febs/mall/entity/MallMemberWallet.java
+++ b/src/main/java/cc/mrbird/febs/mall/entity/MallMemberWallet.java
@@ -25,14 +25,9 @@
     private BigDecimal balance;
 
     /**
-     * 积分
+     * 会员经验
      */
     private BigDecimal score;
-
-    /**
-     * 累计积分
-     */
-    private BigDecimal totalScore;
 
     /**
      * 抽奖积分,签到积分,下单赠送积分
@@ -43,4 +38,9 @@
      * 佣金
      */
     private BigDecimal commission;
+
+    /**
+     * 累计积分
+     */
+    private BigDecimal totalScore;
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/IApiMallMemberService.java b/src/main/java/cc/mrbird/febs/mall/service/IApiMallMemberService.java
index e323d71..8ce9ca0 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/IApiMallMemberService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/IApiMallMemberService.java
@@ -117,4 +117,6 @@
     FebsResponse authDel(ApiDoctorAuthDeleteDto dto);
 
     FebsResponse flowList(ApiMoneyFlowDto dto);
+
+    FebsResponse flowHeader();
 }
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 4510ac0..d9bab10 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
@@ -1510,6 +1510,17 @@
         return new FebsResponse().success().data(pages);
     }
 
+    @Override
+    public FebsResponse flowHeader() {
+        // 获取当前登录用户的ID
+        Long memberId = LoginUserUtil.getLoginUser().getId();
+        ApiMoneyFlowHeaderVo apiMoneyFlowHeaderVo = new ApiMoneyFlowHeaderVo();
+        MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId);
+        apiMoneyFlowHeaderVo.setBalance(mallMemberWallet.getBalance());
+        apiMoneyFlowHeaderVo.setPrizeScore(mallMemberWallet.getPrizeScore());
+        return new FebsResponse().success().data(apiMoneyFlowHeaderVo);
+    }
+
     public static void main(String[] args) {
         Long userld = 16425L;
         String shopAccount = "爱和美医疗";
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/ApiMoneyFlowHeaderVo.java b/src/main/java/cc/mrbird/febs/mall/vo/ApiMoneyFlowHeaderVo.java
new file mode 100644
index 0000000..3e884fb
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/vo/ApiMoneyFlowHeaderVo.java
@@ -0,0 +1,20 @@
+package cc.mrbird.febs.mall.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@ApiModel(value = "ApiMoneyFlowHeaderVo", description = "信息返回类")
+public class ApiMoneyFlowHeaderVo {
+
+
+    @ApiModelProperty(value = "余额")
+    private BigDecimal balance;
+
+    @ApiModelProperty(value = "抽奖积分,签到积分,下单赠送积分")
+    private BigDecimal prizeScore;
+
+}

--
Gitblit v1.9.1