Search in sources :

Example 11 with User

use of com.dtstack.taier.dao.domain.User in project Taier by DTStack.

the class JobService method buildReturnJobListVO.

/**
 * 构建ReturnJobListVO
 * @param returnJobListVOS 结果集
 * @param records 记录数
 */
private void buildReturnJobListVO(List<ReturnJobListVO> returnJobListVOS, List<ScheduleJob> records) {
    List<Long> taskIdList = records.stream().map(ScheduleJob::getTaskId).collect(Collectors.toList());
    List<ScheduleTaskShade> taskShadeList = taskService.lambdaQuery().in(ScheduleTaskShade::getTaskId, taskIdList).eq(ScheduleTaskShade::getIsDeleted, Deleted.NORMAL.getStatus()).list();
    Map<Long, ScheduleTaskShade> taskShadeMap = taskShadeList.stream().collect(Collectors.toMap(ScheduleTaskShade::getTaskId, g -> (g)));
    Map<Long, User> userMap = userService.listAll().stream().collect(Collectors.toMap(User::getId, g -> (g)));
    // 封装返回值
    for (ScheduleJob scheduleJob : records) {
        ReturnJobListVO returnJobListVO = JobMapstructTransfer.INSTANCE.scheduleJobToReturnJobListVO(scheduleJob);
        returnJobListVO.setCycTime(DateUtil.addTimeSplit(scheduleJob.getCycTime()));
        returnJobListVO.setStartExecTime(DateUtil.getDate(scheduleJob.getExecStartTime(), DateUtil.STANDARD_DATETIME_FORMAT));
        returnJobListVO.setEndExecTime(DateUtil.getDate(scheduleJob.getExecEndTime(), DateUtil.STANDARD_DATETIME_FORMAT));
        returnJobListVO.setExecTime(getExecTime(scheduleJob));
        returnJobListVO.setStatus(TaskStatus.getShowStatus(scheduleJob.getStatus()));
        ScheduleTaskShade scheduleTaskShade = taskShadeMap.get(returnJobListVO.getTaskId());
        if (scheduleTaskShade != null) {
            returnJobListVO.setTaskName(scheduleTaskShade.getName());
            returnJobListVO.setOperatorId(scheduleTaskShade.getCreateUserId());
            returnJobListVO.setOperatorName(userMap.get(scheduleTaskShade.getCreateUserId()) != null ? userMap.get(scheduleTaskShade.getCreateUserId()).getUserName() : "");
        }
        returnJobListVOS.add(returnJobListVO);
    }
}
Also used : ReturnJobStatusStatisticsVO(com.dtstack.taier.develop.vo.schedule.ReturnJobStatusStatisticsVO) CountFillDataJobStatusPO(com.dtstack.taier.dao.domain.po.CountFillDataJobStatusPO) UserService(com.dtstack.taier.develop.service.user.UserService) FillDataJobMapstructTransfer(com.dtstack.taier.develop.mapstruct.fill.FillDataJobMapstructTransfer) PageResult(com.dtstack.taier.dao.pager.PageResult) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.apache.commons.lang3.StringUtils) NumberUtils(org.apache.commons.lang.math.NumberUtils) DateUtil(com.dtstack.taier.pluginapi.util.DateUtil) StatusCountPO(com.dtstack.taier.dao.domain.po.StatusCountPO) TaskStatus(com.dtstack.taier.pluginapi.enums.TaskStatus) ServiceImpl(com.baomidou.mybatisplus.extension.service.impl.ServiceImpl) Wrappers(com.baomidou.mybatisplus.core.toolkit.Wrappers) ScheduleTaskShade(com.dtstack.taier.dao.domain.ScheduleTaskShade) QueryFillDataListDTO(com.dtstack.taier.scheduler.dto.fill.QueryFillDataListDTO) Timestamp(java.sql.Timestamp) ReturnJobListVO(com.dtstack.taier.develop.vo.schedule.ReturnJobListVO) QueryFillDataJobListDTO(com.dtstack.taier.scheduler.dto.fill.QueryFillDataJobListDTO) ReturnFillDataJobListVO(com.dtstack.taier.develop.vo.fill.ReturnFillDataJobListVO) ScheduleFillDataInfoDTO(com.dtstack.taier.scheduler.dto.fill.ScheduleFillDataInfoDTO) Collectors(java.util.stream.Collectors) ReturnDisplayPeriodVO(com.dtstack.taier.develop.vo.schedule.ReturnDisplayPeriodVO) FillGeneratStatusEnum(com.dtstack.taier.scheduler.enums.FillGeneratStatusEnum) Deleted(com.dtstack.taier.common.enums.Deleted) FillDataJobVO(com.dtstack.taier.develop.vo.fill.FillDataJobVO) java.util(java.util) ScheduleJob(com.dtstack.taier.dao.domain.ScheduleJob) RdosDefineException(com.dtstack.taier.common.exception.RdosDefineException) FillDataRunnable(com.dtstack.taier.scheduler.server.action.fill.FillDataRunnable) FillDataThreadPoolExecutor(com.dtstack.taier.scheduler.server.action.fill.FillDataThreadPoolExecutor) Lists(com.google.common.collect.Lists) CollectionUtils(org.apache.commons.collections.CollectionUtils) Service(org.springframework.stereotype.Service) FillStatusUpdateFinishEvent(com.dtstack.taier.develop.event.FillStatusUpdateFinishEvent) QueryJobListDTO(com.dtstack.taier.scheduler.dto.schedule.QueryJobListDTO) ErrorCode(com.dtstack.taier.common.exception.ErrorCode) ReturnFillDataListVO(com.dtstack.taier.develop.vo.fill.ReturnFillDataListVO) ScheduleFillDataJob(com.dtstack.taier.dao.domain.ScheduleFillDataJob) FillDataTypeEnum(com.dtstack.taier.scheduler.enums.FillDataTypeEnum) ScheduleJobMapper(com.dtstack.taier.dao.mapper.ScheduleJobMapper) User(com.dtstack.taier.dao.domain.User) DateTime(org.joda.time.DateTime) EScheduleType(com.dtstack.taier.common.enums.EScheduleType) Maps(com.google.common.collect.Maps) ApplicationContext(org.springframework.context.ApplicationContext) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) ScheduleFillJobParticipateDTO(com.dtstack.taier.scheduler.dto.fill.ScheduleFillJobParticipateDTO) JSON(com.alibaba.fastjson.JSON) QueryJobStatusStatisticsDTO(com.dtstack.taier.scheduler.dto.schedule.QueryJobStatusStatisticsDTO) JobMapstructTransfer(com.dtstack.taier.develop.mapstruct.job.JobMapstructTransfer) FillJobTypeEnum(com.dtstack.taier.scheduler.enums.FillJobTypeEnum) JobsStatusStatisticsPO(com.dtstack.taier.dao.domain.po.JobsStatusStatisticsPO) ScheduleJob(com.dtstack.taier.dao.domain.ScheduleJob) User(com.dtstack.taier.dao.domain.User) ReturnJobListVO(com.dtstack.taier.develop.vo.schedule.ReturnJobListVO) ScheduleTaskShade(com.dtstack.taier.dao.domain.ScheduleTaskShade)

