1、历史活动查看
// 历史活动查看(某一次流程的执行经历的多少步) @Test public void queryHistoricActivityInstance() throws Exception { String processInstanceId = "1401"; List<HistoricActivityInstance> hais = historyService.createHistoricActivityInstanceQuery() // 过滤条件 .processInstanceId(processInstanceId ) // 分页条件 // .listPage(firstResult, maxResults) // 排序条件 .orderByHistoricActivityInstanceEndTime().asc() // 执行查询 .list(); for (HistoricActivityInstance hai : hais) { System.out.print("activitiId:" + hai.getActivityId()+","); System.out.print("name:" + hai.getActivityName()+","); System.out.print("type:" + hai.getActivityType()+","); System.out.print("pid:" + hai.getProcessInstanceId()+","); System.out.print("assignee:" + hai.getAssignee()+","); System.out.print("startTime:" + hai.getStartTime()+","); System.out.print("endTime:" + hai.getEndTime()+","); System.out.println("duration:" + hai.getDurationInMillis()); } }
2、历史流程实例查看
// 历史流程实例查看(查找按照某个规则一共执行了多少次流程) @Test public void queryHistoricProcessInstance() throws Exception { // 获取历史流程实例的查询对象 HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery(); // 设置查询参数 historicProcessInstanceQuery //过滤条件 .processDefinitionKey("varTest") // 分页条件 // .listPage(firstResult, maxResults) // 排序条件 .orderByProcessInstanceStartTime().desc(); // 执行查询 List<HistoricProcessInstance> hpis = historicProcessInstanceQuery.list(); // 遍历查看结果 for (HistoricProcessInstance hpi : hpis) { System.out.print("pid:" + hpi.getId()+","); System.out.print("pdid:" + hpi.getProcessDefinitionId()+","); System.out.print("startTime:" + hpi.getStartTime()+","); System.out.print("endTime:" + hpi.getEndTime()+","); System.out.print("duration:" + hpi.getDurationInMillis()+","); System.out.println("vars:" + hpi.getProcessVariables()); } }
Activiti历史查看
时间: 2024-10-09 10:18:04