From 1791d8d45a0f6de527a1e243b9ba806edc0753aa Mon Sep 17 00:00:00 2001
From: Xiajijian <1176061145@qq.com>
Date: Thu, 06 Nov 2025 14:32:14 +0800
Subject: [PATCH] 1.修改文件业务,屏蔽前台接口开关。 2.文件夹业务修改为,分组管理业务。 3.航线(kmz)对象增加分组ID。 4.分组信息删除同时删除分组下航信信息。 5.新增航线(kmz)时,不选分组,将赋值默认分组信息。 6.增加初始化数据类。 7.生成kmz文件,增加默认值管理。

---
 ard-sample/src/main/java/com/ard/sample/component/websocket/handler/DockWebSocketHandler.java |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 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 89b92a5..9d6cc61 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
@@ -1,8 +1,11 @@
 package com.ard.sample.component.websocket.handler;
 
 import com.alibaba.fastjson2.JSON;
+import com.ard.sample.component.websocket.enums.MessageType;
 import com.ard.sample.component.websocket.model.Payload;
 import com.ard.sample.component.websocket.model.WebSocketMessage;
+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;
 import org.springframework.web.socket.TextMessage;
@@ -15,6 +18,9 @@
 
 @Component
 public class DockWebSocketHandler extends TextWebSocketHandler {
+
+    @Autowired
+    private LiveStreamHandler _liveStreamService;
 
     // 存储用户会话:userId -> WebSocketSession
     private final Map<String, WebSocketSession> userSessions = new ConcurrentHashMap<>();
@@ -58,11 +64,11 @@
             Payload payload = webSocketMessage.getPayload();
 
             // 验证消息类型是否合法
-            if (!Arrays.asList("status", "control", "progress", "state").contains(type)) {
+            //if (!Arrays.asList("status", "control", "progress", "state").contains(type)) {
+            if(!MessageType.fromString(type)){
                 session.sendMessage(new TextMessage("不支持的消息类型:" + type));
                 return;
             }
-
             // 处理订阅/取消订阅
             handleSubscription(userId, type, payload);
 
@@ -84,7 +90,18 @@
             // 订阅操作
             subscriptions.computeIfAbsent(subscriptionKey, k -> ConcurrentHashMap.newKeySet()).add(userId);
             System.out.println("用户[" + userId + "]订阅了 设备[" + sn + "]的[" + type + "]类型消息");
+            if(MessageType.LIVESTREAM.getType().equals(type)){
+                // 开启直播
+                // 开启直播逻辑
+                System.out.println("开启直播");
+                _liveStreamService.StartLiveStreaming(sn);
+            }
         } else {
+            // 停止直播
+            if(MessageType.LIVESTREAM.getType().equals(type)){
+                System.out.println("停止直播");
+                _liveStreamService.StopLiveStreaming(sn);
+            }
             // 取消订阅操作
             if (subscriptions.containsKey(subscriptionKey)) {
                 subscriptions.get(subscriptionKey).remove(userId);

--
Gitblit v1.9.3