6f7cc7c14b4532120e9e6827ca0feb2c9aa4c2c7..12017a00ed21f8d461ab444d0bff12f61f476909
2025-02-06 fuliqi
osd测试代码清理
12017a 对比 | 目录
2025-02-06 fuliqi
节前发版代码
7c2317 对比 | 目录
2025-01-24 fuliqi
多次ping
0becc3 对比 | 目录
6个文件已修改
78 ■■■■ 已修改文件
ycl-server/src/main/java/com/ycl/api/DH/module/LoginModule.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/calculate/VideoOnlineCalculation.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/task/PlatformTask.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/task/UYTask.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/utils/CheckPointUtil.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/api/DH/module/LoginModule.java
@@ -197,19 +197,10 @@
//            log.error("CLIENT_GetConfig Failed!" + ToolKits.getErrorCodePrint());
            return null;
        } else {
            osdInfo.read();
            NET_GBMODE_CUSTOMTITLE_INFO[] stuCustomTitle = osdInfo.stuCustomTitle;
            for (NET_GBMODE_CUSTOMTITLE_INFO title : stuCustomTitle) {
                String position = new String(title.szPositon, StandardCharsets.UTF_8).trim();
                NET_TITLE_OSD_INFO[] stuOSD1 = title.stuOSD;
                for (NET_TITLE_OSD_INFO osd : stuOSD1) {
                    String osdStr = null;
                    osdStr = new String(osd.szText, StandardCharsets.UTF_8).trim();
                    if (!StringUtils.isEmpty(osdStr)) {
                        osdResult.setOSD4(osdStr);
                    }
                }
                if ("LeftDown".equals(position)) {
                    NET_TITLE_OSD_INFO[] stuOSD = title.stuOSD;
                    for (NET_TITLE_OSD_INFO osd : stuOSD) {
@@ -274,16 +265,16 @@
                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 {
ycl-server/src/main/java/com/ycl/calculate/VideoOnlineCalculation.java
@@ -7,6 +7,7 @@
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;
@@ -67,11 +68,11 @@
            }
        });
        //重点指挥图像特殊处理,统一采用区县数据
        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);
            }
ycl-server/src/main/java/com/ycl/task/PlatformTask.java
@@ -45,7 +45,7 @@
    private static final String DICT_TYPE = "platform_online";
    private static final ExecutorService executorService = new ThreadPoolExecutor(16,
            128,
            64,
            5000,
            TimeUnit.SECONDS,
            new ArrayBlockingQueue<>(1000),
@@ -68,17 +68,17 @@
                    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);
                }
            });
        }
ycl-server/src/main/java/com/ycl/task/UYTask.java
@@ -214,7 +214,7 @@
                            OnlineCheckThread thread = new OnlineCheckThread(monitor, checkPointUtil, time);
                            return thread.call(); // 假设 OnlineCheckThread 实现了 Callable 接口
                        }, executorService)
                        .orTimeout(60, TimeUnit.SECONDS)
                        .orTimeout(180, TimeUnit.SECONDS)
                        .exceptionally(ex -> {
                            if (ex instanceof TimeoutException) {
                                log.error("任务执行超时:"+monitor.getIp());
ycl-server/src/main/java/com/ycl/utils/CheckPointUtil.java
@@ -86,11 +86,7 @@
            map = new HashMap<>();
        }
        if (!monitor.getPingOnline()) {
            try {
                reachable = InetAddress.getByName(monitor.getIp()).isReachable(5000);
            } catch (IOException e) {
                log.error("Ping异常{}",e.getMessage());
            }
            reachable = checkPing(monitor, reachable);
            if(!reachable) log.error("ping检测离线"+monitor.getIp());
            monitor.setPingOnline(reachable);
        }
@@ -123,6 +119,22 @@
        return monitor;
    }
    private boolean checkPing(TMonitorResult monitor, boolean reachable) {
        try {
            int[] sleepTimes = {5000, 15000, 30000};
            for (int sleepTime : sleepTimes) {
                reachable = InetAddress.getByName(monitor.getIp()).isReachable(5000);
                if (reachable) {
                    break;
                }
                Thread.sleep(sleepTime);
            }
        } catch (Exception e) {
            log.error("Ping异常{}",e.getMessage());
        }
        return reachable;
    }
    /**
     * 监测点位在线
ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
@@ -396,7 +396,7 @@
        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