吉安感知网项目-后端
linwei
2026-02-03 d18ef72c533fe6b18d487bcd9fd333c63ca50f04
drone-service/drone-fw/src/main/java/org/sxkj/fw/cockpit/service/impl/CockpitServiceImpl.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.core.secure.utils.AuthUtil;
import org.springframework.stereotype.Service;
import org.sxkj.common.utils.HeaderUtils;
import org.sxkj.fw.cockpit.service.ICockpitService;
import org.sxkj.fw.cockpit.vo.AlarmStatisticsVO;
import org.sxkj.fw.cockpit.vo.DeviceStatisticsVO;
@@ -47,13 +48,9 @@
   @Override
   public IPage<CockpitFwDeviceVO> selectCockpitDevicePage(IPage<CockpitFwDeviceVO> page, FwDeviceDTO 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.setRegionCode(HeaderUtils.formatAreaCode(byCode.getCode()));
      fwDevice.setCurrentDeptId(AuthUtil.getDeptId());
      IPage<CockpitFwDeviceVO> cockpitFwDeviceVOIPage = fwDeviceService.selectCockpitDevicePage(page, fwDevice);
      return cockpitFwDeviceVOIPage;
@@ -64,8 +61,7 @@
      // 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());
      return fwDeviceService.statisticalDeviceType(HeaderUtils.formatAreaCode(byCode.getCode()), AuthUtil.getDeptId());
   }
   @Override
@@ -112,23 +108,27 @@
      // 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();
      String regionCode = HeaderUtils.formatAreaCode(byCode.getCode());
      // 设备统计
      AlarmStatisticsVO alarmStatisticsVO = fwDeviceService.statisticalDeviceAtt(regionName, AuthUtil.getDeptId());
      AlarmStatisticsVO alarmStatisticsVO = fwDeviceService.statisticalDeviceAtt(regionCode, AuthUtil.getDeptId());
      // 告警统计
      AlarmStatisticsVO alarmStatistics = fwDroneAlarmRecordService.alarmTypeStatistics(regionName, AuthUtil.getDeptId());
      AlarmStatisticsVO alarmStatistics = fwDroneAlarmRecordService.alarmTypeStatistics(regionCode, 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);
      FwDeviceDTO fwDeviceDTO = new FwDeviceDTO();
      Dept dept = SysCache.getDept(Long.valueOf(AuthUtil.getDeptId()));
      Region byCode = RegionCache.getByCode(dept.getAreaCode());
      fwDeviceDTO.setCurrentDeptId(AuthUtil.getDeptId());
      fwDeviceDTO.setRegionCode(HeaderUtils.formatAreaCode(byCode.getCode()));
      return fwDeviceService.getDeviceStatistics(fwDeviceDTO);
   }
}