fix
parent
44e26d2024
commit
8e34d4e4cb
|
@ -16,6 +16,7 @@ import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
||||||
|
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo;
|
import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import com.genersoft.iot.vmp.utils.JsonUtil;
|
import com.genersoft.iot.vmp.utils.JsonUtil;
|
||||||
|
@ -40,6 +41,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceChannelMapper deviceChannelMapper;
|
private DeviceChannelMapper deviceChannelMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceMapper deviceMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserSetting userSetting;
|
private UserSetting userSetting;
|
||||||
|
|
||||||
|
@ -375,7 +379,8 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||||
for (Object o : keys) {
|
for (Object o : keys) {
|
||||||
String key = (String) o;
|
String key = (String) o;
|
||||||
Device device = JsonUtil.redisJsonToObject(redisTemplate, key, Device.class);
|
Device device = JsonUtil.redisJsonToObject(redisTemplate, key, Device.class);
|
||||||
if (Objects.nonNull(device)) { // 只取没有存过得
|
if (Objects.nonNull(device)) {
|
||||||
|
// 只取没有存过得
|
||||||
result.add(JsonUtil.redisJsonToObject(redisTemplate, key, Device.class));
|
result.add(JsonUtil.redisJsonToObject(redisTemplate, key, Device.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,14 +391,22 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||||
@Override
|
@Override
|
||||||
public Device getDevice(String deviceId) {
|
public Device getDevice(String deviceId) {
|
||||||
String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId;
|
String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId;
|
||||||
return JsonUtil.redisJsonToObject(redisTemplate, key, Device.class);
|
Device device = JsonUtil.redisJsonToObject(redisTemplate, key, Device.class);
|
||||||
|
if (device == null){
|
||||||
|
device = deviceMapper.getDeviceByDeviceId(deviceId);
|
||||||
|
if (device != null) {
|
||||||
|
updateDevice(device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) {
|
public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) {
|
||||||
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getId();
|
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getId();
|
||||||
Duration duration = Duration.ofSeconds(60L);
|
Duration duration = Duration.ofSeconds(60L);
|
||||||
redisTemplate.opsForValue().set(key, gpsMsgInfo, duration); // 默认GPS消息保存1分钟
|
redisTemplate.opsForValue().set(key, gpsMsgInfo, duration);
|
||||||
|
// 默认GPS消息保存1分钟
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue