| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import javax.validation.Valid; |
| | | import java.sql.SQLException; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | |
| | | public ResponseResult createJob(@Valid @RequestBody CreateJobParam param) throws SQLException { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation("取消航线任务") |
| | | @DeleteMapping("/jobs") |
| | | public ResponseResult publishCancelJob(@RequestParam(name = "job_id") Set<String> jobIds){ |
| | | try{ |
| | | waylineJobService.cancelFlightTask(jobIds); |
| | | } |
| | | catch (Exception e){ |
| | | return ResponseResult.error(e.getMessage()); |
| | | } |
| | | return ResponseResult.success(); |
| | | return waylineJobService.cancelFlightTask(jobIds); |
| | | } |
| | | |
| | | /** |