Search in sources :

Example 1 with JobNodeVO

use of com.dtstack.taier.develop.vo.schedule.JobNodeVO in project Taier by DTStack.

the class JobJobService method displayLevelNode.

/**
 * 递归分支节点
 *
 * @param directType 前端传过来的条件:方向
 * @param rootJobKey 头结点key
 * @param taskShadeMap 任务集合
 * @param jobMap 实例集合
 * @param jobJobMaps 实例之间的关系
 * @return 节点列表
 */
private List<JobNodeVO> displayLevelNode(Integer directType, String rootJobKey, Map<Long, ScheduleTaskShade> taskShadeMap, Map<String, ScheduleJob> jobMap, Map<String, List<String>> jobJobMaps) {
    List<String> jobKeys = jobJobMaps.get(rootJobKey);
    List<JobNodeVO> jobNodeVOList = Lists.newArrayList();
    if (CollectionUtils.isEmpty(jobKeys)) {
        return Lists.newArrayList();
    }
    for (String jobKey : jobKeys) {
        JobNodeVO vo = new JobNodeVO();
        ScheduleJob scheduleJob = jobMap.get(jobKey);
        if (scheduleJob != null) {
            vo.setJobId(scheduleJob.getJobId());
            vo.setStatus(scheduleJob.getStatus());
            vo.setTaskId(scheduleJob.getTaskId());
            vo.setTaskType(scheduleJob.getTaskType());
            vo.setCycTime(DateUtil.addTimeSplit(scheduleJob.getCycTime()));
            ScheduleTaskShade taskShade = taskShadeMap.get(scheduleJob.getTaskId());
            if (taskShade != null) {
                vo.setTaskName(taskShade.getName());
                vo.setTaskGmtCreate(taskShade.getGmtCreate());
            }
            if (DisplayDirect.CHILD.getType().equals(directType)) {
                vo.setChildNode(displayLevelNode(directType, scheduleJob.getJobKey(), taskShadeMap, jobMap, jobJobMaps));
            } else {
                vo.setParentNode(displayLevelNode(directType, scheduleJob.getJobKey(), taskShadeMap, jobMap, jobJobMaps));
            }
            jobNodeVOList.add(vo);
        }
    }
    return jobNodeVOList;
}
Also used : ScheduleJob(com.dtstack.taier.dao.domain.ScheduleJob) JobNodeVO(com.dtstack.taier.develop.vo.schedule.JobNodeVO) ScheduleTaskShade(com.dtstack.taier.dao.domain.ScheduleTaskShade)

Example 2 with JobNodeVO

use of com.dtstack.taier.develop.vo.schedule.JobNodeVO in project Taier by DTStack.

the class JobJobService method buildRootNode.

/**
 * 封装头节点
 *
 * @param directType 前端传过来的条件:方向
 * @param scheduleJob 周期实例对象
 * @param taskShadeMap 任务集合
 * @param jobMap 实例集合
 * @param jobJobMaps 实例之间的关系
 * @return 头节点
 */
private JobNodeVO buildRootNode(Integer directType, ScheduleJob scheduleJob, Map<Long, ScheduleTaskShade> taskShadeMap, Map<String, ScheduleJob> jobMap, Map<String, List<String>> jobJobMaps) {
    JobNodeVO rootNode = new JobNodeVO();
    rootNode.setJobId(scheduleJob.getJobId());
    rootNode.setStatus(scheduleJob.getStatus());
    rootNode.setTaskId(scheduleJob.getTaskId());
    rootNode.setTaskType(scheduleJob.getTaskType());
    rootNode.setCycTime(DateUtil.addTimeSplit(scheduleJob.getCycTime()));
    String userName = userService.getUserName(scheduleJob.getCreateUserId());
    rootNode.setOperatorId(scheduleJob.getCreateUserId());
    rootNode.setOperatorName(userName);
    ScheduleTaskShade taskShade = taskShadeMap.get(scheduleJob.getTaskId());
    if (taskShade != null) {
        rootNode.setTaskName(taskShade.getName());
        rootNode.setTaskGmtCreate(taskShade.getGmtCreate());
    }
    if (DisplayDirect.CHILD.getType().equals(directType)) {
        rootNode.setChildNode(displayLevelNode(directType, scheduleJob.getJobKey(), taskShadeMap, jobMap, jobJobMaps));
    } else {
        rootNode.setParentNode(displayLevelNode(directType, scheduleJob.getJobKey(), taskShadeMap, jobMap, jobJobMaps));
    }
    return rootNode;
}
Also used : JobNodeVO(com.dtstack.taier.develop.vo.schedule.JobNodeVO) ScheduleTaskShade(com.dtstack.taier.dao.domain.ScheduleTaskShade)

Aggregations

ScheduleTaskShade (com.dtstack.taier.dao.domain.ScheduleTaskShade)2 JobNodeVO (com.dtstack.taier.develop.vo.schedule.JobNodeVO)2 ScheduleJob (com.dtstack.taier.dao.domain.ScheduleJob)1