From c31c769b7c5864be9973d8dd7e11d9ff8e2ac3e9 Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期一, 16 十二月 2024 10:36:18 +0800
Subject: [PATCH] 1

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java |   37 +++++++++++--------------------------
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java  |    2 +-
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java       |    4 ++--
 3 files changed, 14 insertions(+), 29 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 3caa4d3..590c636 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
@@ -165,34 +165,18 @@
 
     @Override
     public UserPointStatistics getStatistics(UserPoint userPoint) {
-        LoginUser loginUser = tokenService.getLoginUser();
-        userPoint.setAppUserId(loginUser.getUserid());
-        List<UserPoint> userPointList = userPointMapper.findLatestChangeByType(userPoint);
-        Map<Integer, Integer> userBalanceMap = userPointList.stream()
-                .collect(Collectors.toMap(UserPoint::getType, UserPoint::getBalance));
+        List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>()
+                .eq(AppUser::getPhone, userPoint.getPhone())
+                .like(AppUser::getName, userPoint.getUserName()));
+        List<Long> userIds = appUserList.stream().map(AppUser::getId).collect(Collectors.toList());
 
-        Integer consumePoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.CONSUME.getCode())).orElse(0);
-        Integer sharePoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.COMMISSION_RETURN.getCode())).orElse(0);
-        Integer pullNewPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.NEW_USER_REFERRAL.getCode())).orElse(0);
-        Integer registerPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.REGISTRATION.getCode())).orElse(0);
-        Integer workPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.WORK_PERFORMANCE.getCode())).orElse(0);
-        Integer shopAchievementPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.TECHNICIAN_PERFORMANCE.getCode())).orElse(0);
-        Integer exchangeGoodsPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.EXCHANGE_GOODS.getCode())).orElse(0);
-        Integer storeAchievementPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.STORE_PERFORMANCE.getCode())).orElse(0);
-        Integer storeCommissionPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.STORE_COMMISSION_RETURN.getCode())).orElse(0);
-        Integer transferPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.TRANSFER_POINTS.getCode())).orElse(0);
-        Integer totalPoint = consumePoint + sharePoint + pullNewPoint + registerPoint + workPoint + shopAchievementPoint + exchangeGoodsPoint + storeAchievementPoint + storeCommissionPoint + transferPoint;
+        list(new LambdaQueryWrapper<UserPoint>()
+                .in(!CollectionUtils.isEmpty(userIds), UserPoint::getAppUserId, userIds)
+                .eq(UserPoint::getType, userPoint.getType())
+                .between(UserPoint::getCreateTime, userPoint.getStartTime(), userPoint.getEndTime()));
 
 
-        UserPointStatistics userPointStatistics = new UserPointStatistics();
-        userPointStatistics.setTotalPoint(totalPoint);
-        userPointStatistics.setConsumePoint(consumePoint);
-        userPointStatistics.setSharePoint(sharePoint);
-        userPointStatistics.setPullNewPoint(pullNewPoint);
-        userPointStatistics.setRegisterPoint(registerPoint);
-        userPointStatistics.setWorkPoint(workPoint);
-        userPointStatistics.setShopAchievementPoint(shopAchievementPoint);
-        return userPointStatistics;
+        return null;
     }
 
     @Override
@@ -205,7 +189,8 @@
         Page<UserPoint> userPointPage = page(page, new LambdaQueryWrapper<UserPoint>()
                 .in(!CollectionUtils.isEmpty(userIds), UserPoint::getAppUserId, userIds)
                 .eq(UserPoint::getType, userPoint.getType())
-                .between(UserPoint::getCreateTime, userPoint.getStartTime(), userPoint.getEndTime())
+                .between(userPoint.getStartTime() !=null && userPoint.getEndTime() != null,
+                        UserPoint::getCreateTime, userPoint.getStartTime(), userPoint.getEndTime())
                 .orderByDesc(UserPoint::getCreateTime));
 
         userPointPage.getRecords().forEach(userPoint1 -> appUserList.stream()
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
index 9e1a950..94fdcd3 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -492,7 +492,7 @@
 				List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getAppUserId, appUser.getId()).eq(Order::getDelFlag, 0).in(Order::getOrderStatus, Arrays.asList(4, 8)));
 				List<Long> orderIds = orders.stream().map(Order::getId).collect(Collectors.toList());
 				int sum = 0;
-				if(orderIds.size() > 0){
+				if(!orderIds.isEmpty()){
 					List<OrderGood> orderGoodList = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().in(OrderGood::getOrderId, orderIds)
 							.eq(OrderGood::getGoodsId, shoppingCart.getGoodsId()).eq(OrderGood::getDelFlag, 0));
 					sum = orderGoodList.stream().mapToInt(OrderGood::getNum).sum();
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
index 6e5189d..811b9fa 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
@@ -45,7 +45,7 @@
     @Resource
     private UserCouponClient userCouponClient;
 
-    @PostMapping("/list")
+    @GetMapping("/list")
     @ApiOperation(value = "优惠劵管理-列表", tags = {"管理后台-活动管理"})
     public R<IPage<CouponInfo>> list(@RequestParam("pageNum") Integer pageNum,
                                      @RequestParam("pageSize") Integer pageSize,
@@ -60,7 +60,7 @@
 
 
     //查看详情
-    @PostMapping("/detail")
+    @GetMapping("/detail")
     @ApiOperation(value = "优惠劵管理-详情", tags = {"管理后台-活动管理"})
     public R<CouponInfo> detail(@RequestParam("id") Integer id) {
         CouponInfo byId = couponInfoService.getById(id);

--
Gitblit v1.7.1