修复前端空指针异常 #831

This commit is contained in:
648540858
2023-06-14 18:14:40 +08:00
parent f4960b2618
commit 5b8ffd5b61
3 changed files with 94 additions and 229 deletions

View File

@@ -596,18 +596,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
@Override
public void sendDeviceOrChannelStatus(String deviceId, String channelId, boolean online) {
String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_DEVICE_STATUS;
if (channelId == null) {
logger.info("[redis通知] 推送设备状态, {}-{}", deviceId, online);
}else {
logger.info("[redis通知] 推送通道状态, {}/{}-{}", deviceId, channelId, online);
}
StringBuilder msg = new StringBuilder();
msg.append(deviceId);
if (channelId != null) {
msg.append(":").append(channelId);
}
msg.append(" ").append(online? "ON":"OFF");
logger.info("[redis通知] 推送状态-> {} ", msg);
// 使用 RedisTemplate<Object, Object> 发送字符串消息会导致发送的消息多带了双引号
stringRedisTemplate.convertAndSend(key, msg.toString());
}
@@ -615,7 +610,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
@Override
public void sendChannelAddOrDelete(String deviceId, String channelId, boolean add) {
String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_DEVICE_STATUS;
logger.info("[redis通知] 推送通道{} {}/{}", add?"增加":"移除", deviceId, channelId);
StringBuilder msg = new StringBuilder();
msg.append(deviceId);
@@ -623,6 +618,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
msg.append(":").append(channelId);
}
msg.append(" ").append(add? "ADD":"DELETE");
logger.info("[redis通知] 推送通道-> {}", msg);
// 使用 RedisTemplate<Object, Object> 发送字符串消息会导致发送的消息多带了双引号
stringRedisTemplate.convertAndSend(key, msg.toString());
}