Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzwf
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzwf
提交
2a33e5bd
提交
2a33e5bd
编写于
3月 31, 2021
作者:
tangyaolong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
抄送实现
上级
61b5dcea
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
79 行增加
和
8 行删除
+79
-8
ProcessInstanceListener.java
...workflow/extensions/listener/ProcessInstanceListener.java
+38
-5
WFCoreService.java
...izlab/core/workflow/extensions/service/WFCoreService.java
+41
-3
未找到文件。
ibzwf-core/src/main/java/cn/ibizlab/core/workflow/extensions/listener/ProcessInstanceListener.java
浏览文件 @
2a33e5bd
...
...
@@ -5,17 +5,16 @@ import cn.ibizlab.core.workflow.extensions.domain.FlowUser;
import
cn.ibizlab.core.workflow.extensions.service.WFCoreService
;
import
cn.ibizlab.core.workflow.extensions.service.WFModelService
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.client.IBZNotifyFeignClient
;
import
cn.ibizlab.util.service.RemoteService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.flowable.bpmn.model.ExtensionAttribute
;
import
org.flowable.bpmn.model.ExtensionElement
;
import
org.flowable.bpmn.model.FormProperty
;
import
org.flowable.bpmn.model.UserTask
;
import
org.flowable.common.engine.api.delegate.event.
*
;
import
org.flowable.common.engine.api.delegate.event.
AbstractFlowableEventListener
;
import
org.flowable.common.engine.api.delegate.event.FlowableEngineEventType
;
import
org.flowable.common.engine.api.delegate.event.FlowableEvent
;
import
org.flowable.common.engine.api.delegate.event.FlowableEventType
;
import
org.flowable.common.engine.impl.event.FlowableEntityEventImpl
;
import
org.flowable.engine.TaskService
;
import
org.flowable.engine.delegate.DelegateExecution
;
...
...
@@ -31,7 +30,9 @@ import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.expression.MapAccessor
;
import
org.springframework.expression.*
;
import
org.springframework.expression.EvaluationContext
;
import
org.springframework.expression.Expression
;
import
org.springframework.expression.ExpressionParser
;
import
org.springframework.expression.spel.standard.SpelExpressionParser
;
import
org.springframework.expression.spel.support.StandardEvaluationContext
;
import
org.springframework.stereotype.Component
;
...
...
@@ -319,6 +320,38 @@ public class ProcessInstanceListener extends AbstractFlowableEventListener {
}
}
else
if
(
evt
instanceof
FlowableActivityEventImpl
)
{
FlowableActivityEventImpl
event
=
((
FlowableActivityEventImpl
)
evt
);
FlowableEventType
eventType
=
event
.
getType
();
if
(
eventType
==
FlowableEngineEventType
.
ACTIVITY_COMPLETED
&&
"userTask"
.
equals
(
event
.
getActivityType
()))
{
if
(
event
.
getExecution
().
getCurrentFlowElement
()
instanceof
UserTask
)
{
UserTask
task
=
(
UserTask
)
event
.
getExecution
().
getCurrentFlowElement
();
List
<
Task
>
exTask
=
taskService
.
createTaskQuery
().
processInstanceId
(
event
.
getProcessInstanceId
()).
list
();
String
sendCopyTag
=
wfCoreService
.
getParam
(
task
,
"form"
,
"procfunc"
);
if
(
sendCopyTag
.
contains
(
"sendcopy"
)){
// 从模板中读取抄送人名单
String
sendCopyUserList
=
wfCoreService
.
getParam
(
task
,
"form"
,
"senduser"
);
if
(
StringUtils
.
isEmpty
(
sendCopyUserList
)){
throw
new
BadRequestAlertException
(
"获取节点抄送用户失败"
,
""
,
""
);
}
String
userIds
=
wfCoreService
.
getGroupUsers
(
sendCopyUserList
,
event
.
getExecution
());
TaskEntity
sendCopyTask
=
null
;
if
(
exTask
.
size
()>
0
){
sendCopyTask
=
wfCoreService
.
createTask
(
exTask
.
get
(
0
));
}
sendCopyTask
.
setId
(
UUID
.
randomUUID
().
toString
().
toLowerCase
());
sendCopyTask
.
setScopeType
(
"sendcopy"
);
taskService
.
saveTask
(
sendCopyTask
);
// 生成待阅抄送给用户
if
(!
StringUtils
.
isEmpty
(
userIds
)){
for
(
String
userid
:
userIds
.
split
(
","
))
{
taskService
.
addUserIdentityLink
(
sendCopyTask
.
getId
(),
userid
,
"sendcopy"
);
}
}
}
}
}
}
else
if
(
evt
instanceof
FlowableActivityEventImpl
)
{
FlowableActivityEventImpl
event
=((
FlowableActivityEventImpl
)
evt
);
...
...
ibzwf-core/src/main/java/cn/ibizlab/core/workflow/extensions/service/WFCoreService.java
浏览文件 @
2a33e5bd
...
...
@@ -34,7 +34,6 @@ import org.flowable.engine.history.HistoricProcessInstance;
import
org.flowable.engine.history.ProcessInstanceHistoryLog
;
import
org.flowable.engine.repository.Deployment
;
import
org.flowable.engine.repository.DeploymentBuilder
;
import
org.flowable.engine.repository.ProcessDefinition
;
import
org.flowable.engine.runtime.ProcessInstance
;
import
org.flowable.engine.task.Comment
;
import
org.flowable.identitylink.api.IdentityLink
;
...
...
@@ -81,6 +80,8 @@ import java.security.Principal;
import
java.sql.Timestamp
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.stream.Collectors
;
@Service
(
"wfCoreService"
)
@Slf4j
...
...
@@ -279,7 +280,6 @@ public class WFCoreService
taskMap
.
put
(
templateCode
,
listMap
);
}
}
}
/**
...
...
@@ -1598,6 +1598,28 @@ public class WFCoreService
}
return
null
;
}
/**
* 清除link已读完的task
* @param element
* @param property
* @param attribute
* @return
*/
public
String
removeTask
(
FlowElement
element
,
String
property
,
String
attribute
)
{
List
<
ExtensionElement
>
formProps
=
element
.
getExtensionElements
().
get
(
property
);
if
(
formProps
==
null
)
{
return
null
;
}
for
(
ExtensionElement
prop
:
formProps
)
{
if
(
prop
.
getAttributes
()
==
null
)
return
null
;
Map
<
String
,
List
<
ExtensionAttribute
>>
attributes
=
prop
.
getAttributes
();
if
(
attributes
.
containsKey
(
attribute
))
{
return
ObjectUtils
.
isEmpty
(
attributes
.
get
(
attribute
))
?
null
:
String
.
valueOf
(
attributes
.
get
(
attribute
).
get
(
0
).
getValue
());
}
}
return
null
;
}
/**
* 获取流程节点所有参数
...
...
@@ -1750,7 +1772,7 @@ public class WFCoreService
* @param sourceTask
* @return
*/
p
rotected
TaskEntity
createTask
(
Task
sourceTask
)
{
p
ublic
TaskEntity
createTask
(
Task
sourceTask
)
{
TaskEntity
task
=
null
;
if
(
sourceTask
!=
null
)
{
//1.生成子任务
...
...
@@ -1896,6 +1918,7 @@ public class WFCoreService
List
<
IdentityLink
>
identityLinks
=
taskService
.
getIdentityLinksForTask
(
taskId
);
identityLinks
.
forEach
(
idl
->{
if
(
userId
.
equals
(
idl
.
getUserId
())){
completeSendCopy
(
identityLinks
,
task
,
userId
);
Map
map
=
new
HashMap
();
map
.
put
(
"taskid"
,
task
.
getId
());
map
.
put
(
"userid"
,
userId
);
...
...
@@ -1906,6 +1929,21 @@ public class WFCoreService
return
true
;
}
/**
* 判断除了本身其他link是否已读
* @return
*/
public
void
completeSendCopy
(
List
<
IdentityLink
>
identityLinks
,
Task
task
,
String
userId
){
List
<
IdentityLink
>
noReadLinks
=
identityLinks
.
stream
().
filter
(
link
->
StringUtils
.
isEmpty
(
link
.
getScopeType
())).
collect
(
Collectors
.
toList
());
// 全部消息已读之后,将抄送任务推送到history表中
String
type
=
task
.
getScopeType
()
==
null
?
""
:
task
.
getScopeType
();
if
(
type
.
equals
(
"sendcopy"
)
&&
noReadLinks
.
size
()
==
1
){
if
(
noReadLinks
.
get
(
0
).
getUserId
().
equals
(
userId
)){
taskService
.
complete
(
task
.
getId
());
}
}
}
/**
* @param taskId 当前需要回退的节点
* @return 回退上一个节点
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录