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
9c6f1d95
Commit
9c6f1d95
authored
Aug 04, 2022
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.格式化加发送消息时增加uuid 否则消息一样前端不刷新
parent
2252c8ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1011 additions
and
1059 deletions
+1011
-1059
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+1011
-1059
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 @
9c6f1d95
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.logging.Logger
;
import
java.util.stream.Collectors
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseEntity
;
import
liquibase.pro.packaged.W
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
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.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -39,1071 +10,1052 @@ import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm;
...
@@ -39,1071 +10,1052 @@ import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFaultAlarm
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFaultAlarm
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFireAlarm
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFireAlarm
;
import
com.yeejoin.equipmanage.common.dto.TemperatureAlarmDto
;
import
com.yeejoin.equipmanage.common.dto.TemperatureAlarmDto
;
import
com.yeejoin.equipmanage.common.entity.vo.CarPropertyVo
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseEntity
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo
;
import
com.yeejoin.equipmanage.common.entity.vo.*
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentStateVo
;
import
com.yeejoin.equipmanage.common.enums.*
;
import
com.yeejoin.equipmanage.common.entity.vo.IndexStateVo
;
import
com.yeejoin.equipmanage.common.enums.AlarmStatusEnum
;
import
com.yeejoin.equipmanage.common.enums.AlarmTypeEnum
;
import
com.yeejoin.equipmanage.common.enums.CarForGisEnum
;
import
com.yeejoin.equipmanage.common.enums.EquipAndCarEnum
;
import
com.yeejoin.equipmanage.common.enums.EquipmentIndexLabelsEnum
;
import
com.yeejoin.equipmanage.common.enums.EquipmentRiskTypeEnum
;
import
com.yeejoin.equipmanage.common.enums.NBalarmEnum
;
import
com.yeejoin.equipmanage.common.enums.RiskLeverForAutoSys
;
import
com.yeejoin.equipmanage.common.enums.TemperatureAlarm
;
import
com.yeejoin.equipmanage.common.enums.TopicEnum
;
import
com.yeejoin.equipmanage.common.enums.TrueOrFalseEnum
;
import
com.yeejoin.equipmanage.common.utils.DateUtils
;
import
com.yeejoin.equipmanage.common.utils.DateUtils
;
import
com.yeejoin.equipmanage.common.utils.StringUtil
;
import
com.yeejoin.equipmanage.common.utils.StringUtil
;
import
com.yeejoin.equipmanage.common.vo.CarIndexGisVo
;
import
com.yeejoin.equipmanage.common.vo.*
;
import
com.yeejoin.equipmanage.common.vo.EquipmentIndexLabelsVo
;
import
com.yeejoin.equipmanage.common.vo.EquipmentVo
;
import
com.yeejoin.equipmanage.common.vo.IotDataVO
;
import
com.yeejoin.equipmanage.common.vo.Token
;
import
com.yeejoin.equipmanage.common.vo.TopicEntityVo
;
import
com.yeejoin.equipmanage.fegin.SystemctlFeign
;
import
com.yeejoin.equipmanage.fegin.SystemctlFeign
;
import
com.yeejoin.equipmanage.mapper.CarMapper
;
import
com.yeejoin.equipmanage.mapper.*
;
import
com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmLogMapper
;
import
com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmMapper
;
import
com.yeejoin.equipmanage.mapper.EquipmentSpecificIndexMapper
;
import
com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper
;
import
com.yeejoin.equipmanage.mapper.FireFightingSystemMapper
;
import
com.yeejoin.equipmanage.remote.RemoteSecurityService
;
import
com.yeejoin.equipmanage.remote.RemoteSecurityService
;
import
com.yeejoin.equipmanage.service.ICarPropertyService
;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.service.IEquipmentAlarmReportDayService
;
import
com.yeejoin.equipmanage.service.IEquipmentIndexService
;
import
com.yeejoin.equipmanage.service.IEquipmentService
;
import
com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmLogService
;
import
com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService
;
import
com.yeejoin.equipmanage.service.IEquipmentSpecificIndexService
;
import
com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce
;
import
com.yeejoin.equipmanage.service.IFireFightingSystemService
;
import
com.yeejoin.equipmanage.service.IMainIotMonitorSerivce
;
import
com.yeejoin.equipmanage.service.ISyncDataService
;
import
com.yeejoin.equipmanage.service.MqttReceiveService
;
import
com.yeejoin.equipmanage.service.MqttSendGateway
;
import
com.yeejoin.equipmanage.utils.BeanUtil
;
import
com.yeejoin.equipmanage.utils.BeanUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
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.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
//import net.sf.json.JSONObject;
//import net.sf.json.JSONObject;
/**
/**
* @author keyong
* @author keyong
* @title: MqttReceiveServiceImpl
* @title: MqttReceiveServiceImpl
*
*
*
<pre>
* <pre>
* @description: 增量数据处理
* @description: 增量数据处理
* </pre>
* </pre>
*
* @date 2020/11/3 13:39
* @date 2020/11/3 13:39
*/
*/
@Slf4j
@Slf4j
@Service
@Service
public
class
MqttReceiveServiceImpl
implements
MqttReceiveService
{
public
class
MqttReceiveServiceImpl
implements
MqttReceiveService
{
private
static
Map
<
String
,
TemperatureAlarmDto
>
temperatureMap
=
new
HashMap
<>();
private
static
Map
<
String
,
TemperatureAlarmDto
>
temperatureMap
=
new
HashMap
<>();
@Autowired
@Autowired
IEquipmentSpecificIndexService
equipmentSpecificIndexService
;
IEquipmentSpecificIndexService
equipmentSpecificIndexService
;
@Autowired
@Autowired
ICarPropertyService
carPropertyService
;
ICarPropertyService
carPropertyService
;
@Autowired
@Autowired
IEquipmentSpecificAlarmService
equipmentSpecificAlarmService
;
IEquipmentSpecificAlarmService
equipmentSpecificAlarmService
;
@Autowired
@Autowired
IEquipmentSpecificAlarmLogService
equipmentSpecificAlarmLogService
;
IEquipmentSpecificAlarmLogService
equipmentSpecificAlarmLogService
;
@Autowired
@Autowired
EquipmentSpecificAlarmMapper
equipmentSpecificAlarmMapper
;
EquipmentSpecificAlarmMapper
equipmentSpecificAlarmMapper
;
@Autowired
@Autowired
EquipmentSpecificAlarmLogMapper
equipmentSpecificAlarmLogMapper
;
EquipmentSpecificAlarmLogMapper
equipmentSpecificAlarmLogMapper
;
@Autowired
@Autowired
@Lazy
@Lazy
IEquipmentIndexService
equipmentIndexService
;
IEquipmentIndexService
equipmentIndexService
;
@Autowired
@Autowired
EquipmentSpecificIndexMapper
equipmentSpecificIndexMapper
;
EquipmentSpecificIndexMapper
equipmentSpecificIndexMapper
;
@Autowired
@Autowired
EquipmentSpecificMapper
equipmentSpecificMapper
;
EquipmentSpecificMapper
equipmentSpecificMapper
;
@Autowired
@Autowired
FireFightingSystemMapper
FireFightingSystemMapper
;
FireFightingSystemMapper
FireFightingSystemMapper
;
@Autowired
@Autowired
IFireFightingSystemService
fireFightingSystemService
;
IFireFightingSystemService
fireFightingSystemService
;
@Autowired
@Autowired
MqttSendGateway
mqttSendGateway
;
MqttSendGateway
mqttSendGateway
;
@Autowired
@Autowired
private
RedisUtils
redisUtils
;
private
RedisUtils
redisUtils
;
@Autowired
@Autowired
CarMapper
carMapper
;
CarMapper
carMapper
;
@Autowired
@Autowired
IMainIotMonitorSerivce
iMainIotMonitorSerivce
;
IMainIotMonitorSerivce
iMainIotMonitorSerivce
;
@Autowired
@Autowired
private
ISyncDataService
syncDataService
;
private
ISyncDataService
syncDataService
;
@Autowired
@Autowired
private
IEquipmentAlarmReportDayService
iEquipmentAlarmReportDayService
;
private
IEquipmentAlarmReportDayService
iEquipmentAlarmReportDayService
;
@Autowired
@Autowired
private
IEquipmentSpecificSerivce
iEquipmentSpecificSerivce
;
private
IEquipmentSpecificSerivce
iEquipmentSpecificSerivce
;
@Autowired
@Autowired
FireFightingSystemMapper
fireFightingSystemMapper
;
FireFightingSystemMapper
fireFightingSystemMapper
;
@Autowired
@Autowired
private
SystemctlFeign
systemctlFeign
;
private
SystemctlFeign
systemctlFeign
;
@Autowired
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
private
RemoteSecurityService
remoteSecurityService
;
@Autowired
@Autowired
private
TopographyService
topographyService
;
private
TopographyService
topographyService
;
@Autowired
@Autowired
private
IEquipmentService
equipmentService
;
private
IEquipmentService
equipmentService
;
@Value
(
"${equipManage.name}"
)
@Value
(
"${equipManage.name}"
)
private
String
serverName
;
private
String
serverName
;
@Value
(
"${mqtt.vehicle.topic}"
)
@Value
(
"${mqtt.vehicle.topic}"
)
private
String
carTopic
;
private
String
carTopic
;
@Value
(
"${equip.point.equipmentdata.topic}"
)
@Value
(
"${equip.point.equipmentdata.topic}"
)
private
String
canvasTopic
;
private
String
canvasTopic
;
@Value
(
"${equip.index.topic}"
)
@Value
(
"${equip.index.topic}"
)
private
String
indexTopic
;
private
String
indexTopic
;
@Value
(
"${spring.redis.expire.time}"
)
@Value
(
"${spring.redis.expire.time}"
)
private
long
redisExpireTime
;
private
long
redisExpireTime
;
@Value
(
"${systemctl.sync.switch}"
)
@Value
(
"${systemctl.sync.switch}"
)
private
Boolean
syncSwitch
;
private
Boolean
syncSwitch
;
@Value
(
"${systemctl.amos.switch}"
)
@Value
(
"${systemctl.amos.switch}"
)
private
Boolean
amosSwitch
;
private
Boolean
amosSwitch
;
@Value
(
"${isSendApp}"
)
@Value
(
"${isSendApp}"
)
private
Boolean
isSendApp
;
private
Boolean
isSendApp
;
private
static
Boolean
bool
=
Boolean
.
FALSE
;
private
static
Boolean
bool
=
Boolean
.
FALSE
;
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
handlerMqttIncrementMessage
(
String
topic
,
String
message
)
{
public
void
handlerMqttIncrementMessage
(
String
topic
,
String
message
)
{
TopicEntityVo
topicEntity
=
new
TopicEntityVo
();
TopicEntityVo
topicEntity
=
new
TopicEntityVo
();
topicEntity
.
setTopic
(
topic
);
topicEntity
.
setTopic
(
topic
);
topicEntity
.
setMessage
(
message
);
topicEntity
.
setMessage
(
message
);
int
endIndex
=
topic
.
lastIndexOf
(
"/"
);
int
endIndex
=
topic
.
lastIndexOf
(
"/"
);
String
iotCode
=
topic
.
substring
(
0
,
endIndex
).
replace
(
"/"
,
""
);
String
iotCode
=
topic
.
substring
(
0
,
endIndex
).
replace
(
"/"
,
""
);
topicEntity
.
setIotCode
(
iotCode
);
topicEntity
.
setIotCode
(
iotCode
);
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
vo
=
eqIotCodeList
.
get
(
0
);
EquipmentSpecificVo
vo
=
eqIotCodeList
.
get
(
0
);
topicEntity
.
setType
(
vo
.
getType
());
topicEntity
.
setType
(
vo
.
getType
());
topicEntity
.
setCode
(
vo
.
getCode
());
topicEntity
.
setCode
(
vo
.
getCode
());
JSONObject
json
=
JSONObject
.
parseObject
(
message
);
JSONObject
json
=
JSONObject
.
parseObject
(
message
);
Iterator
it
=
json
.
entrySet
().
iterator
();
Iterator
it
=
json
.
entrySet
().
iterator
();
List
<
IotDataVO
>
iotDatalist
=
new
ArrayList
<
IotDataVO
>();
List
<
IotDataVO
>
iotDatalist
=
new
ArrayList
<
>();
String
traceId
=
""
;
String
traceId
=
""
;
while
(
it
.
hasNext
())
{
while
(
it
.
hasNext
())
{
IotDataVO
iotDataVO
=
new
IotDataVO
();
IotDataVO
iotDataVO
=
new
IotDataVO
();
Map
.
Entry
<
String
,
Object
>
entry
=
(
Map
.
Entry
<
String
,
Object
>)
it
.
next
();
Map
.
Entry
<
String
,
Object
>
entry
=
(
Map
.
Entry
<
String
,
Object
>)
it
.
next
();
String
key
=
entry
.
getKey
();
String
key
=
entry
.
getKey
();
Object
value
=
entry
.
getValue
();
Object
value
=
entry
.
getValue
();
iotDataVO
.
setKey
(
key
);
iotDataVO
.
setKey
(
key
);
iotDataVO
.
setValue
(
value
);
iotDataVO
.
setValue
(
value
);
if
(
"traceId"
.
equalsIgnoreCase
(
key
))
{
if
(
"traceId"
.
equalsIgnoreCase
(
key
))
{
traceId
=
value
.
toString
();
traceId
=
value
.
toString
();
continue
;
continue
;
}
}
iotDatalist
.
add
(
iotDataVO
);
iotDatalist
.
add
(
iotDataVO
);
}
}
if
(
ObjectUtils
.
isEmpty
(
iotDatalist
))
{
if
(
ObjectUtils
.
isEmpty
(
iotDatalist
))
{
return
;
return
;
}
}
log
.
info
(
String
.
format
(
"收到mqtt消息:%s"
,
message
));
log
.
info
(
String
.
format
(
"收到mqtt消息:%s"
,
message
));
if
(!
StringUtils
.
isEmpty
(
traceId
))
{
if
(!
StringUtils
.
isEmpty
(
traceId
))
{
String
finalTraceId
=
traceId
;
String
finalTraceId
=
traceId
;
List
<
IotDataVO
>
collect
=
iotDatalist
.
stream
().
map
(
x
->
{
List
<
IotDataVO
>
collect
=
iotDatalist
.
stream
().
map
(
x
->
{
x
.
setTraceId
(
finalTraceId
);
x
.
setTraceId
(
finalTraceId
);
return
x
;
return
x
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
realTimeDateProcessing
(
topicEntity
,
collect
);
realTimeDateProcessing
(
topicEntity
,
collect
);
}
else
{
}
else
{
realTimeDateProcessing
(
topicEntity
,
iotDatalist
);
realTimeDateProcessing
(
topicEntity
,
iotDatalist
);
}
}
}
}
/**
/**
* 物联数据处理
* 物联数据处理
*
*
* @param topicEntity
* @param topicEntity
* @param iotDatalist
* @param iotDatalist
*/
*/
public
void
realTimeDateProcessing
(
TopicEntityVo
topicEntity
,
List
<
IotDataVO
>
iotDatalist
)
{
public
void
realTimeDateProcessing
(
TopicEntityVo
topicEntity
,
List
<
IotDataVO
>
iotDatalist
)
{
String
iotCode
=
topicEntity
.
getIotCode
();
String
iotCode
=
topicEntity
.
getIotCode
();
if
(
EquipAndCarEnum
.
equip
.
type
.
equals
(
topicEntity
.
getType
()))
{
if
(
EquipAndCarEnum
.
equip
.
type
.
equals
(
topicEntity
.
getType
()))
{
List
<
EquipmentSpecificIndex
>
indexList
=
equipmentSpecificIndexService
List
<
EquipmentSpecificIndex
>
indexList
=
equipmentSpecificIndexService
.
getEquipmentSpeIndexBySpeIotCode
(
iotCode
);
.
getEquipmentSpeIndexBySpeIotCode
(
iotCode
);
if
(
ObjectUtils
.
isEmpty
(
indexList
))
{
if
(
ObjectUtils
.
isEmpty
(
indexList
))
{
return
;
return
;
}
}
equipRealTimeDate
(
iotDatalist
,
indexList
,
topicEntity
);
equipRealTimeDate
(
iotDatalist
,
indexList
,
topicEntity
);
}
else
{
}
else
{
List
<
CarProperty
>
carProperties
=
carPropertyService
.
getCarPropListByIotCode
(
iotCode
);
List
<
CarProperty
>
carProperties
=
carPropertyService
.
getCarPropListByIotCode
(
iotCode
);
if
(
ObjectUtils
.
isEmpty
(
carProperties
))
{
if
(
ObjectUtils
.
isEmpty
(
carProperties
))
{
return
;
return
;
}
}
carRealTimeDate
(
iotDatalist
,
carProperties
);
carRealTimeDate
(
iotDatalist
,
carProperties
);
}
}
}
}
/**
/**
* 装备实时数据处理
* 装备实时数据处理
*
*
* @param iotDatalist
* @param iotDatalist
* @param indexList
* @param indexList
* @param topicEntity
* @param topicEntity
*/
*/
public
void
equipRealTimeDate
(
List
<
IotDataVO
>
iotDatalist
,
List
<
EquipmentSpecificIndex
>
indexList
,
public
void
equipRealTimeDate
(
List
<
IotDataVO
>
iotDatalist
,
List
<
EquipmentSpecificIndex
>
indexList
,
TopicEntityVo
topicEntity
)
{
TopicEntityVo
topicEntity
)
{
List
<
EquipmentSpecificIndex
>
equipmentSpecificIndexList
=
new
ArrayList
<>();
List
<
EquipmentSpecificIndex
>
equipmentSpecificIndexList
=
new
ArrayList
<>();
List
<
EquipmentSpecificAlarm
>
equipmentSpecificAlarms
=
new
ArrayList
<>();
List
<
EquipmentSpecificAlarm
>
equipmentSpecificAlarms
=
new
ArrayList
<>();
List
<
IndexStateVo
>
indexStateList
=
new
ArrayList
<>();
List
<
IndexStateVo
>
indexStateList
=
new
ArrayList
<>();
// 存储温度数据至内存中(火眼)
// 存储温度数据至内存中(火眼)
iotDataListToCacheMap
(
iotDatalist
);
iotDataListToCacheMap
(
iotDatalist
);
iotDatalist
.
forEach
(
iotDataVO
->
{
iotDatalist
.
forEach
(
iotDataVO
->
{
for
(
EquipmentSpecificIndex
equipmentSpecificIndex
:
indexList
)
{
for
(
EquipmentSpecificIndex
equipmentSpecificIndex
:
indexList
)
{
if
(!
ObjectUtils
.
isEmpty
(
equipmentSpecificIndex
.
getNameKey
())
if
(!
ObjectUtils
.
isEmpty
(
equipmentSpecificIndex
.
getNameKey
())
&&
equipmentSpecificIndex
.
getNameKey
().
toLowerCase
().
equals
(
iotDataVO
.
getKey
().
toLowerCase
()))
{
&&
equipmentSpecificIndex
.
getNameKey
().
toLowerCase
().
equals
(
iotDataVO
.
getKey
().
toLowerCase
()))
{
EquipmentSpecificIndex
equipmentSpeIndex
=
new
EquipmentSpecificIndex
();
EquipmentSpecificIndex
equipmentSpeIndex
=
new
EquipmentSpecificIndex
();
BeanUtils
.
copyProperties
(
equipmentSpecificIndex
,
equipmentSpeIndex
);
BeanUtils
.
copyProperties
(
equipmentSpecificIndex
,
equipmentSpeIndex
);
String
value
=
iotDataVO
.
getValue
().
toString
();
String
value
=
iotDataVO
.
getValue
().
toString
();
String
traceId
=
iotDataVO
.
getTraceId
();
String
traceId
=
iotDataVO
.
getTraceId
();
equipmentSpeIndex
.
setValue
(
value
);
equipmentSpeIndex
.
setValue
(
value
);
equipmentSpeIndex
.
setTraceId
(
traceId
);
equipmentSpeIndex
.
setTraceId
(
traceId
);
equipmentSpeIndex
.
setValueLabel
(
valueTranslate
(
value
,
equipmentSpecificIndex
.
getValueEnum
()));
equipmentSpeIndex
.
setValueLabel
(
valueTranslate
(
value
,
equipmentSpecificIndex
.
getValueEnum
()));
equipmentSpeIndex
.
setUpdateDate
(
new
Date
());
equipmentSpeIndex
.
setUpdateDate
(
new
Date
());
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
);
// 火眼数据构造告警指标逻辑
// 火眼数据构造告警指标逻辑
equipmentSpecificIndex
=
handleTemperatureAlarm
(
equipmentSpeIndex
,
iotDatalist
);
equipmentSpecificIndex
=
handleTemperatureAlarm
(
equipmentSpeIndex
,
iotDatalist
);
// 指标告警处理
// 指标告警处理
if
(
equipmentSpecificIndex
.
getIsAlarm
()
!=
null
&&
1
==
equipmentSpecificIndex
.
getIsAlarm
())
{
if
(
equipmentSpecificIndex
.
getIsAlarm
()
!=
null
&&
1
==
equipmentSpecificIndex
.
getIsAlarm
())
{
equipmentSpecificAlarms
.
addAll
(
createIndexAlarmRecord
(
equipmentSpecificIndex
));
equipmentSpecificAlarms
.
addAll
(
createIndexAlarmRecord
(
equipmentSpecificIndex
));
}
}
}
}
}
}
});
});
// 报警数据保存
// 报警数据保存
List
<
EquipmentSpecificAlarmLog
>
alarmLogs
=
saveOrUpdateEquipAlarm
(
equipmentSpecificAlarms
);
List
<
EquipmentSpecificAlarmLog
>
alarmLogs
=
saveOrUpdateEquipAlarm
(
equipmentSpecificAlarms
);
// 需要在事务提交之后,否侧事务隔离查询不出数据
// 需要在事务提交之后,否侧事务隔离查询不出数据
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
@Override
public
void
afterCommit
()
{
public
void
afterCommit
()
{
// 向预控系统发送消息
// 向预控系统发送消息
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
);
}
}
});
});
}
}
public
void
carRealTimeDate
(
List
<
IotDataVO
>
iotDatalist
,
List
<
CarProperty
>
carProperties
)
{
public
void
carRealTimeDate
(
List
<
IotDataVO
>
iotDatalist
,
List
<
CarProperty
>
carProperties
)
{
List
<
CarProperty
>
carIndexsList
=
new
ArrayList
<>();
List
<
CarProperty
>
carIndexsList
=
new
ArrayList
<>();
iotDatalist
.
forEach
(
iotDataVO
->
{
iotDatalist
.
forEach
(
iotDataVO
->
{
// 对指标key为labels的数据处理
// 对指标key为labels的数据处理
if
(
EquipmentIndexLabelsEnum
.
labels
.
name
.
equals
(
iotDataVO
.
getKey
()))
{
if
(
EquipmentIndexLabelsEnum
.
labels
.
name
.
equals
(
iotDataVO
.
getKey
()))
{
StringBuilder
sb
=
new
StringBuilder
(
"equipmentOnCar_"
);
StringBuilder
sb
=
new
StringBuilder
(
"equipmentOnCar_"
);
EquipmentIndexLabelsVo
labelsVo
=
new
EquipmentIndexLabelsVo
();
EquipmentIndexLabelsVo
labelsVo
=
new
EquipmentIndexLabelsVo
();
Object
obj
=
iotDataVO
.
getValue
();
Object
obj
=
iotDataVO
.
getValue
();
if
(
obj
instanceof
JSONArray
)
{
if
(
obj
instanceof
JSONArray
)
{
List
<
String
>
labelList
=
(
List
<
String
>)
obj
;
List
<
String
>
labelList
=
(
List
<
String
>)
obj
;
labelList
.
forEach
(
code
->
{
labelList
.
forEach
(
code
->
{
String
key
=
sb
.
append
(
code
).
toString
();
String
key
=
sb
.
append
(
code
).
toString
();
labelsVo
.
setEquipmentIotCode
(
code
);
labelsVo
.
setEquipmentIotCode
(
code
);
labelsVo
.
setTime
(
new
Date
());
labelsVo
.
setTime
(
new
Date
());
redisUtils
.
set
(
key
,
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
labelsVo
),
redisExpireTime
);
redisUtils
.
set
(
key
,
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
labelsVo
),
redisExpireTime
);
});
});
}
}
}
}
List
<
CarPropertyVo
>
carPropertyVos
=
new
ArrayList
<>();
List
<
CarPropertyVo
>
carPropertyVos
=
new
ArrayList
<>();
carProperties
.
forEach
(
carProperty
->
{
carProperties
.
forEach
(
carProperty
->
{
if
(
iotDataVO
.
getKey
().
equals
(
carProperty
.
getNameKey
()))
{
if
(
iotDataVO
.
getKey
().
equals
(
carProperty
.
getNameKey
()))
{
carProperty
.
setValue
(
iotDataVO
.
getValue
().
toString
());
carProperty
.
setValue
(
iotDataVO
.
getValue
().
toString
());
carProperty
.
setUpdateDate
(
new
Date
());
carProperty
.
setUpdateDate
(
new
Date
());
carPropertyVos
.
add
(
carPropertyToCarPropertyVo
(
carProperty
));
carPropertyVos
.
add
(
carPropertyToCarPropertyVo
(
carProperty
));
carIndexsList
.
add
(
carProperty
);
carIndexsList
.
add
(
carProperty
);
}
}
});
});
boolean
updateBatchById
=
false
;
boolean
updateBatchById
=
false
;
if
(!
carIndexsList
.
isEmpty
())
{
if
(!
carIndexsList
.
isEmpty
())
{
carPropertyService
.
updateBatchById
(
carIndexsList
);
carPropertyService
.
updateBatchById
(
carIndexsList
);
updateBatchById
=
true
;
updateBatchById
=
true
;
}
}
if
(
updateBatchById
)
{
if
(
updateBatchById
)
{
carTransactionSynch
(
carProperties
,
carPropertyVos
);
carTransactionSynch
(
carProperties
,
carPropertyVos
);
}
}
});
});
}
}
public
static
List
<
EquipmentSpecificAlarmLog
>
upAlarmLogStatus
(
String
iotCode
,
String
equipmentSpecificIndexKey
,
public
static
List
<
EquipmentSpecificAlarmLog
>
upAlarmLogStatus
(
String
iotCode
,
String
equipmentSpecificIndexKey
,
String
traceId
,
IEquipmentSpecificAlarmLogService
equipmentSpecificAlarmLogService
)
{
String
traceId
,
IEquipmentSpecificAlarmLogService
equipmentSpecificAlarmLogService
)
{
LambdaQueryWrapper
<
EquipmentSpecificAlarmLog
>
queryWrapper
=
new
LambdaQueryWrapper
();
LambdaQueryWrapper
<
EquipmentSpecificAlarmLog
>
queryWrapper
=
new
LambdaQueryWrapper
();
queryWrapper
.
eq
(
EquipmentSpecificAlarmLog:
:
getIotCode
,
iotCode
);
queryWrapper
.
eq
(
EquipmentSpecificAlarmLog:
:
getIotCode
,
iotCode
);
queryWrapper
.
eq
(
EquipmentSpecificAlarmLog:
:
getEquipmentSpecificIndexKey
,
equipmentSpecificIndexKey
);
queryWrapper
.
eq
(
EquipmentSpecificAlarmLog:
:
getEquipmentSpecificIndexKey
,
equipmentSpecificIndexKey
);
queryWrapper
.
ne
(
EquipmentSpecificAlarmLog:
:
getStatus
,
AlarmStatusEnum
.
HF
.
getCode
());
queryWrapper
.
ne
(
EquipmentSpecificAlarmLog:
:
getStatus
,
AlarmStatusEnum
.
HF
.
getCode
());
List
<
EquipmentSpecificAlarmLog
>
logs
=
equipmentSpecificAlarmLogService
.
getBaseMapper
()
List
<
EquipmentSpecificAlarmLog
>
logs
=
equipmentSpecificAlarmLogService
.
getBaseMapper
()
.
selectList
(
queryWrapper
);
.
selectList
(
queryWrapper
);
logs
.
forEach
(
x
->
{
logs
.
forEach
(
x
->
{
x
.
setCleanTime
(
new
Date
());
x
.
setCleanTime
(
new
Date
());
x
.
setStatus
(
AlarmStatusEnum
.
HF
.
getCode
());
x
.
setStatus
(
AlarmStatusEnum
.
HF
.
getCode
());
if
(!
StringUtils
.
isEmpty
(
traceId
))
{
if
(!
StringUtils
.
isEmpty
(
traceId
))
{
x
.
setTraceId
(
traceId
);
x
.
setTraceId
(
traceId
);
}
}
});
});
if
(!
logs
.
isEmpty
())
{
if
(!
logs
.
isEmpty
())
{
equipmentSpecificAlarmLogService
.
updateBatchById
(
logs
);
equipmentSpecificAlarmLogService
.
updateBatchById
(
logs
);
}
}
return
logs
;
return
logs
;
}
}
/**
/**
* 画布数据消息推送
* 画布数据消息推送
*
*
* @param indexList
* @param indexList
*/
*/
public
void
publishDataToCanvas
(
List
<
EquipmentSpecificIndex
>
indexList
)
{
public
void
publishDataToCanvas
(
List
<
EquipmentSpecificIndex
>
indexList
)
{
if
(!
ObjectUtils
.
isEmpty
(
indexList
))
{
if
(!
ObjectUtils
.
isEmpty
(
indexList
))
{
EquipmentSpecificIndex
index
=
indexList
.
stream
().
filter
(
x
->
x
.
getUpdateDate
()
!=
null
)
EquipmentSpecificIndex
index
=
indexList
.
stream
().
filter
(
x
->
x
.
getUpdateDate
()
!=
null
)
.
sorted
(
Comparator
.
comparing
(
EquipmentSpecificIndex:
:
getUpdateDate
).
reversed
())
.
sorted
(
Comparator
.
comparing
(
EquipmentSpecificIndex:
:
getUpdateDate
).
reversed
())
.
collect
(
Collectors
.
toList
()).
get
(
0
);
.
collect
(
Collectors
.
toList
()).
get
(
0
);
EquipmentStateVo
equipmentStateVo
=
new
EquipmentStateVo
();
EquipmentStateVo
equipmentStateVo
=
new
EquipmentStateVo
();
equipmentStateVo
.
setEquipName
(
index
.
getEquipmentSpecificName
());
equipmentStateVo
.
setEquipName
(
index
.
getEquipmentSpecificName
());
equipmentStateVo
.
setOrgCode
(
index
.
getOrgCode
());
equipmentStateVo
.
setOrgCode
(
index
.
getOrgCode
());
equipmentStateVo
.
setSpecificId
(
index
.
getEquipmentSpecificId
());
equipmentStateVo
.
setSpecificId
(
index
.
getEquipmentSpecificId
());
equipmentStateVo
.
setEquipCode
(
index
.
getQrCode
());
equipmentStateVo
.
setEquipCode
(
index
.
getQrCode
());
equipmentStateVo
.
setEquipIotCode
(
index
.
getIotCode
());
equipmentStateVo
.
setEquipIotCode
(
index
.
getIotCode
());
equipmentStateVo
.
setStatus
(
""
);
equipmentStateVo
.
setStatus
(
""
);
equipmentStateVo
.
setColor
(
index
.
getEmergencyLevelColor
());
equipmentStateVo
.
setColor
(
index
.
getEmergencyLevelColor
());
// 添加性能指标项
// 添加性能指标项
//flag 无意义 getSpeIndex 方法其他地方共用 做了额外封装 为0时走原逻辑
//flag 无意义 getSpeIndex 方法其他地方共用 做了额外封装 为0时走原逻辑
int
flag
=
0
;
int
flag
=
0
;
equipmentStateVo
.
setSpeindexList
(
fireFightingSystemService
.
getSpeIndex
(
index
.
getEquipmentSpecificId
(),
flag
));
equipmentStateVo
.
setSpeindexList
(
fireFightingSystemService
.
getSpeIndex
(
index
.
getEquipmentSpecificId
(),
flag
));
Map
<
String
,
Object
>
topicObject
=
new
HashMap
<>();
Map
<
String
,
Object
>
topicObject
=
new
HashMap
<>();
topicObject
.
put
(
"equipCode"
,
equipmentStateVo
.
getEquipCode
());
topicObject
.
put
(
"equipCode"
,
equipmentStateVo
.
getEquipCode
());
if
(
TrueOrFalseEnum
.
real
.
value
.
toUpperCase
().
equals
(
index
.
getValue
().
toUpperCase
()))
{
if
(
TrueOrFalseEnum
.
real
.
value
.
toUpperCase
().
equals
(
index
.
getValue
().
toUpperCase
()))
{
topicObject
.
put
(
"color"
,
equipmentStateVo
.
getColor
());
topicObject
.
put
(
"color"
,
equipmentStateVo
.
getColor
());
}
else
{
}
else
{
topicObject
.
put
(
"color"
,
""
);
topicObject
.
put
(
"color"
,
""
);
}
}
Map
<
String
,
Object
>
map
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
equipmentStateVo
));
Map
<
String
,
Object
>
map
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
equipmentStateVo
));
map
.
put
(
canvasTopic
,
topicObject
);
topicObject
.
put
(
"uuid"
,
UUID
.
randomUUID
().
toString
());
map
.
put
(
canvasTopic
,
topicObject
);
// 发送数据至画布
mqttSendGateway
.
sendToMqtt
(
canvasTopic
,
JSON
.
toJSONString
(
map
));
// 发送数据至画布
}
mqttSendGateway
.
sendToMqtt
(
canvasTopic
,
JSON
.
toJSONString
(
map
));
}
}
}
/**
* 报警消息推送amos平台
/**
*
* 报警消息推送amos平台
* @param equipmentSpecificAlarmLog
*
*/
* @param equipmentSpecificAlarmLog
void
syncSystemctlMsg
(
EquipmentSpecificAlarmLog
equipmentSpecificAlarmLog
)
{
*/
try
{
void
syncSystemctlMsg
(
EquipmentSpecificAlarmLog
equipmentSpecificAlarmLog
)
{
MessageModel
model
=
new
MessageModel
();
try
{
String
alarmReason
=
ValidationUtil
.
isEmpty
(
equipmentSpecificAlarmLog
.
getAlarmReason
())
?
""
MessageModel
model
=
new
MessageModel
();
:
equipmentSpecificAlarmLog
.
getAlarmReason
();
String
alarmReason
=
ValidationUtil
.
isEmpty
(
equipmentSpecificAlarmLog
.
getAlarmReason
())
?
""
if
(
alarmReason
.
contains
(
":"
))
{
:
equipmentSpecificAlarmLog
.
getAlarmReason
();
String
[]
split
=
alarmReason
.
split
(
":"
);
if
(
alarmReason
.
contains
(
":"
))
{
alarmReason
=
split
[
1
];
String
[]
split
=
alarmReason
.
split
(
":"
);
}
alarmReason
=
split
[
1
];
model
.
setTitle
(
equipmentSpecificAlarmLog
.
getEquipmentSpecificIndexName
());
}
String
body
=
String
.
format
(
"警情类型:%s;报警设备:%s;报警位置:%s;报警原因:%s;报警时间:%s"
,
model
.
setTitle
(
equipmentSpecificAlarmLog
.
getEquipmentSpecificIndexName
());
equipmentSpecificAlarmLog
.
getEquipmentSpecificIndexName
(),
String
body
=
String
.
format
(
"警情类型:%s;报警设备:%s;报警位置:%s;报警原因:%s;报警时间:%s"
,
equipmentSpecificAlarmLog
.
getEquipmentSpecificName
(),
equipmentSpecificAlarmLog
.
getLocation
(),
equipmentSpecificAlarmLog
.
getEquipmentSpecificIndexName
(),
alarmReason
,
DateUtils
.
date2LongStr
(
equipmentSpecificAlarmLog
.
getCreateDate
()));
equipmentSpecificAlarmLog
.
getEquipmentSpecificName
(),
equipmentSpecificAlarmLog
.
getLocation
(),
model
.
setBody
(
body
);
alarmReason
,
DateUtils
.
date2LongStr
(
equipmentSpecificAlarmLog
.
getCreateDate
()));
model
.
setMsgType
(
"iotMonitor"
);
model
.
setBody
(
body
);
model
.
setSendTime
(
equipmentSpecificAlarmLog
.
getCreateDate
());
model
.
setMsgType
(
"iotMonitor"
);
if
(
isSendApp
)
{
model
.
setSendTime
(
equipmentSpecificAlarmLog
.
getCreateDate
());
model
.
setIsSendApp
(
true
);
if
(
isSendApp
)
{
model
.
setTerminal
(
"APP/WEB"
);
model
.
setIsSendApp
(
true
);
}
else
{
model
.
setTerminal
(
"APP/WEB"
);
model
.
setIsSendApp
(
false
);
}
else
{
model
.
setTerminal
(
"WEB"
);
model
.
setIsSendApp
(
false
);
}
model
.
setTerminal
(
"WEB"
);
model
.
setIsSendWeb
(
true
);
}
model
.
setCategory
(
1
);
model
.
setIsSendWeb
(
true
);
model
.
setCategory
(
1
);
//告警弹窗需要根据人员单位判断是否展示 后端返回单位Code 前端判断
LambdaQueryWrapper
<
EquipmentSpecific
>
wrapper
=
new
LambdaQueryWrapper
<>();
//告警弹窗需要根据人员单位判断是否展示 后端返回单位Code 前端判断
wrapper
.
eq
(
BaseEntity:
:
getId
,
equipmentSpecificAlarmLog
.
getEquipmentSpecificId
());
LambdaQueryWrapper
<
EquipmentSpecific
>
wrapper
=
new
LambdaQueryWrapper
<>();
EquipmentSpecific
equipmentSpecific
=
equipmentSpecificMapper
.
selectOne
(
wrapper
);
wrapper
.
eq
(
BaseEntity:
:
getId
,
equipmentSpecificAlarmLog
.
getEquipmentSpecificId
());
if
(!
ValidationUtil
.
isEmpty
(
equipmentSpecific
)
&&
!
ValidationUtil
.
isEmpty
(
equipmentSpecific
.
getBizOrgCode
())){
EquipmentSpecific
equipmentSpecific
=
equipmentSpecificMapper
.
selectOne
(
wrapper
);
Map
<
String
,
String
>
equipMap
=
new
HashMap
<>();
if
(!
ValidationUtil
.
isEmpty
(
equipmentSpecific
)
&&
!
ValidationUtil
.
isEmpty
(
equipmentSpecific
.
getBizOrgCode
()))
{
equipMap
.
put
(
"bizOrgCode"
,
equipmentSpecific
.
getBizOrgCode
());
Map
<
String
,
String
>
equipMap
=
new
HashMap
<>();
model
.
setExtras
(
equipMap
);
equipMap
.
put
(
"bizOrgCode"
,
equipmentSpecific
.
getBizOrgCode
());
}
model
.
setExtras
(
equipMap
);
model
.
setRelationId
(
String
.
valueOf
(
equipmentSpecificAlarmLog
.
getId
()));
}
Token
token
=
remoteSecurityService
.
getServerToken
();
model
.
setRelationId
(
String
.
valueOf
(
equipmentSpecificAlarmLog
.
getId
()));
systemctlFeign
.
create
(
token
.
getAppKey
(),
token
.
getProduct
(),
token
.
getToke
(),
model
);
Token
token
=
remoteSecurityService
.
getServerToken
();
log
.
info
(
String
.
format
(
"调用平台消息服务成功:%s"
,
JSON
.
toJSONString
(
model
)));
systemctlFeign
.
create
(
token
.
getAppKey
(),
token
.
getProduct
(),
token
.
getToke
(),
model
);
}
catch
(
Exception
e
)
{
log
.
info
(
String
.
format
(
"调用平台消息服务成功:%s"
,
JSON
.
toJSONString
(
model
)));
// e.printStackTrace();
}
catch
(
Exception
e
)
{
log
.
error
(
"告警消息同步平台失败:syncSystemctlMsg,===>>>"
+
e
.
getMessage
());
// e.printStackTrace();
}
log
.
error
(
"告警消息同步平台失败:syncSystemctlMsg,===>>>"
+
e
.
getMessage
());
}
}
}
private
String
getSystemCodeBySpeId
(
String
sysIds
)
{
if
(
StringUtil
.
isNotEmpty
(
sysIds
))
{
private
String
getSystemCodeBySpeId
(
String
sysIds
)
{
List
<
FireFightingSystemEntity
>
sys
=
fireFightingSystemMapper
.
getFightingSysByIds
(
sysIds
.
split
(
","
));
if
(
StringUtil
.
isNotEmpty
(
sysIds
))
{
return
sys
.
stream
().
map
(
FireFightingSystemEntity:
:
getCode
).
collect
(
Collectors
.
joining
(
","
));
List
<
FireFightingSystemEntity
>
sys
=
fireFightingSystemMapper
.
getFightingSysByIds
(
sysIds
.
split
(
","
));
}
else
{
return
sys
.
stream
().
map
(
FireFightingSystemEntity:
:
getCode
).
collect
(
Collectors
.
joining
(
","
));
return
null
;
}
else
{
}
return
null
;
}
}
}
private
EquipmentAlarmReportDay
addEquipAlarmReportRecord
(
EquipmentSpecificIndex
equipmentSpecificIndex
)
{
EquipmentAlarmReportDay
equipmentAlarmReportDay
=
new
EquipmentAlarmReportDay
();
private
EquipmentAlarmReportDay
addEquipAlarmReportRecord
(
EquipmentSpecificIndex
equipmentSpecificIndex
)
{
equipmentAlarmReportDay
.
setOrgCode
(
equipmentSpecificIndex
.
getOrgCode
());
EquipmentAlarmReportDay
equipmentAlarmReportDay
=
new
EquipmentAlarmReportDay
();
equipmentAlarmReportDay
.
setReportDate
(
new
Date
());
equipmentAlarmReportDay
.
setOrgCode
(
equipmentSpecificIndex
.
getOrgCode
());
equipmentAlarmReportDay
.
setUpdateDate
(
new
Date
());
equipmentAlarmReportDay
.
setReportDate
(
new
Date
());
equipmentAlarmReportDay
.
setSystemIds
(
equipmentSpecificIndex
.
getSystemId
());
equipmentAlarmReportDay
.
setUpdateDate
(
new
Date
());
equipmentAlarmReportDay
.
setLastReportDate
(
new
Date
());
equipmentAlarmReportDay
.
setSystemIds
(
equipmentSpecificIndex
.
getSystemId
());
equipmentAlarmReportDay
.
setEquipmentSpecificId
(
equipmentSpecificIndex
.
getEquipmentSpecificId
());
equipmentAlarmReportDay
.
setLastReportDate
(
new
Date
());
equipmentAlarmReportDay
.
setEquipmentSpecificName
(
equipmentSpecificIndex
.
getEquipmentSpecificName
());
equipmentAlarmReportDay
.
setEquipmentSpecificId
(
equipmentSpecificIndex
.
getEquipmentSpecificId
());
equipmentAlarmReportDay
.
setEquipmentDetailId
(
equipmentSpecificIndex
.
getEquipmentDetailId
());
equipmentAlarmReportDay
.
setEquipmentSpecificName
(
equipmentSpecificIndex
.
getEquipmentSpecificName
());
equipmentAlarmReportDay
.
setEquipmentId
(
equipmentSpecificIndex
.
getEquipmentId
());
equipmentAlarmReportDay
.
setEquipmentDetailId
(
equipmentSpecificIndex
.
getEquipmentDetailId
());
equipmentAlarmReportDay
.
setEquipmentCode
(
equipmentSpecificIndex
.
getEquipmentCode
());
equipmentAlarmReportDay
.
setEquipmentId
(
equipmentSpecificIndex
.
getEquipmentId
());
equipmentAlarmReportDay
equipmentAlarmReportDay
.
setEquipmentCode
(
equipmentSpecificIndex
.
getEquipmentCode
());
.
setIndexTrueNum
(
TrueOrFalseEnum
.
real
.
value
.
equals
(
equipmentSpecificIndex
.
getValue
())
?
1L
:
0L
);
equipmentAlarmReportDay
equipmentAlarmReportDay
.
setAlarmType
(
equipmentSpecificIndex
.
getTypeCode
());
.
setIndexTrueNum
(
TrueOrFalseEnum
.
real
.
value
.
equals
(
equipmentSpecificIndex
.
getValue
())
?
1L
:
0L
);
equipmentAlarmReportDay
.
setAlarmTypeName
(
equipmentSpecificIndex
.
getTypeName
());
equipmentAlarmReportDay
.
setAlarmType
(
equipmentSpecificIndex
.
getTypeCode
());
equipmentAlarmReportDay
.
setIndexId
(
equipmentSpecificIndex
.
getEquipmentIndexId
());
equipmentAlarmReportDay
.
setAlarmTypeName
(
equipmentSpecificIndex
.
getTypeName
());
equipmentAlarmReportDay
.
setIndexName
(
equipmentSpecificIndex
.
getEquipmentSpecificIndexName
());
equipmentAlarmReportDay
.
setIndexId
(
equipmentSpecificIndex
.
getEquipmentIndexId
());
equipmentAlarmReportDay
.
setIndexType
(
equipmentSpecificIndex
.
getNameKey
());
equipmentAlarmReportDay
.
setIndexName
(
equipmentSpecificIndex
.
getEquipmentSpecificIndexName
());
equipmentAlarmReportDay
.
setValue
(
equipmentSpecificIndex
.
getValue
());
equipmentAlarmReportDay
.
setIndexType
(
equipmentSpecificIndex
.
getNameKey
());
equipmentAlarmReportDay
.
setIsAlarm
(
equipmentSpecificIndex
.
getIsAlarm
());
equipmentAlarmReportDay
.
setValue
(
equipmentSpecificIndex
.
getValue
());
return
equipmentAlarmReportDay
;
equipmentAlarmReportDay
.
setIsAlarm
(
equipmentSpecificIndex
.
getIsAlarm
());
}
return
equipmentAlarmReportDay
;
}
private
EquipmentSpecificAlarmLog
addEquipAlarmLogRecord
(
EquipmentSpecificAlarm
equipmentSpecificAlarm
)
{
EquipmentSpecificAlarmLog
equipmentSpecificAlarmLog
=
new
EquipmentSpecificAlarmLog
();
private
EquipmentSpecificAlarmLog
addEquipAlarmLogRecord
(
EquipmentSpecificAlarm
equipmentSpecificAlarm
)
{
BeanUtils
.
copyProperties
(
equipmentSpecificAlarm
,
equipmentSpecificAlarmLog
);
EquipmentSpecificAlarmLog
equipmentSpecificAlarmLog
=
new
EquipmentSpecificAlarmLog
();
equipmentSpecificAlarmLog
.
setId
(
null
);
BeanUtils
.
copyProperties
(
equipmentSpecificAlarm
,
equipmentSpecificAlarmLog
);
equipmentSpecificAlarmLog
.
setCreateDate
(
new
Date
());
equipmentSpecificAlarmLog
.
setId
(
null
);
equipmentSpecificAlarmLog
.
setEquipmentSpecificAlarmId
(
equipmentSpecificAlarm
.
getId
());
equipmentSpecificAlarmLog
.
setCreateDate
(
new
Date
());
boolean
bool
=
equipmentSpecificAlarmLogService
.
save
(
equipmentSpecificAlarmLog
);
equipmentSpecificAlarmLog
.
setEquipmentSpecificAlarmId
(
equipmentSpecificAlarm
.
getId
());
// 同步告警消息给平台
boolean
bool
=
equipmentSpecificAlarmLogService
.
save
(
equipmentSpecificAlarmLog
);
if
(
amosSwitch
&&
bool
)
{
// 同步告警消息给平台
EquipmentSpecificAlarmLog
alarmLog
=
equipmentSpecificAlarmLogService
if
(
amosSwitch
&&
bool
)
{
.
getById
(
equipmentSpecificAlarmLog
.
getId
());
EquipmentSpecificAlarmLog
alarmLog
=
equipmentSpecificAlarmLogService
new
Thread
(
new
Runnable
()
{
.
getById
(
equipmentSpecificAlarmLog
.
getId
());
@Override
new
Thread
(
new
Runnable
()
{
public
void
run
()
{
@Override
syncSystemctlMsg
(
alarmLog
);
public
void
run
()
{
}
syncSystemctlMsg
(
alarmLog
);
}).
start
();
}
}
}).
start
();
return
equipmentSpecificAlarmLog
;
}
}
return
equipmentSpecificAlarmLog
;
}
/**
* 添加告警
/**
*
* 添加告警
* @param equipmentSpecificAlarms
*
* @param equipmentSpecificIndex
* @param equipmentSpecificAlarms
* @return
* @param equipmentSpecificIndex
*/
* @return
private
List
<
EquipmentSpecificAlarm
>
addEquipmentSpecificAlarm
(
List
<
EquipmentSpecificAlarm
>
equipmentSpecificAlarms
,
*/
EquipmentSpecificIndex
equipmentSpecificIndex
,
EquipmentSpecificAlarm
equipmentSpecificAlarm
)
{
private
List
<
EquipmentSpecificAlarm
>
addEquipmentSpecificAlarm
(
List
<
EquipmentSpecificAlarm
>
equipmentSpecificAlarms
,
BeanUtils
.
copyProperties
(
equipmentSpecificIndex
,
equipmentSpecificAlarm
);
EquipmentSpecificIndex
equipmentSpecificIndex
,
EquipmentSpecificAlarm
equipmentSpecificAlarm
)
{
equipmentSpecificAlarm
.
setId
(
null
);
BeanUtils
.
copyProperties
(
equipmentSpecificIndex
,
equipmentSpecificAlarm
);
equipmentSpecificAlarm
.
setFrequency
(
1
);
equipmentSpecificAlarm
.
setId
(
null
);
equipmentSpecificAlarm
.
setStatus
(
AlarmStatusEnum
.
BJ
.
getCode
());
equipmentSpecificAlarm
.
setFrequency
(
1
);
equipmentSpecificAlarm
.
setEquipmentSpecificIndexKey
(
equipmentSpecificIndex
.
getNameKey
());
equipmentSpecificAlarm
.
setStatus
(
AlarmStatusEnum
.
BJ
.
getCode
());
equipmentSpecificAlarm
.
setEquipmentSpecificIndexValue
(
equipmentSpecificIndex
.
getValue
());
equipmentSpecificAlarm
.
setEquipmentSpecificIndexKey
(
equipmentSpecificIndex
.
getNameKey
());
equipmentSpecificAlarm
.
setEquipmentSpecificIndexLabel
(
equipmentSpecificIndex
.
getValueLabel
());
equipmentSpecificAlarm
.
setEquipmentSpecificIndexValue
(
equipmentSpecificIndex
.
getValue
());
equipmentSpecificAlarm
.
setType
(
equipmentSpecificIndex
.
getTypeCode
());
equipmentSpecificAlarm
.
setEquipmentSpecificIndexLabel
(
equipmentSpecificIndex
.
getValueLabel
());
equipmentSpecificAlarm
.
setCreateDate
(
new
Date
());
equipmentSpecificAlarm
.
setType
(
equipmentSpecificIndex
.
getTypeCode
());
equipmentSpecificAlarm
.
setUpdateDate
(
new
Date
());
equipmentSpecificAlarm
.
setCreateDate
(
new
Date
());
equipmentSpecificAlarm
.
setEquipmentCode
(
equipmentSpecificIndex
.
getEquipmentCode
());
equipmentSpecificAlarm
.
setUpdateDate
(
new
Date
());
equipmentSpecificAlarm
.
setEquipmentId
(
equipmentSpecificIndex
.
getEquipmentId
());
equipmentSpecificAlarm
.
setEquipmentCode
(
equipmentSpecificIndex
.
getEquipmentCode
());
equipmentSpecificAlarm
.
setEquipmentDetailId
(
equipmentSpecificIndex
.
getEquipmentDetailId
());
equipmentSpecificAlarm
.
setEquipmentId
(
equipmentSpecificIndex
.
getEquipmentId
());
equipmentSpecificAlarm
.
setEquipmentSpecificCode
(
equipmentSpecificIndex
.
getEquipmentSpecificCode
());
equipmentSpecificAlarm
.
setEquipmentDetailId
(
equipmentSpecificIndex
.
getEquipmentDetailId
());
equipmentSpecificAlarm
.
setEmergencyLevel
(
equipmentSpecificIndex
.
getEmergencyLevel
());
equipmentSpecificAlarm
.
setEquipmentSpecificCode
(
equipmentSpecificIndex
.
getEquipmentSpecificCode
());
equipmentSpecificAlarm
.
setEmergencyLevelColor
(
equipmentSpecificIndex
.
getEmergencyLevelColor
());
equipmentSpecificAlarm
.
setEmergencyLevel
(
equipmentSpecificIndex
.
getEmergencyLevel
());
equipmentSpecificAlarm
.
setEmergencyLevelDescribe
(
equipmentSpecificIndex
.
getEmergencyLevelDescribe
());
equipmentSpecificAlarm
.
setEmergencyLevelColor
(
equipmentSpecificIndex
.
getEmergencyLevelColor
());
equipmentSpecificAlarms
.
add
(
equipmentSpecificAlarm
);
equipmentSpecificAlarm
.
setEmergencyLevelDescribe
(
equipmentSpecificIndex
.
getEmergencyLevelDescribe
());
return
equipmentSpecificAlarms
;
equipmentSpecificAlarms
.
add
(
equipmentSpecificAlarm
);
}
return
equipmentSpecificAlarms
;
}
// NB装备告警
private
List
<
EquipmentSpecificAlarm
>
getNbEquipAlarmList
(
List
<
EquipmentSpecificAlarm
>
indexAlarms
,
// NB装备告警
EquipmentSpecificIndex
equipmentSpecificIndex
,
EquipmentSpecificAlarm
equipmentSpecificAlarm
)
{
private
List
<
EquipmentSpecificAlarm
>
getNbEquipAlarmList
(
List
<
EquipmentSpecificAlarm
>
indexAlarms
,
List
<
EquipmentSpecificAlarm
>
equipmentSpecificAlarmList
=
new
ArrayList
<>();
EquipmentSpecificIndex
equipmentSpecificIndex
,
EquipmentSpecificAlarm
equipmentSpecificAlarm
)
{
if
(
ValidationUtil
.
isEmpty
(
indexAlarms
))
{
// 告警表为空,新增告警数据
List
<
EquipmentSpecificAlarm
>
equipmentSpecificAlarmList
=
new
ArrayList
<>();
addEquipmentSpecificAlarm
(
equipmentSpecificAlarmList
,
equipmentSpecificIndex
,
equipmentSpecificAlarm
);
if
(
ValidationUtil
.
isEmpty
(
indexAlarms
))
{
// 告警表为空,新增告警数据
if
(!
checkStateIsNormal
(
equipmentSpecificAlarm
,
equipmentSpecificIndex
))
{
addEquipmentSpecificAlarm
(
equipmentSpecificAlarmList
,
equipmentSpecificIndex
,
equipmentSpecificAlarm
);
return
equipmentSpecificAlarmList
;
if
(!
checkStateIsNormal
(
equipmentSpecificAlarm
,
equipmentSpecificIndex
))
{
}
else
{
return
equipmentSpecificAlarmList
;
equipmentSpecificAlarmList
.
clear
();
}
else
{
}
equipmentSpecificAlarmList
.
clear
();
}
else
{
}
indexAlarms
.
forEach
(
action
->
{
}
else
{
// 状态为正常或报警解除
indexAlarms
.
forEach
(
action
->
{
if
(
checkStateIsNormal
(
action
,
equipmentSpecificIndex
))
{
// 状态为正常或报警解除
// 修改报警数据为正常
if
(
checkStateIsNormal
(
action
,
equipmentSpecificIndex
))
{
action
.
setRecoveryDate
(
new
Date
());
// 修改报警数据为正常
action
.
setStatus
(
AlarmStatusEnum
.
HF
.
getCode
());
action
.
setRecoveryDate
(
new
Date
());
// 修改之前数据为已处理
action
.
setStatus
(
AlarmStatusEnum
.
HF
.
getCode
());
action
.
setResolveResult
(
action
.
getAlamReason
());
// 修改之前数据为已处理
action
.
setConfirmUserName
(
"系统"
);
action
.
setResolveResult
(
action
.
getAlamReason
());
action
.
setConfirmType
(
action
.
getType
());
action
.
setConfirmUserName
(
"系统"
);
equipmentSpecificAlarmLogService
.
updateAlarmLogByIotCodeAndIndexKey
(
action
);
action
.
setConfirmType
(
action
.
getType
());
}
else
{
equipmentSpecificAlarmLogService
.
updateAlarmLogByIotCodeAndIndexKey
(
action
);
action
.
setFrequency
((
action
.
getFrequency
()
+
1
));
}
else
{
}
action
.
setFrequency
((
action
.
getFrequency
()
+
1
));
// 更新所在系统,设备可能编辑过
}
action
.
setTraceId
(
equipmentSpecificIndex
.
getTraceId
());
// 更新所在系统,设备可能编辑过
action
.
setSystemIds
(
equipmentSpecificIndex
.
getSystemId
());
action
.
setTraceId
(
equipmentSpecificIndex
.
getTraceId
());
action
.
setSystemCodes
(
this
.
getSystemCodeBySpeId
(
equipmentSpecificIndex
.
getSystemId
()));
action
.
setSystemIds
(
equipmentSpecificIndex
.
getSystemId
());
action
.
setUpdateDate
(
new
Date
());
action
.
setSystemCodes
(
this
.
getSystemCodeBySpeId
(
equipmentSpecificIndex
.
getSystemId
()));
equipmentSpecificAlarmList
.
add
(
action
);
action
.
setUpdateDate
(
new
Date
());
});
equipmentSpecificAlarmList
.
add
(
action
);
}
});
return
equipmentSpecificAlarmList
;
}
}
return
equipmentSpecificAlarmList
;
}
private
boolean
ifSendToGis
(
List
<
CarIndexGisVo
>
list
)
{
boolean
flag
=
true
;
private
boolean
ifSendToGis
(
List
<
CarIndexGisVo
>
list
)
{
List
<
CarIndexGisVo
>
list1
=
list
.
stream
().
filter
(
x
->
CarForGisEnum
.
JD
.
getNameKey
().
equals
(
x
.
getNameKey
()))
boolean
flag
=
true
;
.
collect
(
Collectors
.
toList
());
List
<
CarIndexGisVo
>
list1
=
list
.
stream
().
filter
(
x
->
CarForGisEnum
.
JD
.
getNameKey
().
equals
(
x
.
getNameKey
()))
List
<
CarIndexGisVo
>
list2
=
list
.
stream
().
filter
(
x
->
CarForGisEnum
.
WD
.
getNameKey
().
equals
(
x
.
getNameKey
()))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
List
<
CarIndexGisVo
>
list2
=
list
.
stream
().
filter
(
x
->
CarForGisEnum
.
WD
.
getNameKey
().
equals
(
x
.
getNameKey
()))
for
(
CarIndexGisVo
gisVo
:
list
)
{
.
collect
(
Collectors
.
toList
());
if
(
CarForGisEnum
.
JD
.
getNameKey
().
equals
(
gisVo
.
getNameKey
()))
{
for
(
CarIndexGisVo
gisVo
:
list
)
{
if
(!
StringUtil
.
isNotEmpty
(
gisVo
.
getValue
())
||
"0"
.
equals
(
gisVo
.
getValue
()))
{
if
(
CarForGisEnum
.
JD
.
getNameKey
().
equals
(
gisVo
.
getNameKey
()))
{
flag
=
false
;
if
(!
StringUtil
.
isNotEmpty
(
gisVo
.
getValue
())
||
"0"
.
equals
(
gisVo
.
getValue
()))
{
continue
;
flag
=
false
;
}
continue
;
}
}
if
(
CarForGisEnum
.
WD
.
getNameKey
().
equals
(
gisVo
.
getNameKey
())
||
"0"
.
equals
(
gisVo
.
getValue
()))
{
}
if
(!
StringUtil
.
isNotEmpty
(
gisVo
.
getValue
()))
{
if
(
CarForGisEnum
.
WD
.
getNameKey
().
equals
(
gisVo
.
getNameKey
())
||
"0"
.
equals
(
gisVo
.
getValue
()))
{
flag
=
false
;
if
(!
StringUtil
.
isNotEmpty
(
gisVo
.
getValue
()))
{
continue
;
flag
=
false
;
}
continue
;
}
}
}
}
if
(
list1
.
size
()
==
0
||
list2
.
size
()
==
0
)
{
}
flag
=
false
;
if
(
list1
.
size
()
==
0
||
list2
.
size
()
==
0
)
{
}
flag
=
false
;
return
flag
;
}
}
return
flag
;
}
/**
* 接收到的IOT数据为火眼存储到Map中
/**
*/
* 接收到的IOT数据为火眼存储到Map中
private
void
iotDataListToCacheMap
(
List
<
IotDataVO
>
iotDatalist
)
{
*/
List
<
IotDataVO
>
iotDataVOs
=
iotDatalist
.
stream
()
private
void
iotDataListToCacheMap
(
List
<
IotDataVO
>
iotDatalist
)
{
.
filter
(
x
->
"alarmLevel"
.
equals
(
x
.
getKey
())
||
"alarmType"
.
equals
(
x
.
getKey
())
List
<
IotDataVO
>
iotDataVOs
=
iotDatalist
.
stream
()
||
"temperature"
.
equals
(
x
.
getKey
())
||
"ruleTemperature"
.
equals
(
x
.
getKey
())
.
filter
(
x
->
"alarmLevel"
.
equals
(
x
.
getKey
())
||
"alarmType"
.
equals
(
x
.
getKey
())
||
"thermometryUnit"
.
equals
(
x
.
getKey
())
||
"alarmRule"
.
equals
(
x
.
getKey
()))
||
"temperature"
.
equals
(
x
.
getKey
())
||
"ruleTemperature"
.
equals
(
x
.
getKey
())
.
collect
(
Collectors
.
toList
());
||
"thermometryUnit"
.
equals
(
x
.
getKey
())
||
"alarmRule"
.
equals
(
x
.
getKey
()))
if
(
iotDataVOs
.
size
()
>
0
)
{
.
collect
(
Collectors
.
toList
());
Map
<
String
,
Object
>
map
=
iotDatalist
.
stream
()
if
(
iotDataVOs
.
size
()
>
0
)
{
.
collect
(
Collectors
.
toMap
(
IotDataVO:
:
getKey
,
IotDataVO:
:
getValue
));
Map
<
String
,
Object
>
map
=
iotDatalist
.
stream
()
putTemperatureMap
(
map
.
get
(
"traceId"
).
toString
(),
map
);
.
collect
(
Collectors
.
toMap
(
IotDataVO:
:
getKey
,
IotDataVO:
:
getValue
));
}
putTemperatureMap
(
map
.
get
(
"traceId"
).
toString
(),
map
);
}
}
}
/**
* 处理火眼逻辑合并为一条告警
/**
*/
* 处理火眼逻辑合并为一条告警
private
EquipmentSpecificIndex
handleTemperatureAlarm
(
EquipmentSpecificIndex
equipmentSpecificIndex
,
*/
List
<
IotDataVO
>
iotDatalist
)
{
private
EquipmentSpecificIndex
handleTemperatureAlarm
(
EquipmentSpecificIndex
equipmentSpecificIndex
,
List
<
IotDataVO
>
collect
=
iotDatalist
.
stream
().
filter
(
x
->
"traceId"
.
equals
(
x
.
getKey
()))
List
<
IotDataVO
>
iotDatalist
)
{
.
collect
(
Collectors
.
toList
());
List
<
IotDataVO
>
collect
=
iotDatalist
.
stream
().
filter
(
x
->
"traceId"
.
equals
(
x
.
getKey
()))
if
(
collect
.
size
()
>
0
&&
temperatureMapIsEmpty
(
String
.
valueOf
(
collect
.
get
(
0
).
getValue
())))
{
.
collect
(
Collectors
.
toList
());
String
traceId
=
String
.
valueOf
(
collect
.
get
(
0
).
getValue
());
if
(
collect
.
size
()
>
0
&&
temperatureMapIsEmpty
(
String
.
valueOf
(
collect
.
get
(
0
).
getValue
())))
{
TemperatureAlarmDto
dto
=
temperatureMap
.
get
(
traceId
);
String
traceId
=
String
.
valueOf
(
collect
.
get
(
0
).
getValue
());
equipmentSpecificIndex
TemperatureAlarmDto
dto
=
temperatureMap
.
get
(
traceId
);
.
setEquipmentSpecificIndexName
(
AlarmTypeEnum
.
getTypeByCode
(
AlarmTypeEnum
.
GZGJ
.
getCode
()));
equipmentSpecificIndex
equipmentSpecificIndex
.
setNameKey
(
AlarmTypeEnum
.
GZGJ
.
getCode
());
.
setEquipmentSpecificIndexName
(
AlarmTypeEnum
.
getTypeByCode
(
AlarmTypeEnum
.
GZGJ
.
getCode
()));
equipmentSpecificIndex
.
setAlamReason
(
equipmentSpecificIndex
.
setNameKey
(
AlarmTypeEnum
.
GZGJ
.
getCode
());
TemperatureAlarm
.
getAlarmContent
(
dto
.
getAlarmLevel
(),
dto
.
getAlarmType
(),
dto
.
getAlarmRule
(),
equipmentSpecificIndex
.
setAlamReason
(
dto
.
getRuleTemperature
(),
dto
.
getTemperature
(),
dto
.
getThermometryUnit
()));
TemperatureAlarm
.
getAlarmContent
(
dto
.
getAlarmLevel
(),
dto
.
getAlarmType
(),
dto
.
getAlarmRule
(),
equipmentSpecificIndex
.
setValue
(
"true"
);
dto
.
getRuleTemperature
(),
dto
.
getTemperature
(),
dto
.
getThermometryUnit
()));
equipmentSpecificIndex
.
setIsAlarm
(
1
);
equipmentSpecificIndex
.
setValue
(
"true"
);
temperatureMap
.
remove
(
traceId
);
equipmentSpecificIndex
.
setIsAlarm
(
1
);
}
temperatureMap
.
remove
(
traceId
);
return
equipmentSpecificIndex
;
}
}
return
equipmentSpecificIndex
;
}
/**
* temperatureMap存储数据
/**
*/
* temperatureMap存储数据
private
void
putTemperatureMap
(
String
traceId
,
Map
<
String
,
Object
>
map
)
{
*/
TemperatureAlarmDto
cacheTemperatureAlarmDto
=
temperatureMap
.
get
(
traceId
);
private
void
putTemperatureMap
(
String
traceId
,
Map
<
String
,
Object
>
map
)
{
if
(
ValidationUtil
.
isEmpty
(
cacheTemperatureAlarmDto
))
{
TemperatureAlarmDto
cacheTemperatureAlarmDto
=
temperatureMap
.
get
(
traceId
);
cacheTemperatureAlarmDto
=
new
TemperatureAlarmDto
();
if
(
ValidationUtil
.
isEmpty
(
cacheTemperatureAlarmDto
))
{
}
cacheTemperatureAlarmDto
=
new
TemperatureAlarmDto
();
TemperatureAlarmDto
newMap
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
),
TemperatureAlarmDto
.
class
);
}
BeanUtil
.
copyPropertiesIgnoreNull
(
newMap
,
cacheTemperatureAlarmDto
);
TemperatureAlarmDto
newMap
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
),
TemperatureAlarmDto
.
class
);
temperatureMap
.
put
(
traceId
,
cacheTemperatureAlarmDto
);
BeanUtil
.
copyPropertiesIgnoreNull
(
newMap
,
cacheTemperatureAlarmDto
);
}
temperatureMap
.
put
(
traceId
,
cacheTemperatureAlarmDto
);
}
private
boolean
temperatureMapIsEmpty
(
String
traceId
)
{
TemperatureAlarmDto
dto
=
temperatureMap
.
get
(
traceId
);
private
boolean
temperatureMapIsEmpty
(
String
traceId
)
{
if
(!
ValidationUtil
.
isEmpty
(
dto
)
&&
!
ValidationUtil
.
isEmpty
(
dto
.
getAlarmLevel
())
TemperatureAlarmDto
dto
=
temperatureMap
.
get
(
traceId
);
&&
!
ValidationUtil
.
isEmpty
(
dto
.
getAlarmType
())
&&
!
ValidationUtil
.
isEmpty
(
dto
.
getAlarmRule
())
if
(!
ValidationUtil
.
isEmpty
(
dto
)
&&
!
ValidationUtil
.
isEmpty
(
dto
.
getAlarmLevel
())
&&
!
ValidationUtil
.
isEmpty
(
dto
.
getRuleTemperature
())
&&
!
ValidationUtil
.
isEmpty
(
dto
.
getTemperature
())
&&
!
ValidationUtil
.
isEmpty
(
dto
.
getAlarmType
())
&&
!
ValidationUtil
.
isEmpty
(
dto
.
getAlarmRule
())
&&
!
ValidationUtil
.
isEmpty
(
dto
.
getThermometryUnit
()))
{
&&
!
ValidationUtil
.
isEmpty
(
dto
.
getRuleTemperature
())
&&
!
ValidationUtil
.
isEmpty
(
dto
.
getTemperature
())
return
true
;
&&
!
ValidationUtil
.
isEmpty
(
dto
.
getThermometryUnit
()))
{
}
return
true
;
return
false
;
}
}
return
false
;
}
/**
* 判断是否为NB物联监测设备参数
/**
*
* 判断是否为NB物联监测设备参数
* @param nameKey
*
* @return
* @param nameKey
*/
* @return
private
boolean
verifyNB
(
String
nameKey
)
{
*/
return
nameKey
.
startsWith
(
"NB_"
);
private
boolean
verifyNB
(
String
nameKey
)
{
}
return
nameKey
.
startsWith
(
"NB_"
);
}
/**
* 判断状态为正常或报警解除
/**
*/
* 判断状态为正常或报警解除
private
boolean
checkStateIsNormal
(
EquipmentSpecificAlarm
equipmentSpecificAlarm
,
*/
EquipmentSpecificIndex
equipmentSpecificIndex
)
{
private
boolean
checkStateIsNormal
(
EquipmentSpecificAlarm
equipmentSpecificAlarm
,
String
enumKey
=
String
.
format
(
"%s_%s"
,
equipmentSpecificAlarm
.
getEquipmentSpecificIndexKey
(),
EquipmentSpecificIndex
equipmentSpecificIndex
)
{
equipmentSpecificIndex
.
getValue
());
String
enumKey
=
String
.
format
(
"%s_%s"
,
equipmentSpecificAlarm
.
getEquipmentSpecificIndexKey
(),
equipmentSpecificAlarm
.
setAlamReason
(
equipmentSpecificAlarm
.
getEquipmentSpecificIndexName
().
replace
(
"NB_"
,
""
)
equipmentSpecificIndex
.
getValue
());
+
":"
+
NBalarmEnum
.
getDescByKey
(
enumKey
));
equipmentSpecificAlarm
.
setAlamReason
(
equipmentSpecificAlarm
.
getEquipmentSpecificIndexName
().
replace
(
"NB_"
,
""
)
boolean
flag
=
false
;
+
":"
+
NBalarmEnum
.
getDescByKey
(
enumKey
));
if
(!
ValidationUtil
.
isEmpty
(
equipmentSpecificAlarm
.
getType
())
boolean
flag
=
false
;
&&
!
ValidationUtil
.
isEmpty
(
equipmentSpecificAlarm
.
getIotCode
())
if
(!
ValidationUtil
.
isEmpty
(
equipmentSpecificAlarm
.
getType
())
&&
!
ValidationUtil
.
isEmpty
(
equipmentSpecificAlarm
.
getEquipmentSpecificIndexKey
())
&&
!
ValidationUtil
.
isEmpty
(
equipmentSpecificAlarm
.
getIotCode
())
&&
(
NBalarmEnum
.
NB_liquid_level_state_0
.
getKey
().
equals
(
enumKey
)
&&
!
ValidationUtil
.
isEmpty
(
equipmentSpecificAlarm
.
getEquipmentSpecificIndexKey
())
||
NBalarmEnum
.
NB_error_code_0
.
getKey
().
equals
(
enumKey
)
&&
(
NBalarmEnum
.
NB_liquid_level_state_0
.
getKey
().
equals
(
enumKey
)
||
NBalarmEnum
.
NB_battery_state_0
.
getKey
().
equals
(
enumKey
)
||
NBalarmEnum
.
NB_error_code_0
.
getKey
().
equals
(
enumKey
)
||
NBalarmEnum
.
NB_hydraulic_state_0
.
getKey
().
equals
(
enumKey
)
||
NBalarmEnum
.
NB_battery_state_0
.
getKey
().
equals
(
enumKey
)
||
NBalarmEnum
.
NB_hydraulic_state_2
.
getKey
().
equals
(
enumKey
)
||
NBalarmEnum
.
NB_hydraulic_state_0
.
getKey
().
equals
(
enumKey
)
||
NBalarmEnum
.
NB_hydraulic_state_4
.
getKey
().
equals
(
enumKey
)
||
NBalarmEnum
.
NB_hydraulic_state_2
.
getKey
().
equals
(
enumKey
)
||
NBalarmEnum
.
NB_alarm_status_4
.
getKey
().
equals
(
enumKey
)))
{
||
NBalarmEnum
.
NB_hydraulic_state_4
.
getKey
().
equals
(
enumKey
)
flag
=
true
;
||
NBalarmEnum
.
NB_alarm_status_4
.
getKey
().
equals
(
enumKey
)))
{
}
flag
=
true
;
return
flag
;
}
}
return
flag
;
}
public
List
<
EquipmentSpecificAlarmLog
>
saveOrUpdateEquipAlarm
(
List
<
EquipmentSpecificAlarm
>
equipmentSpecificAlarms
)
{
public
List
<
EquipmentSpecificAlarmLog
>
saveOrUpdateEquipAlarm
(
List
<
EquipmentSpecificAlarmLog
>
equipmentAlarmLogs
=
new
ArrayList
<>();
List
<
EquipmentSpecificAlarm
>
equipmentSpecificAlarms
)
{
if
(
ObjectUtils
.
isEmpty
(
equipmentSpecificAlarms
))
{
List
<
EquipmentSpecificAlarmLog
>
equipmentAlarmLogs
=
new
ArrayList
<>();
return
equipmentAlarmLogs
;
if
(
ObjectUtils
.
isEmpty
(
equipmentSpecificAlarms
))
{
}
return
equipmentAlarmLogs
;
equipmentSpecificAlarmService
.
saveOrUpdateBatch
(
equipmentSpecificAlarms
);
}
equipmentSpecificAlarms
.
forEach
(
action
->
{
equipmentSpecificAlarmService
.
saveOrUpdateBatch
(
equipmentSpecificAlarms
);
if
(
AlarmStatusEnum
.
BJ
.
getCode
()
==
action
.
getStatus
())
{
equipmentSpecificAlarms
.
forEach
(
action
->
{
equipmentAlarmLogs
.
add
(
addEquipAlarmLogRecord
(
action
));
if
(
AlarmStatusEnum
.
BJ
.
getCode
()
==
action
.
getStatus
())
{
if
(
ValidationUtil
.
isEmpty
(
action
.
getAlamContent
()))
{
equipmentAlarmLogs
.
add
(
addEquipAlarmLogRecord
(
action
));
action
.
setAlamContent
(
action
.
getEquipmentSpecificName
()
+
action
.
getEquipmentSpecificIndexName
());
if
(
ValidationUtil
.
isEmpty
(
action
.
getAlamContent
()))
{
}
action
.
setAlamContent
(
action
.
getEquipmentSpecificName
()
+
action
.
getEquipmentSpecificIndexName
());
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQDQR
.
getTopic
(),
JSONArray
.
toJSON
(
action
).
toString
());
}
}
else
{
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQDQR
.
getTopic
(),
JSONArray
.
toJSON
(
action
).
toString
());
equipmentAlarmLogs
.
addAll
(
upAlarmLogStatus
(
action
.
getIotCode
(),
action
.
getEquipmentSpecificIndexKey
(),
action
.
getTraceId
(),
}
else
{
equipmentSpecificAlarmLogService
));
equipmentAlarmLogs
.
addAll
(
upAlarmLogStatus
(
action
.
getIotCode
(),
action
.
getEquipmentSpecificIndexKey
(),
action
.
getTraceId
(),
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQYQR
.
getTopic
(),
JSONArray
.
toJSON
(
action
).
toString
());
equipmentSpecificAlarmLogService
));
bool
=
Boolean
.
TRUE
;
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQYQR
.
getTopic
(),
JSONArray
.
toJSON
(
action
).
toString
());
}
bool
=
Boolean
.
TRUE
;
});
}
return
equipmentAlarmLogs
;
});
}
return
equipmentAlarmLogs
;
}
/**
* 报警日志同步其他系统
/**
*
* 报警日志同步其他系统
* @param equipmentAlarmLogs
*
*/
* @param equipmentAlarmLogs
public
void
equipmentAlarmLogsToOtherSystems
(
List
<
EquipmentSpecificAlarmLog
>
equipmentAlarmLogs
)
{
*/
if
(
ObjectUtils
.
isEmpty
(
equipmentAlarmLogs
))
{
public
void
equipmentAlarmLogsToOtherSystems
(
List
<
EquipmentSpecificAlarmLog
>
equipmentAlarmLogs
)
{
return
;
if
(
ObjectUtils
.
isEmpty
(
equipmentAlarmLogs
))
{
}
return
;
JSONObject
jsonObject
=
new
JSONObject
();
}
jsonObject
.
put
(
"seqNo"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
).
toLowerCase
());
JSONObject
jsonObject
=
new
JSONObject
();
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
ALARM_LOG_INSERT
.
getTopic
(),
jsonObject
.
toString
());
jsonObject
.
put
(
"seqNo"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
).
toLowerCase
());
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQZXDT
.
getTopic
(),
""
);
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
ALARM_LOG_INSERT
.
getTopic
(),
jsonObject
.
toString
());
// 数字换流站数据处理(高斯库同步及南瑞告警推送)
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQZXDT
.
getTopic
(),
""
);
if
(
syncSwitch
)
{
// 数字换流站数据处理(高斯库同步及南瑞告警推送)
List
<
FireEquipmentFireAlarm
>
alarmList
=
createFireEquipmentFireAlarmVo
(
equipmentAlarmLogs
);
if
(
syncSwitch
)
{
if
(!
CollectionUtils
.
isEmpty
(
alarmList
))
{
List
<
FireEquipmentFireAlarm
>
alarmList
=
createFireEquipmentFireAlarmVo
(
equipmentAlarmLogs
);
Map
<
String
,
List
<
FireEquipmentFireAlarm
>>
collect
=
alarmList
.
stream
()
if
(!
CollectionUtils
.
isEmpty
(
alarmList
))
{
.
collect
(
Collectors
.
groupingBy
(
FireEquipmentFireAlarm:
:
getType
));
Map
<
String
,
List
<
FireEquipmentFireAlarm
>>
collect
=
alarmList
.
stream
()
for
(
String
key
:
collect
.
keySet
())
{
.
collect
(
Collectors
.
groupingBy
(
FireEquipmentFireAlarm:
:
getType
));
List
<
FireEquipmentFireAlarm
>
list
=
collect
.
get
(
key
);
for
(
String
key
:
collect
.
keySet
())
{
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
List
<
FireEquipmentFireAlarm
>
list
=
collect
.
get
(
key
);
if
(
"FIREALARM"
.
equalsIgnoreCase
(
key
))
{
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
syncDataService
.
syncCreatedFireEquipAlarm
(
list
);
if
(
"FIREALARM"
.
equalsIgnoreCase
(
key
))
{
}
else
if
(
"BREAKDOWN"
.
equalsIgnoreCase
(
key
))
{
syncDataService
.
syncCreatedFireEquipAlarm
(
list
);
List
<
FireEquipmentFaultAlarm
>
faultAlarms
=
list
.
stream
().
map
(
x
->
{
}
else
if
(
"BREAKDOWN"
.
equalsIgnoreCase
(
key
))
{
FireEquipmentFaultAlarm
fireEquipmentFaultAlarm
=
new
FireEquipmentFaultAlarm
();
List
<
FireEquipmentFaultAlarm
>
faultAlarms
=
list
.
stream
().
map
(
x
->
{
BeanUtils
.
copyProperties
(
x
,
fireEquipmentFaultAlarm
);
FireEquipmentFaultAlarm
fireEquipmentFaultAlarm
=
new
FireEquipmentFaultAlarm
();
return
fireEquipmentFaultAlarm
;
BeanUtils
.
copyProperties
(
x
,
fireEquipmentFaultAlarm
);
}).
collect
(
Collectors
.
toList
());
return
fireEquipmentFaultAlarm
;
syncDataService
.
syncCreatedFireEquiptFaultAlarm
(
faultAlarms
);
}).
collect
(
Collectors
.
toList
());
}
else
if
(
"SHIELD"
.
equalsIgnoreCase
(
key
))
{
syncDataService
.
syncCreatedFireEquiptFaultAlarm
(
faultAlarms
);
List
<
FireEquipmentDefectAlarm
>
defectAlarms
=
list
.
stream
().
map
(
x
->
{
}
else
if
(
"SHIELD"
.
equalsIgnoreCase
(
key
))
{
FireEquipmentDefectAlarm
fireEquipmentFaultAlarm
=
new
FireEquipmentDefectAlarm
();
List
<
FireEquipmentDefectAlarm
>
defectAlarms
=
list
.
stream
().
map
(
x
->
{
BeanUtils
.
copyProperties
(
x
,
fireEquipmentFaultAlarm
);
FireEquipmentDefectAlarm
fireEquipmentFaultAlarm
=
new
FireEquipmentDefectAlarm
();
return
fireEquipmentFaultAlarm
;
BeanUtils
.
copyProperties
(
x
,
fireEquipmentFaultAlarm
);
}).
collect
(
Collectors
.
toList
());
return
fireEquipmentFaultAlarm
;
syncDataService
.
syncCreatedFireEquipDefectAlarm
(
defectAlarms
);
}).
collect
(
Collectors
.
toList
());
}
syncDataService
.
syncCreatedFireEquipDefectAlarm
(
defectAlarms
);
}
}
}
}
}
}
}
// 向南瑞平台推送报警消息
if
(!
bool
)
{
// 向南瑞平台推送报警消息
syncDataService
.
syncCreatedSendAlarm
(
equipmentAlarmLogs
);
if
(!
bool
)
{
}
syncDataService
.
syncCreatedSendAlarm
(
equipmentAlarmLogs
);
}
}
}
}
}
/**
* 组装数字换流站平台告警数据
/**
*
* 组装数字换流站平台告警数据
* @param
*
* @return
* @param
*/
* @return
private
List
<
FireEquipmentFireAlarm
>
createFireEquipmentFireAlarmVo
(
*/
List
<
EquipmentSpecificAlarmLog
>
equipmentAlarmLogs
)
{
private
List
<
FireEquipmentFireAlarm
>
createFireEquipmentFireAlarmVo
(
Map
<
String
,
String
>
stationInfo
=
equipmentSpecificMapper
.
getStationInfo
().
get
(
0
);
List
<
EquipmentSpecificAlarmLog
>
equipmentAlarmLogs
)
{
List
<
FireEquipmentFireAlarm
>
alarmList
=
new
ArrayList
<>();
Map
<
String
,
String
>
stationInfo
=
equipmentSpecificMapper
.
getStationInfo
().
get
(
0
);
equipmentAlarmLogs
.
forEach
(
action
->
{
List
<
FireEquipmentFireAlarm
>
alarmList
=
new
ArrayList
<>();
FireEquipmentFireAlarm
alarm
=
new
FireEquipmentFireAlarm
();
equipmentAlarmLogs
.
forEach
(
action
->
{
BeanUtils
.
copyProperties
(
action
,
alarm
);
FireEquipmentFireAlarm
alarm
=
new
FireEquipmentFireAlarm
();
alarm
.
setAliasname
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificIndexName
()));
BeanUtils
.
copyProperties
(
action
,
alarm
);
alarm
.
setEquipmentMeasurementId
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentIndexId
().
toString
()));
alarm
.
setAliasname
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificIndexName
()));
alarm
.
setEquipmentMeasurementMRid
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentIndexId
().
toString
()));
alarm
.
setEquipmentMeasurementId
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentIndexId
().
toString
()));
alarm
.
setFieldLabel
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificIndexKey
()));
alarm
.
setEquipmentMeasurementMRid
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentIndexId
().
toString
()));
alarm
.
setFieldName
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificIndexName
()));
alarm
.
setFieldLabel
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificIndexKey
()));
alarm
.
setFireEquipmentId
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificId
().
toString
()));
alarm
.
setFieldName
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificIndexName
()));
alarm
.
setFireEquipmentMRid
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificCode
()));
alarm
.
setFireEquipmentId
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificId
().
toString
()));
alarm
.
setFireEquipmentName
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificName
()));
alarm
.
setFireEquipmentMRid
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificCode
()));
alarm
.
setFrequency
(
1
);
alarm
.
setFireEquipmentName
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificName
()));
alarm
.
setId
(
StringUtil
.
toNotEmptyString
(
action
.
getId
().
toString
()));
alarm
.
setFrequency
(
1
);
alarm
.
setMrid
(
action
.
getId
().
toString
());
alarm
.
setId
(
StringUtil
.
toNotEmptyString
(
action
.
getId
().
toString
()));
alarm
.
setName
(
action
.
getEquipmentSpecificIndexName
());
alarm
.
setMrid
(
action
.
getId
().
toString
());
alarm
.
setRecoveryDate
(
action
.
getUpdateDate
());
alarm
.
setName
(
action
.
getEquipmentSpecificIndexName
());
alarm
.
setStationCode
(
StringUtil
.
toNotEmptyString
(
stationInfo
.
get
(
"stationCode"
)));
alarm
.
setRecoveryDate
(
action
.
getUpdateDate
());
alarm
.
setStationName
(
StringUtil
.
toNotEmptyString
(
stationInfo
.
get
(
"stationName"
)));
alarm
.
setStationCode
(
StringUtil
.
toNotEmptyString
(
stationInfo
.
get
(
"stationCode"
)));
alarm
.
setValue
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificIndexValue
()));
alarm
.
setStationName
(
StringUtil
.
toNotEmptyString
(
stationInfo
.
get
(
"stationName"
)));
alarmList
.
add
(
alarm
);
alarm
.
setValue
(
StringUtil
.
toNotEmptyString
(
action
.
getEquipmentSpecificIndexValue
()));
});
alarmList
.
add
(
alarm
);
return
alarmList
;
});
}
return
alarmList
;
}
/**
* 高斯库同步指标修改
/**
*
* 高斯库同步指标修改
* @param equipmentSpecificIndexList
*
*/
* @param equipmentSpecificIndexList
private
void
syncSpecificIndexsToGS
(
List
<
EquipmentSpecificIndex
>
equipmentSpecificIndexList
)
{
*/
if
(!
ObjectUtils
.
isEmpty
(
equipmentSpecificIndexList
)
&&
syncSwitch
)
{
private
void
syncSpecificIndexsToGS
(
List
<
EquipmentSpecificIndex
>
equipmentSpecificIndexList
)
{
// 数据同步
if
(!
ObjectUtils
.
isEmpty
(
equipmentSpecificIndexList
)
&&
syncSwitch
)
{
List
<
EquipmentIndexVO
>
fireEquipMeasurementCollect
=
new
ArrayList
<>();
// 数据同步
equipmentSpecificIndexList
.
forEach
(
action
->
{
List
<
EquipmentIndexVO
>
fireEquipMeasurementCollect
=
new
ArrayList
<>();
EquipmentIndexVO
equipmentIndexVO
=
new
EquipmentIndexVO
();
equipmentSpecificIndexList
.
forEach
(
action
->
{
BeanUtils
.
copyProperties
(
action
,
equipmentIndexVO
);
EquipmentIndexVO
equipmentIndexVO
=
new
EquipmentIndexVO
();
fireEquipMeasurementCollect
.
add
(
equipmentIndexVO
);
BeanUtils
.
copyProperties
(
action
,
equipmentIndexVO
);
});
fireEquipMeasurementCollect
.
add
(
equipmentIndexVO
);
if
(
0
<
fireEquipMeasurementCollect
.
size
())
{
});
syncDataService
.
syncCreatedFireEquipMeasurement
(
fireEquipMeasurementCollect
);
if
(
0
<
fireEquipMeasurementCollect
.
size
())
{
}
syncDataService
.
syncCreatedFireEquipMeasurement
(
fireEquipMeasurementCollect
);
}
}
}
}
}
private
IndexStateVo
createIndexStateVo
(
EquipmentSpecificIndex
equipmentSpecificIndex
)
{
IndexStateVo
indexStateVo
=
new
IndexStateVo
();
private
IndexStateVo
createIndexStateVo
(
EquipmentSpecificIndex
equipmentSpecificIndex
)
{
BeanUtils
.
copyProperties
(
equipmentSpecificIndex
,
indexStateVo
);
IndexStateVo
indexStateVo
=
new
IndexStateVo
();
indexStateVo
.
setId
(
equipmentSpecificIndex
.
getIotCode
()
+
"_"
+
equipmentSpecificIndex
.
getNameKey
());
BeanUtils
.
copyProperties
(
equipmentSpecificIndex
,
indexStateVo
);
indexStateVo
.
setData
(
equipmentSpecificIndex
.
getValue
());
indexStateVo
.
setId
(
equipmentSpecificIndex
.
getIotCode
()
+
"_"
+
equipmentSpecificIndex
.
getNameKey
());
indexStateVo
.
setIndexKey
(
equipmentSpecificIndex
.
getNameKey
());
indexStateVo
.
setData
(
equipmentSpecificIndex
.
getValue
());
return
indexStateVo
;
indexStateVo
.
setIndexKey
(
equipmentSpecificIndex
.
getNameKey
());
}
return
indexStateVo
;
}
public
List
<
EquipmentSpecificAlarm
>
createIndexAlarmRecord
(
EquipmentSpecificIndex
equipmentSpcIndex
)
{
// 处理火眼视频异常
public
List
<
EquipmentSpecificAlarm
>
createIndexAlarmRecord
(
EquipmentSpecificIndex
equipmentSpcIndex
)
{
List
<
EquipmentSpecificAlarm
>
equipmentSpecificAlarms
=
new
ArrayList
<>();
// 处理火眼视频异常
EquipmentSpecificAlarm
equipmentSpecificAlarm
=
new
EquipmentSpecificAlarm
();
List
<
EquipmentSpecificAlarm
>
equipmentSpecificAlarms
=
new
ArrayList
<>();
equipmentSpecificAlarm
.
setSystemIds
(
equipmentSpcIndex
.
getSystemId
());
EquipmentSpecificAlarm
equipmentSpecificAlarm
=
new
EquipmentSpecificAlarm
();
equipmentSpecificAlarm
.
setSystemCodes
(
this
.
getSystemCodeBySpeId
(
equipmentSpcIndex
.
getSystemId
()));
equipmentSpecificAlarm
.
setSystemIds
(
equipmentSpcIndex
.
getSystemId
());
List
<
EquipmentSpecificAlarm
>
indexAlarms
=
equipmentSpecificAlarmMapper
equipmentSpecificAlarm
.
setSystemCodes
(
this
.
getSystemCodeBySpeId
(
equipmentSpcIndex
.
getSystemId
()));
.
findEquipmentSpecificAlarmByEquipmentSpecificIdAndEquipmentIndexIdAndStatusIstrue
(
List
<
EquipmentSpecificAlarm
>
indexAlarms
=
equipmentSpecificAlarmMapper
equipmentSpcIndex
.
getEquipmentSpecificId
(),
equipmentSpcIndex
.
getEquipmentIndexId
());
.
findEquipmentSpecificAlarmByEquipmentSpecificIdAndEquipmentIndexIdAndStatusIstrue
(
// NB设备告警
equipmentSpcIndex
.
getEquipmentSpecificId
(),
equipmentSpcIndex
.
getEquipmentIndexId
());
if
(
verifyNB
(
equipmentSpcIndex
.
getNameKey
()))
{
// NB设备告警
return
getNbEquipAlarmList
(
indexAlarms
,
equipmentSpcIndex
,
equipmentSpecificAlarm
);
if
(
verifyNB
(
equipmentSpcIndex
.
getNameKey
()))
{
}
return
getNbEquipAlarmList
(
indexAlarms
,
equipmentSpcIndex
,
equipmentSpecificAlarm
);
// 报警表新增信息
}
if
(
ObjectUtils
.
isEmpty
(
indexAlarms
)
&&
(
TrueOrFalseEnum
.
real
.
value
.
equals
(
equipmentSpcIndex
.
getValue
())))
{
// 报警表新增信息
equipmentSpecificAlarms
=
addEquipmentSpecificAlarm
(
equipmentSpecificAlarms
,
equipmentSpcIndex
,
equipmentSpecificAlarm
);
if
(
ObjectUtils
.
isEmpty
(
indexAlarms
)
&&
(
TrueOrFalseEnum
.
real
.
value
.
equals
(
equipmentSpcIndex
.
getValue
())))
{
}
else
{
equipmentSpecificAlarms
=
addEquipmentSpecificAlarm
(
equipmentSpecificAlarms
,
equipmentSpcIndex
,
equipmentSpecificAlarm
);
// 报警表更新信息
}
else
{
for
(
EquipmentSpecificAlarm
action
:
indexAlarms
)
{
// 报警表更新信息
if
(
TrueOrFalseEnum
.
real
.
value
.
equals
(
equipmentSpcIndex
.
getValue
()))
{
for
(
EquipmentSpecificAlarm
action
:
indexAlarms
)
{
// 报警,修改发生频率
if
(
TrueOrFalseEnum
.
real
.
value
.
equals
(
equipmentSpcIndex
.
getValue
()))
{
action
.
setFrequency
((
action
.
getFrequency
()
+
1
));
// 报警,修改发生频率
}
else
{
action
.
setFrequency
((
action
.
getFrequency
()
+
1
));
// 报警恢复,修改数据为恢复状态
}
else
{
action
.
setRecoveryDate
(
new
Date
());
// 报警恢复,修改数据为恢复状态
action
.
setEquipmentSpecificIndexValue
(
TrueOrFalseEnum
.
fake
.
value
);
action
.
setRecoveryDate
(
new
Date
());
action
.
setStatus
(
AlarmStatusEnum
.
HF
.
getCode
());
action
.
setEquipmentSpecificIndexValue
(
TrueOrFalseEnum
.
fake
.
value
);
}
action
.
setStatus
(
AlarmStatusEnum
.
HF
.
getCode
());
action
.
setUpdateDate
(
new
Date
());
}
// 更新所在系统,设备可能编辑过,更新所在系统、装备名称、装备定义code
action
.
setUpdateDate
(
new
Date
());
action
.
setTraceId
(
equipmentSpcIndex
.
getTraceId
());
// 更新所在系统,设备可能编辑过,更新所在系统、装备名称、装备定义code
action
.
setSystemIds
(
equipmentSpcIndex
.
getSystemId
());
action
.
setTraceId
(
equipmentSpcIndex
.
getTraceId
());
action
.
setSystemCodes
(
this
.
getSystemCodeBySpeId
(
equipmentSpcIndex
.
getSystemId
()));
action
.
setSystemIds
(
equipmentSpcIndex
.
getSystemId
());
action
.
setEquipmentSpecificName
(
equipmentSpcIndex
.
getEquipmentSpecificName
());
action
.
setSystemCodes
(
this
.
getSystemCodeBySpeId
(
equipmentSpcIndex
.
getSystemId
()));
action
.
setEquipmentCode
(
equipmentSpcIndex
.
getEquipmentCode
());
action
.
setEquipmentSpecificName
(
equipmentSpcIndex
.
getEquipmentSpecificName
());
// 冗余字段,alarm_log表更新时使用
action
.
setEquipmentCode
(
equipmentSpcIndex
.
getEquipmentCode
());
action
.
setEquipmentSpecificCode
(
equipmentSpcIndex
.
getEquipmentSpecificCode
());
// 冗余字段,alarm_log表更新时使用
action
.
setBuildId
(
equipmentSpcIndex
.
getBuildId
());
action
.
setEquipmentSpecificCode
(
equipmentSpcIndex
.
getEquipmentSpecificCode
());
equipmentSpecificAlarms
.
add
(
action
);
action
.
setBuildId
(
equipmentSpcIndex
.
getBuildId
());
}
equipmentSpecificAlarms
.
add
(
action
);
}
}
}
return
equipmentSpecificAlarms
;
}
return
equipmentSpecificAlarms
;
}
/**
* 发送数据至换流站
/**
*
* 发送数据至换流站
* @param
*
*/
* @param
public
void
sendEquipSpecIndexToAutosysTopic
(
List
<
EquipmentSpecificIndex
>
equipmentSpeIndexs
)
{
*/
equipmentSpeIndexs
.
forEach
(
equipmentSpeIndex
->
{
public
void
sendEquipSpecIndexToAutosysTopic
(
List
<
EquipmentSpecificIndex
>
equipmentSpeIndexs
)
{
String
topic
=
""
;
equipmentSpeIndexs
.
forEach
(
equipmentSpeIndex
->
{
if
(
TrueOrFalseEnum
.
real
.
value
.
equals
(
equipmentSpeIndex
.
getValue
())
String
topic
=
""
;
&&
EquipmentRiskTypeEnum
.
HZGJ
.
getCode
().
equals
(
equipmentSpeIndex
.
getTypeCode
()))
{
if
(
TrueOrFalseEnum
.
real
.
value
.
equals
(
equipmentSpeIndex
.
getValue
())
equipmentSpeIndex
.
setType
(
EquipmentRiskTypeEnum
.
HZGJ
.
getCode
());
&&
EquipmentRiskTypeEnum
.
HZGJ
.
getCode
().
equals
(
equipmentSpeIndex
.
getTypeCode
()))
{
topic
=
String
.
format
(
"%s.%s%s"
,
serverName
,
"equipment/"
,
RiskLeverForAutoSys
.
BJ
.
getCode
());
equipmentSpeIndex
.
setType
(
EquipmentRiskTypeEnum
.
HZGJ
.
getCode
());
}
else
if
(
TrueOrFalseEnum
.
real
.
value
.
equals
(
equipmentSpeIndex
.
getValue
())
topic
=
String
.
format
(
"%s.%s%s"
,
serverName
,
"equipment/"
,
RiskLeverForAutoSys
.
BJ
.
getCode
());
&&
EquipmentRiskTypeEnum
.
GZ
.
getCode
().
equals
(
equipmentSpeIndex
.
getTypeCode
()))
{
}
else
if
(
TrueOrFalseEnum
.
real
.
value
.
equals
(
equipmentSpeIndex
.
getValue
())
equipmentSpeIndex
.
setType
(
EquipmentRiskTypeEnum
.
GZ
.
getCode
());
&&
EquipmentRiskTypeEnum
.
GZ
.
getCode
().
equals
(
equipmentSpeIndex
.
getTypeCode
()))
{
topic
=
String
.
format
(
"%s.%s%s"
,
serverName
,
"equipment/"
,
RiskLeverForAutoSys
.
GZ
.
getCode
());
equipmentSpeIndex
.
setType
(
EquipmentRiskTypeEnum
.
GZ
.
getCode
());
}
else
{
topic
=
String
.
format
(
"%s.%s%s"
,
serverName
,
"equipment/"
,
RiskLeverForAutoSys
.
GZ
.
getCode
());
equipmentSpeIndex
.
setType
(
EquipmentRiskTypeEnum
.
QT
.
getCode
());
}
else
{
topic
=
String
.
format
(
"%s.%s%s"
,
serverName
,
"equipment/"
,
RiskLeverForAutoSys
.
JC
.
getCode
());
equipmentSpeIndex
.
setType
(
EquipmentRiskTypeEnum
.
QT
.
getCode
());
}
topic
=
String
.
format
(
"%s.%s%s"
,
serverName
,
"equipment/"
,
RiskLeverForAutoSys
.
JC
.
getCode
());
TopicEntityVo
topicEntityVo
=
new
TopicEntityVo
();
}
topicEntityVo
.
setIotCode
(
equipmentSpeIndex
.
getIotCode
());
TopicEntityVo
topicEntityVo
=
new
TopicEntityVo
();
topicEntityVo
.
setTopic
(
topic
);
topicEntityVo
.
setIotCode
(
equipmentSpeIndex
.
getIotCode
());
topicEntityVo
.
setMessage
(
JSON
.
toJSONString
(
equipmentSpeIndex
));
topicEntityVo
.
setTopic
(
topic
);
mqttSendGateway
.
sendToMqtt
(
topic
,
JSON
.
toJSONString
(
topicEntityVo
));
topicEntityVo
.
setMessage
(
JSON
.
toJSONString
(
equipmentSpeIndex
));
});
mqttSendGateway
.
sendToMqtt
(
topic
,
JSON
.
toJSONString
(
topicEntityVo
));
}
});
}
/**
* 组态大屏消息推送
/**
*
* 组态大屏消息推送
* @param equipmentSpecificIndexList
*
* @param topicEntity
* @param equipmentSpecificIndexList
*/
* @param topicEntity
public
void
intePageSysDataRefresh
(
List
<
EquipmentSpecificIndex
>
equipmentSpecificIndexList
,
*/
TopicEntityVo
topicEntity
)
{
public
void
intePageSysDataRefresh
(
List
<
EquipmentSpecificIndex
>
equipmentSpecificIndexList
,
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQXXTJ
.
getTopic
(),
""
);
TopicEntityVo
topicEntity
)
{
iEquipmentSpecificSerivce
.
integrationPageSysDataRefresh
(
topicEntity
.
getCode
());
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQXXTJ
.
getTopic
(),
""
);
}
iEquipmentSpecificSerivce
.
integrationPageSysDataRefresh
(
topicEntity
.
getCode
());
}
/**
* 更新数据报表表
/**
*
* 更新数据报表表
* @param equipmentSpecificIndex
*
*/
* @param equipmentSpecificIndex
private
void
saveEquipmentAlarmReportDay
(
EquipmentSpecificIndex
equipmentSpecificIndex
)
{
*/
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
DateUtils
.
DATE_PATTERN
);
private
void
saveEquipmentAlarmReportDay
(
EquipmentSpecificIndex
equipmentSpecificIndex
)
{
EquipmentAlarmReportDay
equipmentAlarmReportDay
=
addEquipAlarmReportRecord
(
equipmentSpecificIndex
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
DateUtils
.
DATE_PATTERN
);
LambdaQueryWrapper
<
EquipmentAlarmReportDay
>
wrapper
=
new
LambdaQueryWrapper
<>();
EquipmentAlarmReportDay
equipmentAlarmReportDay
=
addEquipAlarmReportRecord
(
equipmentSpecificIndex
);
wrapper
.
eq
(
EquipmentAlarmReportDay:
:
getReportDate
,
sdf
.
format
(
equipmentAlarmReportDay
.
getReportDate
()))
LambdaQueryWrapper
<
EquipmentAlarmReportDay
>
wrapper
=
new
LambdaQueryWrapper
<>();
.
eq
(
EquipmentAlarmReportDay:
:
getIndexId
,
equipmentAlarmReportDay
.
getIndexId
())
wrapper
.
eq
(
EquipmentAlarmReportDay:
:
getReportDate
,
sdf
.
format
(
equipmentAlarmReportDay
.
getReportDate
()))
.
eq
(
EquipmentAlarmReportDay:
:
getEquipmentSpecificId
,
equipmentAlarmReportDay
.
getEquipmentSpecificId
());
.
eq
(
EquipmentAlarmReportDay:
:
getIndexId
,
equipmentAlarmReportDay
.
getIndexId
())
List
<
EquipmentAlarmReportDay
>
reportDayList
=
iEquipmentAlarmReportDayService
.
list
(
wrapper
);
.
eq
(
EquipmentAlarmReportDay:
:
getEquipmentSpecificId
,
equipmentAlarmReportDay
.
getEquipmentSpecificId
());
if
(
reportDayList
.
isEmpty
())
{
List
<
EquipmentAlarmReportDay
>
reportDayList
=
iEquipmentAlarmReportDayService
.
list
(
wrapper
);
equipmentAlarmReportDay
.
setReportDate
(
new
Date
());
if
(
reportDayList
.
isEmpty
())
{
equipmentAlarmReportDay
.
setFrequency
(
1
);
equipmentAlarmReportDay
.
setReportDate
(
new
Date
());
iEquipmentAlarmReportDayService
.
save
(
equipmentAlarmReportDay
);
equipmentAlarmReportDay
.
setFrequency
(
1
);
}
else
{
iEquipmentAlarmReportDayService
.
save
(
equipmentAlarmReportDay
);
EquipmentAlarmReportDay
reportDay
=
reportDayList
.
get
(
0
);
}
else
{
reportDay
.
setLastReportDate
(
new
Date
());
EquipmentAlarmReportDay
reportDay
=
reportDayList
.
get
(
0
);
reportDay
.
setValue
(
equipmentAlarmReportDay
.
getValue
());
reportDay
.
setLastReportDate
(
new
Date
());
reportDay
.
setFrequency
(
reportDay
.
getFrequency
()
+
1
);
reportDay
.
setValue
(
equipmentAlarmReportDay
.
getValue
());
reportDay
.
setIndexTrueNum
(
reportDay
.
getIndexTrueNum
()
==
null
?
equipmentAlarmReportDay
.
getIndexTrueNum
()
reportDay
.
setFrequency
(
reportDay
.
getFrequency
()
+
1
);
:
reportDay
.
getIndexTrueNum
()
+
equipmentAlarmReportDay
.
getIndexTrueNum
());
reportDay
.
setIndexTrueNum
(
reportDay
.
getIndexTrueNum
()
==
null
?
equipmentAlarmReportDay
.
getIndexTrueNum
()
iEquipmentAlarmReportDayService
.
updateById
(
reportDay
);
:
reportDay
.
getIndexTrueNum
()
+
equipmentAlarmReportDay
.
getIndexTrueNum
());
}
iEquipmentAlarmReportDayService
.
updateById
(
reportDay
);
}
}
}
private
String
valueTranslate
(
String
value
,
String
enumStr
)
{
if
(
ObjectUtils
.
isEmpty
(
enumStr
))
{
private
String
valueTranslate
(
String
value
,
String
enumStr
)
{
return
""
;
if
(
ObjectUtils
.
isEmpty
(
enumStr
))
{
}
return
""
;
try
{
}
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
enumStr
);
try
{
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
enumStr
);
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
if
(
jsonObject
.
get
(
"key"
).
equals
(
value
))
{
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
return
jsonObject
.
getString
(
"label"
);
if
(
jsonObject
.
get
(
"key"
).
equals
(
value
))
{
}
return
jsonObject
.
getString
(
"label"
);
}
}
}
catch
(
Exception
e
)
{
}
e
.
printStackTrace
();
}
catch
(
Exception
e
)
{
}
e
.
printStackTrace
();
return
""
;
}
}
return
""
;
}
/**
* 车辆数据推送及同步
/**
*
* 车辆数据推送及同步
* @param carProperties
*
* @param carPropertyVos
* @param carProperties
*/
* @param carPropertyVos
public
void
carTransactionSynch
(
List
<
CarProperty
>
carProperties
,
List
<
CarPropertyVo
>
carPropertyVos
)
{
*/
// TODO 数字化换流站组态屏数据推送,需要在事务提交之后,否侧事务隔离查询不出数据
public
void
carTransactionSynch
(
List
<
CarProperty
>
carProperties
,
List
<
CarPropertyVo
>
carPropertyVos
)
{
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
// TODO 数字化换流站组态屏数据推送,需要在事务提交之后,否侧事务隔离查询不出数据
@Override
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
public
void
afterCommit
()
{
@Override
List
<
CarIndexGisVo
>
list
=
createCarIndexGisVo
(
carProperties
);
public
void
afterCommit
()
{
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
CARZXDT
.
getTopic
(),
""
);
List
<
CarIndexGisVo
>
list
=
createCarIndexGisVo
(
carProperties
);
boolean
flag
=
ifSendToGis
(
list
);
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
CARZXDT
.
getTopic
(),
""
);
if
(
flag
)
{
boolean
flag
=
ifSendToGis
(
list
);
mqttSendGateway
.
sendToMqtt
(
carTopic
,
JSON
.
toJSONString
(
list
));
if
(
flag
)
{
}
mqttSendGateway
.
sendToMqtt
(
carTopic
,
JSON
.
toJSONString
(
list
));
}
if
(
syncSwitch
)
{
syncDataService
.
syncCreatedFireVehicleMeasurement
(
carPropertyVos
);
if
(
syncSwitch
)
{
}
syncDataService
.
syncCreatedFireVehicleMeasurement
(
carPropertyVos
);
}
}
});
}
}
});
}
private
CarPropertyVo
carPropertyToCarPropertyVo
(
CarProperty
property
)
{
CarPropertyVo
carPropertyVo
=
new
CarPropertyVo
();
private
CarPropertyVo
carPropertyToCarPropertyVo
(
CarProperty
property
)
{
carPropertyVo
.
setCarId
(
property
.
getCarId
());
CarPropertyVo
carPropertyVo
=
new
CarPropertyVo
();
carPropertyVo
.
setCreateDate
(
property
.
getCreateDate
());
carPropertyVo
.
setCarId
(
property
.
getCarId
());
carPropertyVo
.
setId
(
property
.
getId
());
carPropertyVo
.
setCreateDate
(
property
.
getCreateDate
());
carPropertyVo
.
setIsIot
(
1
);
carPropertyVo
.
setId
(
property
.
getId
());
carPropertyVo
.
setMRid
(
property
.
getEquipmentIndexId
().
toString
());
carPropertyVo
.
setIsIot
(
1
);
carPropertyVo
.
setName
(
property
.
getEquipmentIndexName
());
carPropertyVo
.
setMRid
(
property
.
getEquipmentIndexId
().
toString
());
carPropertyVo
.
setNameKey
(
property
.
getEquipmentIndexKey
());
carPropertyVo
.
setName
(
property
.
getEquipmentIndexName
());
carPropertyVo
.
setSort
(
1
);
carPropertyVo
.
setNameKey
(
property
.
getEquipmentIndexKey
());
carPropertyVo
.
setUnit
(
property
.
getUnitName
());
carPropertyVo
.
setSort
(
1
);
carPropertyVo
.
setValue
(
property
.
getValue
());
carPropertyVo
.
setUnit
(
property
.
getUnitName
());
return
carPropertyVo
;
carPropertyVo
.
setValue
(
property
.
getValue
());
}
return
carPropertyVo
;
}
private
List
<
CarIndexGisVo
>
createCarIndexGisVo
(
List
<
CarProperty
>
carProperties
)
{
List
<
CarIndexGisVo
>
list
=
new
ArrayList
<>();
private
List
<
CarIndexGisVo
>
createCarIndexGisVo
(
List
<
CarProperty
>
carProperties
)
{
long
id
=
0
l
;
List
<
CarIndexGisVo
>
list
=
new
ArrayList
<>();
String
iotCode
=
""
;
long
id
=
0
l
;
for
(
CarProperty
action
:
carProperties
)
{
String
iotCode
=
""
;
CarIndexGisVo
v
=
new
CarIndexGisVo
();
for
(
CarProperty
action
:
carProperties
)
{
id
=
action
.
getCarId
();
CarIndexGisVo
v
=
new
CarIndexGisVo
();
iotCode
=
action
.
getIotCode
();
id
=
action
.
getCarId
();
v
.
setId
(
action
.
getCarId
());
iotCode
=
action
.
getIotCode
();
v
.
setIotCode
(
action
.
getIotCode
());
v
.
setId
(
action
.
getCarId
());
v
.
setNameKey
(
action
.
getEquipmentIndexKey
());
v
.
setIotCode
(
action
.
getIotCode
());
v
.
setValue
(
ObjectUtils
.
isEmpty
(
action
.
getValue
())
?
"0"
:
action
.
getValue
());
v
.
setNameKey
(
action
.
getEquipmentIndexKey
());
list
.
add
(
v
);
v
.
setValue
(
ObjectUtils
.
isEmpty
(
action
.
getValue
())
?
"0"
:
action
.
getValue
());
}
list
.
add
(
v
);
}
CarIndexGisVo
time
=
new
CarIndexGisVo
();
time
.
setId
(
id
);
CarIndexGisVo
time
=
new
CarIndexGisVo
();
time
.
setIotCode
(
iotCode
);
time
.
setId
(
id
);
time
.
setNameKey
(
CarForGisEnum
.
SJ
.
getNameKey
());
time
.
setIotCode
(
iotCode
);
time
.
setValue
(
String
.
valueOf
(
new
Date
().
getTime
()));
time
.
setNameKey
(
CarForGisEnum
.
SJ
.
getNameKey
());
list
.
add
(
time
);
time
.
setValue
(
String
.
valueOf
(
new
Date
().
getTime
()));
list
.
add
(
time
);
return
list
;
}
return
list
;
}
/**
* //若为物联设备,则更新拓扑节点数据及告警状态
/**
*
* //若为物联设备,则更新拓扑节点数据及告警状态
* @param indexList
*
*/
* @param indexList
public
void
updateNodeDateByEquipId
(
List
<
EquipmentSpecificIndex
>
indexList
)
{
*/
if
(!
ObjectUtils
.
isEmpty
(
indexList
))
{
public
void
updateNodeDateByEquipId
(
List
<
EquipmentSpecificIndex
>
indexList
)
{
EquipmentVo
equipmentVo
=
equipmentService
.
getEquipBySpecific
(
indexList
.
get
(
0
).
getEquipmentSpecificId
());
if
(!
ObjectUtils
.
isEmpty
(
indexList
))
{
if
(
equipmentVo
.
getIsIot
().
equals
(
"1"
))
{
EquipmentVo
equipmentVo
=
equipmentService
.
getEquipBySpecific
(
indexList
.
get
(
0
).
getEquipmentSpecificId
());
List
<
EquipmentSpecificAlarm
>
alarmList
=
equipmentSpecificAlarmService
.
getEquipListBySpecific
(
true
,
if
(
equipmentVo
.
getIsIot
().
equals
(
"1"
))
{
indexList
.
get
(
0
).
getEquipmentSpecificId
());
List
<
EquipmentSpecificAlarm
>
alarmList
=
equipmentSpecificAlarmService
.
getEquipListBySpecific
(
true
,
topographyService
.
updateNodeDateByEquipId
(
indexList
.
get
(
0
).
getEquipmentSpecificId
(),
indexList
,
indexList
.
get
(
0
).
getEquipmentSpecificId
());
alarmList
);
topographyService
.
updateNodeDateByEquipId
(
indexList
.
get
(
0
).
getEquipmentSpecificId
(),
indexList
,
}
alarmList
);
}
}
}
}
}
}
}
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