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
2c3bf1ac
Commit
2c3bf1ac
authored
Oct 16, 2024
by
KeYong
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop_bugfix@dl' into develop_bugfix@dl
parents
f671bdec
cfce2561
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
25 deletions
+65
-25
RedisUtils.java
...va/com/yeejoin/amos/boot/biz/common/utils/RedisUtils.java
+16
-0
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+49
-25
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/RedisUtils.java
View file @
2c3bf1ac
...
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.biz.common.utils;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
org.typroject.tyboot.component.cache.enumeration.CacheType
;
...
...
@@ -24,6 +25,10 @@ public class RedisUtils {
@Autowired
private
RedisTemplate
redisTemplate
;
@Autowired
private
StringRedisTemplate
stringRedisTemplate
;
/**
* 指定缓存失效时间
*
...
...
@@ -41,6 +46,17 @@ public class RedisUtils {
}
/**
* 普通缓存获取
*
* @param key 键
* @return 值
*/
public
String
getString
(
String
key
)
{
String
object
=
stringRedisTemplate
.
opsForValue
().
get
(
key
);
return
object
;
}
/**
* 根据key 获取过期时间
*
* @param key 键 不能为null
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MqttReceiveServiceImpl.java
View file @
2c3bf1ac
...
...
@@ -238,6 +238,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private
String
specialChars
;
@Value
(
"${auth-key-auth-enabled:}"
)
private
String
authKeyEnable
;
private
static
final
String
QRCODE_REDIS_KEY
=
"qrCodeRedisKey"
;
public
static
List
<
EquipmentSpecificAlarmLog
>
upAlarmLogStatus
(
String
iotCode
,
String
equipmentSpecificIndexKey
,
String
traceId
,
IEquipmentSpecificAlarmLogService
equipmentSpecificAlarmLogService
,
...
...
@@ -1165,9 +1166,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 处理每站消防储水量不少于4000m³ 预警问题
doWaterStationWarning
(
equipmentSpecificIndex
.
getBizOrgCode
(),
equipmentSpecificIndex
.
getBizOrgName
());
}
//稳压泵启停次数大于15次触发预警
if
(
iotDataVO
.
getKey
().
equalsIgnoreCase
(
FHS_PressurePump_Start
)
||
iotDataVO
.
getKey
().
equalsIgnoreCase
(
FHS_PressurePump_Stop
))
{
//稳压泵启动次数大于15次触发预警
if
(
iotDataVO
.
getKey
().
equalsIgnoreCase
(
FHS_PressurePump_Start
))
{
doPressurePumInfo
(
topicEntity
,
equipmentSpecificIndex
);
}
// 遥测数据生成告警事件、日志处理
...
...
@@ -1425,14 +1425,17 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
//预警业务 泡沫罐 或 者管网压力
JSONObject
config
=
this
.
getRiskTriggerConfig
(
"FIRE_EQUIP_LEVEL"
);
if
(
Objects
.
isNull
(
config
))
{
throw
new
RuntimeException
(
"获取配置失败!"
);
}
HashMap
<
String
,
String
>
extra
=
new
HashMap
<>();
extra
.
put
(
"useSource"
,
"center"
);
extra
.
put
(
"codingSystem"
,
"center"
);
extra
.
put
(
"codingType"
,
"equipment"
);
extra
.
put
(
"problemReception"
,
"station"
);
extra
.
put
(
"useSource"
,
config
.
getString
(
"useSource"
)
);
extra
.
put
(
"codingSystem"
,
config
.
getString
(
"useSource"
)
);
extra
.
put
(
"codingType"
,
config
.
getString
(
"codingType"
)
);
extra
.
put
(
"problemReception"
,
config
.
getString
(
"problemReception"
)
);
extra
.
put
(
"bussId"
,
String
.
valueOf
(
equipmentSpecificIndex
.
getEquipmentSpecificId
()));
extra
.
put
(
"clearUniqueCode"
,
"equip-level"
);
extra
.
put
(
"clearUniqueCode"
,
config
.
getString
(
"clearUniqueCode"
)
);
TableContentVo
tableContentVo
=
new
TableContentVo
(
"报警类型"
,
"text"
,
"液位超出阈值"
,
"1"
);
TableContentVo
tableContentVo1
=
new
TableContentVo
(
"报警部位"
,
"text"
,
equipmentSpecificIndex
.
getLocation
(),
"2"
);
...
...
@@ -1502,13 +1505,17 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private
void
doWaterStationInfo
(
String
bizOrgCode
,
String
bizOrgName
,
String
indexValue
)
{
String
indexKey
=
"WATER_CAPACITY"
;
String
warningObjectCode
=
bizOrgCode
+
"@"
+
indexKey
;
JSONObject
config
=
this
.
getRiskTriggerConfig
(
"FIRE_WATER_CAPACITY"
);
if
(
Objects
.
isNull
(
config
))
{
throw
new
RuntimeException
(
"获取配置失败!"
);
}
HashMap
<
String
,
String
>
extra
=
new
HashMap
<>();
extra
.
put
(
"useSource"
,
"center"
);
extra
.
put
(
"codingSystem"
,
"center"
);
extra
.
put
(
"codingType"
,
"station"
);
extra
.
put
(
"problemReception"
,
"station"
);
extra
.
put
(
"useSource"
,
config
.
getString
(
"useSource"
)
);
extra
.
put
(
"codingSystem"
,
config
.
getString
(
"useSource"
)
);
extra
.
put
(
"codingType"
,
config
.
getString
(
"codingType"
)
);
extra
.
put
(
"problemReception"
,
config
.
getString
(
"problemReception"
)
);
extra
.
put
(
"bussId"
,
warningObjectCode
);
extra
.
put
(
"clearUniqueCode"
,
"station-WATER_CAPACITY"
);
extra
.
put
(
"clearUniqueCode"
,
config
.
getString
(
"clearUniqueCode"
)
);
TableContentVo
tableContentVo
=
new
TableContentVo
(
"分析结果"
,
"text"
,
"消防水池+工业水池储水量<4000m³"
,
"1"
);
TableContentVo
tableContentVo1
=
new
TableContentVo
(
"管理要求"
,
"text"
,
"每站消防储水量不少于4000m³"
,
"2"
);
TableContentVo
tableContentVo2
=
new
TableContentVo
(
"管理依据"
,
"text"
,
"换流站消防系统运行规程"
,
"3"
);
...
...
@@ -1549,17 +1556,21 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
String
startDate
=
DateUtil
.
format
(
DateUtil
.
offsetHour
(
new
Date
(),
-
1
),
DatePattern
.
NORM_DATETIME_PATTERN
);
String
prefix
=
topicEntity
.
getIotCode
().
substring
(
0
,
8
);
String
suffix
=
topicEntity
.
getIotCode
().
substring
(
8
);
ResponseModel
<
Map
<
String
,
Integer
>>
mapResponseModel
=
iotFeign
.
queryIotDataNumByIndex
(
startDate
,
endDate
,
prefix
,
suffix
,
FHS_PressurePump_Start
+
","
+
FHS_PressurePump_Stop
,
"true"
);
ResponseModel
<
Map
<
String
,
Integer
>>
mapResponseModel
=
iotFeign
.
queryIotDataNumByIndex
(
startDate
,
endDate
,
prefix
,
suffix
,
FHS_PressurePump_Start
,
"true"
);
if
(
200
==
mapResponseModel
.
getStatus
())
{
Map
<
String
,
Integer
>
result
=
mapResponseModel
.
getResult
();
Integer
totalNum
=
result
.
get
(
"num"
);
JSONObject
config
=
this
.
getRiskTriggerConfig
(
"FIRE_EQUIP_PRESSURE"
);
if
(
Objects
.
isNull
(
config
))
{
throw
new
RuntimeException
(
"获取配置失败!"
);
}
HashMap
<
String
,
String
>
extra
=
new
HashMap
<>();
extra
.
put
(
"useSource"
,
"center"
);
extra
.
put
(
"codingSystem"
,
"center"
);
extra
.
put
(
"codingType"
,
"equipment"
);
extra
.
put
(
"problemReception"
,
"station"
);
extra
.
put
(
"useSource"
,
config
.
getString
(
"useSource"
)
);
extra
.
put
(
"codingSystem"
,
config
.
getString
(
"useSource"
)
);
extra
.
put
(
"codingType"
,
config
.
getString
(
"codingType"
)
);
extra
.
put
(
"problemReception"
,
config
.
getString
(
"problemReception"
)
);
extra
.
put
(
"bussId"
,
String
.
valueOf
(
equipmentSpecificIndex
.
getEquipmentSpecificId
()));
extra
.
put
(
"clearUniqueCode"
,
"equip-pressure"
);
extra
.
put
(
"clearUniqueCode"
,
config
.
getString
(
"clearUniqueCode"
)
);
TableContentVo
tableContentVo
=
new
TableContentVo
(
"报警类型"
,
"text"
,
"稳压泵启停频次过高"
,
"1"
);
TableContentVo
tableContentVo1
=
new
TableContentVo
(
"报警部位"
,
"text"
,
equipmentSpecificIndex
.
getLocation
(),
"2"
);
TableContentVo
tableContentVo2
=
new
TableContentVo
(
"报警时间"
,
"text"
,
DateUtil
.
now
(),
"3"
);
...
...
@@ -1637,13 +1648,17 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
nowValue
=
checkValue
;
}
if
(
"pool"
.
equals
(
map
.
get
(
"resourceType"
).
toString
())
||
"waterTank"
.
equals
(
map
.
get
(
"resourceType"
).
toString
()))
{
JSONObject
config
=
this
.
getRiskTriggerConfig
(
"FIRE_WATER_LEVEL"
);
if
(
Objects
.
isNull
(
config
))
{
throw
new
RuntimeException
(
"获取配置失败!"
);
}
HashMap
<
String
,
String
>
extra
=
new
HashMap
<>();
extra
.
put
(
"useSource"
,
"center"
);
extra
.
put
(
"codingSystem"
,
"center"
);
extra
.
put
(
"codingType"
,
"water"
);
extra
.
put
(
"problemReception"
,
"station"
);
extra
.
put
(
"useSource"
,
config
.
getString
(
"useSource"
)
);
extra
.
put
(
"codingSystem"
,
config
.
getString
(
"useSource"
)
);
extra
.
put
(
"codingType"
,
config
.
getString
(
"codingType"
)
);
extra
.
put
(
"problemReception"
,
config
.
getString
(
"problemReception"
)
);
extra
.
put
(
"bussId"
,
map
.
get
(
"id"
).
toString
());
extra
.
put
(
"clearUniqueCode"
,
"water-resource"
);
extra
.
put
(
"clearUniqueCode"
,
config
.
getString
(
"clearUniqueCode"
)
);
TableContentVo
tableContentVo
=
new
TableContentVo
(
"报警类型"
,
"text"
,
"液位超出阈值"
,
"1"
);
TableContentVo
tableContentVo1
=
new
TableContentVo
(
"报警部位"
,
"text"
,
equipmentSpecificIndex
.
getLocation
(),
"2"
);
TableContentVo
tableContentVo2
=
new
TableContentVo
(
"报警时间"
,
"text"
,
DateUtil
.
now
(),
"3"
);
...
...
@@ -3093,4 +3108,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
mqttSendGateway
.
sendToMqtt
(
ConfigPageTopicEnum
.
EQUIP_MULTI_INDICATOR
.
getTopic
(),
message2
.
toJSONString
());
}
}
private
JSONObject
getRiskTriggerConfig
(
String
tableName
)
{
Map
<
String
,
Object
>
configMap
=
JSON
.
parseObject
(
redisUtils
.
getString
(
QRCODE_REDIS_KEY
),
Map
.
class
);
if
(!
ObjectUtils
.
isEmpty
(
configMap
))
{
String
config
=
configMap
.
get
(
tableName
+
"0"
).
toString
();
return
JSONObject
.
parseObject
(
config
).
getJSONObject
(
"content"
).
getJSONObject
(
"extra"
);
}
return
null
;
}
}
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