From f0ed143646e3c280416ca05f64c1b59604289928 Mon Sep 17 00:00:00 2001
From: liusuyi <1951119284@qq.com>
Date: Mon, 20 Oct 2025 10:52:48 +0800
Subject: [PATCH] websocket无人机控制者和视频流数据增加boxSn

---
 ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java b/ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java
index f891969..f872a47 100644
--- a/ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java
+++ b/ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java
@@ -52,6 +52,7 @@
 import com.ard.work.service.ITyService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
+
 import javax.annotation.Resource;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -93,6 +94,7 @@
         List<ArdServerInfo> ardServerInfos = ardServerService.selectArdServerInfoList(new ArdServerInfo());
         return getBoxList(ardServerInfos);
     }
+
     /**
      * 获取指定服务器云盒列表
      *
@@ -103,6 +105,7 @@
         TyHttpCommonReceiver<List<BoxInfoReceiver>> boxList = tyClient.getBoxList(serverId);
         return boxList.getContent();
     }
+
     /**
      * 获取直播地址
      *
@@ -111,12 +114,13 @@
     @Override
     public BoxStreamUrlReceiver getBoxLiveUrl(String boxSn) {
         ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(boxSn);
-        if(ardDroneInfo== null){
-            log.warn("未找到对应的飞行器信息,boxSn:{}",boxSn);
+        if (ardDroneInfo == null) {
+            log.warn("未找到对应的飞行器信息,boxSn:{}", boxSn);
             return null;
         }
-        TyHttpCommonReceiver<BoxStreamUrlReceiver> boxLiveUrl = tyClient.getBoxLiveUrl(ardDroneInfo.getServerId(),boxSn);
-        return boxLiveUrl.getContent();
+        TyHttpCommonReceiver<BoxStreamUrlReceiver> boxLiveUrl = tyClient.getBoxLiveUrl(ardDroneInfo.getServerId(),
+                boxSn);
+        return boxLiveUrl == null ? null : boxLiveUrl.getContent();
     }
 
     /**
@@ -140,7 +144,8 @@
     @Override
     public List<BoxPhotosReceiver> getBoxPhotos(BoxPhotosDTO boxPhotosDTO) {
         ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(boxPhotosDTO.getBoxSn());
-        TyHttpCommonReceiver<List<BoxPhotosReceiver>> boxPhotos = tyClient.getBoxPhotos(ardDroneInfo.getServerId(),boxPhotosDTO);
+        TyHttpCommonReceiver<List<BoxPhotosReceiver>> boxPhotos = tyClient.getBoxPhotos(ardDroneInfo.getServerId(),
+                boxPhotosDTO);
         return boxPhotos.getContent();
     }
 
@@ -150,7 +155,7 @@
     @Override
     public Boolean updateBoxSettings(BoxSettingsDTO boxSettingsDTO) {
         ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(boxSettingsDTO.getBoxSn());
-        TyHttpCommonReceiver<?> result = tyClient.updateBoxSettings(ardDroneInfo.getServerId(),boxSettingsDTO);
+        TyHttpCommonReceiver<?> result = tyClient.updateBoxSettings(ardDroneInfo.getServerId(), boxSettingsDTO);
         return result.getState() == 1;
     }
 
@@ -673,8 +678,8 @@
                 break;
             case 0x02:
                 // 处理注册消息
-                 HeartbeatReplyCmd heartbeatReplyCmd = (HeartbeatReplyCmd) tyCommand;
-                 logPrint("心跳消息", heartbeatReplyCmd.getTimestamp());
+                HeartbeatReplyCmd heartbeatReplyCmd = (HeartbeatReplyCmd) tyCommand;
+                logPrint("心跳消息", heartbeatReplyCmd.getTimestamp());
                 break;
             case 0x03:
                 // 处理订阅消息

--
Gitblit v1.9.3