diff --git a/jtt808-server/src/main/java/io/github/yezhihao/netmc/websocket/WsChannelInboundHandler.java b/jtt808-server/src/main/java/io/github/yezhihao/netmc/websocket/WsChannelInboundHandler.java index f8b5d53..0035209 100644 --- a/jtt808-server/src/main/java/io/github/yezhihao/netmc/websocket/WsChannelInboundHandler.java +++ b/jtt808-server/src/main/java/io/github/yezhihao/netmc/websocket/WsChannelInboundHandler.java @@ -7,6 +7,7 @@ import io.netty.channel.group.ChannelGroup; import io.netty.channel.group.DefaultChannelGroup; import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; import io.netty.util.concurrent.GlobalEventExecutor; +import io.netty.util.internal.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yzh.commons.constant.BusinessConstant; @@ -14,6 +15,7 @@ import org.yzh.commons.util.BusinessCacheUtil; import org.yzh.web.util.SendCommandUtil; import java.time.LocalDateTime; +import java.time.LocalTime; /** * 处理消息的handler @@ -37,6 +39,12 @@ public class WsChannelInboundHandler extends SimpleChannelInboundHandler 将要推流设备 = {} ", BusinessCacheUtil.getCurrentPushDevice(), message.getClientId()); sendCommandService.sendToDevice(message.getClientId(), null); } else { @@ -103,7 +104,7 @@ public class JT808Endpoint { // 若无正在推流的设备, 调用推流方法 SendCommandUtil.setService(sendCommandService); - if (BusinessCacheUtil.getCurrentPushDevice() == null || BusinessCacheUtil.getCurrentPushDevice() == message.getClientId()) { + if (StringUtil.isNullOrEmpty(BusinessCacheUtil.getCurrentPushDevice()) || BusinessCacheUtil.getCurrentPushDevice().equals(message.getClientId())) { log.info(BusinessConstant.LOGGER_PREFIX + " : 终端鉴权触发 - 发送推流命令 : 当前指定推流设备 = {} -> 将要推流设备 = {} ", BusinessCacheUtil.getCurrentPushDevice(), message.getClientId()); sendCommandService.sendToDevice(message.getClientId(), null); } else {