From 894d18bb13dae351028e584f9b73a8d6964a0a50 Mon Sep 17 00:00:00 2001
From: zhaowenyu <35589726@qq.com>
Date: Wed, 19 Nov 2025 13:51:17 +0800
Subject: [PATCH] 2025-11-15 zwy 航线信息被删掉后,航线任务列表在读取航线时会报错;处理错误,航线不存在时航线文件名称显示空。正常逻辑应该是航线文件有任务在用,就不能随意删除;

---
 ard-sample/src/main/java/com/ard/sample/component/websocket/handler/DockWebSocketHandler.java |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/ard-sample/src/main/java/com/ard/sample/component/websocket/handler/DockWebSocketHandler.java b/ard-sample/src/main/java/com/ard/sample/component/websocket/handler/DockWebSocketHandler.java
index df43823..e682685 100644
--- a/ard-sample/src/main/java/com/ard/sample/component/websocket/handler/DockWebSocketHandler.java
+++ b/ard-sample/src/main/java/com/ard/sample/component/websocket/handler/DockWebSocketHandler.java
@@ -5,7 +5,6 @@
 import com.ard.sample.component.websocket.model.Payload;
 import com.ard.sample.component.websocket.model.WebSocketMessage;
 import lombok.extern.slf4j.Slf4j;
-import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.web.socket.CloseStatus;
@@ -101,11 +100,12 @@
                 _liveStreamService.StartLiveStreaming(sn);
             }
         } else {
-            // 停止直播
-            if(MessageType.LIVESTREAM.getType().equals(type)){
-                System.out.println("停止直播");
-                _liveStreamService.StopLiveStreaming(sn);
-            }
+            // 停止直播--前端不主动关注直播,则在断开连接时停止
+//            if(MessageType.LIVESTREAM.getType().equals(type)){
+//                System.out.println("停止直播");
+//
+//                _liveStreamService.StopLiveStreaming(sn);
+//            }
             // 取消订阅操作
             if (subscriptions.containsKey(subscriptionKey)) {
                 subscriptions.get(subscriptionKey).remove(userId);
@@ -139,12 +139,13 @@
      */
     private void removeUserAllSubscriptions(String userId) {
         for (Map.Entry<String, Set<String>> entry : subscriptions.entrySet()) {
-            if (entry.getKey().contains(MessageType.LIVESTREAM.getType())) {
-                String sn = entry.getKey().split(":")[0];
-                _liveStreamService.StopLiveStreaming(sn);
-            }
+            // 停止直播逻辑
             entry.getValue().remove(userId);
             if (entry.getValue().isEmpty()) {
+                if (entry.getKey().contains(MessageType.LIVESTREAM.getType())) {
+                    String sn = entry.getKey().split(":")[0];
+                    _liveStreamService.StopLiveStreaming(sn);
+                }
                 subscriptions.remove(entry.getKey());
             }
         }

--
Gitblit v1.9.3