use of com.dtstack.taier.develop.vo.schedule.ReturnJobDisplayVO in project Taier by DTStack.
the class JobJobService method displayOffSpring.
public ReturnJobDisplayVO displayOffSpring(QueryJobDisplayDTO dto) {
// 设置层级 0<level< max.level
dto.setLevel(JobUtils.checkLevel(dto.getLevel(), context.getMaxLevel()));
// 查询实例是否存在,如不不存在,直接抛异常,下面的逻辑不需要在走了
ScheduleJob scheduleJob = jobService.lambdaQuery().eq(ScheduleJob::getJobId, dto.getJobId()).eq(ScheduleJob::getIsDeleted, Deleted.NORMAL.getStatus()).one();
if (scheduleJob == null) {
throw new RdosDefineException("job does not exist");
}
// 先从db里面查询数据,然后在递归封装成节点
List<String> jobKeys = Lists.newArrayList(scheduleJob.getJobKey());
Map<String, List<String>> jobJobMaps = findJobJobByJobKeys(dto, jobKeys);
// 查询所有实例
List<ScheduleJob> scheduleJobList = findJobByJobJob(jobJobMaps);
scheduleJobList.add(scheduleJob);
Map<String, ScheduleJob> jobMap = scheduleJobList.stream().collect(Collectors.groupingBy(ScheduleJob::getJobKey, Collectors.collectingAndThen(Collectors.toCollection(ArrayList<ScheduleJob>::new), a -> a.get(0))));
// 查询所有任务
Map<Long, ScheduleTaskShade> taskShadeMap = findTaskJob(scheduleJobList);
ReturnJobDisplayVO vo = new ReturnJobDisplayVO();
vo.setDirectType(dto.getDirectType());
vo.setRootNode(buildRootNode(dto.getDirectType(), scheduleJob, taskShadeMap, jobMap, jobJobMaps));
return vo;
}
use of com.dtstack.taier.develop.vo.schedule.ReturnJobDisplayVO in project Taier by DTStack.
the class JobJobService method displayAllFlowSubJobs.
private ReturnJobDisplayVO displayAllFlowSubJobs(ScheduleJob scheduleJob) {
List<ScheduleJob> scheduleJobList = jobService.lambdaQuery().eq(ScheduleJob::getFlowJobId, scheduleJob.getJobId()).eq(ScheduleJob::getIsDeleted, Deleted.NORMAL.getStatus()).list();
Map<String, ScheduleJob> jobMap = scheduleJobList.stream().collect(Collectors.toMap(ScheduleJob::getJobKey, g -> (g)));
// 查询实例直接的关系
Set<String> jobKeySet = jobMap.keySet();
jobKeySet.add(scheduleJob.getJobKey());
List<ScheduleJobJob> scheduleJobJobs = this.lambdaQuery().in(ScheduleJobJob::getJobKey, jobKeySet).in(ScheduleJobJob::getIsDeleted, Deleted.NORMAL.getStatus()).list();
Map<String, List<String>> jobJobMaps = scheduleJobJobs.stream().collect(Collectors.groupingBy(ScheduleJobJob::getParentJobKey, Collectors.mapping(ScheduleJobJob::getJobKey, Collectors.toList())));
// 查询任务信息
List<Long> taskIdList = scheduleJobList.stream().map(ScheduleJob::getTaskId).collect(Collectors.toList());
taskIdList.add(scheduleJob.getTaskId());
List<ScheduleTaskShade> taskShades = taskService.lambdaQuery().in(ScheduleTaskShade::getTaskId, taskIdList).eq(ScheduleTaskShade::getIsDeleted, Deleted.NORMAL.getStatus()).list();
Map<Long, ScheduleTaskShade> taskShadeMap = taskShades.stream().collect(Collectors.toMap(ScheduleTaskShade::getTaskId, g -> (g)));
ReturnJobDisplayVO vo = new ReturnJobDisplayVO();
vo.setRootNode(buildRootNode(DisplayDirect.CHILD.getType(), scheduleJob, taskShadeMap, jobMap, jobJobMaps));
return vo;
}
Aggregations