Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzwf
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzwf
提交
6e4a7541
提交
6e4a7541
编写于
3月 25, 2021
作者:
tangyaolong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rollback
上级
b8af9be0
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
192 行增加
和
250 行删除
+192
-250
WFCoreService.java
...izlab/core/workflow/extensions/service/WFCoreService.java
+192
-250
未找到文件。
ibzwf-core/src/main/java/cn/ibizlab/core/workflow/extensions/service/WFCoreService.java
浏览文件 @
6e4a7541
...
@@ -20,8 +20,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
...
@@ -20,8 +20,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.flowable.bpmn.BpmnAutoLayout
;
import
org.flowable.bpmn.BpmnAutoLayout
;
import
org.flowable.bpmn.converter.BpmnXMLConverter
;
import
org.flowable.bpmn.converter.BpmnXMLConverter
;
import
org.flowable.bpmn.model.Process
;
import
org.flowable.bpmn.model.*
;
import
org.flowable.bpmn.model.*
;
import
org.flowable.bpmn.model.Process
;
import
org.flowable.common.engine.api.history.HistoricData
;
import
org.flowable.common.engine.api.history.HistoricData
;
import
org.flowable.common.engine.api.identity.AuthenticationContext
;
import
org.flowable.common.engine.api.identity.AuthenticationContext
;
import
org.flowable.common.engine.impl.identity.Authentication
;
import
org.flowable.common.engine.impl.identity.Authentication
;
...
@@ -98,8 +98,8 @@ public class WFCoreService
...
@@ -98,8 +98,8 @@ public class WFCoreService
@Autowired
@Autowired
private
RuntimeService
runtimeService
;
private
RuntimeService
runtimeService
;
@Autowired
@Autowired
protected
ManagementService
managementService
;
protected
ManagementService
managementService
;
@Autowired
@Autowired
private
WFModelService
wfModelService
;
private
WFModelService
wfModelService
;
...
@@ -659,65 +659,6 @@ public class WFCoreService
...
@@ -659,65 +659,6 @@ public class WFCoreService
return
way
;
return
way
;
}
}
/**
* @param taskId 当前需要回退的节点
* @return 回退上一个节点
*/
public
boolean
wfback
(
String
system
,
String
appname
,
String
entity
,
String
taskId
)
{
try
{
Boolean
flag
=
true
;
String
sourceRef
=
null
;
Task
task
=
taskService
.
createTaskQuery
().
taskId
(
taskId
).
singleResult
();
String
taskDefinitionKey
=
task
.
getTaskDefinitionKey
();
if
(
taskDefinitionKey
==
null
)
{
log
.
debug
(
"taskDefinitionKey不存在"
);
return
false
;
}
String
processInstanceId
=
task
.
getProcessInstanceId
();
if
(
processInstanceId
==
null
)
{
log
.
debug
(
"processInstanceId不存在"
);
return
false
;
}
ProcessDefinition
processDefinition
=
repositoryService
.
createProcessDefinitionQuery
().
processDefinitionId
(
task
.
getProcessDefinitionId
()).
singleResult
();
BpmnModel
bpmnModel
=
repositoryService
.
getBpmnModel
(
processDefinition
.
getId
());
FlowNode
flowNode
=
(
FlowNode
)
bpmnModel
.
getFlowElement
(
task
.
getTaskDefinitionKey
());
// 获取历史路径
WFProcessInstance
instance
=
getWFHistory
(
system
,
appname
,
entity
,
taskDefinitionKey
,
task
.
getProcessInstanceId
());
if
(!
ObjectUtils
.
isEmpty
(
flowNode
)
&&
!
ObjectUtils
.
isEmpty
(
instance
))
{
List
<
WFProcessNode
>
usertasks
=
new
ArrayList
((
Collection
<?
extends
WFProcessNode
>)
instance
.
getExtensionparams
().
get
(
"usertasks"
));
for
(
WFProcessNode
node
:
usertasks
)
{
for
(
SequenceFlow
flow
:
flowNode
.
getIncomingFlows
())
{
if
(
node
.
getUsertaskid
().
equals
(
flow
.
getSourceRef
())&&
flow
.
getSourceRef
().
startsWith
(
"tid"
))
{
sourceRef
=
flow
.
getSourceRef
();
flag
=
false
;
break
;
}
}
if
(!
flag
)
{
break
;
}
}
}
else
{
return
false
;
}
// 执行回退
runtimeService
.
createChangeActivityStateBuilder
().
processInstanceId
(
processInstanceId
).
moveActivityIdTo
(
taskDefinitionKey
,
sourceRef
).
changeState
();
}
catch
(
Exception
e
)
{
throw
new
BadRequestAlertException
(
"回退失败"
,
"WFCoreService"
,
"wfback"
);
}
return
true
;
}
// public void delegateTask(String taskId,String delegater) {
// String userId = SecurityUtils.getCurrentUserObject().getId();
// Task task = permissionService.validateDelegatePermissionOnTask(taskId, userId, delegater);
// taskService.addComment(taskId, processInstanceId, type.toString(), message);
// taskService.delegateTask(task.getId(), delegater);
// }
public
WFProcessInstance
wfsubmit
(
String
system
,
String
appname
,
public
WFProcessInstance
wfsubmit
(
String
system
,
String
appname
,
String
entity
,
String
businessKey
,
String
taskId
,
WFTaskWay
taskWay
)
{
String
entity
,
String
businessKey
,
String
taskId
,
WFTaskWay
taskWay
)
{
...
@@ -1154,7 +1095,7 @@ public class WFCoreService
...
@@ -1154,7 +1095,7 @@ public class WFCoreService
bpmnLayout
.
execute
();
bpmnLayout
.
execute
();
byte
[]
bs
=
bpmnXMLConverter
.
convertToXML
(
entitymodel
);
byte
[]
bs
=
bpmnXMLConverter
.
convertToXML
(
entitymodel
);
bmpmfileId
=
DigestUtils
.
md5DigestAsHex
(
bs
);
bmpmfileId
=
DigestUtils
.
md5DigestAsHex
(
bs
);
if
(
bmpmfileId
.
equals
(
1
))
if
(
bmpmfileId
.
equals
(
old
.
getMd5check
()
))
{
{
log
.
warn
(
"部署流程没有变化,忽略 name:"
+
curProcess
.
getName
()
+
" key "
+
processDefinitionKey
+
" deploy "
+
bmpmfileId
);
log
.
warn
(
"部署流程没有变化,忽略 name:"
+
curProcess
.
getName
()
+
" key "
+
processDefinitionKey
+
" deploy "
+
bmpmfileId
);
deployInfo
+=
curProcess
.
getName
()+
" key:"
+
processDefinitionKey
+
",流程配置没有变化,忽略发布"
+
"\r\n"
;
deployInfo
+=
curProcess
.
getName
()+
" key:"
+
processDefinitionKey
+
",流程配置没有变化,忽略发布"
+
"\r\n"
;
...
@@ -1442,28 +1383,28 @@ public class WFCoreService
...
@@ -1442,28 +1383,28 @@ public class WFCoreService
* @param taskId
* @param taskId
* @param taskWay
* @param taskWay
*/
*/
public
boolean
beforeSign
(
String
system
,
String
appname
,
public
boolean
beforeSign
(
String
system
,
String
appname
,
String
entity
,
String
businessKey
,
String
taskId
,
WFTaskWay
taskWay
)
{
String
entity
,
String
businessKey
,
String
taskId
,
WFTaskWay
taskWay
)
{
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
if
(
StringUtils
.
isEmpty
(
userId
))
if
(
StringUtils
.
isEmpty
(
userId
))
throw
new
BadRequestAlertException
(
"未传入当前用户"
,
entity
,
businessKey
);
throw
new
BadRequestAlertException
(
"未传入当前用户"
,
entity
,
businessKey
);
Object
signUsers
=
taskWay
.
get
(
"users
"
);
Object
signUser
=
taskWay
.
get
(
"srfwfannotator
"
);
if
(
ObjectUtils
.
isEmpty
(
signUsers
))
{
if
(
ObjectUtils
.
isEmpty
(
signUser
))
{
throw
new
BadRequestAlertException
(
"未传入加签用户"
,
entity
,
businessKey
);
throw
new
BadRequestAlertException
(
"未传入加签用户"
,
entity
,
businessKey
);
}
}
Task
curTask
=
taskService
.
createTaskQuery
().
taskId
(
taskId
).
singleResult
();
Task
curTask
=
taskService
.
createTaskQuery
().
taskId
(
taskId
).
singleResult
();
if
(
curTask
==
null
)
{
if
(
curTask
==
null
)
{
throw
new
BadRequestAlertException
(
String
.
format
(
"未能获取到[%s]运行任务"
,
curTask
.
getId
()),
""
,
""
);
throw
new
BadRequestAlertException
(
String
.
format
(
"未能获取到[%s]运行任务"
,
curTask
.
getId
()),
""
,
""
);
}
}
if
(
DelegationState
.
PENDING
!=
curTask
.
getDelegationState
())
{
if
(
DelegationState
.
PENDING
!=
curTask
.
getDelegationState
())
{
taskService
.
delegateTask
(
taskId
,
String
.
valueOf
(
signUsers
));
taskService
.
delegateTask
(
taskId
,
String
.
valueOf
(
signUser
));
//saveTask(curTask);
//saveTask(curTask);
}
else
{
}
else
{
throw
new
BadRequestAlertException
(
String
.
format
(
"任务正在加签中,无法进行二次加签"
,
curTask
.
getId
()),
""
,
""
);
throw
new
BadRequestAlertException
(
String
.
format
(
"任务正在加签中,无法进行二次加签"
,
curTask
.
getId
()),
""
,
""
);
}
}
return
true
;
return
true
;
}
}
/**
/**
* 后加签 (转办)
* 后加签 (转办)
...
@@ -1475,12 +1416,12 @@ public class WFCoreService
...
@@ -1475,12 +1416,12 @@ public class WFCoreService
* @param taskWay
* @param taskWay
*/
*/
public
boolean
afterSign
(
String
system
,
String
appname
,
public
boolean
afterSign
(
String
system
,
String
appname
,
String
entity
,
String
businessKey
,
String
taskId
,
WFTaskWay
taskWay
){
String
entity
,
String
businessKey
,
String
taskId
,
WFTaskWay
taskWay
){
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
if
(
StringUtils
.
isEmpty
(
userId
))
if
(
StringUtils
.
isEmpty
(
userId
))
throw
new
BadRequestAlertException
(
"未传入当前用户"
,
entity
,
businessKey
);
throw
new
BadRequestAlertException
(
"未传入当前用户"
,
entity
,
businessKey
);
Object
signUser
=
taskWay
.
get
(
"
users
"
);
Object
signUser
=
taskWay
.
get
(
"
srfwftransfertor
"
);
if
(
ObjectUtils
.
isEmpty
(
signUser
))
{
if
(
ObjectUtils
.
isEmpty
(
signUser
))
{
throw
new
BadRequestAlertException
(
"未传入转办用户"
,
entity
,
businessKey
);
throw
new
BadRequestAlertException
(
"未传入转办用户"
,
entity
,
businessKey
);
}
}
...
@@ -1600,87 +1541,87 @@ public class WFCoreService
...
@@ -1600,87 +1541,87 @@ public class WFCoreService
}
}
}
}
/**
/**
* 设置流程表单
* 设置流程表单
*
*
* @param sequenceFlow
* @param sequenceFlow
* @param way
* @param way
*/
*/
private
void
setTaskWayForm
(
SequenceFlow
sequenceFlow
,
WFTaskWay
way
)
{
private
void
setTaskWayForm
(
SequenceFlow
sequenceFlow
,
WFTaskWay
way
)
{
Map
<
String
,
String
>
attributes
=
getAllParam
(
sequenceFlow
,
"form"
);
Map
<
String
,
String
>
attributes
=
getAllParam
(
sequenceFlow
,
"form"
);
if
(!
ObjectUtils
.
isEmpty
(
attributes
))
{
if
(!
ObjectUtils
.
isEmpty
(
attributes
))
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
attributes
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
attributes
.
entrySet
())
{
way
.
set
(
entry
.
getKey
(),
entry
.
getValue
());
way
.
set
(
entry
.
getKey
(),
entry
.
getValue
());
}
}
}
}
}
}
/**
/**
* 将流程表单设置到请求头中
* 将流程表单设置到请求头中
*
*
* @param userTask
* @param userTask
*/
*/
private
void
setProcessForm
(
UserTask
userTask
)
{
private
void
setProcessForm
(
UserTask
userTask
)
{
Object
objReq
=
RequestContextHolder
.
currentRequestAttributes
();
Object
objReq
=
RequestContextHolder
.
currentRequestAttributes
();
if
(!
ObjectUtils
.
isEmpty
(
objReq
)
&&
objReq
instanceof
ServletRequestAttributes
)
{
if
(!
ObjectUtils
.
isEmpty
(
objReq
)
&&
objReq
instanceof
ServletRequestAttributes
)
{
ServletRequestAttributes
attr
=
(
ServletRequestAttributes
)
RequestContextHolder
.
currentRequestAttributes
();
ServletRequestAttributes
attr
=
(
ServletRequestAttributes
)
RequestContextHolder
.
currentRequestAttributes
();
HttpServletRequest
req
=
attr
.
getRequest
();
HttpServletRequest
req
=
attr
.
getRequest
();
Map
<
String
,
String
>
attributes
=
getAllParam
(
userTask
,
"form"
);
Map
<
String
,
String
>
attributes
=
getAllParam
(
userTask
,
"form"
);
if
(!
ObjectUtils
.
isEmpty
(
attributes
))
{
if
(!
ObjectUtils
.
isEmpty
(
attributes
))
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
attributes
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
attributes
.
entrySet
())
{
req
.
setAttribute
(
entry
.
getKey
(),
entry
.
getValue
());
req
.
setAttribute
(
entry
.
getKey
(),
entry
.
getValue
());
}
}
}
}
}
}
}
}
/**
/**
* 获取流程节点指定参数
* 获取流程节点指定参数
* @param element
* @param element
* @param property
* @param property
* @param attribute
* @param attribute
* @return
* @return
*/
*/
public
String
getParam
(
FlowElement
element
,
String
property
,
String
attribute
)
{
public
String
getParam
(
FlowElement
element
,
String
property
,
String
attribute
)
{
List
<
ExtensionElement
>
formProps
=
element
.
getExtensionElements
().
get
(
property
);
List
<
ExtensionElement
>
formProps
=
element
.
getExtensionElements
().
get
(
property
);
if
(
formProps
==
null
)
{
if
(
formProps
==
null
)
{
return
null
;
return
null
;
}
}
for
(
ExtensionElement
prop
:
formProps
)
{
for
(
ExtensionElement
prop
:
formProps
)
{
if
(
prop
.
getAttributes
()
==
null
)
if
(
prop
.
getAttributes
()
==
null
)
return
null
;
return
null
;
Map
<
String
,
List
<
ExtensionAttribute
>>
attributes
=
prop
.
getAttributes
();
Map
<
String
,
List
<
ExtensionAttribute
>>
attributes
=
prop
.
getAttributes
();
if
(
attributes
.
containsKey
(
attribute
))
{
if
(
attributes
.
containsKey
(
attribute
))
{
return
ObjectUtils
.
isEmpty
(
attributes
.
get
(
attribute
))
?
null
:
String
.
valueOf
(
attributes
.
get
(
attribute
).
get
(
0
).
getValue
());
return
ObjectUtils
.
isEmpty
(
attributes
.
get
(
attribute
))
?
null
:
String
.
valueOf
(
attributes
.
get
(
attribute
).
get
(
0
).
getValue
());
}
}
}
}
return
null
;
return
null
;
}
}
/**
/**
* 获取流程节点所有参数
* 获取流程节点所有参数
* @param element
* @param element
* @param property
* @param property
* @return
* @return
*/
*/
public
Map
<
String
,
String
>
getAllParam
(
FlowElement
element
,
String
property
)
{
public
Map
<
String
,
String
>
getAllParam
(
FlowElement
element
,
String
property
)
{
Map
<
String
,
String
>
params
=
new
HashMap
();
Map
<
String
,
String
>
params
=
new
HashMap
();
List
<
ExtensionElement
>
formProps
=
element
.
getExtensionElements
().
get
(
property
);
List
<
ExtensionElement
>
formProps
=
element
.
getExtensionElements
().
get
(
property
);
if
(
formProps
==
null
)
{
if
(
formProps
==
null
)
{
return
null
;
return
null
;
}
}
for
(
ExtensionElement
prop
:
formProps
)
{
for
(
ExtensionElement
prop
:
formProps
)
{
if
(
prop
.
getAttributes
()
==
null
)
if
(
prop
.
getAttributes
()
==
null
)
return
null
;
return
null
;
Map
<
String
,
List
<
ExtensionAttribute
>>
attributes
=
prop
.
getAttributes
();
Map
<
String
,
List
<
ExtensionAttribute
>>
attributes
=
prop
.
getAttributes
();
for
(
String
attribute
:
attributes
.
keySet
())
{
for
(
String
attribute
:
attributes
.
keySet
())
{
if
(!
ObjectUtils
.
isEmpty
(
attributes
.
get
(
attribute
)))
{
if
(!
ObjectUtils
.
isEmpty
(
attributes
.
get
(
attribute
)))
{
params
.
put
(
attribute
,
attributes
.
get
(
attribute
).
get
(
0
).
getValue
());
params
.
put
(
attribute
,
attributes
.
get
(
attribute
).
get
(
0
).
getValue
());
}
}
}
}
}
}
return
params
;
return
params
;
}
}
/**
/**
* 获取动态实例标识
* 获取动态实例标识
...
@@ -1728,24 +1669,24 @@ public class WFCoreService
...
@@ -1728,24 +1669,24 @@ public class WFCoreService
}
}
}
}
/**
/**
* 获取连接线条件 (all/any/all|role:any)
* 获取连接线条件 (all/any/all|role:any)
*
*
* @param execution
* @param execution
* @param sequenceFlowId
* @param sequenceFlowId
* @return
* @return
*/
*/
public
String
getNextCondition
(
DelegateExecution
execution
,
Object
sequenceFlowId
)
{
public
String
getNextCondition
(
DelegateExecution
execution
,
Object
sequenceFlowId
)
{
if
(!
ObjectUtils
.
isEmpty
(
execution
.
getCurrentFlowElement
())
&&
execution
.
getCurrentFlowElement
()
instanceof
UserTask
)
{
if
(!
ObjectUtils
.
isEmpty
(
execution
.
getCurrentFlowElement
())
&&
execution
.
getCurrentFlowElement
()
instanceof
UserTask
)
{
UserTask
userTask
=
(
UserTask
)
execution
.
getCurrentFlowElement
();
UserTask
userTask
=
(
UserTask
)
execution
.
getCurrentFlowElement
();
for
(
SequenceFlow
flow
:
userTask
.
getOutgoingFlows
())
{
for
(
SequenceFlow
flow
:
userTask
.
getOutgoingFlows
())
{
if
(
sequenceFlowId
.
equals
(
flow
.
getId
()))
{
if
(
sequenceFlowId
.
equals
(
flow
.
getId
()))
{
return
getParam
(
flow
,
"form"
,
"nextCondition"
);
return
getParam
(
flow
,
"form"
,
"nextCondition"
);
}
}
}
}
}
}
return
null
;
return
null
;
}
}
/**
/**
* 获取用户所属的工作流角色
* 获取用户所属的工作流角色
...
@@ -1753,55 +1694,55 @@ public class WFCoreService
...
@@ -1753,55 +1694,55 @@ public class WFCoreService
* @param execution
* @param execution
* @return
* @return
*/
*/
public
Set
<
String
>
getRoleByUserId
(
String
userId
,
DelegateExecution
execution
)
{
public
Set
<
String
>
getRoleByUserId
(
String
userId
,
DelegateExecution
execution
)
{
Set
roles
=
new
HashSet
();
Set
roles
=
new
HashSet
();
if
(!
ObjectUtils
.
isEmpty
(
userId
))
{
if
(!
ObjectUtils
.
isEmpty
(
userId
))
{
String
candidateUsers
=
getParam
(
execution
.
getCurrentFlowElement
(),
"form"
,
"candidateUsersList"
);
String
candidateUsers
=
getParam
(
execution
.
getCurrentFlowElement
(),
"form"
,
"candidateUsersList"
);
if
(!
StringUtils
.
isEmpty
(
candidateUsers
))
{
if
(!
StringUtils
.
isEmpty
(
candidateUsers
))
{
LinkedHashMap
executionMap
=
(
LinkedHashMap
)
execution
.
getVariable
(
"activedata"
);
LinkedHashMap
executionMap
=
(
LinkedHashMap
)
execution
.
getVariable
(
"activedata"
);
String
[]
groups
=
candidateUsers
.
split
(
"\\|\\|"
);
String
[]
groups
=
candidateUsers
.
split
(
"\\|\\|"
);
if
(
groups
.
length
>
0
)
{
if
(
groups
.
length
>
0
)
{
for
(
String
group
:
groups
)
{
for
(
String
group
:
groups
)
{
if
(
group
.
contains
(
"activedata"
))
{
if
(
group
.
contains
(
"activedata"
))
{
for
(
String
elUserId
:
group
.
split
(
"\\|"
))
{
for
(
String
elUserId
:
group
.
split
(
"\\|"
))
{
ExpressionParser
parser
=
new
SpelExpressionParser
();
ExpressionParser
parser
=
new
SpelExpressionParser
();
StandardEvaluationContext
context
=
new
StandardEvaluationContext
();
StandardEvaluationContext
context
=
new
StandardEvaluationContext
();
Expression
exp
=
parser
.
parseExpression
(
elUserId
);
Expression
exp
=
parser
.
parseExpression
(
elUserId
);
context
.
addPropertyAccessor
(
new
MapAccessor
());
context
.
addPropertyAccessor
(
new
MapAccessor
());
context
.
setVariable
(
"activedata"
,
executionMap
);
context
.
setVariable
(
"activedata"
,
executionMap
);
String
processUserId
=
exp
.
getValue
(
context
,
String
.
class
);
String
processUserId
=
exp
.
getValue
(
context
,
String
.
class
);
if
(!
StringUtils
.
isEmpty
(
processUserId
)
&&
processUserId
.
contains
(
userId
))
{
if
(!
StringUtils
.
isEmpty
(
processUserId
)
&&
processUserId
.
contains
(
userId
))
{
roles
.
add
(
group
);
roles
.
add
(
group
);
}
}
}
}
}
}
if
(
group
.
contains
(
"wfCoreService.getGroupUsers"
))
{
if
(
group
.
contains
(
"wfCoreService.getGroupUsers"
))
{
String
exp
=
group
;
String
exp
=
group
;
EvaluationContext
oldContext
=
new
StandardEvaluationContext
();
EvaluationContext
oldContext
=
new
StandardEvaluationContext
();
oldContext
.
setVariable
(
"wfCoreService"
,
this
);
oldContext
.
setVariable
(
"wfCoreService"
,
this
);
oldContext
.
setVariable
(
"execution"
,
execution
);
oldContext
.
setVariable
(
"execution"
,
execution
);
Expression
oldExp
=
parser
.
parseExpression
(
exp
);
Expression
oldExp
=
parser
.
parseExpression
(
exp
);
List
<
WFMember
>
users
=
oldExp
.
getValue
(
oldContext
,
List
.
class
);
List
<
WFMember
>
users
=
oldExp
.
getValue
(
oldContext
,
List
.
class
);
if
(!
StringUtils
.
isEmpty
(
users
))
{
if
(!
StringUtils
.
isEmpty
(
users
))
{
users
.
forEach
(
groupMember
->
{
users
.
forEach
(
groupMember
->
{
if
(!
ObjectUtils
.
isEmpty
(
groupMember
.
getUserid
())
&&
userId
.
equals
(
groupMember
.
getUserid
()))
{
if
(!
ObjectUtils
.
isEmpty
(
groupMember
.
getUserid
())
&&
userId
.
equals
(
groupMember
.
getUserid
()))
{
String
roleId
;
String
roleId
;
if
(!
ObjectUtils
.
isEmpty
(
groupMember
.
getMdeptid
()))
{
if
(!
ObjectUtils
.
isEmpty
(
groupMember
.
getMdeptid
()))
{
roleId
=
String
.
format
(
"%s_%s"
,
groupMember
.
getGroupid
(),
groupMember
.
getMdeptid
());
roleId
=
String
.
format
(
"%s_%s"
,
groupMember
.
getGroupid
(),
groupMember
.
getMdeptid
());
}
else
{
}
else
{
roleId
=
groupMember
.
getGroupid
();
roleId
=
groupMember
.
getGroupid
();
}
}
roles
.
add
(
roleId
);
roles
.
add
(
roleId
);
}
}
});
});
}
}
}
}
}
}
}
}
}
}
}
}
return
roles
;
return
roles
;
}
}
/**
/**
* 创建任务
* 创建任务
...
@@ -1864,7 +1805,7 @@ public class WFCoreService
...
@@ -1864,7 +1805,7 @@ public class WFCoreService
public
Set
<
String
>
getUsersByRole
(
Set
roles
,
DelegateExecution
execution
)
{
public
Set
<
String
>
getUsersByRole
(
Set
roles
,
DelegateExecution
execution
)
{
Set
userIds
=
new
HashSet
();
Set
userIds
=
new
HashSet
();
if
(!
ObjectUtils
.
isEmpty
(
roles
))
{
if
(!
ObjectUtils
.
isEmpty
(
roles
))
{
String
candidateUsers
=
getParam
(
execution
.
getCurrentFlowElement
(),
"form"
,
"candidateUsersList"
);
String
candidateUsers
=
getParam
(
execution
.
getCurrentFlowElement
(),
"form"
,
"candidateUsersList"
);
if
(!
StringUtils
.
isEmpty
(
candidateUsers
))
{
if
(!
StringUtils
.
isEmpty
(
candidateUsers
))
{
LinkedHashMap
executionMap
=
(
LinkedHashMap
)
execution
.
getVariable
(
"activedata"
);
LinkedHashMap
executionMap
=
(
LinkedHashMap
)
execution
.
getVariable
(
"activedata"
);
String
[]
groups
=
candidateUsers
.
split
(
"\\|\\|"
);
String
[]
groups
=
candidateUsers
.
split
(
"\\|\\|"
);
...
@@ -1912,24 +1853,24 @@ public class WFCoreService
...
@@ -1912,24 +1853,24 @@ public class WFCoreService
return
userIds
;
return
userIds
;
}
}
/**
/**
* 审批记录
* 审批记录
* @param curTask
* @param curTask
* @return
* @return
*/
*/
private
Task
saveTask
(
Task
curTask
){
private
Task
saveTask
(
Task
curTask
){
String
userId
=
"0100"
;
String
userId
=
"0100"
;
if
(
StringUtils
.
isEmpty
(
userId
))
if
(
StringUtils
.
isEmpty
(
userId
))
if
(
StringUtils
.
isEmpty
(
userId
))
if
(
StringUtils
.
isEmpty
(
userId
))
throw
new
BadRequestAlertException
(
"未传入当前用户"
,
""
,
""
);
throw
new
BadRequestAlertException
(
"未传入当前用户"
,
""
,
""
);
Task
signTask
=
createTask
(
curTask
);
Task
signTask
=
createTask
(
curTask
);
signTask
.
setParentTaskId
(
curTask
.
getId
());
signTask
.
setParentTaskId
(
curTask
.
getId
());
taskService
.
saveTask
(
signTask
);
taskService
.
saveTask
(
signTask
);
taskService
.
addUserIdentityLink
(
signTask
.
getId
(),
userId
,
"candidate"
);
taskService
.
addUserIdentityLink
(
signTask
.
getId
(),
userId
,
"candidate"
);
taskService
.
complete
(
signTask
.
getId
());
taskService
.
complete
(
signTask
.
getId
());
return
signTask
;
return
signTask
;
}
}
/**
/**
* 标记任务为已读
* 标记任务为已读
...
@@ -1963,6 +1904,7 @@ public class WFCoreService
...
@@ -1963,6 +1904,7 @@ public class WFCoreService
});
});
return
true
;
return
true
;
}
}
/**
/**
* @param taskId 当前需要回退的节点
* @param taskId 当前需要回退的节点
* @return 回退上一个节点
* @return 回退上一个节点
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录