From dfae9043b11e788fa4d442e4576d73571e976cea Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Fri, 02 Aug 2024 08:49:47 +0800
Subject: [PATCH] 修改异步上传图片文件、增加图斑列表刷新

---
 src/main/java/com/dji/sample/wayline/controller/WaylineJobController.java |   46 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 40 insertions(+), 6 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 5e66deb..d587c29 100644
--- a/src/main/java/com/dji/sample/wayline/controller/WaylineJobController.java
+++ b/src/main/java/com/dji/sample/wayline/controller/WaylineJobController.java
@@ -13,6 +13,7 @@
 import com.dji.sample.wayline.model.param.*;
 import com.dji.sample.wayline.service.IWaylineJobService;
 import com.dji.sample.wayline.service.impl.WaylineJobServiceImpl;
+import com.dji.sample.wayline.util.ErrorCodeUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -77,6 +78,19 @@
     }
 
     /**
+     * 断点任务
+     *
+     * @return
+     */
+    @PostMapping("/{workspace_id}/breakpoint-tasks")
+    @SysLogAnnotation(operModul = "计划库", operType = "断点续飞", operDesc = "创建航路任务(重复定时和连续执行)")
+    public ResponseResult breakPointJob(HttpServletRequest request, @Valid @RequestBody BreakPointJobParam param,
+                                        @PathVariable(name = "workspace_id") String workspaceId) throws SQLException {
+        Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobId(workspaceId, param.getJobId(), param.isBreakPoint());
+        return waylineJobService.publishOneFlightTask(waylineJobDTO.get());
+    }
+
+    /**
      * 分页查询
      *
      * @param page
@@ -93,15 +107,27 @@
         return ResponseResult.success(data);
     }
 
+    @GetMapping("/{workspace_id}/jobs-dp")
+    @SysLogAnnotation(operModul = "计划库", operType = "查询", operDesc = "分页查询")
+    public ResponseResult<PaginationData<WaylineJobDTO>> getJobsByState(@RequestParam(defaultValue = "1") Long page,
+                                                                        @RequestParam(name = "page_size", defaultValue = "10") Long pageSize,
+                                                                        @PathVariable(name = "workspace_id") String workspaceId,
+                                                                        @RequestParam(name = "order", defaultValue = "") String order,
+                                                                        WaylineJobQueryParam waylineJobQueryParam) {
+        PaginationData<WaylineJobDTO> data = waylineJobService.getJobsByWorkspaceIdNew(workspaceId, page, pageSize, waylineJobQueryParam, order);
+        return ResponseResult.success(data);
+    }
+
     /**
      * 子查询
+     *
      * @param workspaceId
      * @return
      */
     @GetMapping("/{workspace_id}/getChildrenJobs")
     @SysLogAnnotation(operModul = "计划库", operType = "查询", operDesc = "分页查询")
     public ResponseResult<List<WaylineJobDTO>> getChildrenJobs(
-                                                                 @PathVariable(name = "workspace_id") String workspaceId, WaylineJobQueryParam waylineJobQueryParam) {
+            @PathVariable(name = "workspace_id") String workspaceId, WaylineJobQueryParam waylineJobQueryParam) {
         List<WaylineJobDTO> data = waylineJobService.getChildrenJobs(workspaceId, waylineJobQueryParam);
         return ResponseResult.success(data);
     }
@@ -120,6 +146,10 @@
         return ResponseResult.success(waylineJobEntity);
     }
 
+    @GetMapping("/code")
+    public ResponseResult errotCode(@RequestParam Integer code) {
+        return ResponseResult.success(ErrorCodeUtil.codeToReason(code));
+    }
 
     /**
      * 发送命令取消作业。
@@ -165,11 +195,15 @@
      * 统计飞行次数
      */
     @PostMapping("/{workspace_id}/patrol_statistics")
-    public ResponseResult<WaylineJobCountDTO> patrolStatistics(@PathVariable(name = "workspace_id") String workspaceId,String queryTime) {
+    public ResponseResult<WaylineJobCountDTO> patrolStatistics(@PathVariable(name = "workspace_id") String workspaceId, String queryTime, String deviceSn) {
 
-        WaylineJobCountDTO waylineJobCountDTO = waylineJobService.patrolStatistics(workspaceId,queryTime);
+        WaylineJobCountDTO waylineJobCountDTO = waylineJobService.patrolStatistics(workspaceId, queryTime, deviceSn);
 
         return ResponseResult.success(waylineJobCountDTO);
+    }
+    @GetMapping("/idToName")
+    public ResponseResult findName(@RequestParam String jobid) {
+        return ResponseResult.success(waylineJobService.getName(jobid));
     }
 
     /**
@@ -189,9 +223,9 @@
      *
      * @return
      */
-    @PostMapping("/{sn}/jobs/flyByArea")
+    @PostMapping("/{sn}/jobs/{device_sn}/flyByArea")
     @SysLogAnnotation(operModul = "根据区域飞行", operType = "根据区域飞行", operDesc = "根据区域飞行")
-    public ResponseResult flyByArea(@PathVariable(name = "sn") String sn, @RequestBody FlyAreaParam flyAreaParam) {
-        return waylineJobService.flyByArea(sn, flyAreaParam);
+    public ResponseResult flyByArea(@PathVariable(name = "sn") String sn, @RequestBody FlyAreaParam flyAreaParam, @PathVariable(name = "device_sn") String deviceSn) throws Exception {
+        return waylineJobService.flyByArea(sn, flyAreaParam, deviceSn);
     }
 }

--
Gitblit v1.9.3