Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzwf
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzwf
提交
2e315112
提交
2e315112
编写于
3月 21, 2021
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
下一步条件(清除role其余用户待办)
上级
9825bc5e
变更
2
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
185 行增加
和
99 行删除
+185
-99
ProcessInstanceListener.java
...workflow/extensions/listener/ProcessInstanceListener.java
+74
-74
WFCoreService.java
...izlab/core/workflow/extensions/service/WFCoreService.java
+111
-25
未找到文件。
ibzwf-core/src/main/java/cn/ibizlab/core/workflow/extensions/listener/ProcessInstanceListener.java
浏览文件 @
2e315112
此差异已折叠。
点击以展开。
ibzwf-core/src/main/java/cn/ibizlab/core/workflow/extensions/service/WFCoreService.java
浏览文件 @
2e315112
...
...
@@ -1577,23 +1577,6 @@ public class WFCoreService
return
false
;
}
}
/**
* 判断是否需要挂起
* @param execution
* @return
*/
public
boolean
accessClaim
(
DelegateExecution
execution
)
{
Object
sequenceFlowId
=
execution
.
getVariable
(
"sequenceFlowId"
);
String
flowAccessCond
=
getNextCondition
(
execution
,
sequenceFlowId
);
// role : any || all
if
(!
ObjectUtils
.
isEmpty
(
flowAccessCond
)
&&
"ANY"
.
equalsIgnoreCase
(
flowAccessCond
)){
return
true
;
}
else
if
(!
ObjectUtils
.
isEmpty
(
flowAccessCond
)
&&
"ALL|ROLE:ANY"
.
equalsIgnoreCase
(
flowAccessCond
))
{
return
true
;
}
else
{
return
false
;
}
}
/**
* 获取连接线条件 (all/any/all|role:any)
...
...
@@ -1602,7 +1585,7 @@ public class WFCoreService
* @param sequenceFlowId
* @return
*/
p
rivate
String
getNextCondition
(
DelegateExecution
execution
,
Object
sequenceFlowId
)
{
p
ublic
String
getNextCondition
(
DelegateExecution
execution
,
Object
sequenceFlowId
)
{
if
(!
ObjectUtils
.
isEmpty
(
execution
.
getCurrentFlowElement
())
&&
execution
.
getCurrentFlowElement
()
instanceof
UserTask
)
{
UserTask
userTask
=
(
UserTask
)
execution
.
getCurrentFlowElement
();
for
(
SequenceFlow
flow
:
userTask
.
getOutgoingFlows
())
{
...
...
@@ -1625,13 +1608,6 @@ public class WFCoreService
return
null
;
}
/**
* role:any 认领当前任务,挂起将role中其他人任务
*/
public
void
ClaimTask
(
String
taskId
,
String
userId
)
{
taskService
.
claim
(
taskId
,
userId
);
}
/**
* 获取用户所属的工作流角色
* @param userId
...
...
@@ -1726,4 +1702,114 @@ public class WFCoreService
}
return
task
;
}
/**
* 清除角色中其他成员待办任务
* @param userRoles
* @param execution
*/
public
void
deleteRoleTask
(
Set
userRoles
,
DelegateExecution
execution
)
{
Object
processInstanceId
=
execution
.
getProcessInstanceId
();
if
(
ObjectUtils
.
isEmpty
(
processInstanceId
)){
throw
new
BadRequestAlertException
(
"无法获取流程实例"
,
""
,
""
);
}
Set
<
String
>
roleUserIds
=
getUsersByRole
(
userRoles
,
execution
);
if
(
roleUserIds
.
size
()>
0
){
Map
param
=
new
HashMap
();
param
.
put
(
"userids"
,
roleUserIds
);
param
.
put
(
"processinstanceid"
,
processInstanceId
);
List
<
Map
>
tasks
=
wfCoreMapper
.
searchUserTask
(
param
);
if
(
tasks
.
size
()>
0
){
for
(
Map
task
:
tasks
){
Object
executionId
=
task
.
get
(
"execution"
);
if
(!
StringUtils
.
isEmpty
(
executionId
)){
runtimeService
.
deleteMultiInstanceExecution
(
String
.
valueOf
(
executionId
),
false
);
}
}
}
}
}
/**
* 获取角色成员
* @param roles
* @param execution
* @return
*/
public
Set
<
String
>
getUsersByRole
(
Set
roles
,
DelegateExecution
execution
)
{
Set
userIds
=
new
HashSet
();
if
(!
ObjectUtils
.
isEmpty
(
roles
))
{
String
candidateUsers
=
getCandidateUsers
(
execution
);
if
(!
StringUtils
.
isEmpty
(
candidateUsers
))
{
LinkedHashMap
executionMap
=
(
LinkedHashMap
)
execution
.
getVariable
(
"activedata"
);
String
[]
groups
=
candidateUsers
.
split
(
"\\|\\|"
);
if
(
groups
.
length
>
0
)
{
for
(
String
group
:
groups
)
{
if
(
group
.
contains
(
"activedata"
)
&&
roles
.
contains
(
group
))
{
for
(
String
elUserId
:
group
.
split
(
"\\|"
))
{
ExpressionParser
parser
=
new
SpelExpressionParser
();
StandardEvaluationContext
context
=
new
StandardEvaluationContext
();
Expression
exp
=
parser
.
parseExpression
(
elUserId
);
context
.
addPropertyAccessor
(
new
MapAccessor
());
context
.
setVariable
(
"activedata"
,
executionMap
);
String
processUserId
=
exp
.
getValue
(
context
,
String
.
class
);
if
(
StringUtils
.
isEmpty
(
processUserId
))
{
userIds
.
add
(
processUserId
);
}
}
}
if
(
group
.
contains
(
"wfCoreService.getGroupUsers"
))
{
EvaluationContext
oldContext
=
new
StandardEvaluationContext
();
oldContext
.
setVariable
(
"wfCoreService"
,
this
);
oldContext
.
setVariable
(
"execution"
,
execution
);
Expression
oldExp
=
parser
.
parseExpression
(
group
);
List
<
WFMember
>
users
=
oldExp
.
getValue
(
oldContext
,
List
.
class
);
if
(!
StringUtils
.
isEmpty
(
users
))
{
users
.
forEach
(
groupMember
->
{
if
(!
ObjectUtils
.
isEmpty
(
groupMember
.
getUserid
()))
{
String
roleId
;
if
(!
ObjectUtils
.
isEmpty
(
groupMember
.
getMdeptid
()))
{
roleId
=
String
.
format
(
"%s_%s"
,
groupMember
.
getGroupid
(),
groupMember
.
getMdeptid
());
}
else
{
roleId
=
groupMember
.
getGroupid
();
}
if
(
roles
.
contains
(
roleId
))
{
userIds
.
add
(
groupMember
.
getUserid
());
}
}
});
}
}
}
}
}
}
return
userIds
;
}
/**
* 获取步骤审批用户
* @param execution
* @return
*/
private
String
getCandidateUsers
(
DelegateExecution
execution
){
String
strCandidateUsers
=
""
;
UserTask
task
=
(
UserTask
)
execution
.
getCurrentFlowElement
();
List
fieldList
=
task
.
getExtensionElements
().
get
(
"field"
);
if
(!
ObjectUtils
.
isEmpty
(
fieldList
)){
for
(
Object
field
:
fieldList
)
{
if
(!
ObjectUtils
.
isEmpty
(((
ExtensionElement
)
field
).
getAttributes
())){
List
<
ExtensionAttribute
>
attributes
=
((
ExtensionElement
)
field
).
getAttributes
().
get
(
"name"
);
if
(
attributes
.
size
()
>
0
){
if
(
attributes
.
get
(
0
).
getValue
().
equals
(
"candidateUsersList"
)){
strCandidateUsers
=
((
ExtensionElement
)
field
).
getChildElements
().
get
(
"string"
).
get
(
0
).
getElementText
();
break
;
}
}
}
}
}
return
strCandidateUsers
;
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录