更新心跳逻辑
This commit is contained in:
parent
6d1dd1ae26
commit
70b723a15d
@ -49,7 +49,7 @@ public class HeartbeatCommand implements BaseCommand{
|
|||||||
if (devices != null && devices.isArray()) {
|
if (devices != null && devices.isArray()) {
|
||||||
for (JsonNode device : devices) {
|
for (JsonNode device : devices) {
|
||||||
Long deviceId = device.get("deviceId").asLong();
|
Long deviceId = device.get("deviceId").asLong();
|
||||||
Boolean online = device.get("online").asBoolean();
|
int online = device.get("online").asInt();
|
||||||
DeviceInfoCache deviceInfoCacheById = cacheService.getEquipmentCache().getDeviceInfoCacheById(deviceId);
|
DeviceInfoCache deviceInfoCacheById = cacheService.getEquipmentCache().getDeviceInfoCacheById(deviceId);
|
||||||
if (deviceInfoCacheById == null || !deviceInfoCacheById.getObjectType().equals(EquipmentTypeIds.EQUIPMENT_TYPE_STATION_WTG)) {
|
if (deviceInfoCacheById == null || !deviceInfoCacheById.getObjectType().equals(EquipmentTypeIds.EQUIPMENT_TYPE_STATION_WTG)) {
|
||||||
continue;
|
continue;
|
||||||
@ -59,10 +59,10 @@ public class HeartbeatCommand implements BaseCommand{
|
|||||||
String keyCommFaultState = String.format("RT:%d:commfaultstate",deviceId);
|
String keyCommFaultState = String.format("RT:%d:commfaultstate",deviceId);
|
||||||
Integer plcDeviceStatus = adminRedisTemplate.get(keyPLCDeviceStatus);
|
Integer plcDeviceStatus = adminRedisTemplate.get(keyPLCDeviceStatus);
|
||||||
if (plcDeviceStatus == null){
|
if (plcDeviceStatus == null){
|
||||||
adminRedisTemplate.set(keyCommFaultState, online ? 0 : 1);
|
adminRedisTemplate.set(keyCommFaultState, (online == 1) ? 0 : 1);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
adminRedisTemplate.set(keyCommFaultState, online && (plcDeviceStatus != 0) ? 0 : 1);
|
adminRedisTemplate.set(keyCommFaultState, (online == 1) && (plcDeviceStatus != 0) ? 0 : 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user