From 2bc35df79fca920ad584a82b5ea7b35b6ca7b8a0 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期三, 15 一月 2025 10:12:57 +0800
Subject: [PATCH] 12.18

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java |   42 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
index dc5612c..33f4f12 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
@@ -14,6 +14,7 @@
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.page.PageInfo;
 import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.common.security.utils.SecurityUtils;
@@ -66,10 +67,10 @@
      */
     @GetMapping("/getUserPointDetail")
     @ApiOperation("获取变更明细")
-    public TableDataInfo<UserPointDetailVO> getUserPointDetail(@ApiParam("指定日期") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate date,
-                                                               @ApiParam("变动类型(1=消费积分,2=返佣积分,3=拉新人积分,4=兑换商品 " +
+    public R<PageInfo<UserPointDetailVO>> getUserPointDetail(@ApiParam("指定日期") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate date,
+                                          @ApiParam("变动类型(1=消费积分,2=返佣积分,3=拉新人积分,4=兑换商品 " +
                                                                        "5 = 门店业绩积分 6 =门店返佣积分7=技师业绩积分8 =转赠积分 9 =做工积分 " +
-                                                                       "10 =注册积分)") Integer type) {
+                                                                       "10 =注册积分)") Integer type, Integer pageCurr, Integer pageSize) {
         LocalDateTime startTime = null;
         LocalDateTime endTime = null;
         if (date != null) {
@@ -84,9 +85,8 @@
             endTime = lastDayOfMonth.atTime(LocalTime.MAX);
         }
 
-        startPage();
-        List<UserPointDetailVO> list = userPointService.getUserPointDetail(SecurityUtils.getUserId(), startTime, endTime, type);
-        return getDataTable(list);
+        PageInfo<UserPointDetailVO> userPointDetail = userPointService.getUserPointDetail(SecurityUtils.getUserId(), startTime, endTime, type, pageCurr, pageSize);
+        return R.ok(userPointDetail);
     }
 
     /**
@@ -134,7 +134,21 @@
     @GetMapping("/user/list")
     @ApiOperation(value = "积分管理-用户积分明细(必传用户id)", tags = "后台")
     public R<Page<UserPoint>> userlist(UserPoint userPoint) {
-        Page<UserPoint> page = userPointService.lambdaQuery().eq(UserPoint::getAppUserId, userPoint.getAppUserId()).orderByDesc(UserPoint::getCreateTime).page(Page.of(userPoint.getPageNum(), userPoint.getPageSize()));
+        Page<UserPoint> page = userPointService.lambdaQuery()
+                .eq(userPoint.getType()!=null,UserPoint::getType, userPoint.getType())
+                .eq(UserPoint::getAppUserId, userPoint.getAppUserId())
+                .orderByDesc(UserPoint::getCreateTime)
+                .page(Page.of(userPoint.getPageNum(), userPoint.getPageSize()));
+        for (UserPoint record : page.getRecords()) {
+            int i = record.getHistoricalPoint() - record.getBalance();
+            if (i>0){
+                record.setVariableType(2);
+            }else if (i<0){
+                record.setVariableType(1);
+            }else{
+                record.setVariableType(0);
+            }
+        }
         return R.ok(page);
     }
 
@@ -173,5 +187,19 @@
         List<UserPoint> list = userPointService.list(queryWrapper);
         return R.ok(list);
     }
+
+
+
+    /**
+     * 判断当天是否分享获得过积分
+     * @param appUserId
+     * @return
+     */
+    @PostMapping("/judgmentDailyShare")
+    public R<Boolean> judgmentDailyShare(@RequestParam("appUserId") Long appUserId){
+        long count = userPointService.count(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUserId)
+                .eq(UserPoint::getType, 4).last(" and DATE_FORMAT(NOW(), '%Y-%m-%d') = DATE_FORMAT(create_time, '%Y-%m-%d')"));
+        return R.ok(count != 0);
+    }
 }
 

--
Gitblit v1.7.1