From 8093bf217b5dbe59a5703b013f3fc79ed0d4fc36 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期六, 11 一月 2025 18:06:03 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/qijisheng

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
index 8223d51..f75ee37 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -2,7 +2,10 @@
 
 import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
+import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.account.api.model.AppUser;
@@ -18,6 +21,7 @@
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.exception.ServiceException;
 import com.ruoyi.common.core.utils.PhoneNumberValidator;
+import com.ruoyi.common.core.web.page.PageInfo;
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.other.api.domain.PointSetting;
 import com.ruoyi.other.api.domain.VipSetting;
@@ -67,7 +71,8 @@
         VipSetting vipSetting = vipSettingService.getVipSettingByUserId(userId);
 
         UserPointVO userPointVO = new UserPointVO();
-        userPointVO.setTotalPoint(appUser.getTotalPoint());
+        // todo bug说取剩余积分
+        userPointVO.setTotalPoint(appUser.getLavePoint());
         userPointVO.setConsumePoint(appUser.getAvailablePoint());
         userPointVO.setShopPoint(appUser.getShopPoint());
         userPointVO.setSharePoint(appUser.getSharePoint());
@@ -79,13 +84,14 @@
     }
 
     @Override
-    public List<UserPointDetailVO> getUserPointDetail(Long userId, LocalDateTime startTime, LocalDateTime endTime, Integer type) {
-        List<UserPoint> userPointList = list(new LambdaQueryWrapper<UserPoint>()
-                .between(startTime != null, UserPoint::getCreateTime, startTime, endTime)
-                .eq(type != null, UserPoint::getType, type)
-                .eq(UserPoint::getAppUserId, userId).orderByDesc(UserPoint::getCreateTime));
-        if (CollectionUtil.isNotEmpty(userPointList)) {
-            return userPointList.stream().map(p -> {
+    public PageInfo<UserPointDetailVO> getUserPointDetail(Long userId, LocalDateTime startTime, LocalDateTime endTime, Integer type, Integer pageCurr, Integer pageSize) {
+        PageInfo<UserPoint> pageInfo = new PageInfo<>(pageCurr, pageSize);
+        PageInfo<UserPoint> page = this.page(pageInfo, new QueryWrapper<UserPoint>()
+                .between(startTime != null, "create_time", startTime, endTime)
+                .eq(type != null, "type", type)
+                .eq("app_user_id", userId).orderByDesc("create_time"));
+        if (CollectionUtil.isNotEmpty(page.getRecords())) {
+            List<UserPointDetailVO> collect = page.getRecords().stream().map(p -> {
                 UserPointDetailVO userPointDetailVO = new UserPointDetailVO();
                 userPointDetailVO.setType(p.getType());
                 userPointDetailVO.setVariablePoint(p.getVariablePoint());
@@ -93,8 +99,14 @@
                 userPointDetailVO.setCreateTime(format);
                 return userPointDetailVO;
             }).collect(Collectors.toList());
+            PageInfo<UserPointDetailVO> pageInfo1 = new PageInfo<>(pageCurr, pageSize);
+            pageInfo1.setRecords(collect);
+            pageInfo1.setTotal(page.getTotal());
+            pageInfo1.setCurrent(page.getCurrent());
+            pageInfo1.setSize(page.getSize());
+            return pageInfo1;
         }
-        return Collections.emptyList();
+        return null;
     }
 
 

--
Gitblit v1.7.1