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
e1a25a53
authored
Dec 07, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: 状态问题
parent
45f352b3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
View file @
e1a25a53
...
...
@@ -260,6 +260,9 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
}
Collection
<
Object
>
values
=
entries
.
values
();
log
.
info
(
"空间设备当前大小:{}"
,
values
.
size
());
if
(
values
.
size
()
<
10
||
values
.
size
()
>
12
)
{
continue
;
}
List
<
PlatElderCoordinateVO
>
voList
=
values
.
stream
().
map
(
entity
->
{
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
JSONObject
result
=
JSON
.
parseObject
(
entity
.
toString
());
...
...
@@ -303,6 +306,9 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
continue
;
}
Collection
<
Object
>
values
=
entries
.
values
();
if
(
values
.
size
()
<
10
||
values
.
size
()
>
12
)
{
continue
;
}
log
.
info
(
"跌倒设备当前大小:{}"
,
values
.
size
());
List
<
PlatElderCoordinateVO
>
voList
=
values
.
stream
().
map
(
entity
->
{
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
...
...
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
View file @
e1a25a53
...
...
@@ -127,7 +127,7 @@ public class PushCallback implements MqttCallback {
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
*
60
)
{
if
(
size
>=
duration
*
60
)
{
redisTemplate
.
opsForHash
().
delete
(
DEVICE_BR_ANALYSIS
+
device
.
getDeviceId
(),
currentSecond
-
duration
*
60
);
}
redisTemplate
.
opsForValue
().
set
(
DEVICE_BR_DATA
+
device
.
getDeviceId
(),
JSON
.
toJSONString
(
device
.
getProperties
()),
...
...
@@ -138,7 +138,7 @@ public class PushCallback implements MqttCallback {
Long
size
=
redisTemplate
.
opsForHash
().
size
(
DEVICE_SPACE_TEMP_DATA
+
device
.
getDeviceId
());
redisTemplate
.
opsForHash
().
put
(
DEVICE_SPACE_TEMP_DATA
+
device
.
getDeviceId
(),
currentSecond
,
JSON
.
toJSONString
(
device
.
getProperties
()));
redisTemplate
.
expire
(
DEVICE_SPACE_TEMP_DATA
+
device
.
getDeviceId
(),
maxSize
+
1
,
TimeUnit
.
SECONDS
);
if
(
size
>
maxSize
)
{
if
(
size
==
maxSize
)
{
redisTemplate
.
opsForHash
().
delete
(
DEVICE_SPACE_TEMP_DATA
+
device
.
getDeviceId
(),
currentSecond
-
maxSize
);
}
...
...
@@ -150,7 +150,7 @@ public class PushCallback implements MqttCallback {
Long
size
=
redisTemplate
.
opsForHash
().
size
(
DEVICE_FALL_TEMP_DATA
+
device
.
getDeviceId
());
redisTemplate
.
opsForHash
().
put
(
DEVICE_FALL_TEMP_DATA
+
device
.
getDeviceId
(),
currentSecond
,
JSON
.
toJSONString
(
device
.
getProperties
()));
redisTemplate
.
expire
(
DEVICE_FALL_TEMP_DATA
+
device
.
getDeviceId
(),
maxSize
+
1
,
TimeUnit
.
SECONDS
);
if
(
size
>
maxSize
)
{
if
(
size
==
maxSize
)
{
redisTemplate
.
opsForHash
().
delete
(
DEVICE_FALL_TEMP_DATA
+
device
.
getDeviceId
(),
currentSecond
-
maxSize
);
}
...
...
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