flowable发起申请后无法查看申请记录
背景:小程序上线,但发现即使登录失效的情况下仍然可以发起申请。导致申请人无法查看到自己的申请记录。
一、问题原因
- 登录失效导致后端无法查找到用户userId, 因为token失效。
- 导致在给flowable流程传递参数失败。
- 获取用户userId的方法没有抛出异常,而是直接返回Null值,这在使用转String的方法时将Null值转换成了字符串null。而导致了问题。
二、解决方案。
- 两种情况:1. 未结束流程处理。2. 已结束流程处理
1. 未结束流程情况
- 解释:根据登录小程序的手机号找到用户Id(userId)
- 找到
流程框架flowable的相关表数据进行更新
- 更新
act_ru_variable表
查找initiator变量值, 更新TEXT_字段值为userId
。若程序中有根据次字段查询用户userId
的地方会报错。
- 更新
act_ru_execution表
查找start_user_id字段值更新值为userId
## 1. 查询initiator是null值的变量数据进行导出。
select t2.TEXT_ ,T2.PROC_INST_ID_ ,t2.* from act_ru_variable t2 where t2.PROC_INST_ID_ IN
(select T.PROC_INST_ID_ from act_ru_variable t where t.NAME_ = 'initiator' and t.TEXT_ = 'null')
and T2.NAME_ IN ('idNumber','name')
order by ID_;
## 2. 再根据导出的数据查找以下内容,更新变量表和执行表中发起流程使用的相关字段
select * from sys_user t3 where t3.phonenumber = '18****5';
select * from act_ru_variable t3 where T3.PROC_INST_ID_ = 'ed52110***35a686' and t3.NAME_ = 'initiator';
select * from act_ru_execution T where T.PROC_INST_ID_ = '755a*****721fdc8'
2. 已结束流程情况
- 流程结束后流程数据会转移,
在act_ru_procinst转到act_hi_procinst, act_ru_varinst转到act_hi_varinst
## 根据发起流程时传入的身份证号信息查找流程变量,目的是查找流程实例id(procInstId)
select * from act_hi_varinst T where T.NAME_ = 'idNumber' and T.TEXT_ = '4115********5'
## 根据流程实例Id(procInstId)查找流程节点实例
select * from act_hi_actinst t where t.PROC_INST_ID_ ='755a3f59-8****24721fdc8'
## 根据流程实例id(procInstId)查找历史流程实例。并更新实例中发起流程数据。
select * from act_hi_procinst t where t.PROC_INST_ID_ = '755a3f59-******a224721fdc8'
## 根据流程实例更新历史流程变量中发起人变量->initiator
select * from act_hi_varinst T where t.PROC_INST_ID_ ='755a3f59********4721fdc8'