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
b3077db1
Commit
b3077db1
authored
Jun 21, 2023
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(equip):苏州换流站代码优化
parent
7e9c0b42
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
259 additions
and
189 deletions
+259
-189
RedisKey.java
...java/com/yeejoin/amos/boot/biz/common/utils/RedisKey.java
+10
-0
EquipmentIndexVO.java
...eejoin/equipmanage/common/entity/vo/EquipmentIndexVO.java
+9
-0
EquipmentIndexCacheRunner.java
...yeejoin/equipmanage/config/EquipmentIndexCacheRunner.java
+48
-0
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+187
-187
EquipmentSpecificIndexMapper.xml
...rc/main/resources/mapper/EquipmentSpecificIndexMapper.xml
+5
-2
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/RedisKey.java
View file @
b3077db1
...
@@ -42,6 +42,16 @@ public class RedisKey {
...
@@ -42,6 +42,16 @@ public class RedisKey {
/** 企业用户注册前缀 */
/** 企业用户注册前缀 */
public
static
final
String
FLC_USER_TEL
=
"flc_tel_"
;
public
static
final
String
FLC_USER_TEL
=
"flc_tel_"
;
/**
* 装备指标Key值
*/
public
static
final
String
EQUIP_INDEX_ADDRESS
=
"equip_index_address"
;
/**
* 装备指标Key值
*/
public
static
final
String
EQUIP_INDEX_ADDRESS_KEY
=
"equip_index_address_key"
;
/** 驼峰转下划线(简单写法,效率低于 ) */
/** 驼峰转下划线(简单写法,效率低于 ) */
public
static
String
humpToLine
(
String
str
)
{
public
static
String
humpToLine
(
String
str
)
{
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/vo/EquipmentIndexVO.java
View file @
b3077db1
...
@@ -69,4 +69,13 @@ public class EquipmentIndexVO {
...
@@ -69,4 +69,13 @@ public class EquipmentIndexVO {
@ApiModelProperty
(
value
=
"指标枚举"
)
@ApiModelProperty
(
value
=
"指标枚举"
)
private
String
valueEnum
;
private
String
valueEnum
;
@ApiModelProperty
(
value
=
"信号的索引键key,用于唯一索引信号"
)
private
String
indexAddress
;
@ApiModelProperty
(
value
=
"测点类型,analog/state"
)
private
String
dataType
;
@ApiModelProperty
(
value
=
"网关标识"
)
private
String
gatewayId
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/config/EquipmentIndexCacheRunner.java
0 → 100644
View file @
b3077db1
package
com
.
yeejoin
.
equipmanage
.
config
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO
;
import
com.yeejoin.equipmanage.mapper.EquipmentSpecificIndexMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* @author LiuLin
* @date 2023/6/15
* @apiNote
*/
@Component
@Slf4j
public
class
EquipmentIndexCacheRunner
implements
CommandLineRunner
{
@Resource
private
EquipmentSpecificIndexMapper
equipmentSpecificIndexMapper
;
@Resource
private
RedisUtils
redisUtils
;
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
log
.
info
(
">>服务启动执行,执行预加载数据等操作"
);
redisUtils
.
del
(
RedisKey
.
EQUIP_INDEX_ADDRESS
);
redisUtils
.
del
(
RedisKey
.
EQUIP_INDEX_ADDRESS_KEY
);
List
<
EquipmentIndexVO
>
equipSpecificIndexList
=
equipmentSpecificIndexMapper
.
getEquipSpecificIndexList
(
null
);
Map
<
String
,
Object
>
equipmentIndexVOMap
=
equipSpecificIndexList
.
stream
()
.
filter
(
v
->
v
.
getGatewayId
()
!=
null
)
.
collect
(
Collectors
.
toMap
(
vo
->
vo
.
getIndexAddress
()
+
"_"
+
vo
.
getGatewayId
(),
Function
.
identity
()));
Map
<
String
,
Object
>
equipmentIndexKeyMap
=
equipSpecificIndexList
.
stream
()
.
filter
(
v
->
v
.
getIndexAddress
()
!=
null
&&
v
.
getGatewayId
()
==
null
)
.
collect
(
Collectors
.
toMap
(
EquipmentIndexVO:
:
getIndexAddress
,
Function
.
identity
()));
redisUtils
.
hmset
(
RedisKey
.
EQUIP_INDEX_ADDRESS
,
equipmentIndexVOMap
);
redisUtils
.
hmset
(
RedisKey
.
EQUIP_INDEX_ADDRESS_KEY
,
equipmentIndexKeyMap
);
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MqttReceiveServiceImpl.java
View file @
b3077db1
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.component.influxdb.InfluxDbConnection
;
import
com.yeejoin.amos.component.influxdb.InfluxDbConnection
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
...
@@ -370,237 +371,236 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -370,237 +371,236 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
timeStamp
=
jsonObject
.
getString
(
"time_stamp"
);
timeStamp
=
jsonObject
.
getString
(
"time_stamp"
);
quality
=
jsonObject
.
getString
(
"quality"
);
quality
=
jsonObject
.
getString
(
"quality"
);
}
}
Map
<
Object
,
Object
>
equipmentIndexKeyMap
=
redisUtils
.
hmget
(
RedisKey
.
EQUIP_INDEX_ADDRESS_KEY
);
if
(
equipmentIndexKeyMap
.
get
(
indexAddress
)
!=
null
)
{
EquipmentSpecificIndex
equipmentSpeIndex
=
equipmentSpecificIndexService
.
getEquipmentSpeIndexByIndexAddress
(
indexAddress
,
null
);
EquipmentSpecificIndex
equipmentSpeIndex
=
equipmentSpecificIndexService
.
getEquipmentSpeIndexByIndexAddress
(
indexAddress
,
null
);
equipmentSpeIndex
.
setValue
(
value
);
if
(
equipmentSpeIndex
==
null
)
{
equipmentSpeIndex
.
setValueLabel
(
valueTranslate
(
value
,
equipmentSpeIndex
.
getValueEnum
()));
return
;
equipmentSpeIndex
.
setEquipmentType
(
topicEntity
.
getType
());
}
equipmentSpeIndex
.
setUpdateDate
(
new
Date
());
equipmentSpeIndex
.
setValue
(
value
);
equipmentSpeIndex
.
setQuality
(
quality
);
equipmentSpeIndex
.
setValueLabel
(
valueTranslate
(
value
,
equipmentSpeIndex
.
getValueEnum
()));
equipmentSpeIndex
.
setDataType
(
dataType
);
equipmentSpeIndex
.
setEquipmentType
(
topicEntity
.
getType
());
equipmentSpeIndex
.
setTimeStamp
(
timeStamp
);
equipmentSpeIndex
.
setUpdateDate
(
new
Date
());
equipmentSpeIndex
.
setUUID
(
UUIDUtils
.
getUUID
());
equipmentSpeIndex
.
setQuality
(
quality
);
equipmentSpeIndex
.
setDataType
(
dataType
);
equipmentSpeIndex
.
setTimeStamp
(
timeStamp
);
equipmentSpeIndex
.
setUUID
(
UUIDUtils
.
getUUID
());
IotDataVO
iotDataVO
=
new
IotDataVO
();
IotDataVO
iotDataVO
=
new
IotDataVO
();
iotDataVO
.
setKey
(
equipmentSpeIndex
.
getNameKey
());
iotDataVO
.
setKey
(
equipmentSpeIndex
.
getNameKey
());
iotDataVO
.
setValue
(
value
);
iotDataVO
.
setValue
(
value
);
iotDatalist
.
add
(
iotDataVO
);
iotDatalist
.
add
(
iotDataVO
);
// iEquipmentSpecificSerivce.getEquipSpecificDetailsByEquipmentId(equipmentSpeIndex.getEquipmentSpecificId());
// iEquipmentSpecificSerivce.getEquipSpecificDetailsByEquipmentId(equipmentSpeIndex.getEquipmentSpecificId());
QueryWrapper
<
EquipmentSpecific
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
EquipmentSpecific
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"id"
,
equipmentSpeIndex
.
getEquipmentSpecificId
());
queryWrapper
.
eq
(
"id"
,
equipmentSpeIndex
.
getEquipmentSpecificId
());
EquipmentSpecific
equipmentSpecific
=
iEquipmentSpecificSerivce
.
getOne
(
queryWrapper
);
EquipmentSpecific
equipmentSpecific
=
iEquipmentSpecificSerivce
.
getOne
(
queryWrapper
);
if
(
equipmentSpecific
==
null
)
{
if
(
equipmentSpecific
==
null
)
{
return
;
return
;
}
}
String
iotCode
=
equipmentSpecific
.
getIotCode
();
String
iotCode
=
equipmentSpecific
.
getIotCode
();
List
<
EquipmentSpecificVo
>
eqIotCodeList
=
iEquipmentSpecificSerivce
.
getEquipAndCarIotcodeByIotcode
(
iotCode
);
List
<
EquipmentSpecificVo
>
eqIotCodeList
=
iEquipmentSpecificSerivce
.
getEquipAndCarIotcodeByIotcode
(
iotCode
);
if
(
eqIotCodeList
.
isEmpty
())
{
if
(
eqIotCodeList
.
isEmpty
())
{
log
.
info
(
"该数据{}不存在!"
,
iotCode
);
log
.
info
(
"该数据{}不存在!"
,
iotCode
);
return
;
return
;
}
}
if
(
eqIotCodeList
.
size
()
>
1
)
{
if
(
eqIotCodeList
.
size
()
>
1
)
{
log
.
info
(
"有重复的{}数据!"
,
iotCode
);
log
.
info
(
"有重复的{}数据!"
,
iotCode
);
}
}
EquipmentSpecificVo
equipmentSpecificVo
=
eqIotCodeList
.
get
(
0
);
EquipmentSpecificVo
equipmentSpecificVo
=
eqIotCodeList
.
get
(
0
);
topicEntity
.
setType
(
equipmentSpecificVo
.
getType
());
topicEntity
.
setType
(
equipmentSpecificVo
.
getType
());
topicEntity
.
setCode
(
equipmentSpecificVo
.
getCode
());
topicEntity
.
setCode
(
equipmentSpecificVo
.
getCode
());
//es存储数据
//es存储数据
eSeqService
.
saveESEquiplistSpecificBySystemESVO
(
equipmentSpeIndex
,
String
.
valueOf
(
equipmentSpecificVo
.
getSystemId
()),
equipmentSpecificVo
.
getSystemName
());
eSeqService
.
saveESEquiplistSpecificBySystemESVO
(
equipmentSpeIndex
,
String
.
valueOf
(
equipmentSpecificVo
.
getSystemId
()),
equipmentSpecificVo
.
getSystemName
());
//更新装备性能指标
//更新装备性能指标
equipmentSpecificIndexService
.
updateById
(
equipmentSpeIndex
);
equipmentSpecificIndexService
.
updateById
(
equipmentSpeIndex
);
// 更新设备表指标状态
// 更新设备表指标状态
iEquipmentSpecificSerivce
.
updateEquipmentSpecIndexRealtimeData
(
equipmentSpeIndex
);
iEquipmentSpecificSerivce
.
updateEquipmentSpecIndexRealtimeData
(
equipmentSpeIndex
);
equipmentSpecificIndexList
.
add
(
equipmentSpeIndex
);
equipmentSpecificIndexList
.
add
(
equipmentSpeIndex
);
indexStateList
.
add
(
createIndexStateVo
(
equipmentSpeIndex
));
indexStateList
.
add
(
createIndexStateVo
(
equipmentSpeIndex
));
// 添加指标报告
// 添加指标报告
saveEquipmentAlarmReportDay
(
equipmentSpeIndex
);
saveEquipmentAlarmReportDay
(
equipmentSpeIndex
);
// 火眼数据构造告警指标逻辑
// 火眼数据构造告警指标逻辑
equipmentSpeIndex
=
handleTemperatureAlarm
(
equipmentSpeIndex
,
iotDatalist
);
equipmentSpeIndex
=
handleTemperatureAlarm
(
equipmentSpeIndex
,
iotDatalist
);
boolean
alarmFlag
=
false
;
boolean
alarmFlag
=
false
;
Map
<
String
,
String
>
messageBodyMap
=
new
HashMap
<>();
Map
<
String
,
String
>
messageBodyMap
=
new
HashMap
<>();
//管网压力、泡沫罐信息、水箱液位告警处理
//管网压力、泡沫罐信息、水箱液位告警处理
if
(
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
CAFS_FoamTank_FoamTankLevel
.
toLowerCase
())
||
if
(
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
CAFS_FoamTank_FoamTankLevel
.
toLowerCase
())
||
FHS_PipePressureDetector_PipePressure
.
toLowerCase
().
equals
(
iotDataVO
.
getKey
().
toLowerCase
())
||
FHS_PipePressureDetector_PipePressure
.
toLowerCase
().
equals
(
iotDataVO
.
getKey
().
toLowerCase
())
||
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
CAFS_WaterTank_WaterTankLevel
.
toLowerCase
()))
{
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
CAFS_WaterTank_WaterTankLevel
.
toLowerCase
()))
{
alarmFlag
=
doFoamTankLevel
(
iotDataVO
,
equipmentSpeIndex
,
messageBodyMap
);
alarmFlag
=
doFoamTankLevel
(
iotDataVO
,
equipmentSpeIndex
,
messageBodyMap
);
}
}
//消防水池液位处理
//消防水池液位处理
if
(
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
FHS_FirePoolDevice_WaterLevel
.
toLowerCase
())
||
if
(
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
FHS_FirePoolDevice_WaterLevel
.
toLowerCase
())
||
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
FHS_WirelessliquidDetector_WaterLevel
.
toLowerCase
()))
{
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
FHS_WirelessliquidDetector_WaterLevel
.
toLowerCase
()))
{
alarmFlag
=
doWaterPoolLevel
(
iotDataVO
,
equipmentSpeIndex
,
messageBodyMap
);
alarmFlag
=
doWaterPoolLevel
(
iotDataVO
,
equipmentSpeIndex
,
messageBodyMap
);
}
}
// 遥测数据生成告警事件、日志处理
// 遥测数据生成告警事件、日志处理
if
(
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
CAFS_FoamTank_FoamTankLevel
.
toLowerCase
())
||
if
(
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
CAFS_FoamTank_FoamTankLevel
.
toLowerCase
())
||
FHS_PipePressureDetector_PipePressure
.
toLowerCase
().
equals
(
iotDataVO
.
getKey
().
toLowerCase
())
||
FHS_PipePressureDetector_PipePressure
.
toLowerCase
().
equals
(
iotDataVO
.
getKey
().
toLowerCase
())
||
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
CAFS_WaterTank_WaterTankLevel
.
toLowerCase
())
||
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
CAFS_WaterTank_WaterTankLevel
.
toLowerCase
())
||
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
FHS_FirePoolDevice_WaterLevel
.
toLowerCase
())
||
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
FHS_FirePoolDevice_WaterLevel
.
toLowerCase
())
||
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
FHS_WirelessliquidDetector_WaterLevel
.
toLowerCase
()))
{
iotDataVO
.
getKey
().
toLowerCase
().
equals
(
FHS_WirelessliquidDetector_WaterLevel
.
toLowerCase
()))
{
handlingAlarms
(
equipmentSpeIndex
,
alarmFlag
);
handlingAlarms
(
equipmentSpeIndex
,
alarmFlag
);
}
}
// 指标告警处理
// 指标告警处理
if
(
equipmentSpeIndex
.
getIsAlarm
()
!=
null
&&
1
==
equipmentSpeIndex
.
getIsAlarm
())
{
if
(
equipmentSpeIndex
.
getIsAlarm
()
!=
null
&&
1
==
equipmentSpeIndex
.
getIsAlarm
())
{
equipmentSpecificAlarms
.
addAll
(
createIndexAlarmRecord
(
equipmentSpeIndex
,
messageBodyMap
));
equipmentSpecificAlarms
.
addAll
(
createIndexAlarmRecord
(
equipmentSpeIndex
,
messageBodyMap
));
}
}
// 遥测遥信数据推送云端kafka
// 遥测遥信数据推送云端kafka
JSONObject
jsonObjectXf
=
new
JSONObject
();
JSONObject
jsonObjectXf
=
new
JSONObject
();
jsonObjectXf
.
put
(
"data_class"
,
"realdata"
);
jsonObjectXf
.
put
(
"data_class"
,
"realdata"
);
if
(
equipmentSpeIndex
.
getIsTrend
()
==
1
)
{
if
(
equipmentSpeIndex
.
getIsTrend
()
==
1
)
{
jsonObjectXf
.
put
(
"data_type"
,
"analog"
);
jsonObjectXf
.
put
(
"data_type"
,
"analog"
);
}
else
{
}
else
{
jsonObjectXf
.
put
(
"data_type"
,
"state"
);
jsonObjectXf
.
put
(
"data_type"
,
"state"
);
}
}
String
date
=
DateUtils
.
date2LongStr
(
new
Date
());
String
date
=
DateUtils
.
date2LongStr
(
new
Date
());
jsonObjectXf
.
put
(
"op_type"
,
"subscribe_emergency"
);
jsonObjectXf
.
put
(
"op_type"
,
"subscribe_emergency"
);
JSONObject
jsonObjectCondition
=
new
JSONObject
();
JSONObject
jsonObjectCondition
=
new
JSONObject
();
jsonObjectCondition
.
put
(
"station_psr_id"
,
stationCode
);
jsonObjectCondition
.
put
(
"station_psr_id"
,
stationCode
);
jsonObjectCondition
.
put
(
"station_name"
,
stationName
);
jsonObjectCondition
.
put
(
"station_name"
,
stationName
);
jsonObjectCondition
.
put
(
"data_upload_time"
,
date
);
jsonObjectCondition
.
put
(
"data_upload_time"
,
date
);
jsonObjectXf
.
put
(
"condition"
,
jsonObjectCondition
);
jsonObjectXf
.
put
(
"condition"
,
jsonObjectCondition
);
JSONObject
jsonObjectData
=
new
JSONObject
();
JSONObject
jsonObjectData
=
new
JSONObject
();
jsonObjectData
.
put
(
"psrId"
,
stationCode
);
jsonObjectData
.
put
(
"psrId"
,
stationCode
);
jsonObjectData
.
put
(
"astId"
,
equipmentSpeIndex
.
getSpecificCode
());
jsonObjectData
.
put
(
"astId"
,
equipmentSpeIndex
.
getSpecificCode
());
jsonObjectData
.
put
(
"equipType"
,
equipmentSpeIndex
.
getEquipmentCode
());
jsonObjectData
.
put
(
"equipType"
,
equipmentSpeIndex
.
getEquipmentCode
());
jsonObjectData
.
put
(
"name"
,
equipmentSpeIndex
.
getEquipmentSpecificName
()
+
"-"
+
equipmentSpeIndex
.
getEquipmentSpecificIndexName
());
jsonObjectData
.
put
(
"name"
,
equipmentSpeIndex
.
getEquipmentSpecificName
()
+
"-"
+
equipmentSpeIndex
.
getEquipmentSpecificIndexName
());
if
(
value
.
equals
(
"true"
))
{
if
(
value
.
equals
(
"true"
))
{
jsonObjectData
.
put
(
"value"
,
"1"
);
jsonObjectData
.
put
(
"value"
,
"1"
);
}
else
if
(
value
.
equals
(
"false"
))
{
}
else
if
(
value
.
equals
(
"false"
))
{
jsonObjectData
.
put
(
"value"
,
"0"
);
jsonObjectData
.
put
(
"value"
,
"0"
);
}
else
{
}
else
{
jsonObjectData
.
put
(
"value"
,
value
);
jsonObjectData
.
put
(
"value"
,
value
);
}
}
jsonObjectData
.
put
(
"measurementType"
,
null
==
equipmentSpeIndex
.
getEquipmentIndexKey
()
?
""
:
equipmentSpeIndex
.
getEquipmentIndexKey
());
jsonObjectData
.
put
(
"measurementType"
,
null
==
equipmentSpeIndex
.
getEquipmentIndexKey
()
?
""
:
equipmentSpeIndex
.
getEquipmentIndexKey
());
jsonObjectData
.
put
(
"dateTime"
,
date
);
jsonObjectData
.
put
(
"dateTime"
,
date
);
jsonObjectData
.
put
(
"quality"
,
"0"
);
// 量测质量码:0 有效,1 无效
jsonObjectData
.
put
(
"quality"
,
"0"
);
// 量测质量码:0 有效,1 无效
List
<
JSONObject
>
jsonObjects
=
Arrays
.
asList
(
jsonObjectData
);
List
<
JSONObject
>
jsonObjects
=
Arrays
.
asList
(
jsonObjectData
);
jsonObjectXf
.
put
(
"data"
,
jsonObjects
);
jsonObjectXf
.
put
(
"data"
,
jsonObjects
);
// 遥测
// 遥测
if
(!
isOpenTelemetering
&&
equipmentSpeIndex
.
getIsTrend
()
==
1
)
{
if
(!
isOpenTelemetering
&&
equipmentSpeIndex
.
getIsTrend
()
==
1
)
{
}
else
{
}
else
{
try
{
try
{
emqKeeper
.
getMqttClient
().
publish
(
"emq.xf.created"
,
jsonObjectXf
.
toString
().
getBytes
(),
1
,
false
);
emqKeeper
.
getMqttClient
().
publish
(
"emq.xf.created"
,
jsonObjectXf
.
toString
().
getBytes
(),
1
,
false
);
log
.
info
(
"遥测遥信数据推送云端kafka成功"
);
log
.
info
(
"遥测遥信数据推送云端kafka成功"
);
}
catch
(
MqttException
e
)
{
}
catch
(
MqttException
e
)
{
log
.
error
(
"遥测遥信数据推送云端kafka失败=====>"
+
e
.
getMessage
());
log
.
error
(
"遥测遥信数据推送云端kafka失败=====>"
+
e
.
getMessage
());
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
// 报警数据保存
// 报警数据保存
List
<
EquipmentSpecificAlarmLog
>
alarmLogs
=
new
ArrayList
<>();
List
<
EquipmentSpecificAlarmLog
>
alarmLogs
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
equipmentSpecificAlarms
))
{
if
(!
ObjectUtils
.
isEmpty
(
equipmentSpecificAlarms
))
{
equipmentSpecificAlarmService
.
saveOrUpdateBatch
(
equipmentSpecificAlarms
);
equipmentSpecificAlarmService
.
saveOrUpdateBatch
(
equipmentSpecificAlarms
);
}
}
// 需要在事务提交之后,否则事务隔离查询不出数据
// 需要在事务提交之后,否则事务隔离查询不出数据
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
@Override
public
void
afterCommit
()
{
public
void
afterCommit
()
{
equipmentSpecificAlarms
.
forEach
(
action
->
{
equipmentSpecificAlarms
.
forEach
(
action
->
{
if
(
AlarmStatusEnum
.
BJ
.
getCode
()
==
action
.
getStatus
())
{
if
(
AlarmStatusEnum
.
BJ
.
getCode
()
==
action
.
getStatus
())
{
alarmLogs
.
add
(
addEquipAlarmLogRecord
(
action
));
alarmLogs
.
add
(
addEquipAlarmLogRecord
(
action
));
if
(
ValidationUtil
.
isEmpty
(
action
.
getAlamContent
()))
{
if
(
ValidationUtil
.
isEmpty
(
action
.
getAlamContent
()))
{
action
.
setAlamContent
(
action
.
getEquipmentSpecificName
()
+
action
.
getEquipmentSpecificIndexName
());
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
;
}
}
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
);
// 四横八纵遥测信号信息列表刷新
// 四横八纵遥测信号信息列表刷新
publishNormalIndexValueToPage
(
equipmentSpecificIndexList
);
publishNormalIndexValueToPage
(
equipmentSpecificIndexList
);
if
(
"zd"
.
equals
(
system
))
{
if
(
"zd"
.
equals
(
system
))
{
System
.
out
.
println
(
"站端系统----------------"
);
System
.
out
.
println
(
"站端系统----------------"
);
// 向预控系统发送消息
// 向预控系统发送消息
sendEquipSpecIndexToAutosysTopic
(
equipmentSpecificIndexList
);
sendEquipSpecIndexToAutosysTopic
(
equipmentSpecificIndexList
);
// 首页性能指标数据订阅
// 首页性能指标数据订阅
mqttSendGateway
.
sendToMqtt
(
indexTopic
,
JSON
.
toJSONString
(
indexStateList
));
mqttSendGateway
.
sendToMqtt
(
indexTopic
,
JSON
.
toJSONString
(
indexStateList
));
// 组态大屏消息推送,设备表实时指标修改
// 组态大屏消息推送,设备表实时指标修改
intePageSysDataRefresh
(
equipmentSpecificIndexList
,
topicEntity
);
intePageSysDataRefresh
(
equipmentSpecificIndexList
,
topicEntity
);
// 数字换流站同步指标修改
// 数字换流站同步指标修改
syncSpecificIndexsToGS
(
equipmentSpecificIndexList
);
syncSpecificIndexsToGS
(
equipmentSpecificIndexList
);
// 则更新拓扑节点数据及告警状态
// 则更新拓扑节点数据及告警状态
updateNodeDateByEquipId
(
equipmentSpecificIndexList
);
updateNodeDateByEquipId
(
equipmentSpecificIndexList
);
// 向画布推送
// 向画布推送
publishDataToCanvas
(
equipmentSpecificIndexList
);
publishDataToCanvas
(
equipmentSpecificIndexList
);
// 向其他系统推送报警
// 向其他系统推送报警
equipmentAlarmLogsToOtherSystems
(
alarmLogs
);
equipmentAlarmLogsToOtherSystems
(
alarmLogs
);
if
(
equipmentSpecificVo
.
getEcode
()
!=
null
)
{
String
ecode
=
equipmentSpecificVo
.
getEcode
();
boolean
flag
=
false
;
//消防泵
if
(
equipmentSpecificVo
.
getEcode
()
!=
null
)
{
String
[]
strings
=
pumpCodes
.
split
(
","
);
String
ecode
=
equipmentSpecificVo
.
getEcode
();
for
(
String
string
:
strings
)
{
boolean
flag
=
false
;
if
(
ecode
.
startsWith
(
string
))
{
//通知>消防应急预案
topicEntity
.
setType
(
"xfb"
);
mqttSendGateway
.
sendToMqtt
(
emergencyDisposalIndicators
,
JSONObject
.
toJSONString
(
topicEntity
));
flag
=
true
;
break
;
}
}
// 消防炮
//消防泵
String
[]
stringxfp
=
monitorCodes
.
split
(
","
);
String
[]
strings
=
pumpCodes
.
split
(
","
);
if
(!
flag
)
{
for
(
String
string
:
strings
)
{
for
(
String
string1
:
stringxfp
)
{
if
(
ecode
.
startsWith
(
string
))
{
if
(
ecode
.
startsWith
(
string1
))
{
//通知>消防应急预案
//通知>消防应急预案
topicEntity
.
setType
(
"xf
p
"
);
topicEntity
.
setType
(
"xf
b
"
);
mqttSendGateway
.
sendToMqtt
(
emergencyDisposalIndicators
,
JSONObject
.
toJSONString
(
topicEntity
));
mqttSendGateway
.
sendToMqtt
(
emergencyDisposalIndicators
,
JSONObject
.
toJSONString
(
topicEntity
));
flag
=
true
;
flag
=
true
;
break
;
break
;
}
}
}
}
}
//消防水源
// 消防炮
if
(!
flag
)
{
String
[]
stringxfp
=
monitorCodes
.
split
(
","
);
List
<
Map
>
lit
=
iEquipmentSpecificSerivce
.
getWater
(
equipmentSpecificVo
.
getId
());
if
(!
flag
)
{
if
(
lit
!=
null
&&
lit
.
size
()
>
0
)
{
for
(
String
string1
:
stringxfp
)
{
topicEntity
.
setType
(
"xfsy"
);
if
(
ecode
.
startsWith
(
string1
))
{
mqttSendGateway
.
sendToMqtt
(
emergencyDisposalIndicators
,
JSONObject
.
toJSONString
(
topicEntity
));
//通知>消防应急预案
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
));
}
}
}
}
}
}
}
}
}
}
});
});
}
}
}
@Override
@Override
...
...
amos-boot-system-equip/src/main/resources/mapper/EquipmentSpecificIndexMapper.xml
View file @
b3077db1
...
@@ -329,10 +329,13 @@
...
@@ -329,10 +329,13 @@
ei.`name` AS perfQuotaName,
ei.`name` AS perfQuotaName,
si.`value`,
si.`value`,
ei.is_iot,
ei.is_iot,
e
i.unit AS unitName,
s
i.unit AS unitName,
ei.sort_num,
ei.sort_num,
si.create_date,
si.create_date,
si.update_date
si.update_date,
si.index_address,
si.gateway_id,
si.data_type
FROM
FROM
wl_equipment_specific_index si
wl_equipment_specific_index si
LEFT JOIN wl_equipment_index ei ON si.equipment_index_id = ei.id
LEFT JOIN wl_equipment_index ei ON si.equipment_index_id = ei.id
...
...
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