Jbpm工作流表补数记录

一: 历史数据表
11.  JBPM4_HIST_ACTINST 流程活动(节点)实例表 存放Activity Instance的历史记录
12.  JBPM4_HIST_DETAIL  流程历史详细表    保存Variable的变更记录
13.  JBPM4_HIST_PROCINST 流程实例历史表 存放Process Instance的历史信息
14.  JBPM4_HIST_TASK  流程任务实例历史表 Task的历史信息。
15.  JBPM4_HIST_VAR 流程变量(上下文)历史表 保存历史的变量
 
若:
在流程最后一步,发起人提交处长后,处长在审核同意操作后,工作流程已执行完,但,业务表没有同步更新:
本次记录限于:处长 在流程审核最后操作时,执行同意流程时:

--子表,procinst外键
delete from JBPM4_HIST_DETAIL where hproci_='13433593';
--子表,procinst外键
delete from JBPM4_HIST_ACTINST where execution_='JbpmCheckFlowVersionThi.13433593' ;
--主表,BDid主键
delete from JBPM4_HIST_PROCINST where dbid_ = 13433593 ;

delete from jbpm4_hist_task where dbid_ = 13364559 ;

--工作流业务表

insert into jbpm4_execution (dbid_, class_, dbversion_, activityname_, procdefid_, hasvars_, name_, key_, id_, state_, susphiststate_, priority_, hisactinst_, parent_, instance_, superexec_, subprocinst_, parent_idx_) values (13433593, 'pvm', 114, '处长岗', 'JbpmCheckFlowVersionThi-3133', 1, null, null, 'JbpmCheckFlowVersionThi.13433593', 'active-root', null, 0, 13364560, null, 13433593, null, null, null);

insert into jbpm4_task (dbid_, class_, dbversion_, name_, descr_, state_, susphiststate_, assignee_, form_, priority_, create_, duedate_, progress_, signalling_, execution_id_, activity_name_, hasvars_, supertask_, execution_, procinst_, swimlane_, taskdefname_) values (13364559, 'T ', 1, '处长岗', null, 'open', null, 'directorV1.3', null, 0, TO_DATE('2016-03-22 15:54:05', '%Y-%m-%d %H:%M:%S'), null, null, 1, 'JbpmCheckFlowVersionThi.13433593', '处长岗', 0, null, 13433593, 13433593, null, '处长岗');

insert into JBPM4_VARIABLE (dbid_, class_, dbversion_, key_, converter_, hist_, execution_, task_, lob_, date_value_, double_value_, classname_, long_value_, string_value_, text_value_, exesys_) values (13433593, 'string', 0, 'opinion', null, 0, 13433593, null, null, null, null, null, null, 'YES', null, null);

主子表关系:

JBPM4_HIST_PROCINST这张表,因为JBPM4_HIST_ACTINST表的HPROCI_字段是关联JBPM4_HIST_PROCINST表的DBID_字段,如果JBPM4_HIST_PROCINST不存在就会报 table or view not exist.  (表或视图不存在)

关联:ACTINST.hproci_ = PROCINST.dbid_(主键);
子表:JBPM4_HIST_ACTINST ;
主表:JBPM4_HIST_PROCINST ;
--------------------------------------------------------------------------------------------------------------------------------------
补数表:
jbpm4_execution;jbpm4_task;JBPM4_VARIABLE;
补数原则:按照如下顺序;
select * from jbpm4_execution where dbid_ ='13433593';// dbid= reinsbpmMain.taskid;
select * from jbpm4_task where dbid_='13364559';// 原则上为hist_task.taskid,约束JBPM4_HIST_ACTINST表的htask_

select * from JBPM4_VARIABLE where dbid_='13433593';// dbid= reinsbpmMain.taskid;

dbid= reinsbpmMain.taskid;

 删除表:按照如下顺序;
 delete from JBPM4_HIST_ACTINST where dbid_ in (13364560,13354970) ;

delete from JBPM4_HIST_PROCINST where dbid_ = 13433593 ;
delete from jbpm4_hist_task where dbid_ = 13364559 ;

关联量表:

select * from jbpm4_hist_task where execution_ = 'JbpmCheckFlowVersionThi.13433593' ; //若 hist_actinst表中,
select * from JBPM4_HIST_ACTINST where execution_='JbpmCheckFlowVersionThi.13433593' ; //删除处长审批,即 最后一条数据!注:需注意两者约束!

 
 如上分析:若hist_actinst表中,处长审批节点中,htask字段可留值(即hist_task中会有一条dbid_为9092064的数据),这样,在执行时,只会更新9092064其时间,不会重新插入时间!
 
第二:流程实例表 补数原则,基于!
jbpm4_execution 流程实例表:
以JBPM4_HIST_ACTINST表记录为依据 进行补数!
select * from jbpm4_execution where dbid_ ='13433989';//id=task.execution_;
 select * from jbpm4_task where dbid_='13364561';//ACTINST.htask_

select * from JBPM4_VARIABLE where dbid_='13433989';//同上!

select * from JBPM4_HIST_PROCINST where dbid_ = 13433593 ;//JBPM4_HIST_ACTINST.proch_;

 
补数时,一定确保如上所提表中数据完整,确保在其约束下可验证流程id一致性!
posted @ 2016-04-27 10:17  唐僧吃肉  阅读(442)  评论(0编辑  收藏  举报