|
|
@@ -134,7 +134,7 @@ public class DevicePingInfoService extends SuperService {
|
|
|
* 检查设备的状态
|
|
|
*/
|
|
|
public void checkDeviceState() {
|
|
|
- log.info("checkDeviceState: {}", DateUtils.paresTime(System.currentTimeMillis(), DateUtils.FORMAT_LONG));
|
|
|
+// log.info("checkDeviceState: {}", DateUtils.paresTime(System.currentTimeMillis(), DateUtils.FORMAT_LONG));
|
|
|
List<DeviceInfo> list = deviceInfoDao.findAll();
|
|
|
if (ObjectUtils.isNotEmpty(list)) {
|
|
|
long time = System.currentTimeMillis();
|
|
|
@@ -157,14 +157,16 @@ public class DevicePingInfoService extends SuperService {
|
|
|
avgTime = maxPingTime;
|
|
|
}
|
|
|
}
|
|
|
- // 根据ping数据判断是否在线
|
|
|
- if ((time - firstTime) > avgTime) {
|
|
|
- onLineState = OnLineState.OffLine;
|
|
|
- } else {
|
|
|
- onLineState = OnLineState.OnLine;
|
|
|
+ if (firstTime != null) {
|
|
|
+ // 根据ping数据判断是否在线
|
|
|
+ if ((time - firstTime) > avgTime) {
|
|
|
+ onLineState = OnLineState.OffLine;
|
|
|
+ } else {
|
|
|
+ onLineState = OnLineState.OnLine;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- log.info("{} {}", deviceInfo.getDeviceId(), onLineState);
|
|
|
+// log.info("{} {}", deviceInfo.getDeviceId(), onLineState);
|
|
|
if (onLineState != deviceInfo.getOnLineState()) {
|
|
|
log.info("设备在线状态改变:{} {}", deviceInfo.getDeviceName(), onLineState);
|
|
|
Map<String, Object> standardData = new HashMap<String, Object>();
|