1、创建ProcessEngine
1.1、java代码
ProcessEngineConfiguration configuration = new StandaloneProcessEngineConfiguration()
.setJdbcUrl("jdbc:mysql://192.168.209.102:3306/flowable-demo?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true")
.setJdbcDriver("com.mysql.cj.jdbc.Driver")
.setJdbcUsername("root")
.setJdbcPassword("123456")
// 如果数据库中的表结构不存在就新建
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
// 通过ProcessEngineConfiguration构建我们的ProcessEngine
processEngine = configuration.buildProcessEngine();
1.2、数据库表流向
# 1、生成表
# 2、查询ACT_GE_PROPERTY
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.execution-related-entities-count';
# 3、插入ACT_GE_PROPERTY
insert
into ACT_GE_PROPERTY
(NAME_, VALUE_, REV_)
values ('cfg.execution-related-entities-count', 'true', 1);
# 4、查询ACT_GE_PROPERTY
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.task-related-entities-count';
# 5、插入ACT_GE_PROPERTY
insert
into ACT_GE_PROPERTY
(NAME_, VALUE_, REV_)
values ('cfg.task-related-entities-count', 'true', 1);
2、发布流程
2.1、java代码
// 获取repositoryService对象
RepositoryService repositoryService = processEngine.getRepositoryService();
Deployment deployment = repositoryService.createDeployment()
// 关联要部署的流程文件
.addClasspathResource("holiday-request.bpmn20.xml")
.name("请假流程")
.deploy();
log.info("deploymentId:{}", deployment.getId());
log.info("deploymentName:{}", deployment.getName());
2.2、数据库表流向
# 1、查ACT_GE_PROPERTY
select *
from ACT_GE_PROPERTY
where NAME_ = 'schema.version';
# 2、ACT_RE_DEPLOYMENT
select distinct count(RES.ID_)
from ACT_RE_DEPLOYMENT RES
WHERE RES.ENGINE_VERSION_ = 'v5';
# 3、查ACT_GE_PROPERTY NAME_ = 'cfg.execution-related-entities-count'
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.execution-related-entities-count';
# 4、查ACT_GE_PROPERTY NAME_ = 'cfg.task-related-entities-count'
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.task-related-entities-count';
# 5、ACT_GE_PROPERTY 保存发布下一个新流程时,生成id和版本号,用于下一个新发布的流程
select *
from ACT_GE_PROPERTY
where NAME_ = 'next.dbid';
# 6、更新配置文件
update
ACT_GE_PROPERTY
SET REV_ = 2,
VALUE_ = '2501'
where NAME_ = 'next.dbid'
and REV_ = 1;
# 7、查ACT_RE_PROCDEF表
select *
from ACT_RE_PROCDEF
where KEY_ = 'holidayRequest'
and (
TENANT_ID_ = ''
or TENANT_ID_ is null
)
and DERIVED_FROM_ is null
and VERSION_ = (select max(VERSION_)
from ACT_RE_PROCDEF
where KEY_ = 'holidayRequest'
and (
TENANT_ID_ = ''
or TENANT_ID_ is null
));
# 8、查ACT_RU_TIMER_JOB表
select J.*
from ACT_RU_TIMER_JOB J
inner join
ACT_RE_PROCDEF P
on J.PROC_DEF_ID_ = P.ID_
where J.HANDLER_TYPE_ = 'timer-start-event'
and P.KEY_ = 'holidayRequest'
and (
P.TENANT_ID_ = ''
or P.TENANT_ID_ is null
);
# 9、查ACT_PROCDEF_INFO表
select *
from ACT_PROCDEF_INFO
where PROC_DEF_ID_ = 'holidayRequest:1:3';
# 10、插入数据ACT_RE_PROCDEF
insert
into ACT_RE_PROCDEF
(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_,
HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_, SUSPENSION_STATE_, DERIVED_FROM_, DERIVED_FROM_ROOT_, DERIVED_VERSION_,
TENANT_ID_, ENGINE_VERSION_)
values ('holidayRequest:1:3', 1, 'http://www.flowable.org/processdef', '请假流程', 'holidayRequest', 1, '1',
'holiday-request.bpmn20.xml', null, null, false, false, 1, null, null, 0, '', null);
# 11、插入数据ACT_GE_BYTEARRAY
insert
into ACT_GE_BYTEARRAY
(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_, GENERATED_)
values ('2', 1, 'holiday-request.bpmn20.xml', 'java.io.ByteArrayInputStream@3fabf088', '1', false);
3、获取流程定义信息
3.1、java代码
// 获取查询器
ProcessDefinitionQuery processDefinitionQuery = processEngine.getRepositoryService().createProcessDefinitionQuery();
ProcessDefinition processDefinition = processDefinitionQuery
// 设置需要查询流程id
.deploymentId("1")
// 响应一条结果
.singleResult();
log.info("id:{}", processDefinition.getId());
log.info("deploymentId:{}", processDefinition.getDeploymentId());
log.info("name:{}", processDefinition.getName());
log.info("description:{}", processDefinition.getDescription());
3.2、数据库表流向
# 1、查ACT_GE_PROPERTY
select *
from ACT_GE_PROPERTY
where NAME_ = 'schema.version';
# 2、ACT_RE_DEPLOYMENT
select distinct count(RES.ID_)
from ACT_RE_DEPLOYMENT RES
WHERE RES.ENGINE_VERSION_ = 'v5';
# 3、查ACT_GE_PROPERTY NAME_ = 'cfg.execution-related-entities-count'
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.execution-related-entities-count';
# 4、查ACT_GE_PROPERTY NAME_ = 'cfg.task-related-entities-count'
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.task-related-entities-count';
# 5、查询ACT_RE_PROCDEF
select distinct RES.*
from ACT_RE_PROCDEF RES
WHERE RES.DEPLOYMENT_ID_ = '1'
order by RES.ID_ asc;
3、删除部署的流程
3.1、java代码
RepositoryService repositoryService = processEngine.getRepositoryService();
// 删除部署的流程,如果部署的流程启动了 就不能删除了
repositoryService.deleteDeployment("1");
// // 删除部署的流程,如果部署的流程启动了 也可以删除了,相关的流程任务也会被删除
// repositoryService.deleteDeployment("1", true);
3.2、数据库表流向
# 1、查ACT_GE_PROPERTY
select *
from ACT_GE_PROPERTY
where NAME_ = 'schema.version';
# 2、ACT_RE_DEPLOYMENT
select distinct count(RES.ID_)
from ACT_RE_DEPLOYMENT RES
WHERE RES.ENGINE_VERSION_ = 'v5';
# 3、查ACT_GE_PROPERTY NAME_ = 'cfg.execution-related-entities-count'
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.execution-related-entities-count';
# 4、查ACT_GE_PROPERTY NAME_ = 'cfg.task-related-entities-count'
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.task-related-entities-count';
# 5、查询ACT_RE_DEPLOYMENT
select *
from ACT_RE_DEPLOYMENT
where ID_ = '1';
# 6、查询 ACT_RE_PROCDEF
select distinct RES.*
from ACT_RE_PROCDEF RES
WHERE RES.DEPLOYMENT_ID_ = '1'
order by RES.ID_ asc;
# 7、查询 ACT_RE_MODEL
select distinct RES.*
from ACT_RE_MODEL RES
WHERE RES.DEPLOYMENT_ID_ = '1'
order by RES.ID_ asc;
# 8、查询 ACT_PROCDEF_INFO
select *
from ACT_PROCDEF_INFO
where PROC_DEF_ID_ = 'holidayRequest:1:3';
# 9、查询 ACT_RU_TIMER_JOB
select J.*
from ACT_RU_TIMER_JOB J
where J.HANDLER_TYPE_ = 'timer-start-event'
and J.PROC_DEF_ID_ = 'holidayRequest:1:3';
# 10、查询 ACT_RE_PROCDEF
select *
from ACT_RE_PROCDEF
where KEY_ = 'holidayRequest'
and (
TENANT_ID_ = ''
or TENANT_ID_ is null
)
and DERIVED_FROM_ is null
and VERSION_ = (select max(VERSION_)
from ACT_RE_PROCDEF
where KEY_ = 'holidayRequest'
and (
TENANT_ID_ = ''
or TENANT_ID_ is null
));
# 11、查询 ACT_RE_PROCDEF
select distinct RES.*
from ACT_RE_PROCDEF RES
WHERE RES.KEY_ = 'holidayRequest'
and RES.VERSION_ < 1
and (
RES.TENANT_ID_ = ''
or RES.TENANT_ID_ is null
)
order by RES.VERSION_ desc LIMIT 1
OFFSET 0;
# 12、删除ACT_GE_BYTEARRAY记录
delete
from ACT_GE_BYTEARRAY
where DEPLOYMENT_ID_ = '1';
# 13、删除ACT_RE_DEPLOYMENT记录
delete
from ACT_RE_DEPLOYMENT
where ID_ = '1';
# 14、删除ACT_RU_EVENT_SUBSCR记录
delete
from ACT_RU_EVENT_SUBSCR
where PROC_DEF_ID_ = 'holidayRequest:1:3'
and EXECUTION_ID_ is null
and PROC_INST_ID_ is null;
# 15、删除ACT_RU_IDENTITYLINK记录
delete
from ACT_RU_IDENTITYLINK
where PROC_DEF_ID_ = 'holidayRequest:1:3';
# 16、删除ACT_RE_PROCDEF记录
delete
from ACT_RE_PROCDEF
where DEPLOYMENT_ID_ = '1';
4、启动流程实例
4.1、java代码
// 通过RuntimeService来启动流程实例
RuntimeService runtimeService = processEngine.getRuntimeService();
// 构建流程变量(表单信息)
Map<String, Object> variables = new HashMap<>();
variables.put("employee", "张三");
variables.put("nrOfHolidays", 3);
variables.put("description", "请假去做大宝剑");
// 启动流程
ProcessInstance holidayRequest = runtimeService.startProcessInstanceByKey("holidayRequest", variables);
log.info("holidayRequest.getId:{}", holidayRequest.getId());
log.info("holidayRequest.getActivityId:{}", holidayRequest.getActivityId());
log.info("holidayRequest.getProcessDefinitionKey:{}", holidayRequest.getProcessDefinitionKey());
log.info("holidayRequest.getProcessDefinitionId:{}", holidayRequest.getProcessDefinitionId());
log.info("holidayRequest.getProcessVariables:{}", holidayRequest.getProcessVariables());
4.2、数据库表流向
# 1、查ACT_GE_PROPERTY
select *
from ACT_GE_PROPERTY
where NAME_ = 'schema.version';
# 2、ACT_RE_DEPLOYMENT
select distinct count(RES.ID_)
from ACT_RE_DEPLOYMENT RES
WHERE RES.ENGINE_VERSION_ = 'v5';
# 3、查ACT_GE_PROPERTY NAME_ = 'cfg.execution-related-entities-count'
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.execution-related-entities-count';
# 4、查ACT_GE_PROPERTY NAME_ = 'cfg.task-related-entities-count'
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.task-related-entities-count';
# 5、ACT_RE_PROCDEF
select *
from ACT_RE_PROCDEF
where KEY_ = 'holidayRequest'
and (
TENANT_ID_ = ''
or TENANT_ID_ is null
)
and DERIVED_FROM_ is null
and VERSION_ = (select max(VERSION_)
from ACT_RE_PROCDEF
where KEY_ = 'holidayRequest'
and (
TENANT_ID_ = ''
or TENANT_ID_ is null
));
# 6、ACT_RE_DEPLOYMENT
select *
from ACT_RE_DEPLOYMENT
where ID_ = '2501';
# 7、ACT_GE_BYTEARRAY
select *
from ACT_GE_BYTEARRAY
where DEPLOYMENT_ID_ = '2501'
order by NAME_ asc;
# 8、ACT_RE_PROCDEF
select *
from ACT_RE_PROCDEF
where DEPLOYMENT_ID_ = '2501'
and KEY_ = 'holidayRequest'
and (
TENANT_ID_ = ''
or TENANT_ID_ is null
);
# 9、ACT_PROCDEF_INFO
select *
from ACT_PROCDEF_INFO
where PROC_DEF_ID_ = 'holidayRequest:1:2503';
# 10、ACT_GE_PROPERTY 保存下一个流程任务时,生成id和版本号,用于下一个新开启的任务节点
select *
from ACT_GE_PROPERTY
where NAME_ = 'next.dbid';
# 11、ACT_GE_PROPERTY
update
ACT_GE_PROPERTY
SET REV_ = 4,
VALUE_ = '7501'
where NAME_ = 'next.dbid'
and REV_ = 3;
# 12、ACT_HI_VARINST
insert
into ACT_HI_VARINST
(ID_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, SCOPE_ID_, SUB_SCOPE_ID_, SCOPE_TYPE_,
BYTEARRAY_ID_, DOUBLE_, LONG_, TEXT_, TEXT2_, CREATE_TIME_, LAST_UPDATED_TIME_)
values ('5002', '5001', '5001', null, 'nrOfHolidays', 0, 'integer', null, null, null, null, null, 3, '3', null,
'2023-12-15 11:32:39.081', '2023-12-15 11:32:39.081'),
('5003', '5001', '5001', null, 'description', 0, 'string', null, null, null, null, null, null, '请假去做大宝剑',
null, '2023-12-15 11:32:39.082', '2023-12-15 11:32:39.082'),
('5004', '5001', '5001', null, 'employee', 0, 'string', null, null, null, null, null, null, '张三', null,
'2023-12-15 11:32:39.082', '2023-12-15 11:32:39.082');
# 13、ACT_HI_TASKINST
insert
into ACT_HI_TASKINST
(ID_, REV_, TASK_DEF_ID_, PROC_DEF_ID_, PROC_INST_ID_, EXECUTION_ID_, SCOPE_ID_, SUB_SCOPE_ID_, SCOPE_TYPE_,
SCOPE_DEFINITION_ID_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, OWNER_, ASSIGNEE_, START_TIME_, CLAIM_TIME_, END_TIME_,
DURATION_, DELETE_REASON_, TASK_DEF_KEY_, FORM_KEY_, PRIORITY_, DUE_DATE_, CATEGORY_, TENANT_ID_, LAST_UPDATED_TIME_)
values ('5008', 1, null, 'holidayRequest:1:2503', '5001', '5005', null, null, null, null, '同意 或者 拒绝', null, null,
null, null, '2023-12-15 11:32:39.109', null, null, null, null, 'approveTask', null, 50, null, null, '',
'2023-12-15 11:32:39.109');
# 14、ACT_HI_PROCINST
insert
into ACT_HI_PROCINST
(ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, START_TIME_, END_TIME_, DURATION_, START_USER_ID_,
START_ACT_ID_, END_ACT_ID_, SUPER_PROCESS_INSTANCE_ID_, DELETE_REASON_, TENANT_ID_, NAME_, CALLBACK_ID_,
CALLBACK_TYPE_)
values ('5001', 1, '5001', null, 'holidayRequest:1:2503', '2023-12-15 11:32:38.903', null, null, null, 'startEvent',
null, null, null, '', null, null, null);
# 15、ACT_HI_ACTINST
insert
into ACT_HI_ACTINST
(ID_, REV_, PROC_DEF_ID_, PROC_INST_ID_, EXECUTION_ID_, ACT_ID_, TASK_ID_, CALL_PROC_INST_ID_, ACT_NAME_, ACT_TYPE_,
ASSIGNEE_, START_TIME_, END_TIME_, DURATION_, DELETE_REASON_, TENANT_ID_)
values ('5006', 1, 'holidayRequest:1:2503', '5001', '5005', 'startEvent', null, null, null, 'startEvent', null,
'2023-12-15 11:32:39.085', '2023-12-15 11:32:39.088', 3, null, ''),
('5007', 1, 'holidayRequest:1:2503', '5001', '5005', 'approveTask', '5008', null, '同意 或者 拒绝', 'userTask',
null, '2023-12-15 11:32:39.089', null, null, null, '');
# 16、ACT_HI_IDENTITYLINK
insert
into ACT_HI_IDENTITYLINK
(ID_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_, SCOPE_ID_, SCOPE_TYPE_, SCOPE_DEFINITION_ID_, CREATE_TIME_)
values ('5009', 'candidate', null, 'managers', '5008', null, null, null, null, null);
# 17、ACT_RU_EXECUTION
insert
into ACT_RU_EXECUTION
(ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_, IS_EVENT_SCOPE_,
IS_MI_ROOT_, PARENT_ID_, SUPER_EXEC_, ROOT_PROC_INST_ID_, SUSPENSION_STATE_, TENANT_ID_, NAME_, START_ACT_ID_,
START_TIME_, START_USER_ID_, IS_COUNT_ENABLED_, EVT_SUBSCR_COUNT_, TASK_COUNT_, JOB_COUNT_, TIMER_JOB_COUNT_,
SUSP_JOB_COUNT_, DEADLETTER_JOB_COUNT_, VAR_COUNT_, ID_LINK_COUNT_, CALLBACK_ID_, CALLBACK_TYPE_)
values ('5001', 1, '5001', null, 'holidayRequest:1:2503', null, true, false, true, false, false, null, null, '5001', 1,
'', null, 'startEvent', '2023-12-15 11:32:38.903', null, true, 0, 0, 0, 0, 0, 0, 0, 0, null, null),
('5005', 1, '5001', null, 'holidayRequest:1:2503', 'approveTask', true, false, false, false, false, '5001', null,
'5001', 1, '', null, null, '2023-12-15 11:32:39.082', null, true, 0, 1, 0, 0, 0, 0, 0, 0, null, null);
# 18、ACT_RU_TASK
insert
into ACT_RU_TASK
(ID_, REV_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_, ASSIGNEE_, DELEGATION_,
EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_ID_, SCOPE_ID_, SUB_SCOPE_ID_, SCOPE_TYPE_, SCOPE_DEFINITION_ID_,
TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_, CLAIM_TIME_, IS_COUNT_ENABLED_,
VAR_COUNT_, ID_LINK_COUNT_, SUB_TASK_COUNT_)
values ('5008', 1, '同意 或者 拒绝', null, null, 50, '2023-12-15 11:32:39.089', null, null, null, '5005', '5001',
'holidayRequest:1:2503', null, null, null, null, null, 'approveTask', null, null, 1, '', null, null, true, 0, 1,
0);
# 19、ACT_RU_IDENTITYLINK
insert
into ACT_RU_IDENTITYLINK
(ID_, REV_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_, PROC_DEF_ID_, SCOPE_ID_, SCOPE_TYPE_,
SCOPE_DEFINITION_ID_)
values ('5009', 1, 'candidate', null, 'managers', '5008', null, null, null, null, null);
# 20、ACT_RU_VARIABLE
INSERT
INTO ACT_RU_VARIABLE
(ID_, REV_, TYPE_, NAME_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, SCOPE_ID_, SUB_SCOPE_ID_, SCOPE_TYPE_, BYTEARRAY_ID_,
DOUBLE_, LONG_, TEXT_, TEXT2_)
VALUES ('5002', 1, 'integer', 'nrOfHolidays', '5001', '5001', null, null, null, null, null, null, 3, '3', null),
('5003', 1, 'string', 'description', '5001', '5001', null, null, null, null, null, null, null, '请假去做大宝剑',
null),
('5004', 1, 'string', 'employee', '5001', '5001', null, null, null, null, null, null, null, '张三', null);
5、查看任务
5.1、java代码
TaskService taskService = processEngine.getTaskService();
List<Task> managers = taskService.createTaskQuery()
// 通过流程定义id获取任务列表
.processDefinitionKey("holidayRequest")
// 通过组获取任务列表
.taskCandidateGroup("managers")
.list();
managers.forEach(e -> log.info("task:{}", e));
5.2、数据库表流向
# 1、查ACT_GE_PROPERTY
select *
from ACT_GE_PROPERTY
where NAME_ = 'schema.version';
# 2、ACT_RE_DEPLOYMENT
select distinct count(RES.ID_)
from ACT_RE_DEPLOYMENT RES
WHERE RES.ENGINE_VERSION_ = 'v5';
# 3、查ACT_GE_PROPERTY NAME_ = 'cfg.execution-related-entities-count'
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.execution-related-entities-count';
# 4、查ACT_GE_PROPERTY NAME_ = 'cfg.task-related-entities-count'
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.task-related-entities-count';
# 5、ACT_RU_TASK、 ACT_RU_IDENTITYLINK
select distinct RES.*
from ACT_RU_TASK RES
inner join
ACT_RU_IDENTITYLINK I
on I.TASK_ID_ = RES.ID_
inner join
ACT_RE_PROCDEF D
on RES.PROC_DEF_ID_ = D.ID_
WHERE D.KEY_ = 'holidayRequest'
and RES.ASSIGNEE_ is null
and I.TYPE_ = 'candidate'
and (
I.GROUP_ID_ IN (
'managers'
)
)
order by RES.ID_ asc;
6、完成任务
6.1、java代码
TaskService taskService = processEngine.getTaskService();
// 查询任务
Task task = taskService.createTaskQuery()
// 通过流程定义id获取任务列表
.processDefinitionKey("holidayRequest")
// 通过组获取任务列表
.taskCandidateGroup("managers")
.singleResult();
// 定义变量信息
Map<String, Object> variables = new HashMap<>();
variables.put("approved", false);
taskService.complete(task.getId(), variables);
6.2、数据库表流向
# 1、查ACT_GE_PROPERTY
select *
from ACT_GE_PROPERTY
where NAME_ = 'schema.version';
# 2、ACT_RE_DEPLOYMENT
select distinct count(RES.ID_)
from ACT_RE_DEPLOYMENT RES
WHERE RES.ENGINE_VERSION_ = 'v5';
# 3、查ACT_GE_PROPERTY NAME_ = 'cfg.execution-related-entities-count'
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.execution-related-entities-count';
# 4、查ACT_GE_PROPERTY NAME_ = 'cfg.task-related-entities-count'
select *
from ACT_GE_PROPERTY
where NAME_ = 'cfg.task-related-entities-count';
# 5、查询任务 ACT_RU_TASK、 ACT_RU_IDENTITYLINK
select distinct RES.*
from ACT_RU_TASK RES
inner join
ACT_RU_IDENTITYLINK I
on I.TASK_ID_ = RES.ID_
inner join
ACT_RE_PROCDEF D
on RES.PROC_DEF_ID_ = D.ID_
WHERE D.KEY_ = 'holidayRequest'
and RES.ASSIGNEE_ is null
and I.TYPE_ = 'candidate'
and (
I.GROUP_ID_ IN (
'managers'
)
)
order by RES.ID_ asc;
# 6、ACT_RU_TASK
select *
from ACT_RU_TASK
where ID_ = '5008';
# 7、ACT_RE_PROCDEF
select *
from ACT_RE_PROCDEF
where ID_ = 'holidayRequest:1:2503';
# 8、ACT_RE_DEPLOYMENT
select *
from ACT_RE_DEPLOYMENT
where ID_ = '2501';
# 9、ACT_GE_BYTEARRAY
select *
from ACT_GE_BYTEARRAY
where DEPLOYMENT_ID_ = '2501'
order by NAME_ asc;
# 10、ACT_RE_PROCDEF
select *
from ACT_RE_PROCDEF
where DEPLOYMENT_ID_ = '2501'
and KEY_ = 'holidayRequest'
and (
TENANT_ID_ = ''
or TENANT_ID_ is null
);
# 11、ACT_PROCDEF_INFO
select *
from ACT_PROCDEF_INFO
where PROC_DEF_ID_ = 'holidayRequest:1:2503';
# 12、ACT_RU_EXECUTION
select *
from ACT_RU_EXECUTION
where ID_ = '5005';
# 13、ACT_RU_VARIABLE
select *
from ACT_RU_VARIABLE
where EXECUTION_ID_ = '5005'
and TASK_ID_ is null;
# 14、ACT_RU_EXECUTION
select *
from ACT_RU_EXECUTION
where ID_ = '5001';
# 15、ACT_RU_VARIABLE
select *
from ACT_RU_VARIABLE
where EXECUTION_ID_ = '5001'
and TASK_ID_ is null;
# 16、ACT_GE_PROPERTY
select *
from ACT_GE_PROPERTY
where NAME_ = 'next.dbid';
# 17、ACT_GE_PROPERTY
update
ACT_GE_PROPERTY
SET REV_ = 5,
VALUE_ = '10001'
where NAME_ = 'next.dbid'
and REV_ = 4;
# 18、ACT_RU_IDENTITYLINK
select *
from ACT_RU_IDENTITYLINK
where TASK_ID_ = '5008';
# 19、ACT_HI_TASKINST
select *
from ACT_HI_TASKINST
where ID_ = '5008';
# 20、ACT_RU_TASK
select distinct T.*
from ACT_RU_TASK T
where T.EXECUTION_ID_ = '5005';
# 21、ACT_HI_ACTINST
select *
from ACT_HI_ACTINST RES
where EXECUTION_ID_ = '5005'
and ACT_ID_ = 'approveTask'
and END_TIME_ is null;
# 22、ACT_RU_EXECUTION
select *
from ACT_RU_EXECUTION
where PARENT_ID_ = '5001';
# 23、ACT_RU_EXECUTION
select *
from ACT_RU_EXECUTION
where PROC_INST_ID_ = '5001'
and PARENT_ID_ is not null;
# 24、ACT_RU_EXECUTION
select *
from ACT_RU_EXECUTION
where SUPER_EXEC_ = '5001';
# 25、ACT_RU_IDENTITYLINK
select *
from ACT_RU_IDENTITYLINK
where PROC_INST_ID_ = '5001';
# 26、ACT_RU_TASK
select distinct T.*
from ACT_RU_TASK T
where T.EXECUTION_ID_ = '5001';
# 27、ACT_RU_TIMER_JOB
select *
from ACT_RU_TIMER_JOB J
where J.EXECUTION_ID_ = '5001';
# 28、ACT_RU_JOB
select *
from ACT_RU_JOB J
where J.EXECUTION_ID_ = '5001';
# 29、ACT_RU_SUSPENDED_JOB
select *
from ACT_RU_SUSPENDED_JOB J
where J.EXECUTION_ID_ = '5001';
# 30、ACT_RU_DEADLETTER_JOB
select *
from ACT_RU_DEADLETTER_JOB J
where J.EXECUTION_ID_ = '5001';
# 31、ACT_RU_EVENT_SUBSCR
select *
from ACT_RU_EVENT_SUBSCR
where (
EXECUTION_ID_ = '5001'
);
# 32、ACT_HI_PROCINST
select *
from ACT_HI_PROCINST
where PROC_INST_ID_ = '5001';
# 33、ACT_HI_VARINST
insert
into ACT_HI_VARINST
(ID_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, SCOPE_ID_, SUB_SCOPE_ID_, SCOPE_TYPE_,
BYTEARRAY_ID_, DOUBLE_, LONG_, TEXT_, TEXT2_, CREATE_TIME_, LAST_UPDATED_TIME_)
values ('7501', '5001', '5001', null, 'approved', 0, 'boolean', null, null, null, null, null, 0, null, null,
'2023-12-15 13:59:58.504', '2023-12-15 13:59:58.504');
# 34、ACT_HI_ACTINST
insert
into ACT_HI_ACTINST
(ID_, REV_, PROC_DEF_ID_, PROC_INST_ID_, EXECUTION_ID_, ACT_ID_, TASK_ID_, CALL_PROC_INST_ID_, ACT_NAME_, ACT_TYPE_,
ASSIGNEE_, START_TIME_, END_TIME_, DURATION_, DELETE_REASON_, TENANT_ID_)
values ('7502', 1, 'holidayRequest:1:2503', '5001', '5005', 'decision', null, null, null, 'exclusiveGateway', null,
'2023-12-15 13:59:58.536', '2023-12-15 13:59:58.555', 19, null, ''),
('7503', 1, 'holidayRequest:1:2503', '5001', '5005', 'sendRejectionMail', null, null, 'Send out rejection email',
'serviceTask', null, '2023-12-15 13:59:58.555', '2023-12-15 13:59:58.558', 3, null, ''),
('7504', 1, 'holidayRequest:1:2503', '5001', '5005', 'rejectEnd', null, null, null, 'endEvent', null,
'2023-12-15 13:59:58.558', '2023-12-15 13:59:58.56', 2, null, '');
# 35、ACT_HI_PROCINST
update
ACT_HI_PROCINST
SET REV_ = 2,
END_TIME_ = '2023-12-15 13:59:58.631',
DURATION_ = 8839728,
END_ACT_ID_ = 'rejectEnd'
where ID_ = '5001'
and REV_ = 1;
# 36、ACT_RU_EXECUTION
update
ACT_RU_EXECUTION
SET REV_ = 2,
IS_ACTIVE_ = false
where ID_ = '5001'
and REV_ = 1;
# 37、ACT_RU_EXECUTION
update
ACT_RU_EXECUTION
SET REV_ = 2,
ACT_ID_ = 'rejectEnd',
IS_ACTIVE_ = false,
TASK_COUNT_ = 0
where ID_ = '5005'
and REV_ = 1;
# 38、ACT_HI_ACTINST
update
ACT_HI_ACTINST
SET REV_ = 2,
PROC_DEF_ID_ = 'holidayRequest:1:2503',
END_TIME_ = '2023-12-15 13:59:58.533',
DURATION_ = 8839444
where ID_ = '5007'
and REV_ = 1;
# 39、ACT_HI_TASKINST
update
ACT_HI_TASKINST
SET REV_ = 2,
END_TIME_ = '2023-12-15 13:59:58.517',
DURATION_ = 8839408,
LAST_UPDATED_TIME_ = '2023-12-15 13:59:58.517'
where ID_ = '5008'
and REV_ = 1;
# 40、ACT_RU_VARIABLE
delete
from ACT_RU_VARIABLE
where EXECUTION_ID_ = '5001';
# 41、ACT_RU_IDENTITYLINK
delete
from ACT_RU_IDENTITYLINK
where TASK_ID_ = '5008';
# 42、ACT_RU_TASK
delete
from ACT_RU_TASK
where ID_ = '5008'
and REV_ = 1;
# 43、ACT_RU_TASK
delete
from ACT_RU_TASK
where EXECUTION_ID_ = '5001';
# 44、ACT_RU_EXECUTION
delete
from ACT_RU_EXECUTION
where ID_ = '5005'
and REV_ = 2;
# 45、ACT_RU_EXECUTION
delete
from ACT_RU_EXECUTION
where ID_ = '5001'
and REV_ = 2;
7、查看历史任务
7.1、java代码
HistoryService historyService = processEngine.getHistoryService();
List<HistoricActivityInstance> list = historyService.createHistoricActivityInstanceQuery()
.processDefinitionId("holidayRequest:1:2503")
// 查询已经完成的
.finished()
// 指定排序字段和排序
.orderByHistoricActivityInstanceEndTime()
.asc()
.list();
list.forEach(e -> log.info("HistoricActivityInstance:{}", e));
7.2、数据库表流向
# 1、ACT_HI_ACTINST
select RES.*
from ACT_HI_ACTINST RES
WHERE RES.PROC_DEF_ID_ = 'holidayRequest:1:2503'
and RES.END_TIME_ is not null
order by END_TIME_ asc;
# 2、
# 3、
# 4、
8、查看任务
8.1、java代码
8.2、数据库表流向
# 1、
# 2、
# 3、
# 4、