From fd7b8fb7c89832c28a838b0449bbb8a392433ee2 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 22 四月 2025 14:33:02 +0800
Subject: [PATCH] 将华为云短信替换成阿里云短信

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java |   61 ++++++++++++++++++++++++------
 1 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
index 31f1e1d..7d435f6 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
@@ -5,10 +5,15 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.common.core.web.page.PageInfo;
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.other.api.domain.Shop;
+import com.ruoyi.other.api.domain.ShopGiveawayTemporary;
 import com.ruoyi.other.api.domain.ShopPoint;
+import com.ruoyi.other.api.domain.ShopPointCopy;
 import com.ruoyi.other.api.enums.PointChangeType;
+import com.ruoyi.other.mapper.ShopGiveawayTemporaryMapper;
+import com.ruoyi.other.mapper.ShopPointCopyMapper;
 import com.ruoyi.other.mapper.ShopPointMapper;
 import com.ruoyi.other.service.ShopPointService;
 import com.ruoyi.other.service.ShopService;
@@ -44,6 +49,12 @@
     private SysUserClient sysUserClient;
     @Resource
     private ShopService shopService;
+    @Resource
+    private ShopGiveawayTemporaryMapper shopGiveawayTemporaryMapper;
+    
+    @Resource
+    private ShopPointCopyMapper shopPointCopyMapper;
+    
 
 
 
@@ -55,11 +66,19 @@
         if (sysUser.getRoleType()==1){
 
             ShopPointStatistics shopPointStatistics = new ShopPointStatistics();
+            shopPointStatistics.setTotalPoint(0);
+            shopPointStatistics.setSubShopCommissionPoint(0);
+            shopPointStatistics.setShopPoint(0);
+            shopPointStatistics.setShopCommissionPoint(0);
+            
             IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint);
+            shopPointIPage.getRecords().forEach(s->s.setVariablePoint(s.getVariablePoint() * s.getChangeDirection()));
             shopPointStatistics.setShopPointIPage(shopPointIPage);
-
-
-            List<ShopPoint> shopPointList = list();
+    
+            IPage<ShopPoint> page1 = new PageInfo<>(0, 100000);
+            IPage<ShopPoint> shopPointIPage1 = this.baseMapper.queryShpointPage(page1, shopPoint);
+            List<ShopPoint> shopPointList = shopPointIPage1.getRecords();
+            shopPointList.forEach(s->s.setVariablePoint(s.getVariablePoint() * s.getChangeDirection()));
             Map<Integer, List<ShopPoint>> shopPointByTypeMap = shopPointList.stream().collect(Collectors.groupingBy(ShopPoint::getType));
             shopPointByTypeMap.forEach((type, shopPoints) -> {
                 shopPoints.stream().map(ShopPoint::getVariablePoint).reduce(Integer::sum).ifPresent(sum -> {
@@ -78,13 +97,6 @@
                     }
                 });
             });
-
-            Integer point = shopPointStatistics.getShopPoint() == null ? 0 : shopPointStatistics.getShopPoint();
-            Integer shopCommissionPoint = shopPointStatistics.getShopCommissionPoint() == null ? 0 : shopPointStatistics.getShopCommissionPoint();
-            Integer setSubShopCommissionPoint = shopPointStatistics.getSubShopCommissionPoint() == null ? 0 : shopPointStatistics.getSubShopCommissionPoint();
-            Integer totalPoint = point + shopCommissionPoint + setSubShopCommissionPoint;
-            shopPointStatistics.setTotalPoint(totalPoint);
-
 
             LocalDateTime startTime = shopPoint.getStartTime();
             LocalDateTime endTime = shopPoint.getEndTime();
@@ -123,12 +135,22 @@
                 brokenLine.put("data", data);
                 shopPointStatistics.setBrokenLine(brokenLine);
             }
+    
+            Integer shopPoint1 = shopPointStatistics.getShopPoint();
+            Integer shopCommissionPoint = shopPointStatistics.getShopCommissionPoint();
+            Integer subShopCommissionPoint = shopPointStatistics.getSubShopCommissionPoint();
+            shopPointStatistics.setTotalPoint(shopPoint1 + shopCommissionPoint + subShopCommissionPoint);
             return shopPointStatistics;
         }else{
             Shop shop = shopService.getById(sysUser.getObjectId());
-            Integer serverPoint = shop.getServerPoint();
-            Integer sharePoint = shop.getSharePoint();
-            Integer lowerLevelSharePoint = shop.getLowerLevelSharePoint();
+            List<ShopGiveawayTemporary> list1 = shopGiveawayTemporaryMapper.selectList(new LambdaQueryWrapper<ShopGiveawayTemporary>().eq(ShopGiveawayTemporary::getShopId, shop.getId()));
+            int serverPointCopy = list1.stream().mapToInt(ShopGiveawayTemporary::getServerPoint).sum();
+            int sharePointCopy = list1.stream().mapToInt(ShopGiveawayTemporary::getSharePoint).sum();
+            int lowerLevelSharePointCopy = list1.stream().mapToInt(ShopGiveawayTemporary::getLowerLevelSharePoint).sum();
+            shopPoint.setShopId(shop.getId());
+            Integer serverPoint = shop.getServerPoint() + serverPointCopy;
+            Integer sharePoint = shop.getSharePoint() + sharePointCopy;
+            Integer lowerLevelSharePoint = shop.getLowerLevelSharePoint() + lowerLevelSharePointCopy;
             ShopPointStatistics shopPointStatistics = new ShopPointStatistics();
             shopPointStatistics.setTotalPoint(serverPoint + sharePoint + lowerLevelSharePoint);
             shopPointStatistics.setShopPoint(serverPoint);
@@ -136,6 +158,7 @@
             shopPointStatistics.setSubShopCommissionPoint(lowerLevelSharePoint);
 
             IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint);
+            shopPointIPage.getRecords().forEach(s->s.setVariablePoint(s.getVariablePoint() * s.getChangeDirection()));
             shopPointStatistics.setShopPointIPage(shopPointIPage);
 
             LocalDateTime startTime = shopPoint.getStartTime();
@@ -178,4 +201,16 @@
             return shopPointStatistics;
         }
     }
+    
+    
+    /**
+     * 获取门店积分流水
+     * @param page
+     * @param shopPoint
+     * @return
+     */
+    @Override
+    public IPage<ShopPoint> getShopPointPage(IPage<ShopPoint> page, ShopPoint shopPoint) {
+        return this.baseMapper.queryShpointPage(page, shopPoint);
+    }
 }

--
Gitblit v1.7.1