From 6008ff1aad2de3a1b1d85fcd8fae89e217ccfa22 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 04 六月 2025 17:33:11 +0800
Subject: [PATCH] 小程序接口 退出登录

---
 ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/UserAccountController.java |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/UserAccountController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/UserAccountController.java
index c1a039b..e6123fb 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/UserAccountController.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/UserAccountController.java
@@ -12,6 +12,7 @@
 import com.ruoyi.system.model.*;
 import com.ruoyi.system.query.UserAccountDetailQuery;
 import com.ruoyi.system.service.*;
+import com.ruoyi.system.vo.GetWithdrawalDetailVo;
 import com.ruoyi.system.vo.RegionVo;
 import com.ruoyi.system.vo.UserAccountVo;
 import io.swagger.annotations.Api;
@@ -49,8 +50,7 @@
 
 
 
-    // TODO 需要订单来查看其他金额
-    @ApiOperation(value = "获取用户钱包信息",tags = {"获取用户钱包信息"})
+    @ApiOperation(value = "获取用户钱包信息",tags = {"用户钱包模块"})
     @GetMapping("/getUserAccount")
     public R<UserAccountVo> getUserAccount() {
         UserAccountVo userAccountVo = new UserAccountVo();
@@ -58,8 +58,15 @@
         TbUser user = userService.getById(loginUser.getUserId());
         userAccountVo.setBalance(user.getBalance());
 
+        List<TbAccountDetail> list = accountDetailService.list(new LambdaQueryWrapper<TbAccountDetail>().eq(TbAccountDetail::getCategory, 1).eq(TbAccountDetail::getUserId, user.getId()));
+        BigDecimal reduce = list.stream().filter(e->e.getStatus()==2).map(TbAccountDetail::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
+        userAccountVo.setWithdrawalBalance(reduce);
 
-
+        BigDecimal reduce1 = list.stream().filter(e->e.getStatus()==1).map(TbAccountDetail::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
+        userAccountVo.setAuditBalance(reduce1);
+        List<TbAccountDetail> list1 = accountDetailService.list(new LambdaQueryWrapper<TbAccountDetail>().eq(TbAccountDetail::getCategory, 2).eq(TbAccountDetail::getStatus, 1).eq(TbAccountDetail::getUserId, user.getId()));
+        BigDecimal reduce2 = list1.stream().map(TbAccountDetail::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
+        userAccountVo.setEntryBalance(reduce2);
 
         return R.ok(userAccountVo);
     }
@@ -68,7 +75,7 @@
 
 
 
-    @ApiOperation(value = "获取用户钱包信息-收支明细",tags = {"获取用户钱包信息-收支明细"})
+    @ApiOperation(value = "获取用户钱包信息-收支明细",tags = {"用户钱包模块"})
     @GetMapping("/getUserAccountDetail")
     public R<Page<TbAccountDetail>> getUserAccountDetail(UserAccountDetailQuery query) {
         LoginUser loginUser = tokenService.getLoginUser();
@@ -83,7 +90,7 @@
     }
 
 
-    @ApiOperation(value = "申请提现",tags = {"获取用户钱包信息-申请提现"})
+    @ApiOperation(value = "申请提现",tags = {"用户钱包模块"})
     @PostMapping("/withdrawal")
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     public R<?> withdrawal(@RequestBody @Valid UserWithdrawalDto dto) {
@@ -118,13 +125,14 @@
         accountDetail.setCategory(1);
         accountDetail.setStatus(1);
         accountDetail.setMoney(new BigDecimal(dto.getAmount()));
+        accountDetail.setSourceId(withdrawal.getId());
         accountDetailService.save(accountDetail);
         return R.ok();
     }
 
 
 
-    @ApiOperation(value = "获取用户绑定的卡",tags = {"获取用户绑定的卡"})
+    @ApiOperation(value = "获取用户绑定的卡",tags = {"用户钱包模块"})
     @GetMapping("/getUserBank")
     public R<TbBank> getUserBank() {
         LoginUser loginUser = tokenService.getLoginUser();
@@ -133,7 +141,7 @@
     }
 
 
-    @ApiOperation(value = "保存银行卡",tags = {"保存银行卡" })
+    @ApiOperation(value = "保存银行卡",tags = {"用户钱包模块"})
     @PostMapping("/saveUserBank")
     public R<?> getUserBank(@Valid @RequestBody SaveUserBankDto dto) {
         LoginUser loginUser = tokenService.getLoginUser();
@@ -154,6 +162,18 @@
     }
 
 
+    @ApiOperation(value = "提现说明需求",tags = {"用户钱包模块"})
+    @GetMapping("/getWithdrawalDetail")
+    public R<GetWithdrawalDetailVo> getWithdrawalDetail(@RequestParam String sourceId) {
+        TbWithdrawal withdrawal =  withdrawalService.getById(sourceId);
+        GetWithdrawalDetailVo vo = new GetWithdrawalDetailVo();
+        vo.setImg(withdrawal.getImg());
+        vo.setRemark(withdrawal.getRemark());
+        return R.ok(vo);
+    }
+
+
+
 
 
 

--
Gitblit v1.7.1