From a7aaeabc7873a0eafb4a7ecad7f65b018b7a9bc9 Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Fri, 24 Feb 2023 19:31:23 +0800
Subject: [PATCH] What's new? 1. Add license for dock. 2. Modify the logic corresponding to the firmware file and device type. 3. Add multiple mqtt clients options. 4. Modify the structure of the interface for obtaining the device list. 5. Fixed some issues.

---
 src/main/java/com/dji/sample/wayline/controller/WaylineJobController.java |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/dji/sample/wayline/controller/WaylineJobController.java b/src/main/java/com/dji/sample/wayline/controller/WaylineJobController.java
index f066f54..f24bdb2 100644
--- a/src/main/java/com/dji/sample/wayline/controller/WaylineJobController.java
+++ b/src/main/java/com/dji/sample/wayline/controller/WaylineJobController.java
@@ -10,7 +10,9 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
 import java.sql.SQLException;
+import java.util.Set;
 
 import static com.dji.sample.component.AuthInterceptor.TOKEN_CLAIM;
 
@@ -35,12 +37,12 @@
      * @throws SQLException
      */
     @PostMapping("/{workspace_id}/flight-tasks")
-    public ResponseResult createJob(HttpServletRequest request, @RequestBody CreateJobParam param,
+    public ResponseResult createJob(HttpServletRequest request, @Valid @RequestBody CreateJobParam param,
                                     @PathVariable(name = "workspace_id") String workspaceId) throws SQLException {
         CustomClaim customClaim = (CustomClaim)request.getAttribute(TOKEN_CLAIM);
         customClaim.setWorkspaceId(workspaceId);
-        boolean isCreate = waylineJobService.createJob(param, customClaim);
-        return isCreate ? ResponseResult.success() : ResponseResult.error();
+
+        return waylineJobService.publishFlightTask(param, customClaim);
     }
 
     /**
@@ -59,16 +61,29 @@
     }
 
     /**
-     * Issue wayline mission to the dock for execution.
-     * @param jobId
+     * Send the command to cancel the jobs.
+     * @param jobIds
      * @param workspaceId
      * @return
      * @throws SQLException
      */
-    @PostMapping("/{workspace_id}/jobs/{job_id}")
-    public ResponseResult publishJob(@PathVariable(name = "job_id") String jobId,
+    @DeleteMapping("/{workspace_id}/jobs")
+    public ResponseResult publishCancelJob(@RequestParam(name = "job_id") Set<String> jobIds,
                                      @PathVariable(name = "workspace_id") String workspaceId) throws SQLException {
-        waylineJobService.publishFlightTask(workspaceId, jobId);
+        waylineJobService.cancelFlightTask(workspaceId, jobIds);
+        return ResponseResult.success();
+    }
+
+    /**
+     * Set the media files for this job to upload immediately.
+     * @param workspaceId
+     * @param jobId
+     * @return
+     */
+    @PostMapping("/{workspace_id}/jobs/{job_id}/media-highest")
+    public ResponseResult uploadMediaHighestPriority(@PathVariable(name = "workspace_id") String workspaceId,
+                                             @PathVariable(name = "job_id") String jobId) {
+        waylineJobService.uploadMediaHighestPriority(workspaceId, jobId);
         return ResponseResult.success();
     }
 }

--
Gitblit v1.9.3