//歷史任務實例
List<HistoricTaskInstance> historicTaskInstanceList = historyService // 歷史相關Service
.createHistoricTaskInstanceQuery() // 創建歷史任務實例查詢
.taskAssignee(assignee.toString())
// .finished() // 查詢已經完成的任務
.list();
//歷史實例過程查詢
List<HistoricProcessInstance> historicProcessInstancesList = historyService.createHistoricProcessInstanceQuery()
.processInstanceIds(historicTaskInstanceList.stream().map(TaskInfo::getProcessInstanceId).collect(Collectors.toSet()))
.list();
//獲取businessKey
List<ApprovalTemp> collect = historicProcessInstancesList.stream().map(e -> {
return new ApprovalTemp().setBusinessKey(e.getBusinessKey()).setName(e.getName()).setCreateTime(e.getStartTime()).setTaskId(e.getId());
}).collect(Collectors.toList());
List<Follow> follows = followDao.findByUserId(assignee);
List<ApprovalDTO> list = approvalDTO(follows, collect);
// ..........