流程任务:
// 删除流程实例
@Test
public void demo8(){
String procInstId = "1801";
String reson = "先删除看看情况";
processEngine.getRuntimeService().deleteProcessInstance(procInstId, reson);
}
删除完流程信息后:会在表ACT_HI_PROCINST: 记录删除的信息
查询流程实例:
// 查询流程实例
@Test
public void demo9(){
ProcessInstanceQuery pi = processEngine.getRuntimeService().createProcessInstanceQuery();
List<ProcessInstance> list = pi.list();
for(ProcessInstance p : list){
System.out.println(p.getId());
System.out.println(p.getBusinessKey());
}
}
执行sql:
SELECT DISTINCT
RES.*,
P.KEY_ AS ProcessDefinitionKey,
P.ID_ AS ProcessDefinitionId
FROM
ACT_RU_EXECUTION RES
INNER JOIN ACT_RE_PROCDEF P
ON RES.PROC_DEF_ID_ = P.ID_
WHERE RES.PARENT_ID_ IS NULL
ORDER BY RES.ID_ ASC
查询个人任务:
// 查询个人任务
@Test
public void demo10(){
// 可以提供很多的其他查询条件
//List<Task> tasks = processEngine.getTaskService().createTaskQuery().taskAssignee("小华").orderByExecutionId().list();
TaskQuery tq = processEngine.getTaskService().createTaskQuery();
String name = "一级管理员";
tq.taskAssignee(name);
List<Task> list = tq.list();
for(Task t : list){
System.out.println(t.getId());
System.out.println(t.getName());
}
}
执行sql:
SELECT DISTINCT
RES.*
FROM
ACT_RU_TASK RES
WHERE RES.ASSIGNEE_ = ?
ORDER BY RES.ID_ ASC
办理个人任务:
// 办理个人任务
@Test
public void demo11(){
String taskId = "1904";
processEngine.getTaskService().complete(taskId);
}
直接向下执行流程
// 直接向下执行流程
@Test
public void demo12(){
String executionId = "1901";
processEngine.getRuntimeService().signal(executionId);
}
每次执行新的流程把ACT_RU_TASK表中的数据生成一个新的task_id 旧的数据放入到历史表中