吉安感知网项目-后端
linwei
2026-02-03 6a8762f95544819eeea4a4d5503232e1925ca04c
drone-service/drone-fw/src/main/java/org/sxkj/fw/cockpit/service/impl/CockpitServiceImpl.java
@@ -4,6 +4,11 @@
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.area.service.IFwAreaDivideService;
import org.sxkj.fw.area.service.IFwDefenseSceneManageService;
import org.sxkj.fw.area.vo.FwAreaDivideVO;
import org.sxkj.fw.area.vo.FwDefenseSceneManageVO;
import org.sxkj.fw.cockpit.service.ICockpitService;
import org.sxkj.fw.cockpit.vo.AlarmStatisticsVO;
import org.sxkj.fw.cockpit.vo.DeviceStatisticsVO;
@@ -18,9 +23,14 @@
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.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Optional;
@@ -36,6 +46,12 @@
   @Resource
   private IFwEffectEvalService fwEffectEvalService;
   @Resource
   private IFwAreaDivideService iFwAreaDivideService;
   @Resource
   private IFwDefenseSceneManageService iFwDefenseSceneManageService;
   @Override
   public IPage<FwDroneAlarmRecordVO> selectFwDroneAlarmRecordPage(IPage<FwDroneAlarmRecordVO> page, FwDroneAlarmRecordDTO fwDroneAlarmRecord) {
@@ -44,16 +60,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 +117,54 @@
   @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);
   }
   /**
    *
    * @param filterTime
    * @return
    */
   @Override
   public List<FwDefenseSceneManageVO> selectFwDefenseSceneManageList(Date filterTime) {
      return iFwDefenseSceneManageService.selectFwDefenseSceneManageList(filterTime);
   }
   /**
    *
    * @param filterSelected
    * @param sceneId
    * @param areaTypeKeys
    * @param isSetSceneManage
    * @param flyTime
    * @return
    */
   @Override
   public List<FwAreaDivideVO> selectFwAreaDivideList(Integer filterSelected, Long sceneId, String areaTypeKeys, Integer isSetSceneManage, LocalDateTime flyTime) {
      return iFwAreaDivideService.selectFwAreaDivideList(filterSelected, sceneId, areaTypeKeys, isSetSceneManage, flyTime);
   }
}