Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
779b1a91
Commit
779b1a91
authored
Aug 05, 2022
by
王鹿鹿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
任务 8234
parent
93fc19f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
24 deletions
+21
-24
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+21
-24
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MqttReceiveServiceImpl.java
View file @
779b1a91
...
...
@@ -284,12 +284,28 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
});
// 报警数据保存
List
<
EquipmentSpecificAlarmLog
>
alarmLogs
=
saveOrUpdateEquipAlarm
(
equipmentSpecificAlarms
);
List
<
EquipmentSpecificAlarmLog
>
alarmLogs
=
new
ArrayList
<>();
equipmentSpecificAlarmService
.
saveOrUpdateBatch
(
equipmentSpecificAlarms
);
// 需要在事务提交之后,否侧事务隔离查询不出数据
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
public
void
afterCommit
()
{
equipmentSpecificAlarms
.
forEach
(
action
->
{
if
(
AlarmStatusEnum
.
BJ
.
getCode
()
==
action
.
getStatus
())
{
alarmLogs
.
add
(
addEquipAlarmLogRecord
(
action
));
if
(
ValidationUtil
.
isEmpty
(
action
.
getAlamContent
()))
{
action
.
setAlamContent
(
action
.
getEquipmentSpecificName
()
+
action
.
getEquipmentSpecificIndexName
());
}
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQDQR
.
getTopic
(),
JSONArray
.
toJSON
(
action
).
toString
());
}
else
{
alarmLogs
.
addAll
(
upAlarmLogStatus
(
action
.
getIotCode
(),
action
.
getEquipmentSpecificIndexKey
(),
action
.
getTraceId
(),
equipmentSpecificAlarmLogService
));
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQYQR
.
getTopic
(),
JSONArray
.
toJSON
(
action
).
toString
());
bool
=
Boolean
.
TRUE
;
}
});
// 向预控系统发送消息
sendEquipSpecIndexToAutosysTopic
(
equipmentSpecificIndexList
);
...
...
@@ -707,29 +723,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
return
flag
;
}
public
List
<
EquipmentSpecificAlarmLog
>
saveOrUpdateEquipAlarm
(
List
<
EquipmentSpecificAlarm
>
equipmentSpecificAlarms
)
{
List
<
EquipmentSpecificAlarmLog
>
equipmentAlarmLogs
=
new
ArrayList
<>();
if
(
ObjectUtils
.
isEmpty
(
equipmentSpecificAlarms
))
{
return
equipmentAlarmLogs
;
}
equipmentSpecificAlarmService
.
saveOrUpdateBatch
(
equipmentSpecificAlarms
);
equipmentSpecificAlarms
.
forEach
(
action
->
{
if
(
AlarmStatusEnum
.
BJ
.
getCode
()
==
action
.
getStatus
())
{
equipmentAlarmLogs
.
add
(
addEquipAlarmLogRecord
(
action
));
if
(
ValidationUtil
.
isEmpty
(
action
.
getAlamContent
()))
{
action
.
setAlamContent
(
action
.
getEquipmentSpecificName
()
+
action
.
getEquipmentSpecificIndexName
());
}
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQDQR
.
getTopic
(),
JSONArray
.
toJSON
(
action
).
toString
());
}
else
{
equipmentAlarmLogs
.
addAll
(
upAlarmLogStatus
(
action
.
getIotCode
(),
action
.
getEquipmentSpecificIndexKey
(),
action
.
getTraceId
(),
equipmentSpecificAlarmLogService
));
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQYQR
.
getTopic
(),
JSONArray
.
toJSON
(
action
).
toString
());
bool
=
Boolean
.
TRUE
;
}
});
return
equipmentAlarmLogs
;
}
// public void saveOrUpdateEquipAlarm(
// List<EquipmentSpecificAlarm> equipmentSpecificAlarms) {
// equipmentSpecificAlarmService.saveOrUpdateBatch(equipmentSpecificAlarms);
// }
/**
* 报警日志同步其他系统
...
...
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