Search in sources :

Example 1 with ReturnScheduleTaskVO

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);
}
Also used : User(com.dtstack.taier.dao.domain.User) ReturnScheduleTaskVO(com.dtstack.taier.develop.vo.schedule.ReturnScheduleTaskVO) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) Timestamp(java.sql.Timestamp) ScheduleTaskShade(com.dtstack.taier.dao.domain.ScheduleTaskShade) PageResult(com.dtstack.taier.dao.pager.PageResult)

Aggregations

Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)1 ScheduleTaskShade (com.dtstack.taier.dao.domain.ScheduleTaskShade)1 User (com.dtstack.taier.dao.domain.User)1 PageResult (com.dtstack.taier.dao.pager.PageResult)1 ReturnScheduleTaskVO (com.dtstack.taier.develop.vo.schedule.ReturnScheduleTaskVO)1 Timestamp (java.sql.Timestamp)1