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
27b684b6
Commit
27b684b6
authored
Jun 15, 2023
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(equip):装备代码集成influxDB,版本1.0
parent
05a123c4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
5 deletions
+49
-5
pom.xml
...e/amos-boot-module-biz/amos-boot-module-equip-biz/pom.xml
+6
-0
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+30
-2
application-dev.properties
...ystem-equip/src/main/resources/application-dev.properties
+12
-2
application.properties
...ot-system-equip/src/main/resources/application.properties
+1
-1
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/pom.xml
View file @
27b684b6
...
@@ -56,6 +56,12 @@
...
@@ -56,6 +56,12 @@
<artifactId>
amos-component-security
</artifactId>
<artifactId>
amos-component-security
</artifactId>
<version>
1.7.13-SNAPSHOT
</version>
<version>
1.7.13-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-component-influxdb
</artifactId>
<version>
1.8.5-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MqttReceiveServiceImpl.java
View file @
27b684b6
...
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.component.influxdb.InfluxDbConnection
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFaultAlarm
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFaultAlarm
;
...
@@ -111,6 +112,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -111,6 +112,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
//消防炮
//消防炮
@Value
(
"${equipment.plan.monitor}"
)
@Value
(
"${equipment.plan.monitor}"
)
String
monitorCodes
;
String
monitorCodes
;
@Autowired
private
InfluxDbConnection
influxDbConnection
;
/**
/**
* 泡沫罐KEY
* 泡沫罐KEY
*/
*/
...
@@ -601,6 +606,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -601,6 +606,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
handlerMqttIotMessage
(
String
topic
,
String
message
)
{
public
void
handlerMqttIotMessage
(
String
topic
,
String
message
)
{
//influxdb
Map
<
String
,
String
>
tagsMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
fieldsMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
fieldsStrMap
=
new
HashMap
<>();
log
.
info
(
"接收到iot消息: {}"
,
message
);
log
.
info
(
"接收到iot消息: {}"
,
message
);
TopicEntityVo
topicEntity
=
new
TopicEntityVo
();
TopicEntityVo
topicEntity
=
new
TopicEntityVo
();
topicEntity
.
setTopic
(
topic
);
topicEntity
.
setTopic
(
topic
);
...
@@ -613,9 +623,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -613,9 +623,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
String
dataType
=
jsonObject
.
getString
(
"dataType"
);
String
dataType
=
jsonObject
.
getString
(
"dataType"
);
String
indexAddress
=
jsonObject
.
getString
(
"address"
);
String
indexAddress
=
jsonObject
.
getString
(
"address"
);
String
traceId
=
jsonObject
.
getString
(
"traceId"
);
String
traceId
=
jsonObject
.
getString
(
"traceId"
);
String
deviceCode
=
jsonObject
.
getString
(
"deviceCode"
);
String
gatewayId
=
jsonObject
.
getString
(
"gatewayId"
);
String
gatewayId
=
jsonObject
.
getString
(
"gatewayId"
);
String
value
=
jsonObject
.
getString
(
"value"
);
String
value
=
jsonObject
.
getString
(
"value"
);
EquipmentSpecificIndex
equipmentSpeIndex
=
equipmentSpecificIndexService
.
getEquipmentSpeIndexByIndexAddress
(
indexAddress
,
gatewayId
);
EquipmentSpecificIndex
equipmentSpeIndex
=
equipmentSpecificIndexService
.
getEquipmentSpeIndexByIndexAddress
(
indexAddress
,
gatewayId
);
if
(
equipmentSpeIndex
==
null
){
if
(
equipmentSpeIndex
==
null
){
return
;
return
;
...
@@ -630,8 +642,24 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -630,8 +642,24 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpeIndex
.
setTraceId
(
traceId
);
equipmentSpeIndex
.
setTraceId
(
traceId
);
equipmentSpeIndex
.
setUUID
(
UUIDUtils
.
getUUID
());
equipmentSpeIndex
.
setUUID
(
UUIDUtils
.
getUUID
());
//更新装备性能指标
//更新装备性能指标
equipmentSpecificIndexService
.
updateById
(
equipmentSpeIndex
);
//equipmentSpecificIndexService.updateById(equipmentSpeIndex);
tagsMap
.
put
(
"key"
,
indexAddress
+
"_"
+
gatewayId
);
fieldsMap
.
put
(
"traceId"
,
traceId
);
fieldsMap
.
put
(
"address"
,
indexAddress
);
fieldsMap
.
put
(
"value"
,
value
);
fieldsMap
.
put
(
"gatewayId"
,
gatewayId
);
fieldsMap
.
put
(
"dataType"
,
dataType
);
fieldsMap
.
put
(
"equipmentId"
,
equipmentSpeIndex
.
getEquipmentId
());
fieldsMap
.
put
(
"equipmentIndexName"
,
equipmentSpeIndex
.
getEquipmentIndexName
());
fieldsMap
.
put
(
"equipmentIndexKey"
,
equipmentSpeIndex
.
getEquipmentIndexKey
());
fieldsMap
.
put
(
"isAlarm"
,
equipmentSpeIndex
.
getIsAlarm
().
toString
());
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
fieldsMap
.
put
(
"createdTime"
,
simpleDateFormat
.
format
(
new
Date
()));
fieldsMap
.
put
(
"equipment"
,
JSON
.
toJSONString
(
equipmentSpeIndex
));
influxDbConnection
.
insert
(
"iot_data"
,
tagsMap
,
fieldsMap
);
QueryWrapper
<
EquipmentSpecific
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
EquipmentSpecific
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"id"
,
equipmentSpeIndex
.
getEquipmentSpecificId
());
queryWrapper
.
eq
(
"id"
,
equipmentSpeIndex
.
getEquipmentSpecificId
());
...
...
amos-boot-system-equip/src/main/resources/application-dev.properties
View file @
27b684b6
...
@@ -134,4 +134,14 @@ water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,
...
@@ -134,4 +134,14 @@ water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,
# 江西电建-车辆里程过滤参数(单位KM)
# 江西电建-车辆里程过滤参数(单位KM)
mileage.parameter
=
0.5
mileage.parameter
=
0.5
# 江西电建-车辆里程跨天记录切分(每日0点执行)
# 江西电建-车辆里程跨天记录切分(每日0点执行)
mileage.segmentation.cron
=
0 0 0 * * ?
mileage.segmentation.cron
=
0 0 0 * * ?
\ No newline at end of file
# influxDB
spring.influx.url
=
http://172.16.11.201:8086
spring.influx.password
=
Yeejoin@2020
spring.influx.user
=
root
spring.influx.database
=
iot_platform
spring.influx.retention_policy
=
default
spring.influx.retention_policy_time
=
30d
spring.influx.actions
=
10000
spring.influx.bufferLimit
=
20000
\ No newline at end of file
amos-boot-system-equip/src/main/resources/application.properties
View file @
27b684b6
...
@@ -9,7 +9,7 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
...
@@ -9,7 +9,7 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#mybatis mapper file
#mybatis mapper file
mybatis.mapper-locations
=
classpath:mapper/*.xml
mybatis.mapper-locations
=
classpath:mapper/*.xml
#mybatis-plus
#mybatis-plus
mybatis-plus.configuration.log-impl
=
org.apache.ibatis.logging.s
tdout.StdOut
Impl
mybatis-plus.configuration.log-impl
=
org.apache.ibatis.logging.s
lf4j.Slf4j
Impl
# mybatis entity package
# mybatis entity package
mybatis.type-aliases-package
=
com.yeejoin.equipmanage.common.entity
mybatis.type-aliases-package
=
com.yeejoin.equipmanage.common.entity
spring.jackson.time-zone
=
GMT+8
spring.jackson.time-zone
=
GMT+8
...
...
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