Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bf80128e
authored
Dec 21, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:离线不删除设备缓存,
parent
8d47ba0e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
5 deletions
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
View file @
bf80128e
...
...
@@ -921,12 +921,10 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
List
<
PlatDevice
>
deviceList
=
list
(
deviceLambdaQueryWrapper
);
if
(
CollectionUtils
.
isNotEmpty
(
deviceList
))
{
for
(
PlatDevice
platDevice
:
deviceList
)
{
platDevice
.
setStatus
(
messageType
.
toLowerCase
());
if
(
isOffLine
)
{
RedisUtil
.
delete
(
RedisConst
.
ALARM_DEVICE_OFF_BED_ID
+
platDevice
.
getId
());
}
}
deviceCacheUtil
.
putAll
(
deviceList
);
}
return
true
;
}
...
...
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
View file @
bf80128e
...
...
@@ -114,12 +114,10 @@ public class PushCallback implements MqttCallback {
// 收到消息并设置返回字符串格式
String
payload
=
new
String
(
message
.
getPayload
(),
"UTF-8"
);
// logger.info("接收消息主题:{}, 接收消息QoS:{}", topic, message.getQos());
logger
.
info
(
"接收消息内容:payload格式:{}"
,
payload
);
// 解析数据
DeviceInfo
device
=
JSON
.
parseObject
(
payload
,
DeviceInfo
.
class
);
// todo
syncProperties
(
device
);
...
...
@@ -199,7 +197,7 @@ public class PushCallback implements MqttCallback {
String
deviceId
=
device
.
getDeviceId
();
String
messageType
=
device
.
getMessageType
();
//更新设备状态
boolean
statusFlag
=
platDeviceService
.
updateDeviceStatus
(
messageType
,
deviceId
,
""
);
platDeviceService
.
updateDeviceStatus
(
messageType
,
deviceId
,
""
);
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
equalsAnyIgnoreCase
(
messageType
,
DeviceState
.
online
.
getValue
()))
{
return
;
}
...
...
@@ -247,6 +245,7 @@ public class PushCallback implements MqttCallback {
}
}
}
}
catch
(
Exception
e
){
logger
.
error
(
"告警异常pushCallback:"
,
e
);
}
...
...
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