From c19e0d4d1ab47905f7e7f7a334691704f7fed422 Mon Sep 17 00:00:00 2001
From: aix <vip_xiaobin810@163.com>
Date: Thu, 08 Aug 2024 16:22:02 +0800
Subject: [PATCH] 国土调查云获取token接口

---
 src/main/java/com/dji/sample/manage/controller/LiveStreamController.java |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/dji/sample/manage/controller/LiveStreamController.java b/src/main/java/com/dji/sample/manage/controller/LiveStreamController.java
index c8bd144..98f4270 100644
--- a/src/main/java/com/dji/sample/manage/controller/LiveStreamController.java
+++ b/src/main/java/com/dji/sample/manage/controller/LiveStreamController.java
@@ -15,6 +15,7 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
 import java.util.List;
 
 import static com.dji.sample.component.AuthInterceptor.TOKEN_CLAIM;
@@ -48,21 +49,22 @@
 
     /**
      * Get live capability data of all drones in the current user's workspace from the database.
-     * @param request
+     * 从数据库中获取当前工作区中所有无人机的实时性能数据。
+     * @param workspaceId
      * @return  live capability
      */
-    @GetMapping("/capacity")
-    public ResponseResult<List<CapacityDeviceDTO>> getLiveCapacity(HttpServletRequest request) {
-        // Get information about the current user.
-        CustomClaim customClaim = (CustomClaim)request.getAttribute(TOKEN_CLAIM);
+    @GetMapping("/capacity/{workspace_id}")
+    public ResponseResult<List<CapacityDeviceDTO>> getLiveCapacity(@PathVariable("workspace_id") String workspaceId,String sn) {
+        // Get information about the current user. 获取当前登录用户的信息
+//        CustomClaim customClaim = (CustomClaim)request.getAttribute(TOKEN_CLAIM);
 
-        List<CapacityDeviceDTO> liveCapacity = liveStreamService.getLiveCapacity(customClaim.getWorkspaceId());
-
+        List<CapacityDeviceDTO> liveCapacity = liveStreamService.getLiveCapacity(workspaceId,sn);
         return ResponseResult.success(liveCapacity);
     }
 
     /**
      * Live streaming according to the parameters passed in from the web side.
+     * 根据从web端传入的参数进行直播。
      * @param liveParam Live streaming parameters.
      * @return
      */
@@ -71,8 +73,14 @@
         return liveStreamService.liveStart(liveParam);
     }
 
+    @PostMapping("/streams/address")
+    public ResponseResult liveAddress(@RequestParam String deviceSn,@RequestParam String deviceName) throws IOException {
+        return liveStreamService.liveAddress(deviceSn,deviceName);
+    }
+
     /**
      * Stop live streaming according to the parameters passed in from the web side.
+     * 根据从web端传入的参数停止直播。
      * @param liveParam Live streaming parameters.
      * @return
      */
@@ -82,8 +90,8 @@
     }
 
     /**
-     * Set the quality of the live streaming according to the parameters passed in from the web side.
-     * @param liveParam Live streaming parameters.
+     * 根据从web端传入的参数设置直播的质量。
+     * @param liveParam 直播参数
      * @return
      */
     @PostMapping("/streams/update")
@@ -96,4 +104,4 @@
         return liveStreamService.liveLensChange(liveParam);
     }
 
-}
\ No newline at end of file
+}

--
Gitblit v1.9.3