use of com.dtstack.taier.develop.vo.schedule.ReturnScheduleTaskVO in project Taier by DTStack.
the class TaskService method queryTasks.
/**
* 查询任务列表
*
* @param dto 查询条件
* @return
*/
public PageResult<List<ReturnScheduleTaskVO>> queryTasks(QueryTaskListDTO dto) {
Page<ScheduleTaskShade> page = new Page<>(dto.getCurrentPage(), dto.getPageSize());
// 分页查询
Page<ScheduleTaskShade> resultPage = this.lambdaQuery().eq(ScheduleTaskShade::getFlowId, 0L).eq(ScheduleTaskShade::getIsDeleted, Deleted.NORMAL.getStatus()).like(StringUtils.isNotBlank(dto.getName()), ScheduleTaskShade::getName, dto.getName()).eq(dto.getOperatorId() != null, ScheduleTaskShade::getCreateUserId, dto.getOperatorId()).eq(dto.getTenantId() != null, ScheduleTaskShade::getTenantId, dto.getTenantId()).eq(dto.getScheduleStatus() != null, ScheduleTaskShade::getScheduleStatus, dto.getScheduleStatus()).between(dto.getStartModifiedTime() != null && dto.getEndModifiedTime() != null, ScheduleTaskShade::getGmtModified, null == dto.getStartModifiedTime() ? null : new Timestamp(dto.getStartModifiedTime()), null == dto.getEndModifiedTime() ? null : new Timestamp(dto.getEndModifiedTime())).in(CollectionUtils.isNotEmpty(dto.getTaskTypeList()), ScheduleTaskShade::getTaskType, dto.getTaskTypeList()).in(CollectionUtils.isNotEmpty(dto.getPeriodTypeList()), ScheduleTaskShade::getPeriodType, dto.getPeriodTypeList()).page(page);
List<ReturnScheduleTaskVO> scheduleTaskVOS = ScheduleTaskMapstructTransfer.INSTANCE.beanToTaskVO(resultPage.getRecords());
List<Long> userIds = resultPage.getRecords().stream().map(ScheduleTaskShade::getCreateUserId).collect(Collectors.toList());
Map<Long, User> userMap = userService.getUserMap(userIds);
scheduleTaskVOS.forEach(vo -> vo.setOperatorName(userMap.get(vo.getOperatorId()) != null ? userMap.get(vo.getOperatorId()).getUserName() : ""));
return new PageResult<>(dto.getCurrentPage(), dto.getPageSize(), resultPage.getTotal(), (int) resultPage.getPages(), scheduleTaskVOS);
}
Aggregations