找回密码
 立即注册

QQ登录

只需一步,快速开始

Lay.Li 悬赏达人认证 活字格认证
超级版主   /  发表于:2022-6-24 09:23  /   查看:2826  /  回复:0
本帖最后由 Erik.Xue 于 2022-8-24 11:25 编辑

各位格友大家好,大家期待已久的活字格8.0马上就要上线了,不知道大家有没有体验预览版呢。
今天给大家带来的是一个目前已知问题的解决方案,这时可能就会有格友提问了,那既然是已知问题为什么不修复呢?其实我们也是很想去修复的,但是因为这个问题比较复杂,修复的话需要一些时间,考虑大家盼望新版本的心情,就没有在这个版本中修复
1517411228500518.gif217166442.png
如果是体验过预览版的格友呢,可能已经遇到过这个问题了。这个问题就是当流程是在外连数据库创建时,删除流程或流程数据会删除不成功,点击删除会一直加载,然后弹出任务被取消的提示。这个帖子就是给大家介绍一下目前的解决方案。
话不多说,上方案,既然在活字格里面删除不掉,那么我们索性就直接在外联数据库中删除,那么这里就给到了大家在外联数据库直接删除流程数据的sql语句,语句如下执行的操作就是创建两个存储过程然后执行删除掉流程中的数据。

首先是mysql数据库的sql语句
创建存储过程sp_delete_hi
  1. delimiter $
  2. CREATE PROCEDURE sp_delete_hi(in processInstanceId varchar(128))
  3. BEGIN
  4. -- 删除通用 hi 表数据
  5. 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);
  6. delete from ACT_EVT_LOG where PROC_INST_ID_ = processInstanceId;
  7. delete from ACT_HI_ACTINST where PROC_INST_ID_ = processInstanceId;
  8. delete from ACT_HI_ATTACHMENT where PROC_INST_ID_ = processInstanceId;
  9. delete from ACT_HI_COMMENT where PROC_INST_ID_ = processInstanceId;
  10. delete from ACT_HI_DETAIL where PROC_INST_ID_ = processInstanceId;
  11. delete from ACT_HI_PROCINST where PROC_INST_ID_ = processInstanceId;
  12. delete from ACT_HI_TASKINST where PROC_INST_ID_ = processInstanceId;
  13. delete from ACT_HI_IDENTITYLINK where PROC_INST_ID_ = processInstanceId;
  14. delete from ACT_HI_VARINST where PROC_INST_ID_ = processInstanceId;
  15. END $
复制代码
创建存储过程sp_delete_ru
  1. delimiter $
  2. CREATE PROCEDURE sp_delete_ru(in processInstanceId varchar(128))
  3. BEGIN
  4. -- 删除 ru 表数据
  5. delete from ACT_RU_DEADLETTER_JOB where PROCESS_INSTANCE_ID_ = processInstanceId;
  6. delete from ACT_RU_EVENT_SUBSCR where PROC_INST_ID_ = processInstanceId;
  7. delete from ACT_RU_INTEGRATION where PROCESS_INSTANCE_ID_ = processInstanceId;
  8. delete from ACT_RU_JOB where PROCESS_INSTANCE_ID_ = processInstanceId;
  9. delete from ACT_RU_SUSPENDED_JOB where PROCESS_INSTANCE_ID_ = processInstanceId;
  10. delete from ACT_RU_TASK where PROC_INST_ID_ = processInstanceId;
  11. delete from ACT_RU_TIMER_JOB where PROCESS_INSTANCE_ID_ = processInstanceId;

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

  18. delete from ACT_RU_IDENTITYLINK where PROC_INST_ID_ = processInstanceId;
  19. delete from ACT_RU_EXECUTION where PROC_INST_ID_ = processInstanceId;
  20. END $

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

  2. CALL sp_delete_ru('流程实例ID');
复制代码

然后是sqlserver的sql语句
创建存储过程sp_delete_hi
  1. CREATE PROC sp_delete_hi
  2. @processInstanceId varchar(128)
  3. AS
  4. BEGIN
  5. -- 删除通用 hi 表数据
  6. 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);
  7. delete ACT_EVT_LOG where PROC_INST_ID_ = @processInstanceId;
  8. delete ACT_HI_ACTINST where PROC_INST_ID_ = @processInstanceId;
  9. delete ACT_HI_ATTACHMENT where PROC_INST_ID_ = @processInstanceId;
  10. delete ACT_HI_COMMENT where PROC_INST_ID_ = @processInstanceId;
  11. delete ACT_HI_DETAIL where PROC_INST_ID_ = @processInstanceId;
  12. delete ACT_HI_PROCINST where PROC_INST_ID_ = @processInstanceId;
  13. delete ACT_HI_TASKINST where PROC_INST_ID_ = @processInstanceId;
  14. delete ACT_HI_IDENTITYLINK where PROC_INST_ID_ = @processInstanceId;
  15. delete ACT_HI_VARINST where PROC_INST_ID_ = @processInstanceId;
  16. END
复制代码
创建存储过程sp_delete_ru
  1. CREATE PROC sp_delete_ru
  2. @processInstanceId varchar(128)
  3. AS
  4. BEGIN
  5. -- 删除 ru 表数据
  6. delete ACT_RU_DEADLETTER_JOB where PROCESS_INSTANCE_ID_ = @processInstanceId;
  7. delete ACT_RU_EVENT_SUBSCR where PROC_INST_ID_ = @processInstanceId;
  8. delete ACT_RU_INTEGRATION where PROCESS_INSTANCE_ID_ = @processInstanceId;
  9. delete ACT_RU_JOB where PROCESS_INSTANCE_ID_ = @processInstanceId;
  10. delete ACT_RU_SUSPENDED_JOB where PROCESS_INSTANCE_ID_ = @processInstanceId;
  11. delete ACT_RU_TASK where PROC_INST_ID_ = @processInstanceId;
  12. delete ACT_RU_TIMER_JOB where PROCESS_INSTANCE_ID_ = @processInstanceId;

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

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

  2. EXEC sp_delete_ru '流程实例ID';
复制代码

好了,这就是给大家介绍的目前的解决方案,不过请大家放心。这个问题开发同事以及在研究了,在之后的版本中是会去修复的,目前只能先麻烦大家用这种方式去绕一下了

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部