Browse Source

无人机对接接口 url返回值修改

S0025136190 1 year ago
parent
commit
5db4c5bfab

+ 2 - 2
Backend/sample/src/main/java/com/dji/sample/manage/controller/UpstreamController.java

@@ -78,9 +78,9 @@ public class UpstreamController {
      * @return
      */
     @GetMapping("/webRtc")
-    public HttpResultResponse<List<String>> getWebRtc(String payload,
+    public HttpResultResponse<List<UpstreamLivestreamUrlDTO>> getWebRtc(String payload,
                                                                  String deviceSn) {
-        List<String> url = livestreamUrlService.selWebRtc(payload, deviceSn);
+        List<UpstreamLivestreamUrlDTO> url = livestreamUrlService.selWebRtc(payload, deviceSn);
         return HttpResultResponse.success(url);
     }
 

+ 28 - 0
Backend/sample/src/main/java/com/dji/sample/manage/model/dto/UpstreamLivestreamUrlDTO.java

@@ -0,0 +1,28 @@
+package com.dji.sample.manage.model.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author huiqing.jiang
+ * @date 2024/9/5
+ * @version 0.1
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class UpstreamLivestreamUrlDTO {
+
+    private Integer id;
+
+    private String workspaceId;
+
+    private String deviceSn;
+
+    private String payload;
+
+    private String url;
+}

+ 2 - 1
Backend/sample/src/main/java/com/dji/sample/manage/service/IManageDeviceLivestreamUrlService.java

@@ -2,6 +2,7 @@ package com.dji.sample.manage.service;
 
 
 import com.dji.sample.manage.model.dto.ManageDeviceLivestreamUrlDTO;
+import com.dji.sample.manage.model.dto.UpstreamLivestreamUrlDTO;
 import com.dji.sample.manage.model.dto.WorkspaceDTO;
 
 import java.util.List;
@@ -19,5 +20,5 @@ public interface IManageDeviceLivestreamUrlService {
      * 上游系统获取webRtc地址
      * @return
      */
-    List<String> selWebRtc(String payload,String deviceSn);
+    List<UpstreamLivestreamUrlDTO> selWebRtc(String payload, String deviceSn);
 }

+ 9 - 3
Backend/sample/src/main/java/com/dji/sample/manage/service/impl/ManageDeviceLivestreamUrlServiceImpl.java

@@ -11,6 +11,7 @@ import com.dji.sample.manage.log.annotation.Log;
 import com.dji.sample.manage.log.enums.BusinessType;
 import com.dji.sample.manage.model.dto.ManageDeviceLivestreamUrlDTO;
 import com.dji.sample.manage.model.dto.RtmpUrlDTO;
+import com.dji.sample.manage.model.dto.UpstreamLivestreamUrlDTO;
 import com.dji.sample.manage.model.entity.ManageDeviceLivestreamUrlEntity;
 import com.dji.sample.manage.model.entity.UserEntity;
 import com.dji.sample.manage.model.enums.LiveUrlTypeEnum;
@@ -150,8 +151,8 @@ public class ManageDeviceLivestreamUrlServiceImpl implements IManageDeviceLivest
     }
 
     @Override
-    public List<String> selWebRtc(String payload, String deviceSn) {
-        List<String> resultList = new ArrayList<>();
+    public List<UpstreamLivestreamUrlDTO> selWebRtc(String payload, String deviceSn) {
+        List<UpstreamLivestreamUrlDTO> resultList = new ArrayList<>();
         LambdaQueryWrapper<ManageDeviceLivestreamUrlEntity> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(ManageDeviceLivestreamUrlEntity::getUrlType,LiveUrlTypeEnum.WEBRTC.getVal())
                 .eq(null!= payload,ManageDeviceLivestreamUrlEntity::getPayloadIndex,payload)
@@ -159,7 +160,12 @@ public class ManageDeviceLivestreamUrlServiceImpl implements IManageDeviceLivest
         List<ManageDeviceLivestreamUrlEntity> result = mapper.selectList(wrapper);
         if(result.size() > 0 ) {
             for(ManageDeviceLivestreamUrlEntity entity :result) {
-                resultList.add(entity.getUrl());
+                UpstreamLivestreamUrlDTO upstreamLivestreamUrlDTO = new UpstreamLivestreamUrlDTO();
+                upstreamLivestreamUrlDTO.setWorkspaceId(entity.getWorkspaceId());
+                upstreamLivestreamUrlDTO.setDeviceSn(entity.getDeviceSn());
+                upstreamLivestreamUrlDTO.setUrl(entity.getUrl());
+                upstreamLivestreamUrlDTO.setPayload(entity.getPayloadIndex());
+                resultList.add(upstreamLivestreamUrlDTO);
             }
         }
         return resultList;