| | |
| | | import com.dji.sample.wayline.model.param.*; |
| | | import com.dji.sample.wayline.service.IWaylineJobService; |
| | | import com.dji.sample.wayline.service.impl.WaylineJobServiceImpl; |
| | | import com.dji.sample.wayline.util.ErrorCodeUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 断点任务 |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping("/{workspace_id}/breakpoint-tasks") |
| | | @SysLogAnnotation(operModul = "计划库", operType = "断点续飞", operDesc = "创建航路任务(重复定时和连续执行)") |
| | | public ResponseResult breakPointJob(HttpServletRequest request, @Valid @RequestBody BreakPointJobParam param, |
| | | @PathVariable(name = "workspace_id") String workspaceId) throws SQLException { |
| | | Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobId(workspaceId, param.getJobId(), param.isBreakPoint()); |
| | | return waylineJobService.publishOneFlightTask(waylineJobDTO.get()); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param page |
| | |
| | | return ResponseResult.success(data); |
| | | } |
| | | |
| | | @GetMapping("/{workspace_id}/jobs-dp") |
| | | @SysLogAnnotation(operModul = "计划库", operType = "查询", operDesc = "分页查询") |
| | | public ResponseResult<PaginationData<WaylineJobDTO>> getJobsByState(@RequestParam(defaultValue = "1") Long page, |
| | | @RequestParam(name = "page_size", defaultValue = "10") Long pageSize, |
| | | @PathVariable(name = "workspace_id") String workspaceId, |
| | | @RequestParam(name = "order", defaultValue = "") String order, |
| | | WaylineJobQueryParam waylineJobQueryParam) { |
| | | PaginationData<WaylineJobDTO> data = waylineJobService.getJobsByWorkspaceIdNew(workspaceId, page, pageSize, waylineJobQueryParam, order); |
| | | return ResponseResult.success(data); |
| | | } |
| | | |
| | | /** |
| | | * 子查询 |
| | | * |
| | | * @param workspaceId |
| | | * @return |
| | | */ |
| | | @GetMapping("/{workspace_id}/getChildrenJobs") |
| | | @SysLogAnnotation(operModul = "计划库", operType = "查询", operDesc = "分页查询") |
| | | public ResponseResult<List<WaylineJobDTO>> getChildrenJobs( |
| | | @PathVariable(name = "workspace_id") String workspaceId, WaylineJobQueryParam waylineJobQueryParam) { |
| | | @PathVariable(name = "workspace_id") String workspaceId, WaylineJobQueryParam waylineJobQueryParam) { |
| | | List<WaylineJobDTO> data = waylineJobService.getChildrenJobs(workspaceId, waylineJobQueryParam); |
| | | return ResponseResult.success(data); |
| | | } |
| | |
| | | return ResponseResult.success(waylineJobEntity); |
| | | } |
| | | |
| | | @GetMapping("/code") |
| | | public ResponseResult errotCode(@RequestParam Integer code) { |
| | | return ResponseResult.success(ErrorCodeUtil.codeToReason(code)); |
| | | } |
| | | |
| | | /** |
| | | * 发送命令取消作业。 |
| | |
| | | * 统计飞行次数 |
| | | */ |
| | | @PostMapping("/{workspace_id}/patrol_statistics") |
| | | public ResponseResult<WaylineJobCountDTO> patrolStatistics(@PathVariable(name = "workspace_id") String workspaceId,String queryTime,String deviceSn) { |
| | | public ResponseResult<WaylineJobCountDTO> patrolStatistics(@PathVariable(name = "workspace_id") String workspaceId, String queryTime, String deviceSn) { |
| | | |
| | | WaylineJobCountDTO waylineJobCountDTO = waylineJobService.patrolStatistics(workspaceId,queryTime,deviceSn); |
| | | WaylineJobCountDTO waylineJobCountDTO = waylineJobService.patrolStatistics(workspaceId, queryTime, deviceSn); |
| | | |
| | | return ResponseResult.success(waylineJobCountDTO); |
| | | } |
| | | @GetMapping("/idToName") |
| | | public ResponseResult findName(@RequestParam String jobid) { |
| | | return ResponseResult.success(waylineJobService.getName(jobid)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/{sn}/jobs/{device_sn}/flyByArea") |
| | | @SysLogAnnotation(operModul = "根据区域飞行", operType = "根据区域飞行", operDesc = "根据区域飞行") |
| | | public ResponseResult flyByArea(@PathVariable(name = "sn") String sn, @RequestBody FlyAreaParam flyAreaParam,@PathVariable(name = "device_sn")String deviceSn)throws Exception { |
| | | return waylineJobService.flyByArea(sn, flyAreaParam,deviceSn); |
| | | public ResponseResult flyByArea(@PathVariable(name = "sn") String sn, @RequestBody FlyAreaParam flyAreaParam, @PathVariable(name = "device_sn") String deviceSn) throws Exception { |
| | | return waylineJobService.flyByArea(sn, flyAreaParam, deviceSn); |
| | | } |
| | | } |