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
9bde89bd
Commit
9bde89bd
authored
Jun 14, 2023
by
maoying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除无用代码
parent
59858e54
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
161 deletions
+16
-161
EquipmentSpecificSerivceImpl.java
...quipmanage/service/impl/EquipmentSpecificSerivceImpl.java
+11
-9
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+5
-152
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentSpecificSerivceImpl.java
View file @
9bde89bd
...
@@ -1714,16 +1714,18 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
...
@@ -1714,16 +1714,18 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Override
@Override
public
void
updateEquipmentSpecIndexRealtimeData
(
EquipmentSpecificIndex
index
)
{
public
void
updateEquipmentSpecIndexRealtimeData
(
EquipmentSpecificIndex
index
)
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
if
(!
ObjectUtils
.
isEmpty
(
index
))
{
if
(!
ObjectUtils
.
isEmpty
(
index
.
getEquipmentSpecificId
()
))
{
EquipmentSpecific
es
=
equipmentSpecificMapper
.
selectById
(
index
.
getEquipmentSpecificId
());
EquipmentSpecific
es
=
equipmentSpecificMapper
.
selectById
(
index
.
getEquipmentSpecificId
());
es
.
setRealtimeIotEsIndexId
(
index
.
getId
());
if
(!
ObjectUtils
.
isEmpty
(
es
)){
es
.
setRealtimeIotIndexKey
(
index
.
getNameKey
());
es
.
setRealtimeIotEsIndexId
(
index
.
getId
());
es
.
setRealtimeIotIndexName
(
index
.
getEquipmentSpecificIndexName
());
es
.
setRealtimeIotIndexKey
(
index
.
getNameKey
());
es
.
setRealtimeIotIndexValue
(
index
.
getValue
());
es
.
setRealtimeIotIndexName
(
index
.
getEquipmentSpecificIndexName
());
es
.
setRealtimeIotIndexId
(
index
.
getEquipmentIndexId
());
es
.
setRealtimeIotIndexValue
(
index
.
getValue
());
es
.
setRealtimeIotIndexUpdateDate
(
index
.
getUpdateDate
());
es
.
setRealtimeIotIndexId
(
index
.
getEquipmentIndexId
());
es
.
setValueLabel
(
index
.
getValueLabel
());
es
.
setRealtimeIotIndexUpdateDate
(
index
.
getUpdateDate
());
equipmentSpecificMapper
.
updateById
(
es
);
es
.
setValueLabel
(
index
.
getValueLabel
());
equipmentSpecificMapper
.
updateById
(
es
);
}
}
}
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MqttReceiveServiceImpl.java
View file @
9bde89bd
...
@@ -606,9 +606,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -606,9 +606,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
topicEntity
.
setTopic
(
topic
);
topicEntity
.
setTopic
(
topic
);
topicEntity
.
setMessage
(
message
);
topicEntity
.
setMessage
(
message
);
List
<
IotDataVO
>
iotDatalist
=
new
ArrayList
<>();
List
<
EquipmentSpecificIndex
>
equipmentSpecificIndexList
=
new
ArrayList
<>();
List
<
EquipmentSpecificIndex
>
equipmentSpecificIndexList
=
new
ArrayList
<>();
List
<
EquipmentSpecificAlarm
>
equipmentSpecificAlarms
=
new
ArrayList
<>();
List
<
IndexStateVo
>
indexStateList
=
new
ArrayList
<>();
List
<
IndexStateVo
>
indexStateList
=
new
ArrayList
<>();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
message
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
message
);
...
@@ -618,7 +616,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -618,7 +616,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
String
gatewayId
=
jsonObject
.
getString
(
"gatewayId"
);
String
gatewayId
=
jsonObject
.
getString
(
"gatewayId"
);
String
value
;
String
value
;
//如果消息是遥信类型,进行指标转换
//如果消息是遥信类型,进行指标转换
if
(
dataType
!=
null
&&
dataType
.
equals
(
"state"
)){
if
(
dataType
!=
null
&&
!
"state"
.
equals
(
dataType
)){
value
=
jsonObject
.
getString
(
"value"
);
value
=
jsonObject
.
getString
(
"value"
);
}
else
{
}
else
{
value
=
jsonObject
.
getInteger
(
"value"
)
==
1
?
"true"
:
"false"
;
value
=
jsonObject
.
getInteger
(
"value"
)
==
1
?
"true"
:
"false"
;
...
@@ -637,10 +635,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -637,10 +635,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpeIndex
.
setDataType
(
dataType
);
equipmentSpeIndex
.
setDataType
(
dataType
);
equipmentSpeIndex
.
setTraceId
(
traceId
);
equipmentSpeIndex
.
setTraceId
(
traceId
);
equipmentSpeIndex
.
setUUID
(
UUIDUtils
.
getUUID
());
equipmentSpeIndex
.
setUUID
(
UUIDUtils
.
getUUID
());
IotDataVO
iotDataVO
=
new
IotDataVO
();
//更新装备性能指标
iotDataVO
.
setKey
(
equipmentSpeIndex
.
getNameKey
());
equipmentSpecificIndexService
.
updateById
(
equipmentSpeIndex
);
iotDataVO
.
setValue
(
value
);
iotDatalist
.
add
(
iotDataVO
);
QueryWrapper
<
EquipmentSpecific
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
EquipmentSpecific
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"id"
,
equipmentSpeIndex
.
getEquipmentSpecificId
());
queryWrapper
.
eq
(
"id"
,
equipmentSpeIndex
.
getEquipmentSpecificId
());
...
@@ -663,11 +660,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -663,11 +660,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
topicEntity
.
setType
(
equipmentSpecificVo
.
getType
());
topicEntity
.
setType
(
equipmentSpecificVo
.
getType
());
topicEntity
.
setCode
(
equipmentSpecificVo
.
getCode
());
topicEntity
.
setCode
(
equipmentSpecificVo
.
getCode
());
//es存储数据
eSeqService
.
saveESEquiplistSpecificBySystemESVO
(
equipmentSpeIndex
,
String
.
valueOf
(
equipmentSpecificVo
.
getSystemId
()),
equipmentSpecificVo
.
getSystemName
());
//更新装备性能指标
equipmentSpecificIndexService
.
updateById
(
equipmentSpeIndex
);
// 更新设备表指标状态
// 更新设备表指标状态
iEquipmentSpecificSerivce
.
updateEquipmentSpecIndexRealtimeData
(
equipmentSpeIndex
);
iEquipmentSpecificSerivce
.
updateEquipmentSpecIndexRealtimeData
(
equipmentSpeIndex
);
...
@@ -678,110 +670,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -678,110 +670,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 添加指标报告
// 添加指标报告
saveEquipmentAlarmReportDay
(
equipmentSpeIndex
);
saveEquipmentAlarmReportDay
(
equipmentSpeIndex
);
// 火眼数据构造告警指标逻辑
equipmentSpeIndex
=
handleTemperatureAlarm
(
equipmentSpeIndex
,
iotDatalist
);
boolean
alarmFlag
=
false
;
Map
<
String
,
String
>
messageBodyMap
=
new
HashMap
<>();
//管网压力、泡沫罐信息、水箱液位告警处理
if
(
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
CAFS_FoamTank_FoamTankLevel
.
toLowerCase
())
||
FHS_PipePressureDetector_PipePressure
.
toLowerCase
().
equals
(
iotDataVO
.
getKey
().
toLowerCase
())
||
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
CAFS_WaterTank_WaterTankLevel
.
toLowerCase
()))
{
alarmFlag
=
doFoamTankLevel
(
iotDataVO
,
equipmentSpeIndex
,
messageBodyMap
);
}
//消防水池液位处理
if
(
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
FHS_FirePoolDevice_WaterLevel
.
toLowerCase
())
||
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
FHS_WirelessliquidDetector_WaterLevel
.
toLowerCase
()))
{
alarmFlag
=
doWaterPoolLevel
(
iotDataVO
,
equipmentSpeIndex
,
messageBodyMap
);
}
// 遥测数据生成告警事件、日志处理
if
(
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
CAFS_FoamTank_FoamTankLevel
.
toLowerCase
())
||
FHS_PipePressureDetector_PipePressure
.
toLowerCase
().
equals
(
iotDataVO
.
getKey
().
toLowerCase
())
||
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
CAFS_WaterTank_WaterTankLevel
.
toLowerCase
())
||
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
FHS_FirePoolDevice_WaterLevel
.
toLowerCase
())
||
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
FHS_WirelessliquidDetector_WaterLevel
.
toLowerCase
()))
{
handlingAlarms
(
equipmentSpeIndex
,
alarmFlag
);
}
// 指标告警处理
if
(
equipmentSpeIndex
.
getIsAlarm
()
!=
null
&&
1
==
equipmentSpeIndex
.
getIsAlarm
())
{
equipmentSpecificAlarms
.
addAll
(
createIndexAlarmRecord
(
equipmentSpeIndex
,
messageBodyMap
));
}
// 遥测遥信数据推送云端kafka
JSONObject
jsonObjectXf
=
new
JSONObject
();
jsonObjectXf
.
put
(
"data_class"
,
"realdata"
);
if
(
equipmentSpeIndex
.
getIsTrend
()
==
1
)
{
jsonObjectXf
.
put
(
"data_type"
,
"analog"
);
}
else
{
jsonObjectXf
.
put
(
"data_type"
,
"state"
);
}
String
date
=
DateUtils
.
date2LongStr
(
new
Date
());
jsonObjectXf
.
put
(
"op_type"
,
"subscribe_emergency"
);
JSONObject
jsonObjectCondition
=
new
JSONObject
();
jsonObjectCondition
.
put
(
"station_psr_id"
,
stationCode
);
jsonObjectCondition
.
put
(
"station_name"
,
stationName
);
jsonObjectCondition
.
put
(
"data_upload_time"
,
date
);
jsonObjectXf
.
put
(
"condition"
,
jsonObjectCondition
);
JSONObject
jsonObjectData
=
new
JSONObject
();
jsonObjectData
.
put
(
"psrId"
,
stationCode
);
jsonObjectData
.
put
(
"astId"
,
equipmentSpeIndex
.
getSpecificCode
());
jsonObjectData
.
put
(
"equipType"
,
equipmentSpeIndex
.
getEquipmentCode
());
jsonObjectData
.
put
(
"name"
,
equipmentSpeIndex
.
getEquipmentSpecificName
()
+
"-"
+
equipmentSpeIndex
.
getEquipmentSpecificIndexName
());
if
(
value
.
equals
(
"true"
))
{
jsonObjectData
.
put
(
"value"
,
"1"
);
}
else
if
(
value
.
equals
(
"false"
))
{
jsonObjectData
.
put
(
"value"
,
"0"
);
}
else
{
jsonObjectData
.
put
(
"value"
,
value
);
}
jsonObjectData
.
put
(
"measurementType"
,
null
==
equipmentSpeIndex
.
getEquipmentIndexKey
()
?
""
:
equipmentSpeIndex
.
getEquipmentIndexKey
());
jsonObjectData
.
put
(
"dateTime"
,
date
);
jsonObjectData
.
put
(
"quality"
,
"0"
);
// 量测质量码:0 有效,1 无效
List
<
JSONObject
>
jsonObjects
=
Arrays
.
asList
(
jsonObjectData
);
jsonObjectXf
.
put
(
"data"
,
jsonObjects
);
// 遥测
if
(!
isOpenTelemetering
&&
equipmentSpeIndex
.
getIsTrend
()
==
1
)
{
}
else
{
try
{
emqKeeper
.
getMqttClient
().
publish
(
"emq.xf.created"
,
jsonObjectXf
.
toString
().
getBytes
(),
1
,
false
);
log
.
info
(
"遥测遥信数据推送云端kafka成功"
);
}
catch
(
MqttException
e
)
{
log
.
error
(
"遥测遥信数据推送云端kafka失败=====>"
+
e
.
getMessage
());
e
.
printStackTrace
();
}
}
// 报警数据保存
List
<
EquipmentSpecificAlarmLog
>
alarmLogs
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
equipmentSpecificAlarms
))
{
equipmentSpecificAlarmService
.
saveOrUpdateBatch
(
equipmentSpecificAlarms
);
}
// 需要在事务提交之后,否则事务隔离查询不出数据
// 需要在事务提交之后,否则事务隔离查询不出数据
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
@Override
public
void
afterCommit
()
{
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
,
false
));
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQYQR
.
getTopic
(),
JSONArray
.
toJSON
(
action
).
toString
());
bool
=
Boolean
.
TRUE
;
}
});
// 直流中心消息推送刷新
// 直流中心消息推送刷新
publishDataToDCCenterPage
(
equipmentSpecificIndexList
);
publishDataToDCCenterPage
(
equipmentSpecificIndexList
);
...
@@ -808,47 +702,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -808,47 +702,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 向画布推送
// 向画布推送
publishDataToCanvas
(
equipmentSpecificIndexList
);
publishDataToCanvas
(
equipmentSpecificIndexList
);
// 向其他系统推送报警
equipmentAlarmLogsToOtherSystems
(
alarmLogs
);
if
(
equipmentSpecificVo
.
getEcode
()
!=
null
)
{
String
ecode
=
equipmentSpecificVo
.
getEcode
();
boolean
flag
=
false
;
//消防泵
String
[]
strings
=
pumpCodes
.
split
(
","
);
for
(
String
string
:
strings
)
{
if
(
ecode
.
startsWith
(
string
))
{
//通知>消防应急预案
topicEntity
.
setType
(
"xfb"
);
mqttSendGateway
.
sendToMqtt
(
emergencyDisposalIndicators
,
JSONObject
.
toJSONString
(
topicEntity
));
flag
=
true
;
break
;
}
}
// 消防炮
String
[]
stringxfp
=
monitorCodes
.
split
(
","
);
if
(!
flag
)
{
for
(
String
string1
:
stringxfp
)
{
if
(
ecode
.
startsWith
(
string1
))
{
//通知>消防应急预案
topicEntity
.
setType
(
"xfp"
);
mqttSendGateway
.
sendToMqtt
(
emergencyDisposalIndicators
,
JSONObject
.
toJSONString
(
topicEntity
));
flag
=
true
;
break
;
}
}
}
//消防水源
if
(!
flag
)
{
List
<
Map
>
lit
=
iEquipmentSpecificSerivce
.
getWater
(
equipmentSpecificVo
.
getId
());
if
(
lit
!=
null
&&
lit
.
size
()
>
0
)
{
topicEntity
.
setType
(
"xfsy"
);
mqttSendGateway
.
sendToMqtt
(
emergencyDisposalIndicators
,
JSONObject
.
toJSONString
(
topicEntity
));
}
}
}
}
}
}
}
});
});
...
...
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