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
7864b12e
Commit
7864b12e
authored
Jun 28, 2023
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(equip):换流站添加消息转发iot,存储influxdb,兼容绍兴换流站消息
parent
85d334d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+16
-4
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 @
7864b12e
...
@@ -358,18 +358,24 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -358,18 +358,24 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
message
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
message
);
String
dataType
=
jsonObject
.
getString
(
"datatype"
);
String
dataType
=
jsonObject
.
getString
(
"datatype"
);
String
indexAddress
,
value
,
timeStamp
,
quality
=
null
;
String
indexAddress
=
null
,
value
,
timeStamp
,
quality
=
null
;
//如果消息是遥信类型,进行指标转换
//如果消息是遥信类型,进行指标转换
if
(
dataType
!=
null
&&
dataType
.
equals
(
"state"
))
{
assert
dataType
!=
null
;
if
(
dataType
.
equals
(
"state"
))
{
indexAddress
=
jsonObject
.
getString
(
"scadaid"
);
indexAddress
=
jsonObject
.
getString
(
"scadaid"
);
value
=
jsonObject
.
getInteger
(
"value"
)
==
1
?
"true"
:
"false"
;
value
=
jsonObject
.
getInteger
(
"value"
)
==
1
?
"true"
:
"false"
;
timeStamp
=
jsonObject
.
getString
(
"timestamp"
);
timeStamp
=
jsonObject
.
getString
(
"timestamp"
);
}
else
{
}
else
if
(
dataType
.
equals
(
"analog"
))
{
indexAddress
=
jsonObject
.
getString
(
"key"
);
indexAddress
=
jsonObject
.
getString
(
"key"
);
value
=
jsonObject
.
getString
(
"value"
);
value
=
jsonObject
.
getString
(
"value"
);
timeStamp
=
jsonObject
.
getString
(
"time_stamp"
);
timeStamp
=
jsonObject
.
getString
(
"time_stamp"
);
quality
=
jsonObject
.
getString
(
"quality"
);
quality
=
jsonObject
.
getString
(
"quality"
);
}
else
{
indexAddress
=
jsonObject
.
getString
(
"key"
);
value
=
jsonObject
.
getFloat
(
"value"
)
==
0.0
?
"false"
:
"true"
;
timeStamp
=
jsonObject
.
getString
(
"time_stamp"
);
quality
=
jsonObject
.
getString
(
"quality"
);
}
}
Map
<
Object
,
Object
>
equipmentIndexKeyMap
=
redisUtils
.
hmget
(
RedisKey
.
EQUIP_INDEX_ADDRESS_KEY
);
Map
<
Object
,
Object
>
equipmentIndexKeyMap
=
redisUtils
.
hmget
(
RedisKey
.
EQUIP_INDEX_ADDRESS_KEY
);
if
(
equipmentIndexKeyMap
.
get
(
indexAddress
)
!=
null
)
{
if
(
equipmentIndexKeyMap
.
get
(
indexAddress
)
!=
null
)
{
...
@@ -389,7 +395,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -389,7 +395,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
iotDataVO
.
setValue
(
value
);
iotDataVO
.
setValue
(
value
);
iotDatalist
.
add
(
iotDataVO
);
iotDatalist
.
add
(
iotDataVO
);
// iEquipmentSpecificSerivce.getEquipSpecificDetailsByEquipmentId(equipmentSpeIndex.getEquipmentSpecificId());
QueryWrapper
<
EquipmentSpecific
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
EquipmentSpecific
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"id"
,
equipmentSpeIndex
.
getEquipmentSpecificId
());
queryWrapper
.
eq
(
"id"
,
equipmentSpeIndex
.
getEquipmentSpecificId
());
EquipmentSpecific
equipmentSpecific
=
iEquipmentSpecificSerivce
.
getOne
(
queryWrapper
);
EquipmentSpecific
equipmentSpecific
=
iEquipmentSpecificSerivce
.
getOne
(
queryWrapper
);
...
@@ -397,6 +402,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -397,6 +402,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
return
;
return
;
}
}
String
iotCode
=
equipmentSpecific
.
getIotCode
();
String
iotCode
=
equipmentSpecific
.
getIotCode
();
StringBuilder
endIndex
=
new
StringBuilder
(
iotCode
).
insert
(
8
,
'/'
);
String
iotTopic
=
"influxdb/"
+
endIndex
;
if
(
isSendIot
)
{
JSONObject
msg
=
new
JSONObject
();
msg
.
put
(
equipmentSpeIndex
.
getEquipmentIndexKey
(),
value
);
mqttSendGateway
.
sendToMqtt
(
iotTopic
,
JSON
.
toJSONString
(
msg
));
}
List
<
EquipmentSpecificVo
>
eqIotCodeList
=
iEquipmentSpecificSerivce
.
getEquipAndCarIotcodeByIotcode
(
iotCode
);
List
<
EquipmentSpecificVo
>
eqIotCodeList
=
iEquipmentSpecificSerivce
.
getEquipAndCarIotcodeByIotcode
(
iotCode
);
...
...
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