From b5b95f50e7905e9424628254b3cba7b92aa77cde Mon Sep 17 00:00:00 2001
From: zhaowenyu <35589726@qq.com>
Date: Wed, 03 Dec 2025 14:52:56 +0800
Subject: [PATCH] 2025-12-03 zwy 维护大疆上云、司空错误码!返回前端的错误码和错误详情。

---
 ard-admin/src/main/java/com/ard/web/controller/sample/wayline/WaylineJobController.java |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/ard-admin/src/main/java/com/ard/web/controller/sample/wayline/WaylineJobController.java b/ard-admin/src/main/java/com/ard/web/controller/sample/wayline/WaylineJobController.java
index f14a80c..8669604 100644
--- a/ard-admin/src/main/java/com/ard/web/controller/sample/wayline/WaylineJobController.java
+++ b/ard-admin/src/main/java/com/ard/web/controller/sample/wayline/WaylineJobController.java
@@ -13,6 +13,7 @@
 import org.springframework.web.bind.annotation.*;
 import javax.validation.Valid;
 import java.sql.SQLException;
+import java.util.Optional;
 import java.util.Set;
 
 /**
@@ -41,6 +42,23 @@
         return waylineJobService.publishFlightTask(param, loginUser);
     }
 
+    @ApiOperation("获取航线任务")
+    @PostMapping("/flight-id")
+    public ResponseResult<WaylineJobDTO> getJob(@RequestParam(name = "job_id") String jobId) {
+        try {
+            if(jobId == null){
+                return ResponseResult.error("任务ID不能为空");
+            }
+            Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobId(jobId);
+            if(waylineJobDTO.isEmpty()) {
+                return ResponseResult.error("任务不存在");
+            }
+            return ResponseResult.success(waylineJobDTO.get());
+        } catch (Exception e) {
+            return ResponseResult.error(e.getMessage());
+        }
+    }
+
     /**
      * Paginate through all jobs.
      * @param page
@@ -50,9 +68,21 @@
     @ApiOperation("航线任务列表")
     @GetMapping("/jobs")
     public ResponseResult<PaginationData<WaylineJobDTO>> getJobs(@RequestParam(defaultValue = "1") Long page,
-                     @RequestParam(name = "page_size", defaultValue = "10") Long pageSize) {
-        PaginationData<WaylineJobDTO> data = waylineJobService.getJobsByWorkspaceId(page, pageSize);
-        return ResponseResult.success(data);
+                     @RequestParam(name = "page_size", defaultValue = "10") Long pageSize,
+                                                                 @RequestParam(required = false) Integer status,
+                                                                 @RequestParam(required = false) Long startTime,
+                                                                 @RequestParam(required = false) Long endTime,
+                                                                 @RequestParam(required = false) Integer taskType,
+                                                                 @RequestParam(required = false) String name,
+                                                                 @RequestParam(required = false) Boolean isComplete) {
+        try {
+//        PaginationData<WaylineJobDTO> data = waylineJobService.getJobsByWorkspaceId(page, pageSize);defaultValue
+            PaginationData<WaylineJobDTO> data = waylineJobService.getJobsList(page, pageSize, status, startTime, endTime, taskType, name, isComplete);
+            return ResponseResult.success(data);
+        }
+        catch (Exception e) {
+            return ResponseResult.error(e.getMessage());
+        }
     }
 
     /**
@@ -64,7 +94,12 @@
     @ApiOperation("取消航线任务")
     @DeleteMapping("/jobs")
     public ResponseResult publishCancelJob(@RequestParam(name = "job_id") Set<String> jobIds){
-        waylineJobService.cancelFlightTask(jobIds);
+        try{
+            waylineJobService.cancelFlightTask(jobIds);
+        }
+        catch (Exception e){
+            return ResponseResult.error(e.getMessage());
+        }
         return ResponseResult.success();
     }
 

--
Gitblit v1.9.3