Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzwf
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzwf
提交
13d72b1c
提交
13d72b1c
编写于
5月 10, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
工作流部署
上级
bf25ac0b
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
56 行增加
和
26 行删除
+56
-26
ProcessInstanceListener.java
...lab/core/extensions/listener/ProcessInstanceListener.java
+28
-17
WFCoreService.java
...ava/cn/ibizlab/core/extensions/service/WFCoreService.java
+28
-9
未找到文件。
ibzwf-core/src/main/java/cn/ibizlab/core/extensions/listener/ProcessInstanceListener.java
浏览文件 @
13d72b1c
...
...
@@ -36,9 +36,6 @@ import java.util.Map;
@Component
public
class
ProcessInstanceListener
implements
FlowableEventListener
{
@Autowired
@Lazy
private
WFCoreService
wfCoreService
;
@Autowired
@Lazy
...
...
@@ -48,8 +45,6 @@ public class ProcessInstanceListener implements FlowableEventListener {
@Lazy
private
RemoteService
remoteService
;
@Autowired
private
AuthTokenUtil
jwtTokenUtil
;
@Override
public
void
onEvent
(
FlowableEvent
evt
)
{
...
...
@@ -62,8 +57,9 @@ public class ProcessInstanceListener implements FlowableEventListener {
if
(
executionEntity
.
getVariable
(
"cloud-serviceid"
)==
null
)
return
;
String
businessKey
=(
String
)
executionEntity
.
getVariable
(
"businessKey"
);
AuthenticationUser
curUser
=(
AuthenticationUser
)
executionEntity
.
getVariable
(
"curuser"
);
HashMap
curUser
=(
HashMap
)
executionEntity
.
getVariable
(
"curuser"
);
String
entity
=
executionEntity
.
getVariable
(
"entitys"
).
toString
();
String
cloudServiceid
=
executionEntity
.
getVariable
(
"cloud-serviceid"
).
toString
();
Map
setting
=
wfModelService
.
getProcessGlobalSetting
(
executionEntity
.
getProcessDefinitionId
());
String
wfstepfield
=
""
;
...
...
@@ -75,30 +71,41 @@ public class ProcessInstanceListener implements FlowableEventListener {
String
udstatefield
=
""
;
if
(
setting
.
containsKey
(
"udstatefield"
+
"_"
+
entity
))
udstatefield
=
setting
.
get
(
"udstatefield"
+
"_"
+
entity
).
toString
();
String
wfstate
=
""
;
if
(
setting
.
containsKey
(
"wfstate"
+
"_"
+
entity
))
wfstate
=
setting
.
get
(
"wfstate
"
+
"_"
+
entity
).
toString
();
String
wfstate
field
=
""
;
if
(
setting
.
containsKey
(
"wfstate
field
"
+
"_"
+
entity
))
wfstate
field
=
setting
.
get
(
"wfstatefield
"
+
"_"
+
entity
).
toString
();
String
wfverfield
=
""
;
if
(
setting
.
containsKey
(
"wfverfield"
+
"_"
+
entity
))
wfverfield
=
setting
.
get
(
"wfverfield"
+
"_"
+
entity
).
toString
();
String
majortext_field
=
""
;
if
(
setting
.
containsKey
(
"majortext"
+
"_"
+
entity
))
{
majortext_field
=
setting
.
get
(
"majortext"
+
"_"
+
entity
).
toString
();
Object
activedata
=
executionEntity
.
getVariable
(
"activedata"
);
if
(
activedata
!=
null
)
executionEntity
.
setVariable
(
"majortext"
,((
Map
)
activedata
).
get
(
majortext_field
));
}
executionEntity
.
setVariable
(
"wfstepfield"
,
wfstepfield
);
executionEntity
.
setVariable
(
"wfinstfield"
,
wfinstfield
);
executionEntity
.
setVariable
(
"udstatefield"
,
udstatefield
);
executionEntity
.
setVariable
(
"wfstate
"
,
wfstate
);
executionEntity
.
setVariable
(
"wfstate
field"
,
wfstatefield
);
executionEntity
.
setVariable
(
"wfverfield"
,
wfverfield
);
executionEntity
.
setVariable
(
"majortextfield"
,
majortext_field
);
Map
callbackArg
=
new
LinkedHashMap
();
if
(!
StringUtils
.
isEmpty
(
wfinstfield
))
callbackArg
.
put
(
wfinstfield
,
executionEntity
.
getProcessInstanceId
());
if
(!
StringUtils
.
isEmpty
(
wfstate
))
callbackArg
.
put
(
wfstate
,
1
);
if
(!
StringUtils
.
isEmpty
(
wfstate
field
))
callbackArg
.
put
(
wfstate
field
,
1
);
if
(!
StringUtils
.
isEmpty
(
udstatefield
))
callbackArg
.
put
(
udstatefield
,
"20"
);
if
((!
StringUtils
.
isEmpty
(
wfverfield
))&&(
executionEntity
.
getVariable
(
"wfversion"
)!=
null
))
callbackArg
.
put
(
wfverfield
,
Integer
.
parseInt
(
executionEntity
.
getVariable
(
"wfversion"
).
toString
()));
if
(
callbackArg
.
size
()>
0
)
{
String
token
=
"Bearer "
+
jwtTokenUtil
.
generateToken
(
curUser
);
if
(
curUser
.
get
(
"bearer-token"
)==
null
)
return
;
String
token
=
curUser
.
get
(
"bearer-token"
).
toString
();
remoteService
.
getClient
(
cloudServiceid
).
put
(
entity
+
"/"
+
businessKey
,
token
,
callbackArg
);
}
}
...
...
@@ -117,7 +124,7 @@ public class ProcessInstanceListener implements FlowableEventListener {
if
(
executionEntity
.
getVariable
(
"cloud-serviceid"
)==
null
)
return
;
String
businessKey
=(
String
)
executionEntity
.
getVariable
(
"businessKey"
);
AuthenticationUser
curUser
=(
AuthenticationUser
)
executionEntity
.
getVariable
(
"curuser"
);
HashMap
curUser
=(
HashMap
)
executionEntity
.
getVariable
(
"curuser"
);
String
entity
=
executionEntity
.
getVariable
(
"entitys"
).
toString
();
String
cloudServiceid
=
executionEntity
.
getVariable
(
"cloud-serviceid"
).
toString
();
String
wfstepfield
=
executionEntity
.
getVariable
(
"wfstepfield"
).
toString
();
...
...
@@ -131,7 +138,9 @@ public class ProcessInstanceListener implements FlowableEventListener {
if
(!
StringUtils
.
isEmpty
(
wfstepfield
))
callbackArg
.
put
(
wfstepfield
,
""
);
if
(
callbackArg
.
size
()>
0
)
{
String
token
=
"Bearer "
+
jwtTokenUtil
.
generateToken
(
curUser
);
if
(
curUser
.
get
(
"bearer-token"
)==
null
)
return
;
String
token
=
curUser
.
get
(
"bearer-token"
).
toString
();
remoteService
.
getClient
(
cloudServiceid
).
put
(
entity
+
"/"
+
businessKey
,
token
,
callbackArg
);
}
...
...
@@ -169,7 +178,7 @@ public class ProcessInstanceListener implements FlowableEventListener {
if
(
event
.
getExecution
().
getVariable
(
"cloud-serviceid"
)==
null
)
return
;
String
businessKey
=(
String
)
event
.
getExecution
().
getVariable
(
"businessKey"
);
AuthenticationUser
curUser
=(
AuthenticationUser
)
event
.
getExecution
().
getVariable
(
"curuser"
);
HashMap
curUser
=(
HashMap
)
event
.
getExecution
().
getVariable
(
"curuser"
);
String
entity
=
event
.
getExecution
().
getVariable
(
"entitys"
).
toString
();
String
cloudServiceid
=
event
.
getExecution
().
getVariable
(
"cloud-serviceid"
).
toString
();
String
wfstepfield
=
event
.
getExecution
().
getVariable
(
"wfstepfield"
).
toString
();
...
...
@@ -177,7 +186,9 @@ public class ProcessInstanceListener implements FlowableEventListener {
if
(!
StringUtils
.
isEmpty
(
wfstepfield
)&&
event
.
getActivityId
().
startsWith
(
"tid-"
))
callbackArg
.
put
(
wfstepfield
,
event
.
getActivityId
().
split
(
"-"
)[
1
]);
if
(
callbackArg
.
size
()>
0
)
{
String
token
=
"Bearer "
+
jwtTokenUtil
.
generateToken
(
curUser
);
if
(
curUser
.
get
(
"bearer-token"
)==
null
)
return
;
String
token
=
curUser
.
get
(
"bearer-token"
).
toString
();
remoteService
.
getClient
(
cloudServiceid
).
put
(
entity
+
"/"
+
businessKey
,
token
,
callbackArg
);
}
...
...
ibzwf-core/src/main/java/cn/ibizlab/core/extensions/service/WFCoreService.java
浏览文件 @
13d72b1c
...
...
@@ -60,6 +60,25 @@ public class WFCoreService
@Autowired
private
IWFProcessDefinitionService
iwfProcessDefinitionService
;
@Autowired
private
AuthTokenUtil
jwtTokenUtil
;
private
HashMap
getCurUser
()
{
HashMap
curUser
=
new
HashMap
();
AuthenticationUser
user
=
AuthenticationUser
.
getAuthenticationUser
();
curUser
.
put
(
"userid"
,
user
.
getUserid
());
curUser
.
put
(
"username"
,
user
.
getUsername
());
curUser
.
put
(
"personname"
,
user
.
getPersonname
());
curUser
.
put
(
"orgid"
,
user
.
getOrgid
());
curUser
.
put
(
"mdeptid"
,
user
.
getMdeptid
());
curUser
.
put
(
"bcode"
,
user
.
getBcode
());
curUser
.
put
(
"orgInfo"
,
user
.
getOrgInfo
());
curUser
.
put
(
"sessionParams"
,
user
.
getSessionParams
());
curUser
.
put
(
"bearer-token"
,
"Bearer "
+
jwtTokenUtil
.
generateToken
(
user
));
return
curUser
;
}
public
List
<
WFProcessDefinition
>
getWorkflow
(
String
system
,
String
appname
,
String
entity
)
{
return
wfModelService
.
getWorkflow
(
system
,
entity
);
...
...
@@ -161,7 +180,7 @@ public class WFCoreService
Map
<
String
,
Object
>
variables
=
new
LinkedHashMap
<>();
variables
.
put
(
"businessKey"
,
businessKey
);
variables
.
put
(
"activedata"
,
instance
.
get
(
"activedata"
));
variables
.
put
(
"curuser"
,
AuthenticationUser
.
getAuthentication
User
());
variables
.
put
(
"curuser"
,
getCur
User
());
variables
.
put
(
"cloud-serviceid"
,
system
+
"-"
+
appname
);
variables
.
put
(
"system"
,
system
);
variables
.
put
(
"appname"
,
appname
);
...
...
@@ -263,9 +282,9 @@ public class WFCoreService
}
if
(!
StringUtils
.
isEmpty
(
taskDefinitionKey
))
query
.
taskDefinitionKey
(
taskDefinitionKey
);
List
<
Task
>
tasks
=
query
.
includeProcessVariables
().
listPage
(
0
,
500
);
List
<
Task
>
tasks
=
query
.
listPage
(
0
,
500
);
for
(
Task
task:
tasks
)
{
Object
key
=
task
.
get
ProcessVariables
().
get
(
"businessKey"
);
Object
key
=
task
.
get
Category
(
);
if
(
key
!=
null
)
{
String
str
=
key
.
toString
();
if
(
str
.
indexOf
(
":k-"
)>
0
)
...
...
@@ -292,7 +311,7 @@ public class WFCoreService
Map
<
String
,
Object
>
transientVariables
=
new
LinkedHashMap
<>();
transientVariables
.
put
(
"activedata"
,
taskWay
.
get
(
"activedata"
));
transientVariables
.
put
(
"curuser"
,
AuthenticationUser
.
getAuthentication
User
());
transientVariables
.
put
(
"curuser"
,
getCur
User
());
//根据流程定义启动流程
Authentication
.
setAuthenticatedUserId
(
userId
);
...
...
@@ -469,8 +488,6 @@ public class WFCoreService
@Autowired
private
RemoteService
remoteService
;
@Autowired
private
AuthTokenUtil
jwtTokenUtil
;
public
void
execute
(
DelegateExecution
delegateExecution
,
Object
activedata
)
throws
Exception
{
//String entity = (String)delegateExecution.getVariable("pass");
...
...
@@ -478,7 +495,7 @@ public class WFCoreService
{
ServiceTask
task
=(
ServiceTask
)
delegateExecution
.
getCurrentFlowElement
();
AuthenticationUser
curUser
=(
AuthenticationUser
)
delegateExecution
.
getVariable
(
"curuser"
);
HashMap
curUser
=(
HashMap
)
delegateExecution
.
getVariable
(
"curuser"
);
String
businessKey
=(
String
)
delegateExecution
.
getVariable
(
"businessKey"
);
String
cloudServiceId
=(
String
)
delegateExecution
.
getVariable
(
"cloud-serviceid"
);
...
...
@@ -504,7 +521,9 @@ public class WFCoreService
}
if
(
StringUtils
.
isEmpty
(
serviceEntity
)||
StringUtils
.
isEmpty
(
serviceDEAction
))
return
;
String
token
=
"Bearer "
+
jwtTokenUtil
.
generateToken
(
curUser
);
if
(
curUser
.
get
(
"bearer-token"
)==
null
)
return
;
String
token
=
curUser
.
get
(
"bearer-token"
).
toString
();
String
path
=
serviceEntity
;
//cloudServiceId="support5";
if
(
serviceDEAction
.
equalsIgnoreCase
(
"create"
))
...
...
@@ -543,7 +562,7 @@ public class WFCoreService
return
new
Timestamp
(
new
java
.
util
.
Date
().
getTime
());
}
public
String
getGroupUsers
(
String
groupIds
,
AuthenticationUser
user
,
LinkedHashMap
<
String
,
Object
>
activedata
)
public
String
getGroupUsers
(
String
groupIds
,
HashMap
user
,
LinkedHashMap
<
String
,
Object
>
activedata
)
{
String
strUsers
=
""
;
if
(
StringUtils
.
isEmpty
(
groupIds
))
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录