zxl
昨天 3b0516a2959e25576e4f3fda697a3b025d06c8c9
ycl-server/src/main/java/com/ycl/utils/CheckPointUtil.java
@@ -49,6 +49,12 @@
     * @return
     */
    public TMonitorResult check(TMonitorResult monitor,Integer times) {
        //        TMonitorResult(deptId=202, ip=51.95.48.18, online=0,
//            onlineStr=null, pingOnline=true, pingOnlineStr=null,
//            checkCount=1, offLineCount=0, offLineTimeStr=null,
//            monitorType=3, name=DX_R三中大门前路段左侧人行道2_全景,
//            workOrder=null, pointId=null, createWorkOrder=null, dynamicColumnList=null),
        // 先检测能否访问该ip的网页
        ResponseEntity<String> res = null;
        String prefix = "http://";
@@ -61,7 +67,6 @@
            res = selfHttpUtil.get(prefix + monitor.getIp(), null, null);
            monitor.setPingOnline(Objects.nonNull(res) && HttpStatus.OK == res.getStatusCode());
        } catch (Exception e) {
            log.error("web检测离线"+monitor.getIp());
            monitor.setPingOnline(Boolean.FALSE);
        }
        // 如果http得到的不在线,那么再ping一下
@@ -87,7 +92,6 @@
        }
        if (!monitor.getPingOnline()) {
            reachable = checkPing(monitor, reachable);
            if(!reachable) log.error("ping检测离线"+monitor.getIp());
            monitor.setPingOnline(reachable);
        }
        if (!monitor.getPingOnline()) {
@@ -116,6 +120,7 @@
        redisTemplate.opsForHash().put(RedisConstant.ONLINE_KEY, monitor.getNo(), map);
        monitor.setCheckCount(checkTimes);
        monitor.setOffLineCount(offLineTimes);
        return monitor;
    }
@@ -130,7 +135,7 @@
                Thread.sleep(sleepTime);
            }
        } catch (Exception e) {
            log.error("Ping异常{}",e.getMessage());
            log.error("Ping异常",e);
        }
        return reachable;
    }