无人机项目后端代码
xieb
2023-10-17 c7adeb1f4c48dfea357e824d69496fcaf1768d52
src/main/java/com/dji/sample/wayline/controller/WaylineJobController.java
@@ -3,6 +3,7 @@
import com.dji.sample.common.model.CustomClaim;
import com.dji.sample.common.model.PaginationData;
import com.dji.sample.common.model.ResponseResult;
import com.dji.sample.log.aspect.SysLogAnnotation;
import com.dji.sample.wayline.model.dto.WaylineJobDTO;
import com.dji.sample.wayline.model.param.CreateJobParam;
import com.dji.sample.wayline.model.param.UpdateJobParam;
@@ -31,7 +32,7 @@
    private IWaylineJobService waylineJobService;
    /**
     * Create a wayline task for the Dock.
     * 创建航路任务。
     * @param request
     * @param param
     * @param workspaceId
@@ -39,6 +40,7 @@
     * @throws SQLException
     */
    @PostMapping("/{workspace_id}/flight-tasks")
    @SysLogAnnotation(operModul = "计划库", operType = "新增", operDesc = "创建计划")
    public ResponseResult createJob(HttpServletRequest request, @Valid @RequestBody CreateJobParam param,
                                    @PathVariable(name = "workspace_id") String workspaceId) throws SQLException {
        CustomClaim customClaim = (CustomClaim)request.getAttribute(TOKEN_CLAIM);
@@ -47,14 +49,34 @@
        return waylineJobService.publishFlightTask(param, customClaim);
    }
    /**
     * Paginate through all jobs in this workspace.
     * 创建航路任务(重复定时和连续执行)
     * @param request
     * @param param
     * @param workspaceId
     * @return
     * @throws SQLException
     */
    @PostMapping("/{workspace_id}/flight-tasks-condition")
    @SysLogAnnotation(operModul = "计划库", operType = "新增", operDesc = "创建航路任务(重复定时和连续执行)")
    public ResponseResult createJobCondition(HttpServletRequest request, @Valid @RequestBody CreateJobParam param,
                                    @PathVariable(name = "workspace_id") String workspaceId) throws SQLException {
        CustomClaim customClaim = (CustomClaim)request.getAttribute(TOKEN_CLAIM);
        customClaim.setWorkspaceId(workspaceId);
        return waylineJobService.publishFlightTaskCondition(param, customClaim);
    }
    /**
     * 分页查询
     * @param page
     * @param pageSize
     * @param workspaceId
     * @return
     */
    @GetMapping("/{workspace_id}/jobs")
    @SysLogAnnotation(operModul = "计划库", operType = "查询", operDesc = "分页查询")
    public ResponseResult<PaginationData<WaylineJobDTO>> getJobs(@RequestParam(defaultValue = "1") Long page,
                                                                 @RequestParam(name = "page_size", defaultValue = "10") Long pageSize,
                                                                 @PathVariable(name = "workspace_id") String workspaceId, WaylineJobQueryParam waylineJobQueryParam){
@@ -63,13 +85,14 @@
    }
    /**
     * Send the command to cancel the jobs.
     * 发送命令取消作业。
     * @param jobIds
     * @param workspaceId
     * @return
     * @throws SQLException
     */
    @DeleteMapping("/{workspace_id}/jobs")
    @SysLogAnnotation(operModul = "计划库", operType = "删除", operDesc = "发送命令取消作业")
    public ResponseResult publishCancelJob(@RequestParam(name = "job_id") Set<String> jobIds,
                                     @PathVariable(name = "workspace_id") String workspaceId) throws SQLException {
        waylineJobService.cancelFlightTask(workspaceId, jobIds);
@@ -77,12 +100,13 @@
    }
    /**
     * Set the media files for this job to upload immediately.
     * 将此作业的媒体文件设置为立即上传。
     * @param workspaceId
     * @param jobId
     * @return
     */
    @PostMapping("/{workspace_id}/jobs/{job_id}/media-highest")
    @SysLogAnnotation(operModul = "计划库", operType = "修改", operDesc = "将此作业的媒体文件设置为立即上传")
    public ResponseResult uploadMediaHighestPriority(@PathVariable(name = "workspace_id") String workspaceId,
                                             @PathVariable(name = "job_id") String jobId) {
        waylineJobService.uploadMediaHighestPriority(workspaceId, jobId);
@@ -90,6 +114,7 @@
    }
    @PutMapping("/{workspace_id}/jobs/{job_id}")
    @SysLogAnnotation(operModul = "计划库", operType = "修改", operDesc = "修改")
    public ResponseResult updateJobStatus(@PathVariable(name = "workspace_id") String workspaceId,
                                          @PathVariable(name = "job_id") String jobId,
                                          @Valid @RequestBody UpdateJobParam param) {