From d3e9a09cb54017a8063e5bfe3ace5012f66f3130 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 25 三月 2025 18:34:34 +0800
Subject: [PATCH] 修改统计bug

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java |   38 +++++++++++++++-----------------------
 1 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
index 57ba325..efd454d 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -32,6 +32,7 @@
 import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 /**
@@ -236,6 +237,7 @@
                                          @RequestParam Integer pageNum,
                                          Integer pageSize) {
 
+        List<Integer> shopIds = new ArrayList<>();
         List<Long> userIds = new ArrayList<>();
         if (StringUtils.isNotEmpty(authName)){
             R<List<AppUser>> uR = appUserClient.getAppUserByName(authName);
@@ -244,7 +246,11 @@
                 return R.ok(Page.of(pageNum, pageSize));
             }
             userIds.addAll(userList.stream().map(AppUser::getId).collect(Collectors.toList()));
-
+            //门店名称
+            Set<Integer> integers = shopClient.getShopIdByName(authName).getData();
+            if(null != integers){
+                shopIds.addAll(integers);
+            }
         }
         if (StringUtils.isNotEmpty(authPhone)){
             R<List<AppUser>> uR = appUserClient.getAppUserByPhone(authPhone);
@@ -253,29 +259,15 @@
                 return R.ok(Page.of(pageNum, pageSize));
             }
             userIds.addAll(userList.stream().map(AppUser::getId).collect(Collectors.toList()));
+            //获取门店
+            for (AppUser appUser : userList) {
+                List<Shop> data = shopClient.getShopByUserId(appUser.getId()).getData();
+                if(null != data && data.size() > 0){
+                    shopIds.addAll(data.stream().map(Shop::getId).collect(Collectors.toList()));
+                }
+            }
         }
-
-        List<Share> list = shareService.list();
-        if (CollectionUtils.isEmpty(list)){
-            return R.ok(Page.of(pageNum, pageSize));
-        }
-        List<Long> objectIds = list.stream().map(Share::getObjectId).distinct().collect(Collectors.toList());
-        List<AppUser> appUsers = appUserClient.listByIds(objectIds);
-        List<Long> appUserIds = appUsers.stream().filter(item -> !item.getDelFlag()).map(AppUser::getId).collect(Collectors.toList());
-        if (CollectionUtils.isEmpty(userIds)){
-            userIds = appUserIds;
-        }
-
-
-        Page<Share> page = shareService.lambdaQuery()
-                .ne(Share::getAuditStatus, 1)
-                .like(name != null, Share::getName, name)
-                .eq(addType != null, Share::getAddType, addType)
-                .eq(auditStatus != null, Share::getAuditStatus, auditStatus)
-                .in(!CollectionUtils.isEmpty(userIds),Share::getObjectId, userIds)
-                .eq(Share::getDelFlag, 0)
-                .orderByDesc(Share::getCreateTime)
-                .page(Page.of(pageNum, pageSize));
+        Page<Share> page = shareService.authmanagelist(name, addType, auditStatus, userIds, shopIds, pageNum, pageSize);
         for (Share record : page.getRecords()) {
             if (record.getAddType() == 2) {
                 AppUser appUserById = appUserClient.getAppUserById(Long.valueOf(record.getObjectId()));

--
Gitblit v1.7.1