无人机项目后端代码
guoshilong
2023-09-26 3ba2ea4de914835bc316826f2c7f93a648760e9c
src/main/java/com/dji/sample/wayline/controller/WaylineJobController.java
@@ -5,6 +5,8 @@
import com.dji.sample.common.model.ResponseResult;
import com.dji.sample.wayline.model.dto.WaylineJobDTO;
import com.dji.sample.wayline.model.param.CreateJobParam;
import com.dji.sample.wayline.model.param.UpdateJobParam;
import com.dji.sample.wayline.model.param.WaylineJobQueryParam;
import com.dji.sample.wayline.service.IWaylineJobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -29,7 +31,7 @@
    private IWaylineJobService waylineJobService;
    /**
     * Create a wayline task for the Dock.
     * 创建航路任务。
     * @param request
     * @param param
     * @param workspaceId
@@ -46,7 +48,7 @@
    }
    /**
     * Paginate through all jobs in this workspace.
     * 分页查询
     * @param page
     * @param pageSize
     * @param workspaceId
@@ -54,14 +56,14 @@
     */
    @GetMapping("/{workspace_id}/jobs")
    public ResponseResult<PaginationData<WaylineJobDTO>> getJobs(@RequestParam(defaultValue = "1") Long page,
                     @RequestParam(name = "page_size", defaultValue = "10") Long pageSize,
                     @PathVariable(name = "workspace_id") String workspaceId) {
        PaginationData<WaylineJobDTO> data = waylineJobService.getJobsByWorkspaceId(workspaceId, page, pageSize);
                                                                 @RequestParam(name = "page_size", defaultValue = "10") Long pageSize,
                                                                 @PathVariable(name = "workspace_id") String workspaceId, WaylineJobQueryParam waylineJobQueryParam){
        PaginationData<WaylineJobDTO> data = waylineJobService.getJobsByWorkspaceId(workspaceId, page, pageSize,waylineJobQueryParam);
        return ResponseResult.success(data);
    }
    /**
     * Send the command to cancel the jobs.
     * 发送命令取消作业。
     * @param jobIds
     * @param workspaceId
     * @return
@@ -75,7 +77,7 @@
    }
    /**
     * Set the media files for this job to upload immediately.
     * 将此作业的媒体文件设置为立即上传。
     * @param workspaceId
     * @param jobId
     * @return
@@ -86,4 +88,12 @@
        waylineJobService.uploadMediaHighestPriority(workspaceId, jobId);
        return ResponseResult.success();
    }
    @PutMapping("/{workspace_id}/jobs/{job_id}")
    public ResponseResult updateJobStatus(@PathVariable(name = "workspace_id") String workspaceId,
                                          @PathVariable(name = "job_id") String jobId,
                                          @Valid @RequestBody UpdateJobParam param) {
        waylineJobService.updateJobStatus(workspaceId, jobId, param);
        return ResponseResult.success();
    }
}