Aggregations

User (com.dtstack.taier.dao.domain.User)11 RdosDefineException (com.dtstack.taier.common.exception.RdosDefineException)7 ScheduleTaskShade (com.dtstack.taier.dao.domain.ScheduleTaskShade)5 Timestamp (java.sql.Timestamp)5 JSON (com.alibaba.fastjson.JSON)4 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)4 Deleted (com.dtstack.taier.common.enums.Deleted)4 ErrorCode (com.dtstack.taier.common.exception.ErrorCode)4 PageResult (com.dtstack.taier.dao.pager.PageResult)4 UserService (com.dtstack.taier.develop.service.user.UserService)4 Wrappers (com.baomidou.mybatisplus.core.toolkit.Wrappers)3 ServiceImpl (com.baomidou.mybatisplus.extension.service.impl.ServiceImpl)3 EScheduleType (com.dtstack.taier.common.enums.EScheduleType)3 ScheduleFillDataJob (com.dtstack.taier.dao.domain.ScheduleFillDataJob)3 ScheduleJob (com.dtstack.taier.dao.domain.ScheduleJob)3 CountFillDataJobStatusPO (com.dtstack.taier.dao.domain.po.CountFillDataJobStatusPO)3 JobsStatusStatisticsPO (com.dtstack.taier.dao.domain.po.JobsStatusStatisticsPO)3 StatusCountPO (com.dtstack.taier.dao.domain.po.StatusCountPO)3 UserDTO (com.dtstack.taier.dao.dto.UserDTO)3 ScheduleJobMapper (com.dtstack.taier.dao.mapper.ScheduleJobMapper)3