From 2d8ded3e77b22e44985265ca4063102662e452c1 Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Mon, 12 Dec 2022 18:32:19 +0800
Subject: [PATCH] initial v1.3.1
---
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..49ff96b 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.List;
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") List<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