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

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

@@ -1,28 +0,0 @@
package com.genersoft.iot.vmp.gb28181.event;
import com.genersoft.iot.vmp.conf.UserSetting;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
/**
* @description:设备离在线状态检测器,用于检测设备状态
* @author: swwheihei
* @date: 2020年5月13日 下午2:40:29
*/
@Component
public class DeviceOffLineDetector {
@Autowired
private RedisUtil redis;
@Autowired
private UserSetting userSetting;
public boolean isOnline(String deviceId) {
String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + deviceId;
return redis.hasKey(key);
}
}