| | |
| | | if(StringUtils.isNotEmpty(name) && name.contains("|")){ |
| | | String[] osdNames = name.split("\\|"); |
| | | //剔除掉空串 |
| | | List<String> nonEmptyList = new ArrayList<>(); |
| | | for (String osd : osdNames) { |
| | | if (StringUtils.isNotEmpty(osd)) { |
| | | nonEmptyList.add(osd); |
| | | } |
| | | } |
| | | result.setOSD1(nonEmptyList.get(0)); |
| | | result.setOSD2(nonEmptyList.get(1)); |
| | | result.setOSD3(nonEmptyList.get(2)); |
| | | result.setName(nonEmptyList.get(3)); |
| | | // List<String> nonEmptyList = new ArrayList<>(); |
| | | // for (String osd : osdNames) { |
| | | // if (StringUtils.isNotEmpty(osd)) { |
| | | // nonEmptyList.add(osd); |
| | | // } |
| | | // } |
| | | result.setOSD1(osdNames[0]); |
| | | result.setOSD2(osdNames[1]); |
| | | result.setOSD3(osdNames[2]); |
| | | result.setName(osdNames[3]); |
| | | } |
| | | } |
| | | }else { |
| | |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.service.ICheckIndexVideoService; |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import constant.CheckThreadConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | }); |
| | | //重点指挥图像特殊处理,统一采用区县数据 |
| | | Map<Long, BigDecimal> keyCommandMap = checkIndexVideos.stream().filter(checkIndexVideo -> !checkIndexVideo.getDeptTag() && !checkIndexVideo.getProvinceTag()) |
| | | Map<Long, BigDecimal> keyCommandMap = checkIndexVideos.stream().filter(checkIndexVideo -> CheckConstants.Examine_Tag_County.equals(checkIndexVideo.getExamineTag())) |
| | | .collect(Collectors.toMap(checkIndexVideo -> checkIndexVideo.getDeptId(), checkIndexVideo -> checkIndexVideo.getKeyCommandImageOnline())); |
| | | for (CheckIndexVideo checkIndexVideo : checkIndexVideos) { |
| | | //替换省厅和部级 重点指挥图像 |
| | | if(checkIndexVideo.getProvinceTag() || checkIndexVideo.getDeptTag()){ |
| | | if(CheckConstants.Examine_Tag_Province.equals(checkIndexVideo.getExamineTag()) || CheckConstants.Examine_Tag_Dept.equals(checkIndexVideo.getExamineTag())){ |
| | | BigDecimal keyCommand = keyCommandMap.get(checkIndexVideo.getDeptId()); |
| | | checkIndexVideo.setKeyCommandImageOnline(keyCommand); |
| | | } |
| | |
| | | private static final String DICT_TYPE = "platform_online"; |
| | | |
| | | private static final ExecutorService executorService = new ThreadPoolExecutor(16, |
| | | 128, |
| | | 64, |
| | | 5000, |
| | | TimeUnit.SECONDS, |
| | | new ArrayBlockingQueue<>(1000), |
| | |
| | | for (int tryTimes = 1; tryTimes < 3; tryTimes++) { |
| | | // 三秒未ping通重试一次,如果不行才扣分 |
| | | reachable = InetAddress.getByName(platform.getPlatformIP()).isReachable(3000); |
| | | if (! reachable && tryTimes == 0) { |
| | | continue; |
| | | } |
| | | if (! reachable) { |
| | | // 如果ping不通,离线时长加5秒 |
| | | redisTemplate.opsForValue().increment(REDIS_KEY_PREFIX + platform.getPlatformIP(), 5); |
| | | log.warn(platform.getPlatformName() + "平台未ping通"); |
| | | if (reachable) { |
| | | break; |
| | | } |
| | | } |
| | | if (!reachable) { |
| | | // 如果ping不通,离线时长加5秒 |
| | | redisTemplate.opsForValue().increment(REDIS_KEY_PREFIX + platform.getPlatformIP(), 5); |
| | | log.warn(platform.getPlatformName() + "平台未ping通"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("检查平台连通性时发生错误", e); |
| | | log.error("检查平台连通性时发生d错误", e); |
| | | } |
| | | }); |
| | | } |
| | |
| | | OnlineCheckThread thread = new OnlineCheckThread(monitor, checkPointUtil, time); |
| | | return thread.call(); // 假设 OnlineCheckThread 实现了 Callable 接口 |
| | | }, executorService) |
| | | .orTimeout(120, TimeUnit.SECONDS) |
| | | .orTimeout(180, TimeUnit.SECONDS) |
| | | .exceptionally(ex -> { |
| | | if (ex instanceof TimeoutException) { |
| | | log.error("任务执行超时:"+monitor.getIp()); |
| | |
| | | IFNULL(SUM(IF((p.online = 1 and p.ping_online = 1), 1, 0)), 0) AS totalMembers, |
| | | IFNULL(SUM(IF((p.online = -1 or p.ping_online = -1), 1, 0)), 0) AS postsPercentage, |
| | | IFNULL(SUM(IF((p.online = 0 and p.ping_online = 0), 1, 0)), 0) AS unknownNumbers, |
| | | IFNULL(ROUND(SUM(IF((p.online = 1 and p.online= 1), 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage |
| | | IFNULL(ROUND(SUM(IF((p.online = 1 and p.ping_online= 1), 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage |
| | | FROM t_monitor m |
| | | left join t_yw_point p on m.serial_number = p.serial_number |
| | | left join sys_dept d on p.dept_id = d.dept_id and d.del_flag = 0 |