| | |
| | | //// + Arrays.toString(jobIds.toArray())); |
| | | // } |
| | | |
| | | // Group job id by dock sn. |
| | | // 按 dock sn 对作业 ID 进行分组。 |
| | | Map<String, List<String>> dockJobs = waylineJobs.stream() |
| | | .collect(Collectors.groupingBy(WaylineJobDTO::getDockSn, |
| | | Collectors.mapping(WaylineJobDTO::getJobId, Collectors.toList()))); |
| | |
| | | */ |
| | | @Override |
| | | public ResponseResult publishCancelTask(String dockSn, List<String> jobIds) { |
| | | |
| | | for(String jobId : jobIds) { |
| | | Optional<WaylineJobDTO> waylineJobDTO = this.getJobByJobId(jobId); |
| | | if (waylineJobDTO.isEmpty()) { |
| | | return ResponseResult.error("任务不存在,jobId: " + jobId); |
| | | } |
| | | if (waylineJobDTO.get().getTaskType() == 3) { |
| | | // 已经执行完的子任务是否删除,或者清掉父任务ID,和正常任务一起显示在列表中。 |
| | | this.deleteTask(jobId); |
| | | return ResponseResult.success(); |
| | | } |
| | | } |
| | | boolean isOnline = deviceService.checkDeviceOnline(dockSn); |
| | | if (!isOnline) { |
| | | Integer errorCode = CommonErrorEnum.DEVICE_OFFLINE.getErrorCode(); |
| | |
| | | public List<WaylineJobDTO> getJobsByConditions(Collection<String> jobIds, WaylineJobStatusEnum status) { |
| | | return mapper.selectList( |
| | | new LambdaQueryWrapper<WaylineJobEntity>() |
| | | .eq(Objects.nonNull(status), WaylineJobEntity::getStatus, status.getVal()) |
| | | // 不过滤状态, |
| | | //.eq(Objects.nonNull(status), WaylineJobEntity::getStatus, status.getVal()) |
| | | .and(!CollectionUtils.isEmpty(jobIds), |
| | | wrapper -> jobIds.forEach(id -> wrapper.eq(WaylineJobEntity::getJobId, id).or()))) |
| | | .stream() |