|
|
|
@ -132,10 +132,8 @@ public class PatrolDeviceStatusSynTask { |
|
|
|
for (int i = 0; i < ivsJsonObjectItems.size(); ++i) { |
|
|
|
JSONObject item = ivsJsonObjectItems.getJSONObject(i); |
|
|
|
String patrolDeviceCode = item.getString("code"); |
|
|
|
int status = item.getInteger("status"); |
|
|
|
if (status == 1) { |
|
|
|
ivsDeviceStatusMap.put(patrolDeviceCode, Boolean.TRUE); |
|
|
|
} |
|
|
|
Integer status = item.getInteger("status"); |
|
|
|
ivsDeviceStatusMap.put(patrolDeviceCode, null != status && status == 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -157,23 +155,23 @@ public class PatrolDeviceStatusSynTask { |
|
|
|
} |
|
|
|
if (ivsDeviceStatusMap.containsKey(patrolDeviceCode)) { |
|
|
|
boolean online = ivsDeviceStatusMap.get(patrolDeviceCode); |
|
|
|
String deviceOnlineKey = "mont_patrol_device_online_status:" + patrolDeviceCode; |
|
|
|
if (online) { |
|
|
|
Boolean hasKey = redisService.hasKey("mont_patrol_device_online_status:" + patrolDeviceCode); |
|
|
|
if (!hasKey) { |
|
|
|
if (webSendFlag == 0) { |
|
|
|
webSendFlag = 1; |
|
|
|
} |
|
|
|
|
|
|
|
JSONObject returnJsonObject = patrolDeviceMesHandle(patrolDeviceCode, null, eqpBookId, heart_beat_interval, heartBeatInterval, dateTimeNowFormat); |
|
|
|
redisService.setCacheObject("mont_patrol_device_online_status:" + patrolDeviceCode, returnJsonObject); |
|
|
|
redisService.expire("mont_patrol_device_online_status:" + patrolDeviceCode, heartBeatInterval); |
|
|
|
} else { |
|
|
|
redisService.expire("mont_patrol_device_online_status:" + patrolDeviceCode, heartBeatInterval); |
|
|
|
if (!redisService.hasKey(deviceOnlineKey)) { |
|
|
|
webSendFlag = 1; |
|
|
|
} |
|
|
|
|
|
|
|
JSONObject returnJsonObject = patrolDeviceMesHandle(patrolDeviceCode, null, eqpBookId, heart_beat_interval, heartBeatInterval, dateTimeNowFormat); |
|
|
|
redisService.setCacheObject(deviceOnlineKey, returnJsonObject); |
|
|
|
redisService.expire(deviceOnlineKey, heartBeatInterval); |
|
|
|
} else { |
|
|
|
redisService.deleteObject(deviceOnlineKey); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
patrolDeviceChannelOnlineHandle(ivsDeviceStatusMap, patrolDeviceCode, eqpBookId, heart_beat_interval, heartBeatInterval, dateTimeNowFormat, webSendFlag); |
|
|
|
if (patrolDeviceChannelOnlineHandle(ivsDeviceStatusMap, patrolDeviceCode, eqpBookId, heart_beat_interval, heartBeatInterval, dateTimeNowFormat)) { |
|
|
|
webSendFlag = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (webSendFlag == 1) { |
|
|
|
@ -228,14 +226,14 @@ public class PatrolDeviceStatusSynTask { |
|
|
|
this.montQueryClient.statisBasedataStatisRobotuavOnlineDay(); |
|
|
|
} |
|
|
|
|
|
|
|
public void patrolDeviceChannelOnlineHandle( |
|
|
|
public boolean patrolDeviceChannelOnlineHandle( |
|
|
|
Map<String, Boolean> ivsDeviceStatusMap, |
|
|
|
String patrolDeviceCode, |
|
|
|
Long eqpBookId, |
|
|
|
int heart_beat_interval, |
|
|
|
int heartBeatInterval, |
|
|
|
String dateTimeNowFormat, |
|
|
|
int webSendFlag) { |
|
|
|
String dateTimeNowFormat) { |
|
|
|
boolean newlyOnline = false; |
|
|
|
JSONObject channelQuery = new JSONObject(); |
|
|
|
channelQuery.put("eqpBookId", eqpBookId); |
|
|
|
Object channelDataObject = this.basedataClient.channelList(channelQuery).getRows(); |
|
|
|
@ -244,22 +242,24 @@ public class PatrolDeviceStatusSynTask { |
|
|
|
for (Object channelObject : channelDataJsonList) { |
|
|
|
JSONObject channelJson = (JSONObject) JSONObject.toJSON(channelObject); |
|
|
|
String channelCode = channelJson.getString("channelCode"); |
|
|
|
Boolean hasKey = this.redisService.hasKey("mont_patrol_device_channel_online_status:" + channelCode); |
|
|
|
if (!hasKey) { |
|
|
|
if (webSendFlag == 0) { |
|
|
|
webSendFlag = 1; |
|
|
|
} |
|
|
|
if (ivsDeviceStatusMap.containsKey(channelCode)) { |
|
|
|
boolean online = ivsDeviceStatusMap.get(channelCode); |
|
|
|
String channelOnlineKey = "mont_patrol_device_channel_online_status:" + channelCode; |
|
|
|
if (online) { |
|
|
|
if (!this.redisService.hasKey(channelOnlineKey)) { |
|
|
|
newlyOnline = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (ivsDeviceStatusMap.containsKey(channelCode)) { |
|
|
|
JSONObject returnJsonObject = this.patrolDeviceMesHandle(patrolDeviceCode, channelCode, eqpBookId, heart_beat_interval, heartBeatInterval, dateTimeNowFormat); |
|
|
|
this.redisService.setCacheObject("mont_patrol_device_channel_online_status:" + channelCode, returnJsonObject); |
|
|
|
this.redisService.expire("mont_patrol_device_channel_online_status:" + channelCode, heartBeatInterval); |
|
|
|
this.redisService.setCacheObject(channelOnlineKey, returnJsonObject); |
|
|
|
this.redisService.expire(channelOnlineKey, heartBeatInterval); |
|
|
|
} else { |
|
|
|
this.redisService.deleteObject(channelOnlineKey); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.redisService.expire("mont_patrol_device_channel_online_status:" + channelCode, heartBeatInterval); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return newlyOnline; |
|
|
|
} |
|
|
|
|
|
|
|
public JSONObject patrolDeviceMesHandle(String patrolDeviceCode, String channelCode, Long eqpBookId, int heartBeatInterval, int heartBeatInterval2, String dateTimeNowFormat) { |
|
|
|
|