首页 > 代码库 > Activiti历史查看
Activiti历史查看
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()); } }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。