public virtual IPage <TaskModel> GetHistoryTasks(string processInstanceId, string businessKey, bool?finished = null) { IHistoricTaskInstanceQuery query = historyService.CreateHistoricTaskInstanceQuery(); query.SetProcessInstanceId(processInstanceId) .SetProcessInstanceBusinessKey(businessKey); if (finished.GetValueOrDefault(false)) { query.SetFinished(); } var pageable = new Pageable { PageNo = 1, PageSize = int.MaxValue }; pageable.Sort = new Sort(); pageable.Sort.Add(new Sort.Order() { Property = "startTime", Direction = Sort.Direction.ASC }); historicSortApplier.ApplySort(query, pageable); return(pageRetriever.LoadPage(historyService as ServiceImpl, query, pageable, historicTaskInstanceConverter, (q, firstResult, pageSize) => { return new GetHistoricInstanceTasksCmd(q, firstResult, pageSize); })); }
/// <summary> /// 获取流程实例历史记录,默认不启用分页,返回当期流程实例下的所有历史任务. /// </summary> public virtual IPage <TaskModel> GetHistoryTasks(string processInstanceId, string businessKey, string tenantId, Pageable pageable) { IHistoricTaskInstanceQuery query = historyService.CreateHistoricTaskInstanceQuery(); if (string.IsNullOrWhiteSpace(processInstanceId) == false) { query.SetProcessInstanceId(processInstanceId); } else { query.SetProcessInstanceBusinessKey(businessKey) .SetTaskTenantId(tenantId); } if (pageable.PageSize == 0) { pageable.PageNo = 1; pageable.PageSize = int.MaxValue; } historicSortApplier.ApplySort(query, pageable); return(pageRetriever.LoadPage(historyService as ServiceImpl, query, pageable, historicTaskInstanceConverter, (q, firstResult, pageSize) => { return new GetHistoricInstanceTasksCmd(q, firstResult, pageSize); })); }