吉安感知网项目-后端
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;
@@ -18,7 +19,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 +48,20 @@
   @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());
      return fwDeviceService.selectCockpitDevicePage(page, fwDevice);
         Dept dept = SysCache.getDept(Long.valueOf(AuthUtil.getDeptId()));
         Region byCode = RegionCache.getByCode(dept.getAreaCode());
         fwDevice.setRegionCode(HeaderUtils.formatAreaCode(byCode.getCode()));
         fwDevice.setCurrentDeptId(AuthUtil.getDeptId());
      IPage<CockpitFwDeviceVO> cockpitFwDeviceVOIPage = fwDeviceService.selectCockpitDevicePage(page, fwDevice);
      return cockpitFwDeviceVOIPage;
   }
   @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());
      return fwDeviceService.statisticalDeviceType(HeaderUtils.formatAreaCode(byCode.getCode()), AuthUtil.getDeptId());
   }
   @Override
@@ -97,13 +105,30 @@
   @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 regionCode = HeaderUtils.formatAreaCode(byCode.getCode());
      // 设备统计
      AlarmStatisticsVO alarmStatisticsVO = fwDeviceService.statisticalDeviceAtt(regionCode, AuthUtil.getDeptId());
      // 告警统计
      AlarmStatisticsVO alarmStatistics = fwDroneAlarmRecordService.alarmTypeStatistics(deptList,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) {
      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);
   }
}