| | |
| | | @PreAuthorize("hasAuthority('manager:task:update')") |
| | | @ApiOperation("完成任务") |
| | | @PostMapping("/task/complete/{id}") |
| | | public R completeTask(@PathVariable String id) { |
| | | public R completeTask(@PathVariable String id) throws Exception { |
| | | if (Objects.isNull(id)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | List<Long> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getId, id).in(Task::getTaskStatus, longs)); |
| | | if (tasks.isEmpty()) { |
| | | throw new CoolException("任务已处执行状态不可一键完成!!"); |
| | | } |
| | | try { |
| | | taskService.completeTask(tasks); |
| | | } catch (Exception ex) { |
| | | return R.error("任务异常,无法完成!!"); |
| | | // if (tasks.isEmpty()) { |
| | | // throw new CoolException("任务已处执行状态不可一键完成!!"); |
| | | // } |
| | | taskService.completeTask(tasks); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:update')") |
| | | @ApiOperation("取消任务") |
| | | @PostMapping("/task/cancel/{id}") |
| | | public R cancelTask(@PathVariable String id) { |
| | | if (Objects.isNull(id)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:update')") |
| | | @ApiOperation("任务出库置顶") |
| | | @PostMapping("/task/top/{id}") |