From ba12d5d8e844146c334223ef5939a51c8e5d76ca Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Thu, 29 Jan 2026 20:18:26 +0800
Subject: [PATCH] 反无-权限控制

---
 drone-service/drone-fw/src/main/java/org/sxkj/fw/cockpit/service/impl/CockpitServiceImpl.java |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/drone-service/drone-fw/src/main/java/org/sxkj/fw/cockpit/service/impl/CockpitServiceImpl.java b/drone-service/drone-fw/src/main/java/org/sxkj/fw/cockpit/service/impl/CockpitServiceImpl.java
index 7654f61..299edb1 100644
--- a/drone-service/drone-fw/src/main/java/org/sxkj/fw/cockpit/service/impl/CockpitServiceImpl.java
+++ b/drone-service/drone-fw/src/main/java/org/sxkj/fw/cockpit/service/impl/CockpitServiceImpl.java
@@ -18,7 +18,10 @@
 import org.sxkj.fw.record.entity.FwDroneAlarmRecordEntity;
 import org.sxkj.fw.record.service.IFwDroneAlarmRecordService;
 import org.sxkj.fw.record.vo.FwDroneAlarmRecordVO;
+import org.sxkj.system.cache.RegionCache;
 import org.sxkj.system.cache.SysCache;
+import org.sxkj.system.entity.Dept;
+import org.sxkj.system.entity.Region;
 
 import javax.annotation.Resource;
 import java.util.List;
@@ -44,16 +47,24 @@
 
 	@Override
 	public IPage<CockpitFwDeviceVO> selectCockpitDevicePage(IPage<CockpitFwDeviceVO> page, FwDeviceDTO fwDevice) {
-		List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()));
-		fwDevice.setDeptList(deptList);
+		// List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()));
+		// fwDevice.setDeptList(deptList);
+		// fwDevice.setCurrentDeptId(AuthUtil.getDeptId());
+		Dept dept = SysCache.getDept(Long.valueOf(AuthUtil.getDeptId()));
+		Region byCode = RegionCache.getByCode(dept.getAreaCode());
+		String regionName = byCode.getName();
+		fwDevice.setRegionName(regionName);
 		fwDevice.setCurrentDeptId(AuthUtil.getDeptId());
 		return fwDeviceService.selectCockpitDevicePage(page, fwDevice);
 	}
 
 	@Override
 	public List<DeviceStatisticsVO> statisticalDeviceType() {
-		List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()));
-		return fwDeviceService.statisticalDeviceType(deptList,AuthUtil.getDeptId());
+		// List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()));
+		Dept dept = SysCache.getDept(Long.valueOf(AuthUtil.getDeptId()));
+		Region byCode = RegionCache.getByCode(dept.getAreaCode());
+		String regionName = byCode.getName();
+		return fwDeviceService.statisticalDeviceType(regionName, AuthUtil.getDeptId());
 	}
 
 	@Override
@@ -97,11 +108,14 @@
 
 	@Override
 	public AlarmStatisticsVO statisticsAlarmsAndDeviceRecords() {
-		List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()));
- 		// 设备统计
-		AlarmStatisticsVO alarmStatisticsVO = fwDeviceService.statisticalDeviceAtt(deptList,AuthUtil.getDeptId());
+		// List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()));
+		Dept dept = SysCache.getDept(Long.valueOf(AuthUtil.getDeptId()));
+		Region byCode = RegionCache.getByCode(dept.getAreaCode());
+		String regionName = byCode.getName();
+		// 设备统计
+		AlarmStatisticsVO alarmStatisticsVO = fwDeviceService.statisticalDeviceAtt(regionName, AuthUtil.getDeptId());
 		// 告警统计
-		AlarmStatisticsVO alarmStatistics = fwDroneAlarmRecordService.alarmTypeStatistics(deptList,AuthUtil.getDeptId());
+		AlarmStatisticsVO alarmStatistics = fwDroneAlarmRecordService.alarmTypeStatistics(regionName, AuthUtil.getDeptId());
 		alarmStatisticsVO.setHistoryAlarmCount(alarmStatistics.getHistoryAlarmCount());
 		alarmStatisticsVO.setRealTimeAlarmCount(alarmStatistics.getRealTimeAlarmCount());
 		return alarmStatisticsVO;

--
Gitblit v1.9.3