Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
station
YeeAmosFireAutoSysRoot
Commits
3234ff09
Commit
3234ff09
authored
Apr 11, 2023
by
KeYong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
6a489e5e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
BizContingencyHandler.java
...eejoin/amos/fas/business/event/BizContingencyHandler.java
+23
-1
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/event/BizContingencyHandler.java
View file @
3234ff09
package
com
.
yeejoin
.
amos
.
fas
.
business
.
event
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.yeejoin.amos.fas.business.action.ContingencyAction
;
import
com.yeejoin.amos.fas.business.action.model.ContingencyRo
;
import
com.yeejoin.amos.fas.business.action.mq.WebMqttComponent
;
...
...
@@ -19,6 +20,8 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.support.TransactionSynchronization
;
import
org.springframework.transaction.support.TransactionSynchronizationManager
;
import
org.springframework.util.CollectionUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
...
...
@@ -80,6 +83,7 @@ public class BizContingencyHandler implements EventHandler{
ContingencyAction
contingencyAction
;
@Override
@Transactional
public
void
handler
(
ContingecyExecEvent
event
)
throws
Exception
{
/**
...
...
@@ -117,7 +121,6 @@ public class BizContingencyHandler implements EventHandler{
event
.
getPlanExecute
().
getButtonCode
(),
event
.
getPlanExecute
().
getConfirm
(),
RequestContext
.
getLoginId
());
}
catch
(
Exception
e
)
{
throw
e
;
}
finally
{
...
...
@@ -201,6 +204,25 @@ public class BizContingencyHandler implements EventHandler{
}
}
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
public
void
afterCommit
()
{
String
planStep
=
""
;
if
(
redisTemplate
.
hasKey
(
"planStep"
))
{
planStep
=
Objects
.
requireNonNull
(
redisTemplate
.
opsForValue
().
get
(
"planStep"
)).
toString
();
}
else
{
planStep
=
planStepService
.
getPlanStep
();
}
JSONArray
objects
=
JSON
.
parseArray
(
planStep
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"plan"
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"contingency"
,
new
ContingencyRo
());
result
.
put
(
"msgContext"
,
Collections
.
EMPTY_MAP
);
result
.
put
(
"msgType"
,
"getStepList"
);
result
.
put
(
"planStep"
,
objects
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
result
));
}
});
}
...
...
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