From 1442f149019ee0590389abd7a88a79c4d9b59034 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期二, 27 五月 2025 18:23:34 +0800
Subject: [PATCH] bug修改

---
 ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/HomePageController.java |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/HomePageController.java b/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/HomePageController.java
index b4d9189..60dca9e 100644
--- a/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/HomePageController.java
+++ b/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/HomePageController.java
@@ -1,6 +1,8 @@
 package com.ruoyi.admin.controller;
 
+import com.ruoyi.admin.entity.Franchisee;
 import com.ruoyi.admin.request.UserDataCountRequest;
+import com.ruoyi.admin.service.FranchiseeService;
 import com.ruoyi.admin.service.MasterWorkerService;
 import com.ruoyi.admin.service.UserService;
 import com.ruoyi.admin.vo.MasterWorkerRankVO;
@@ -21,6 +23,7 @@
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -55,6 +58,19 @@
         if (null == loginUser) {
             return R.loginExpire("登录失效!");
         }
+
+        Integer franchiseeId = loginUser.getSysUser().getFranchiseeId();
+        String[] siteIds = new String[0];
+        if (franchiseeId!=null){
+            Franchisee byId = franchiseeService.getById(franchiseeId);
+            siteIds = byId.getSiteIds().split(",");
+            if (loginUser.getIsFranchisee()&&siteIds.length==0){
+                return R.ok();
+            }
+        }
+        userDataCountRequest.setSiteIds(Arrays.asList(siteIds));
+
+
         if (loginUser.getIsFranchisee()||!userDataCountRequest.getCityList().isEmpty()) {
             if (null == userDataCountRequest.getCityList() || userDataCountRequest.getCityList().isEmpty()) {
                 userDataCountRequest.setCityList(loginUser.getCityList());
@@ -62,9 +78,9 @@
 //            else {
 ////                userDataCountRequest.getCityList().addAll(loginUser.getCityList());
 //            }
-            R<List<Integer>> listR = orderClient.queryIdsBycode(userDataCountRequest.getCityList());
+            R<List<Integer>> listR = orderClient.queryIdsBycodeAndSite(userDataCountRequest.getCityList(),userDataCountRequest.getSiteIds());
 
-            return R.ok(userService.userDataCount1(userDataCountRequest, listR.getData()));
+            return R.ok(userService.userDataCount1(userDataCountRequest, listR.getData(),userDataCountRequest.getSiteIds()));
 
         }
         return R.ok(userService.userDataCount(userDataCountRequest));
@@ -97,6 +113,8 @@
         return R.ok(userService.userTrends(cityList));
     }
 
+    @Resource
+    private FranchiseeService franchiseeService;
     /**
      * 回收订单统计
      *
@@ -117,6 +135,17 @@
 //                orderCount.getCityList().addAll(loginUser.getCityList());
             }
         }
+        Integer franchiseeId = loginUser.getSysUser().getFranchiseeId();
+        String[] siteIds = new String[0];
+        if (franchiseeId!=null) {
+            Franchisee byId = franchiseeService.getById(franchiseeId);
+            siteIds = byId.getSiteIds().split(",");
+            orderCount.setSiteIds(siteIds);
+            if (loginUser.getIsFranchisee() && siteIds.length == 0) {
+                return R.ok(new OrderResultVO());
+            }
+        }
+        orderCount.setSiteIds(siteIds);
         return orderClient.orderCountHome(orderCount);
     }
 

--
Gitblit v1.7.1