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
b45d6e38
authored
Dec 11, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: 状态bug
parent
c65440f9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
View file @
b45d6e38
...
...
@@ -123,12 +123,14 @@ public class PushCallback implements MqttCallback {
if
(
REPORT_PROPERTY
.
equals
(
device
.
getMessageType
())
&&
headers
.
getProductName
().
contains
(
"呼吸"
))
{
// 缓存呼吸设备某段时间的数据,hash 最大长度 duration
long
duration
=
getSleepTimeActionDuration
();
L
ong
size
=
redisTemplate
.
opsForHash
().
size
(
DEVICE_BR_ANALYSIS
+
device
.
getDeviceId
());
l
ong
size
=
redisTemplate
.
opsForHash
().
size
(
DEVICE_BR_ANALYSIS
+
device
.
getDeviceId
());
redisTemplate
.
opsForHash
().
put
(
DEVICE_BR_ANALYSIS
+
device
.
getDeviceId
(),
currentSecond
,
JSON
.
toJSONString
(
device
.
getProperties
()));
redisTemplate
.
expire
(
DEVICE_BR_ANALYSIS
+
device
.
getDeviceId
(),
duration
+
3
,
TimeUnit
.
MINUTES
);
if
(
size
>
=
duration
)
{
if
(
size
=
=
duration
)
{
redisTemplate
.
opsForHash
().
delete
(
DEVICE_BR_ANALYSIS
+
device
.
getDeviceId
(),
currentSecond
-
duration
);
}
else
if
(
size
>
duration
)
{
redisTemplate
.
delete
(
Objects
.
requireNonNull
(
redisTemplate
.
keys
(
DEVICE_BR_ANALYSIS
+
device
.
getDeviceId
())));
}
redisTemplate
.
opsForValue
().
set
(
DEVICE_BR_DATA
+
device
.
getDeviceId
(),
JSON
.
toJSONString
(
device
.
getProperties
()),
5000
,
TimeUnit
.
MILLISECONDS
);
...
...
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