From 04ce420613f90f8414e87e8fe68484fc32485349 Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期二, 24 六月 2025 18:49:06 +0800
Subject: [PATCH] 部署

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java |  117 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 101 insertions(+), 16 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 600120a..a36874c 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
@@ -2,14 +2,13 @@
 
 
 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.plugins.pagination.Page;
 import com.ruoyi.account.api.model.UserPoint;
+import com.ruoyi.account.mapper.UserPointMapper;
 import com.ruoyi.account.service.UserPointService;
-import com.ruoyi.account.vo.TransferPoint;
-import com.ruoyi.account.vo.UserPointDetailVO;
-import com.ruoyi.account.vo.UserPointStatistics;
-import com.ruoyi.account.vo.UserPointVO;
+import com.ruoyi.account.vo.*;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.web.controller.BaseController;
@@ -29,7 +28,9 @@
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.YearMonth;
+import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -47,6 +48,8 @@
     private UserPointService userPointService;
     @Resource
     private OrderClient orderClient;
+    @Resource
+    private UserPointMapper userPointMapper;
 
 
     /**
@@ -64,9 +67,7 @@
     @GetMapping("/getUserPointDetail")
     @ApiOperation("获取变更明细")
     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, Integer pageCurr, Integer pageSize) {
+                                          @ApiParam("变动类型(4=兑换商品,12=他人赠送,13=赠与他人,16=取消订单,17=充值 )") Integer type, Integer pageCurr, Integer pageSize) {
         LocalDateTime startTime = null;
         LocalDateTime endTime = null;
         if (date != null) {
@@ -107,7 +108,17 @@
         return R.ok();
     }
 
-    
+
+    /**
+     * 删除用户积分流水
+     */
+
+    @DeleteMapping("/deleteUserPoint")
+    public R deleteUserPoint(@RequestParam("orderId") Long orderId) {
+        userPointService.remove(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getObjectId, orderId));
+        return R.ok();
+    }
+
 
     /**
      * 积分统计
@@ -193,17 +204,91 @@
     }
 
 
+    /**
+     * 获取用户积分变更详情
+     */
+    @GetMapping("/getUserPontDetailPageList")
+    @ApiOperation(value = "用户积分详情", tags = "管理后台-财务统计-用户积分统计")
+    public R<PageInfo<UserPointDetailVO>> getUserPontDetailPageList(@RequestParam(value = "types",required = false) Collection<Integer> types,
+                                                                               @RequestParam(value = "objectIdStr",required = false) String objectIdStr,
+                                                                               @RequestParam(value = "id") Long id,
+                                                                               @ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr,
+                                                                               @ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize) {
+        PageInfo<UserPointDetailVO> pageInfo=userPointService.getUserPontDetailPageList(types, objectIdStr,id,pageCurr,pageSize);
+
+        return R.ok(pageInfo);
+    }
 
     /**
-     * 判断当天是否分享获得过积分
-     * @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);
+    @GetMapping("/getUserPointStatisticsPageList")
+    @ApiOperation(value = "用户积分统计", tags = "管理后台-财务统计-用户积分统计")
+    public R<PageInfo<UserPointStatisticsPageVO>> getUserPointStatisticsPageList(@RequestParam(value = "types",required = false) Collection<Integer> types,
+                                                                    @RequestParam(value = "name",required = false) String name,
+                                                                    @RequestParam(value = "phone",required = false) String phone,
+                                                                    @RequestParam(value = "beginTime",required = false)@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")  LocalDateTime beginTime,
+                                                                    @RequestParam(value = "endTime",required = false)@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")  LocalDateTime endTime,
+                                                                    @ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr,
+                                                                    @ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize) {
+        //查找记录
+        PageInfo<UserPointStatisticsPageVO> pageInfo=userPointService.getUserPointStatisticsPageList(types,name,phone,beginTime,endTime,pageCurr,pageSize);
+        return R.ok(pageInfo);
     }
+
+    /**
+     * 用户积分统计
+     */
+    @GetMapping("/getUserPointStatisticsTop")
+    @ApiOperation(value = "用户积分统计-顶部", tags = "管理后台-财务统计-用户积分统计")
+    public R<UserPointStatisticsTopVO> getUserPointStatisticsTop(@RequestParam(value = "types",required = false) Collection<Integer> types,
+                                                                      @RequestParam(value = "name",required = false) String name,
+                                                                      @RequestParam(value = "phone",required = false) String phone,
+                                                                      @RequestParam(value = "beginTime",required = false)@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime beginTime,
+                                                                      @RequestParam(value = "endTime",required = false)@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime
+                                                                     ) {
+        UserPointStatisticsTopVO userPointStatisticsOutVO = new UserPointStatisticsTopVO();
+        //充值绿电分
+
+        Integer chargePoint=userPointService.selectRechargeAndUse(name,phone,beginTime,endTime,17);
+        // 消费绿电分
+        Integer exchangePoint =userPointService.selectRechargeAndUse(name,phone,beginTime,endTime,4);
+        Integer cancelPoint = userPointService.selectRechargeAndUse(name,phone,beginTime,endTime,16);
+        Integer usePoint=(exchangePoint==null?0:exchangePoint )-( cancelPoint==null?0:cancelPoint);
+        userPointStatisticsOutVO.setChargeTotalPoint(chargePoint==null?0:chargePoint);
+        userPointStatisticsOutVO.setUseTotalPoint(usePoint);
+        return R.ok(userPointStatisticsOutVO);
+    }
+
+    /**
+     * 导出店铺余额列表
+     */
+
+    @GetMapping("/userPointExcel")
+    @ApiOperation(value = "导出", tags = {"管理后台-财务统计-用户积分统计"})
+    void userPointExcel(HttpServletResponse response,
+                        @RequestParam(value = "types",required = false) Collection<Integer> types,
+                        @RequestParam(value = "name",required = false) String name,
+                        @RequestParam(value = "phone",required = false) String phone,
+                        @RequestParam(value = "beginTime",required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime beginTime,
+                        @RequestParam(value = "endTime",required = false)@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")  LocalDateTime endTime){
+        List<UserPointExcel> exportList =userPointMapper.userPointExcel(types,name,phone,beginTime,endTime);
+        exportList.forEach(x->{
+            if (x.getType()==12||x.getType()==17){
+                x.setVariablePointStr("+"+x.getVariablePoint()+"绿电分");
+            }else {
+                x.setVariablePointStr("-"+x.getVariablePoint()+"绿电分");
+            }
+        });
+        ExcelUtil<UserPointExcel> util = new ExcelUtil<UserPointExcel>(UserPointExcel.class);
+        util.exportExcel(response, exportList, "店铺余额列表数据");
+    }
+
+    @PostMapping("/save")
+    R save(@RequestBody UserPoint userPoint){
+        userPointService.save(userPoint);
+        return R.ok();
+    }
+
 }
 

--
Gitblit v1.7.1