吉安感知网项目-后端
linwei
2026-01-31 1c3d9f4f6d0dc330a80b199cfb824f41a048fe6c
drone-service/drone-fw/src/main/java/org/sxkj/fw/cockpit/service/impl/CockpitServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.core.secure.utils.AuthUtil;
import org.springframework.stereotype.Service;
import org.sxkj.fw.cockpit.service.ICockpitService;
import org.sxkj.fw.cockpit.vo.AlarmStatisticsVO;
@@ -17,6 +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;
@@ -42,12 +47,25 @@
   @Override
   public IPage<CockpitFwDeviceVO> selectCockpitDevicePage(IPage<CockpitFwDeviceVO> page, FwDeviceDTO fwDevice) {
      return fwDeviceService.selectCockpitDevicePage(page, fwDevice);
      // 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());
      IPage<CockpitFwDeviceVO> cockpitFwDeviceVOIPage = fwDeviceService.selectCockpitDevicePage(page, fwDevice);
      return cockpitFwDeviceVOIPage;
   }
   @Override
   public List<DeviceStatisticsVO> statisticalDeviceType() {
      return fwDeviceService.statisticalDeviceType();
      // 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
@@ -91,12 +109,26 @@
   @Override
   public AlarmStatisticsVO statisticsAlarmsAndDeviceRecords() {
      // 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();
      AlarmStatisticsVO alarmStatisticsVO = fwDeviceService.statisticalDeviceAtt(regionName, AuthUtil.getDeptId());
      // 告警统计
      AlarmStatisticsVO alarmStatistics = fwDroneAlarmRecordService.alarmTypeStatistics();
      AlarmStatisticsVO alarmStatistics = fwDroneAlarmRecordService.alarmTypeStatistics(regionName, AuthUtil.getDeptId());
      alarmStatisticsVO.setHistoryAlarmCount(alarmStatistics.getHistoryAlarmCount());
      alarmStatisticsVO.setRealTimeAlarmCount(alarmStatistics.getRealTimeAlarmCount());
      return alarmStatisticsVO;
   }
   /**
    *
    * @param effectiveRangeKmIsNotNull
    * @return
    */
   @Override
   public List<DeviceStatisticsVO> getDeviceOutStatistics(String effectiveRangeKmIsNotNull) {
      return fwDeviceService.getDeviceOutStatistics(effectiveRangeKmIsNotNull);
   }
}