package org.sxkj.fw.cockpit.service.impl;
|
|
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.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;
|
import org.sxkj.fw.detection.entity.FwEffectEvalEntity;
|
import org.sxkj.fw.detection.param.FwEffectEvalParam;
|
import org.sxkj.fw.detection.service.IFwEffectEvalService;
|
import org.sxkj.fw.device.dto.FwDeviceDTO;
|
import org.sxkj.fw.device.entity.FwDeviceEntity;
|
import org.sxkj.fw.device.service.IFwDeviceService;
|
import org.sxkj.fw.device.vo.CockpitFwDeviceVO;
|
import org.sxkj.fw.record.dto.FwDroneAlarmRecordDTO;
|
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;
|
|
@Service
|
public class CockpitServiceImpl implements ICockpitService {
|
|
@Resource
|
private IFwDroneAlarmRecordService fwDroneAlarmRecordService;
|
|
@Resource
|
private IFwDeviceService fwDeviceService;
|
|
@Resource
|
private IFwEffectEvalService fwEffectEvalService;
|
|
@Resource
|
private IFwAreaDivideService iFwAreaDivideService;
|
|
@Resource
|
private IFwDefenseSceneManageService iFwDefenseSceneManageService;
|
|
|
@Override
|
public IPage<FwDroneAlarmRecordVO> selectFwDroneAlarmRecordPage(IPage<FwDroneAlarmRecordVO> page, FwDroneAlarmRecordDTO fwDroneAlarmRecord) {
|
return fwDroneAlarmRecordService.selectFwDroneAlarmRecordPage(page, fwDroneAlarmRecord);
|
}
|
|
@Override
|
public IPage<CockpitFwDeviceVO> selectCockpitDevicePage(IPage<CockpitFwDeviceVO> page, FwDeviceDTO 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()));
|
Dept dept = SysCache.getDept(Long.valueOf(AuthUtil.getDeptId()));
|
Region byCode = RegionCache.getByCode(dept.getAreaCode());
|
return fwDeviceService.statisticalDeviceType(HeaderUtils.formatAreaCode(byCode.getCode()), AuthUtil.getDeptId());
|
}
|
|
@Override
|
public boolean interferenceAndExpulsion(FwEffectEvalParam fwEffectEvalParam) {
|
// 告警记录
|
FwDroneAlarmRecordEntity alarmRecordEntity = fwDroneAlarmRecordService.getById(fwEffectEvalParam.getAlarmRecordId());
|
// 设备信息
|
FwDeviceEntity device = fwDeviceService.getById(alarmRecordEntity.getDeviceId());
|
// 反制效果
|
FwEffectEvalEntity one = fwEffectEvalService.getOne(Wrappers.<FwEffectEvalEntity>lambdaQuery().eq(FwEffectEvalEntity::getAlarmRecordId, fwEffectEvalParam.getAlarmRecordId()));
|
FwEffectEvalEntity fwEffectEvalEntity = Optional.ofNullable(one)
|
.orElse(new FwEffectEvalEntity());
|
|
// 告警记录相关字段
|
fwEffectEvalEntity.setAlarmRecordId(fwEffectEvalParam.getAlarmRecordId());
|
fwEffectEvalEntity.setDroneName(alarmRecordEntity.getDroneName());
|
fwEffectEvalEntity.setDroneType(alarmRecordEntity.getDroneType());
|
fwEffectEvalEntity.setDroneDeviceCode(alarmRecordEntity.getDroneSerialNo());
|
fwEffectEvalEntity.setFindTime(alarmRecordEntity.getAlarmTime());
|
|
// 从参数获取反制方式,否则使用告警记录中的值
|
fwEffectEvalEntity.setCounterWay(fwEffectEvalParam.getCounterWay());
|
alarmRecordEntity.setCounterWay(fwEffectEvalParam.getCounterWay());
|
// 设备相关字段
|
fwEffectEvalEntity.setDeviceId(alarmRecordEntity.getDeviceId());
|
fwEffectEvalEntity.setDeviceSn(device.getDeviceSn());
|
fwEffectEvalEntity.setDeviceName(device.getDeviceName());
|
fwEffectEvalEntity.setDeviceModel(device.getDeviceModel());
|
fwEffectEvalEntity.setDeviceType(device.getDeviceType());
|
fwEffectEvalEntity.setDeployLongitude(device.getLongitude() != null ? Double.parseDouble(device.getLongitude()) : null);
|
fwEffectEvalEntity.setDeployLatitude(device.getLatitude() != null ? Double.parseDouble(device.getLatitude()) : null);
|
fwEffectEvalEntity.setAreaCode(device.getAreaCode());
|
|
// 反制效果及工作模式(从参数获取,否则使用默认值)
|
fwEffectEvalEntity.setCounterEffect("1"); // 1.success/2.fail
|
fwEffectEvalEntity.setCoverRadiusM(2500); // 覆盖范围(米)
|
fwEffectEvalEntity.setWorkMode("1"); // 1.机动/2.固定
|
fwDroneAlarmRecordService.updateById(alarmRecordEntity);
|
return fwEffectEvalService.saveOrUpdate(fwEffectEvalEntity);
|
}
|
|
@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 regionCode = HeaderUtils.formatAreaCode(byCode.getCode());
|
// 设备统计
|
AlarmStatisticsVO alarmStatisticsVO = fwDeviceService.statisticalDeviceAtt(regionCode, 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);
|
}
|
}
|