优化收到心跳设置设备上线的逻辑

This commit is contained in:
648540858
2022-05-05 14:26:42 +08:00
parent db865cc9cc
commit ff3c30f32e
12 changed files with 30 additions and 72 deletions

View File

@@ -223,4 +223,11 @@ public interface IRedisCatchStorage {
void sendStreamPushRequestedMsg(MessageForPushChannel messageForPushChannel);
/**
* 判断设备状态
* @param deviceId 设备ID
* @return
*/
public boolean deviceIsOnline(String deviceId);
}

View File

@@ -645,4 +645,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
logger.info("[redis 报警通知] {}: {}", key, JSON.toJSON(msg));
redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg));
}
@Override
public boolean deviceIsOnline(String deviceId) {
String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + deviceId;
return redis.hasKey(key);
}
}