| | |
| | | /** |
| | | * 点位在线检测 |
| | | */ |
| | | //TODO:视频离线次数、监测次数(修改逻辑只针对工单,检测在线的) |
| | | public void pointOnline() throws ExecutionException, InterruptedException { |
| | | log.info("开始检测点位在线"); |
| | | Integer times = 2; |
| | |
| | | OnlineCheckThread thread = new OnlineCheckThread(monitor, checkPointUtil, time); |
| | | return thread.call(); // 假设 OnlineCheckThread 实现了 Callable 接口 |
| | | }, executorService) |
| | | .orTimeout(30, TimeUnit.SECONDS) |
| | | .orTimeout(40, TimeUnit.SECONDS) |
| | | .exceptionally(ex -> { |
| | | if (ex instanceof TimeoutException) { |
| | | log.error("任务执行超时:"); |
| | | log.error("任务执行超时:"+monitor.getIp()); |
| | | } else { |
| | | log.error("任务执行异常:" + ex); |
| | | log.error("任务执行异常:"+monitor.getIp() + ex); |
| | | } |
| | | int checkTimes = 1; |
| | | int offLineTimes = 1; |
| | | //TODO:BUG |
| | | Map<String, Object> map = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstant.ONLINE_KEY, monitor.getIp()); |
| | | if (!CollectionUtils.isEmpty(map)) { |
| | | checkTimes = (Integer) map.get("checkTimes") + 1; |
| | |
| | | log.info("点位在线监测完成"); |
| | | } |
| | | |
| | | //(弃用)点位在线率 |
| | | //点位在线率(优云) |
| | | public void videoOnlineTask() { |
| | | //视频图像质量 |
| | | log.info("开始执行点位在线数据同步"); |
| | |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, VideoOnlineResult.class); |
| | | //打标签 |
| | | pointService.setDeviceTagByGB(records); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(records); |
| | | // 工单生成 |
| | |
| | | item.setNo(item.getDeviceId()); |
| | | } |
| | | }); |
| | | //打标签 |
| | | pointService.setDeviceTagByGB(records); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(records); |