Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
workflow-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
workflow-platform
Commits
de807d61
Commit
de807d61
authored
May 29, 2025
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改部分pom
parent
7e49ea3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
workflow-engine/src/main/java/com/mortals/flowable/listener/global/GlobalProcistEndListener.java
...ls/flowable/listener/global/GlobalProcistEndListener.java
+15
-12
No files found.
workflow-engine/src/main/java/com/mortals/flowable/listener/global/GlobalProcistEndListener.java
View file @
de807d61
...
@@ -22,6 +22,7 @@ import com.mortals.xhx.module.platform.service.PlatformListenerService;
...
@@ -22,6 +22,7 @@ import com.mortals.xhx.module.platform.service.PlatformListenerService;
import
com.mortals.xhx.module.platform.service.PlatformModelinfoService
;
import
com.mortals.xhx.module.platform.service.PlatformModelinfoService
;
import
com.mortals.xhx.module.platform.service.PlatformService
;
import
com.mortals.xhx.module.platform.service.PlatformService
;
import
lombok.extern.apachecommons.CommonsLog
;
import
lombok.extern.apachecommons.CommonsLog
;
import
lombok.extern.slf4j.Slf4j
;
import
org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent
;
import
org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent
;
import
org.flowable.engine.HistoryService
;
import
org.flowable.engine.HistoryService
;
import
org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener
;
import
org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener
;
...
@@ -45,10 +46,10 @@ import java.util.stream.Collectors;
...
@@ -45,10 +46,10 @@ import java.util.stream.Collectors;
* @date: 2021/9/9 10:56
* @date: 2021/9/9 10:56
*/
*/
@Component
@Component
@
CommonsLog
@
Slf4j
public
class
GlobalProcistEndListener
extends
AbstractFlowableEngineEventListener
{
public
class
GlobalProcistEndListener
extends
AbstractFlowableEngineEventListener
{
public
static
String
ProcessEnd
=
"1"
;
public
static
String
ProcessEnd
=
"1"
;
@Autowired
@Autowired
private
ExtendProcinstService
extendProcinstService
;
private
ExtendProcinstService
extendProcinstService
;
...
@@ -75,7 +76,7 @@ public class GlobalProcistEndListener extends AbstractFlowableEngineEventListene
...
@@ -75,7 +76,7 @@ public class GlobalProcistEndListener extends AbstractFlowableEngineEventListene
Map
<
String
,
Object
>
variables
=
((
ProcessInstance
)
flowableEntityEvent
.
getEntity
()).
getProcessVariables
();
Map
<
String
,
Object
>
variables
=
((
ProcessInstance
)
flowableEntityEvent
.
getEntity
()).
getProcessVariables
();
//拷贝数据
//拷贝数据
this
.
updateExtendInfoToHis
(
processInstanceId
,
variables
);
this
.
updateExtendInfoToHis
(
processInstanceId
,
variables
);
}
}
/**
/**
...
@@ -83,7 +84,7 @@ public class GlobalProcistEndListener extends AbstractFlowableEngineEventListene
...
@@ -83,7 +84,7 @@ public class GlobalProcistEndListener extends AbstractFlowableEngineEventListene
*
*
* @param processInstanceId 流程实例id
* @param processInstanceId 流程实例id
*/
*/
private
void
updateExtendInfoToHis
(
String
processInstanceId
,
Map
<
String
,
Object
>
variables
)
{
private
void
updateExtendInfoToHis
(
String
processInstanceId
,
Map
<
String
,
Object
>
variables
)
{
//1.更新历史的流程实例的扩展信息 批量更新
//1.更新历史的流程实例的扩展信息 批量更新
ExtendHisprocinstEntity
extendHisProcinst
=
extendHisprocinstService
.
selectOne
(
new
ExtendHisprocinstQuery
().
processInstanceId
(
processInstanceId
),
null
);
ExtendHisprocinstEntity
extendHisProcinst
=
extendHisprocinstService
.
selectOne
(
new
ExtendHisprocinstQuery
().
processInstanceId
(
processInstanceId
),
null
);
if
(
extendHisProcinst
!=
null
&&
!
ProcessStatusEnum
.
ZZ
.
toString
().
equals
(
extendHisProcinst
.
getProcessStatus
()))
{
if
(
extendHisProcinst
!=
null
&&
!
ProcessStatusEnum
.
ZZ
.
toString
().
equals
(
extendHisProcinst
.
getProcessStatus
()))
{
...
@@ -111,21 +112,23 @@ public class GlobalProcistEndListener extends AbstractFlowableEngineEventListene
...
@@ -111,21 +112,23 @@ public class GlobalProcistEndListener extends AbstractFlowableEngineEventListene
//发送消息或者http回调
//发送消息或者http回调
PlatformEntity
modelinfoEntity
=
platformService
.
selectOne
(
new
PlatformQuery
().
platformSn
(
extendHisProcinst
.
getTenantId
()),
null
);
PlatformEntity
modelinfoEntity
=
platformService
.
selectOne
(
new
PlatformQuery
().
platformSn
(
extendHisProcinst
.
getTenantId
()),
null
);
if
(
ObjectUtils
.
isEmpty
(
modelinfoEntity
))
{
if
(
ObjectUtils
.
isEmpty
(
modelinfoEntity
))
{
log
.
info
(
"平台用户为空,sn:"
+
extendHisProcinst
.
getTenantId
());
log
.
info
(
"平台用户为空,sn:"
+
extendHisProcinst
.
getTenantId
());
return
;
return
;
}
}
//校验当前平台用户是否订阅了流程终结消息
//校验当前平台用户是否订阅了流程终结消息
Set
<
String
>
collect
=
platformListenerService
.
find
(
new
PlatformListenerQuery
().
platformId
(
modelinfoEntity
.
getId
())).
stream
().
map
(
item
->
item
.
getTypeCode
()).
collect
(
Collectors
.
toSet
());
Set
<
String
>
collect
=
platformListenerService
.
find
(
new
PlatformListenerQuery
().
platformId
(
modelinfoEntity
.
getId
())).
stream
().
map
(
item
->
item
.
getTypeCode
()).
collect
(
Collectors
.
toSet
());
if
(!
collect
.
contains
(
ProcessEnd
))
{
if
(!
collect
.
contains
(
ProcessEnd
))
{
log
.
info
(
"当前平台用户未订阅流程结束通知,sn:"
+
modelinfoEntity
.
getPlatformSn
());
log
.
info
(
"当前平台用户未订阅流程结束通知,sn:"
+
modelinfoEntity
.
getPlatformSn
());
return
;
return
;
}
}
log
.
info
(
"发送消息或者http回调,type:{}"
,
modelinfoEntity
.
getType
());
//手动终止撤销的不触发通知消息
//手动终止撤销的不触发通知消息
if
(!
ObjectUtils
.
isEmpty
(
modelinfoEntity
)&&!
ProcessStatusEnum
.
ZZ
.
toString
().
equals
(
extendHisProcinst
.
getProcessStatus
()))
{
if
(!
ObjectUtils
.
isEmpty
(
modelinfoEntity
)
&&
!
ProcessStatusEnum
.
ZZ
.
toString
().
equals
(
extendHisProcinst
.
getProcessStatus
()))
{
if
(
PlatformTypeEnum
.
HTTP
.
getValue
()
==
modelinfoEntity
.
getType
())
{
if
(
PlatformTypeEnum
.
HTTP
.
getValue
()
==
modelinfoEntity
.
getType
())
{
//http
//http
FlowMessageReq
flowMessageReq
=
new
FlowMessageReq
();
FlowMessageReq
flowMessageReq
=
new
FlowMessageReq
();
...
@@ -135,7 +138,7 @@ public class GlobalProcistEndListener extends AbstractFlowableEngineEventListene
...
@@ -135,7 +138,7 @@ public class GlobalProcistEndListener extends AbstractFlowableEngineEventListene
flowMessageReq
.
setBusinessKey
(
extendHisProcinst
.
getBusinessKey
());
flowMessageReq
.
setBusinessKey
(
extendHisProcinst
.
getBusinessKey
());
if
(
historicProcessInstance
!=
null
&&
historicProcessInstance
.
getProcessVariables
()!=
null
)
{
if
(
historicProcessInstance
!=
null
&&
historicProcessInstance
.
getProcessVariables
()
!=
null
)
{
flowMessageReq
.
setContent
(
JSON
.
toJSONString
(
variables
));
flowMessageReq
.
setContent
(
JSON
.
toJSONString
(
variables
));
}
}
...
@@ -166,7 +169,7 @@ public class GlobalProcistEndListener extends AbstractFlowableEngineEventListene
...
@@ -166,7 +169,7 @@ public class GlobalProcistEndListener extends AbstractFlowableEngineEventListene
}
catch
(
InterruptedException
interruptedException
)
{
}
catch
(
InterruptedException
interruptedException
)
{
interruptedException
.
printStackTrace
();
interruptedException
.
printStackTrace
();
}
}
doPostMessage
(
url
,
flowMessageReq
);
doPostMessage
(
url
,
flowMessageReq
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment