public String listHistoricTasks() { HistoryService historyService = processEngine.getHistoryService(); historicTaskInstances = historyService.createHistoricTaskInstanceQuery().list(); return "listHistoricTasks"; }
/** * 已办任务(历史任务) * * @return */ public String listHistoryTasks() { HistoryService historyService = processEngine.getHistoryService(); String username = SpringSecurityUtils.getCurrentUsername(); historicTasks = historyService.createHistoricTaskInstanceQuery().taskAssignee(username).finished().list(); return "listHistoryTasks"; }
/** * 用户参与的流程(包含已经完成和未完成) * * @return */ public String listInvolvedProcessInstances() { HistoryService historyService = processEngine.getHistoryService(); // TODO: finished(), unfinished() String username = SpringSecurityUtils.getCurrentUsername(); historicProcessInstances = historyService.createHistoricProcessInstanceQuery().involvedUser(username).list(); return "listInvolvedProcessInstances"; }
@Test public void testHistoryService() { // Given HistoryService historyService = mock(HistoryService.class); when(processEngine.getHistoryService()).thenReturn(historyService); // When HistoryService returnedService = historyService(); // Then assertThat(returnedService).isNotNull().isSameAs(historyService); verify(processEngine, times(1)).getHistoryService(); verifyNoMoreInteractions(processEngine); }
/** 历史任务. */ public Page findHistoricTaskInstances(String tenantId, Page page) { HistoryService historyService = processEngine.getHistoryService(); long count = historyService.createHistoricTaskInstanceQuery().taskTenantId(tenantId).count(); List<HistoricTaskInstance> historicTaskInstances = historyService .createHistoricTaskInstanceQuery() .taskTenantId(tenantId) .listPage((int) page.getStart(), page.getPageSize()); page.setResult(historicTaskInstances); page.setTotalCount(count); return page; }
/** * 查看历史【包含流程跟踪、任务列表(完成和未完成)、流程变量】 * * @return */ public String viewHistory() { HistoryService historyService = processEngine.getHistoryService(); historicTasks = historyService .createHistoricTaskInstanceQuery() .processInstanceId(processInstanceId) .list(); historicVariableInstances = historyService .createHistoricVariableInstanceQuery() .processInstanceId(processInstanceId) .list(); return "viewHistory"; }
/** 参与流程. */ public Page findInvolvedProcessInstances(String userId, String tenantId, Page page) { HistoryService historyService = processEngine.getHistoryService(); // TODO: finished(), unfinished() long count = historyService .createHistoricProcessInstanceQuery() .processInstanceTenantId(tenantId) .involvedUser(userId) .count(); List<HistoricProcessInstance> historicProcessInstances = historyService .createHistoricProcessInstanceQuery() .processInstanceTenantId(tenantId) .involvedUser(userId) .listPage((int) page.getStart(), page.getPageSize()); page.setResult(historicProcessInstances); page.setTotalCount(count); return page; }
/** 未结流程. */ public Page findRunningProcessInstances(String userId, String tenantId, Page page) { HistoryService historyService = processEngine.getHistoryService(); // TODO: 改成通过runtime表搜索,提高效率 long count = historyService .createHistoricProcessInstanceQuery() .processInstanceTenantId(tenantId) .startedBy(userId) .unfinished() .count(); List<HistoricProcessInstance> historicProcessInstances = historyService .createHistoricProcessInstanceQuery() .processInstanceTenantId(tenantId) .startedBy(userId) .unfinished() .listPage((int) page.getStart(), page.getPageSize()); page.setResult(historicProcessInstances); page.setTotalCount(count); return page; }