| | |
| | | import com.ruoyi.alarmpoints.tube.mapper.ArdTubesMapper; |
| | | import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell; |
| | | import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.utils.tools.ArdTool; |
| | |
| | | private ArdCamerasMapper ardCamerasMapper; |
| | | @Resource |
| | | private IHikClientService hikClientService; |
| | | @Resource |
| | | private RedisCache redisCache; |
| | | /** |
| | | * @描述 按条件查询报警 |
| | | * @参数 [condition] |
| | |
| | | private String guideCamera(CameraCmd cmd) { |
| | | String url = ""; |
| | | try { |
| | | String dayNightTime = redisCache.getCacheObject("sys_config:dayNightTime"); |
| | | //获取所有大光电 |
| | | List<ArdCameras> ardCamerasList = ardCamerasMapper.selectArdCamerasList(new ArdCameras("1")); |
| | | //统计所有大光电可视范围内与报警点的距离 |
| | | Map<String, Double> distanceMap = new HashMap<>(); |
| | | Map<String, Integer> guideMap = new HashMap<>(); |
| | | for (ArdCameras camera : ardCamerasList) { |
| | | double[] camPosition = new double[]{camera.getLongitude(), camera.getLatitude()}; |
| | | double distance = GisTool.getDistance(cmd.getTargetPosition(), camPosition); |
| | | if (distance != 0.0 && distance <= camera.getCamMaxVisibleDistance()) { |
| | | distanceMap.put(camera.getId(), distance); |
| | | guideMap.put(camera.getId(),camera.getCamAlarmGuideEnable()); |
| | | } |
| | | } |
| | | if (distanceMap.size() > 0) { |
| | |
| | | //获取距离字典中最近的一个相机ID |
| | | String minDistanceCameraId = ArdTool.getKeyByMinValue(distanceMap); |
| | | log.debug("查找到最近光电:"+minDistanceCameraId+",尝试引导"); |
| | | if(guideMap.get(minDistanceCameraId).equals(0)) |
| | | { |
| | | log.debug("该光电未开启报警引导"); |
| | | return ""; |
| | | } |
| | | //引导光电 |
| | | cmd.setCameraId(minDistanceCameraId); |
| | | cmd.setChannelNum(1); |
| | | cmd.setChannelNum(ArdTool.getChannelBydayNightTime(dayNightTime)); |
| | | boolean guideRes = hikClientService.guideTargetPosition(cmd); |
| | | if (guideRes) { |
| | | log.debug("引导成功,尝试录像"); |