From 1a4e7bbab3d15b36ebb4d7329ee31de62f092eb6 Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期三, 28 五月 2025 16:40:06 +0800 Subject: [PATCH] 小程序接口 --- ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/UserAccountController.java | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 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 fde4c58..80e2b19 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 @@ -49,7 +49,6 @@ - // TODO 需要订单来查看其他金额 @ApiOperation(value = "获取用户钱包信息",tags = {"用户钱包模块"}) @GetMapping("/getUserAccount") public R<UserAccountVo> getUserAccount() { @@ -58,8 +57,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); } @@ -118,6 +124,7 @@ accountDetail.setCategory(1); accountDetail.setStatus(1); accountDetail.setMoney(new BigDecimal(dto.getAmount())); + accountDetail.setSourceId(withdrawal.getId()); accountDetailService.save(accountDetail); return R.ok(); } -- Gitblit v1.7.1