zhaowenyu
2025-11-18 d2b4f1493696c28355242deda4eaa66ceb1ec7d6
2025-11-15 zwy 取消任务时,任务状态无法取消返回提示改为中文。
2 files modified
19 ■■■■■ changed files
ard-admin/src/main/java/com/ard/web/controller/sample/wayline/WaylineJobController.java 7 ●●●●● patch | view | raw | blame | history
ard-sample/src/main/java/com/ard/sample/wayline/service/impl/WaylineJobServiceImpl.java 12 ●●●●● patch | view | raw | blame | history
ard-admin/src/main/java/com/ard/web/controller/sample/wayline/WaylineJobController.java
@@ -71,7 +71,12 @@
    @ApiOperation("取消航线任务")
    @DeleteMapping("/jobs")
    public ResponseResult publishCancelJob(@RequestParam(name = "job_id") Set<String> jobIds){
        waylineJobService.cancelFlightTask(jobIds);
        try{
            waylineJobService.cancelFlightTask(jobIds);
        }
        catch (Exception e){
            return ResponseResult.error(e.getMessage());
        }
        return ResponseResult.success();
    }
ard-sample/src/main/java/com/ard/sample/wayline/service/impl/WaylineJobServiceImpl.java
@@ -179,13 +179,14 @@
        }
        Optional<WaylineJobDTO> waylineJobOpt = this.createWaylineJob(param, loginUser.getUsername(),
                param.getExecuteTime(), param.getExecuteTime());
        if (waylineJobOpt.isEmpty()) {
            return ResponseResult.error("创建机场任务失败!");
        }
        // 循环任务
        if (param.getTaskType() == WaylineTaskTypeEnum.LOOP.getVal()) {
            // 循环任务,不立即执行,由定时任务发布
            return ResponseResult.success();
        }
        if (waylineJobOpt.isEmpty()) {
            return ResponseResult.error("创建机场任务失败!");
        }
        WaylineJobDTO waylineJob = waylineJobOpt.get();
@@ -439,8 +440,9 @@
        // Check if the task status is correct.
        boolean isErr = !jobIds.removeAll(waylineJobIds) || !jobIds.isEmpty();
        if (isErr) {
            throw new IllegalArgumentException("These tasks have an incorrect status and cannot be canceled. "
                    + Arrays.toString(jobIds.toArray()));
            throw new IllegalArgumentException("任务开始后,无法取消。" + Arrays.toString(jobIds.toArray()));
//            throw new IllegalArgumentException("These tasks have an incorrect status and cannot be canceled. "
//                    + Arrays.toString(jobIds.toArray()));
        }
        // Group job id by dock sn.