| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import javax.validation.Valid; |
| | | import java.sql.SQLException; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | |
| | | return waylineJobService.publishFlightTask(param, loginUser); |
| | | } |
| | | |
| | | @ApiOperation("获取航线任务") |
| | | @GetMapping("/flight-id") |
| | | public ResponseResult<WaylineJobDTO> getJob(@RequestParam(name = "job_id") String jobId) { |
| | | try { |
| | | if(jobId == null){ |
| | | return ResponseResult.error(98,"任务ID不能为空"); |
| | | } |
| | | Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobId(jobId); |
| | | if(waylineJobDTO.isEmpty()) { |
| | | return ResponseResult.error(99,"任务不存在"); |
| | | } |
| | | return ResponseResult.success(waylineJobDTO.get()); |
| | | } catch (Exception e) { |
| | | return ResponseResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Paginate through all jobs. |
| | | * @param page |
| | |
| | | @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()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation("取消航线任务") |
| | | @DeleteMapping("/jobs") |
| | | public ResponseResult publishCancelJob(@RequestParam(name = "job_id") Set<String> jobIds){ |
| | | waylineJobService.cancelFlightTask(jobIds); |
| | | return ResponseResult.success(); |
| | | return waylineJobService.cancelFlightTask(jobIds); |
| | | } |
| | | |
| | | /** |