🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
```java /** * 查询流程实例的状态,当前运行结点等信息 */ @Test public void queryProcessInstance() { // 获取引擎 ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); // 获取RunTimeService RuntimeService runtimeService = processEngine.getRuntimeService(); List<ProcessInstance> list = runtimeService .createProcessInstanceQuery() .processDefinitionKey("myEvection")//流程定义的key .list(); for (ProcessInstance processInstance : list) { System.out.println("----------------------------"); System.out.println("流程实例id:" + processInstance.getProcessInstanceId()); System.out.println("所属流程定义id:" + processInstance.getProcessDefinitionId()); System.out.println("是否执行完成:" + processInstance.isEnded()); System.out.println("是否暂停:" + processInstance.isSuspended()); System.out.println("当前活动标识:" + processInstance.getActivityId()); System.out.println("业务标识:" + processInstance.getBusinessKey()); } //---------------------------- //流程实例id:20001 //所属流程定义id:myEvection:1:17504 //是否执行完成:false //是否暂停:false //当前活动标识:null //业务标识:null //---------------------------- //流程实例id:25001 //所属流程定义id:myEvection:1:17504 //是否执行完成:false //是否暂停:false //当前活动标识:null //业务标识:null //---------------------------- //流程实例id:30001 //所属流程定义id:myEvection:1:17504 //是否执行完成:false //是否暂停:false //当前活动标识:null //业务标识:1001 } ```