Lay.Li 发表于 2022-6-24 09:23:11

一看就会,超有用活字格技能:一百四十八、8.0删除工作流数据提示任务被取消问题

本帖最后由 Erik.Xue 于 2022-8-24 11:25 编辑

各位格友大家好,大家期待已久的活字格8.0马上就要上线了,不知道大家有没有体验预览版呢。:itwn:
今天给大家带来的是一个目前已知问题的解决方案,这时可能就会有格友提问了,那既然是已知问题为什么不修复呢?其实我们也是很想去修复的,但是因为这个问题比较复杂,修复的话需要一些时间,考虑大家盼望新版本的心情,就没有在这个版本中修复:'(

如果是体验过预览版的格友呢,可能已经遇到过这个问题了。这个问题就是当流程是在外连数据库创建时,删除流程或流程数据会删除不成功,点击删除会一直加载,然后弹出任务被取消的提示。这个帖子就是给大家介绍一下目前的解决方案。
话不多说,上方案,既然在活字格里面删除不掉,那么我们索性就直接在外联数据库中删除,那么这里就给到了大家在外联数据库直接删除流程数据的sql语句,语句如下执行的操作就是创建两个存储过程然后执行删除掉流程中的数据。

首先是mysql数据库的sql语句
创建存储过程sp_delete_hi
delimiter $
CREATE PROCEDURE sp_delete_hi(in processInstanceId varchar(128))
BEGIN
-- 删除通用 hi 表数据
delete from ACT_GE_BYTEARRAY where ID_ in (select BYTEARRAY_ID_ AS ID_ from ACT_HI_VARINST where BYTEARRAY_ID_ IS NOT NULL AND PROC_INST_ID_ = processInstanceId);
delete from ACT_EVT_LOG where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_ACTINST where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_ATTACHMENT where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_COMMENT where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_DETAIL where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_PROCINST where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_TASKINST where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_IDENTITYLINK where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_VARINST where PROC_INST_ID_ = processInstanceId;
END $创建存储过程sp_delete_ru
delimiter $
CREATE PROCEDURE sp_delete_ru(in processInstanceId varchar(128))
BEGIN
-- 删除 ru 表数据
delete from ACT_RU_DEADLETTER_JOB where PROCESS_INSTANCE_ID_ = processInstanceId;
delete from ACT_RU_EVENT_SUBSCR where PROC_INST_ID_ = processInstanceId;
delete from ACT_RU_INTEGRATION where PROCESS_INSTANCE_ID_ = processInstanceId;
delete from ACT_RU_JOB where PROCESS_INSTANCE_ID_ = processInstanceId;
delete from ACT_RU_SUSPENDED_JOB where PROCESS_INSTANCE_ID_ = processInstanceId;
delete from ACT_RU_TASK where PROC_INST_ID_ = processInstanceId;
delete from ACT_RU_TIMER_JOB where PROCESS_INSTANCE_ID_ = processInstanceId;

CREATE TEMPORARY TABLE temp_byte_ids
SELECT BYTEARRAY_ID_ as ID_
from ACT_RU_VARIABLE where BYTEARRAY_ID_ IS NOT NULL AND PROC_INST_ID_ = processInstanceId;
delete from ACT_RU_VARIABLE where PROC_INST_ID_ = processInstanceId;
delete from ACT_GE_BYTEARRAY where ID_ in (select * from temp_byte_ids);
drop TEMPORARY table temp_byte_ids;

delete from ACT_RU_IDENTITYLINK where PROC_INST_ID_ = processInstanceId;
delete from ACT_RU_EXECUTION where PROC_INST_ID_ = processInstanceId;
END $

调用这两个存储过程,其中参数值为要删除流程的流程实例ID,注意参数是流程实例ID,不是流程定义ID,这个流程有多少个流程实例,全部清空的话,就要以每个流程实例ID为参数都执行一遍哈~CALL sp_delete_hi('流程实例ID');

CALL sp_delete_ru('流程实例ID');
然后是sqlserver的sql语句
创建存储过程sp_delete_hi
CREATE PROC sp_delete_hi
@processInstanceId varchar(128)
AS
BEGIN
-- 删除通用 hi 表数据
delete ACT_GE_BYTEARRAY where ID_ in (select BYTEARRAY_ID_ from ACT_HI_VARINST where BYTEARRAY_ID_ IS NOT NULL AND PROC_INST_ID_ = @processInstanceId);
delete ACT_EVT_LOG where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_ACTINST where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_ATTACHMENT where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_COMMENT where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_DETAIL where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_PROCINST where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_TASKINST where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_IDENTITYLINK where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_VARINST where PROC_INST_ID_ = @processInstanceId;
END创建存储过程sp_delete_ru
CREATE PROC sp_delete_ru
@processInstanceId varchar(128)
AS
BEGIN
-- 删除 ru 表数据
delete ACT_RU_DEADLETTER_JOB where PROCESS_INSTANCE_ID_ = @processInstanceId;
delete ACT_RU_EVENT_SUBSCR where PROC_INST_ID_ = @processInstanceId;
delete ACT_RU_INTEGRATION where PROCESS_INSTANCE_ID_ = @processInstanceId;
delete ACT_RU_JOB where PROCESS_INSTANCE_ID_ = @processInstanceId;
delete ACT_RU_SUSPENDED_JOB where PROCESS_INSTANCE_ID_ = @processInstanceId;
delete ACT_RU_TASK where PROC_INST_ID_ = @processInstanceId;
delete ACT_RU_TIMER_JOB where PROCESS_INSTANCE_ID_ = @processInstanceId;

select BYTEARRAY_ID_ as ID_ into temp_byte_ids from ACT_RU_VARIABLE where BYTEARRAY_ID_ IS NOT NULL AND PROC_INST_ID_ = @processInstanceId;
delete ACT_RU_VARIABLE where PROC_INST_ID_ = @processInstanceId;
delete ACT_GE_BYTEARRAY where ID_ in (select * from temp_byte_ids);
drop table temp_byte_ids;

delete ACT_RU_IDENTITYLINK where PROC_INST_ID_ = @processInstanceId;
delete ACT_RU_EXECUTION where PROC_INST_ID_ = @processInstanceId;
END调用这两个存储过程,其中参数值为要删除流程的流程实例ID,和mysql中的相同要注意参数是流程实例ID,不是流程定义ID,这个流程有多少个流程实例,全部清空的话,就要以每个流程实例ID为参数都执行一遍哈~
EXEC sp_delete_hi '流程实例ID';

EXEC sp_delete_ru '流程实例ID';
好了,这就是给大家介绍的目前的解决方案,不过请大家放心。这个问题开发同事以及在研究了,在之后的版本中是会去修复的,目前只能先麻烦大家用这种方式去绕一下了:loveliness:
页: [1]
查看完整版本: 一看就会,超有用活字格技能:一百四十八、8.0删除工作流数据提示任务被取消问题