activiti学习笔记

发布时间 2023-07-11 10:31:25作者: 花田007

常用表

-- 根据业务表查询流程实例id(自己业务表启动流程时保存流程实例id)
select
* from cc_test t;
-- 查询下一步流程
select * from act_ru_task t where t.PROC_INST_ID_ ='';
-- 查询该流程相关人员
select * from act_ru_identitylink t where t.PROC_INST_ID_ ='';
-- 通常我用来查询业务表id(BUSINESS_KEY_)
select * from act_ru_execution t where t.PROC_INST_ID_ ='';
-- 记录流程历史记录,act_ru开头的表执行完毕会清空,历史表不会清空。可以用来根据历史表中的END_TIME_判断是否执行完成,也可以查询act_ru表是否清空进行判断。
select * from act_hi_taskinst t where t.PROC_INST_ID_ ='';

 代码判断流程是否执行完成

ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
HistoricProcessInstance hpi = processEngine.getHistoryService()   //与执行法的历史信息相关的Service
                    .createHistoricProcessInstanceQuery()   //创建流程实例的历史信息查询对象
                    .processInstanceId(pi.getId())   //查询条件 -- 通过流程实例查询历史信息
                    .singleResult();    //返回查询结果
                    /**
                    *    输出查询的记过
                    **/
            System.out.println("历史信息ID:"+hpi.getId());
            System.out.println("流程定义ID:"+hpi.getProcessDefinitionId());
            System.out.println("流程开始时间:"+hpi.getStartTime());
            System.out.println("流程结束时间:"+hpi.getEndTime());