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);
}
}
Aggregations