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
e5c3e16d
authored
Dec 13, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:上报时间先取当作时间戳
parent
195740c6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
7 deletions
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
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/device/impl/PlatDeviceServiceImpl.java
View file @
e5c3e16d
...
@@ -836,11 +836,11 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -836,11 +836,11 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
public
void
active
(
BaseIdDTO
dto
)
{
public
void
active
(
BaseIdDTO
dto
)
{
PlatDevice
platDevice
=
getById
(
dto
.
getId
());
PlatDevice
platDevice
=
getById
(
dto
.
getId
());
Map
<
String
,
Object
>
resMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
resMap
=
new
HashMap
<>();
resMap
.
put
(
"appid"
,
shengwangProperties
.
getAppId
());
/*
resMap.put("appid",shengwangProperties.getAppId());
String AttrResult = devicePropertiesOperateService.deviceWriteAttr(platDevice.getOriDeviceId(), resMap);
String AttrResult = devicePropertiesOperateService.deviceWriteAttr(platDevice.getOriDeviceId(), resMap);
if (StringUtils.isNotEmpty(AttrResult)) {
if (StringUtils.isNotEmpty(AttrResult)) {
throw new RuntimeException(AttrResult);
throw new RuntimeException(AttrResult);
}
}
*/
SaasPidManage
saasPidManage
=
saasPidManageService
.
getOne
(
new
QueryWrapper
<
SaasPidManage
>().
lambda
()
SaasPidManage
saasPidManage
=
saasPidManageService
.
getOne
(
new
QueryWrapper
<
SaasPidManage
>().
lambda
()
.
eq
(
SaasPidManage:
:
getStatus
,
"1"
)
.
eq
(
SaasPidManage:
:
getStatus
,
"1"
)
.
orderByAsc
(
BaseEntity:
:
getCreateDate
)
.
orderByAsc
(
BaseEntity:
:
getCreateDate
)
...
...
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
View file @
e5c3e16d
...
@@ -232,7 +232,6 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
...
@@ -232,7 +232,6 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
boolean
spaceNoPersonFlag
=
false
;
boolean
spaceNoPersonFlag
=
false
;
for
(
PlatDevice
device
:
spaceDeviceList
)
{
for
(
PlatDevice
device
:
spaceDeviceList
)
{
// 无人
Set
<
String
>
dataSet
=
redisTemplate
.
opsForZSet
().
rangeByScore
(
DEVICE_SPACE_TEMP_DATA
+
platDevice
.
getOriDeviceId
(),
currentSecond
-
10
,
currentSecond
);
Set
<
String
>
dataSet
=
redisTemplate
.
opsForZSet
().
rangeByScore
(
DEVICE_SPACE_TEMP_DATA
+
platDevice
.
getOriDeviceId
(),
currentSecond
-
10
,
currentSecond
);
if
(
CollectionUtils
.
isEmpty
(
dataSet
))
{
if
(
CollectionUtils
.
isEmpty
(
dataSet
))
{
log
.
info
(
"空间设备当前没有上报数据直接返回"
);
log
.
info
(
"空间设备当前没有上报数据直接返回"
);
...
@@ -279,7 +278,6 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
...
@@ -279,7 +278,6 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
}
}
boolean
fallNoPersonFlag
=
false
;
boolean
fallNoPersonFlag
=
false
;
for
(
PlatDevice
device
:
fallDeviceList
)
{
for
(
PlatDevice
device
:
fallDeviceList
)
{
// 无人
Set
<
String
>
dataSet
=
redisTemplate
.
opsForZSet
().
rangeByScore
(
DEVICE_FALL_TEMP_DATA
+
platDevice
.
getOriDeviceId
(),
currentSecond
-
10
,
currentSecond
);
Set
<
String
>
dataSet
=
redisTemplate
.
opsForZSet
().
rangeByScore
(
DEVICE_FALL_TEMP_DATA
+
platDevice
.
getOriDeviceId
(),
currentSecond
-
10
,
currentSecond
);
if
(
CollectionUtils
.
isEmpty
(
dataSet
))
{
if
(
CollectionUtils
.
isEmpty
(
dataSet
))
{
log
.
info
(
"跌倒设备当前没有上报数据直接返回"
);
log
.
info
(
"跌倒设备当前没有上报数据直接返回"
);
...
...
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
View file @
e5c3e16d
...
@@ -153,7 +153,7 @@ public class PushCallback implements MqttCallback {
...
@@ -153,7 +153,7 @@ public class PushCallback implements MqttCallback {
List
<
HeaderInfo
.
Bind
>
bindings
=
headers
.
getBindings
();
List
<
HeaderInfo
.
Bind
>
bindings
=
headers
.
getBindings
();
Long
timestamp
=
device
.
getTimestamp
();
Long
timestamp
=
device
.
getTimestamp
();
long
currentSecond
=
timestamp
/
1000
;
long
currentSecond
=
System
.
currentTimeMillis
()
/
1000
;
// 先通过产品名称判断
// 先通过产品名称判断
if
(
REPORT_PROPERTY
.
equals
(
device
.
getMessageType
())
&&
headers
.
getProductName
().
contains
(
"呼吸"
))
{
if
(
REPORT_PROPERTY
.
equals
(
device
.
getMessageType
())
&&
headers
.
getProductName
().
contains
(
"呼吸"
))
{
cacheBrDeviceData
(
device
,
currentSecond
);
cacheBrDeviceData
(
device
,
currentSecond
);
...
@@ -235,7 +235,7 @@ public class PushCallback implements MqttCallback {
...
@@ -235,7 +235,7 @@ public class PushCallback implements MqttCallback {
long
maxSize
=
10L
;
long
maxSize
=
10L
;
String
key
=
deviceSpaceTempData
+
device
.
getDeviceId
();
String
key
=
deviceSpaceTempData
+
device
.
getDeviceId
();
redisTemplate
.
opsForZSet
().
add
(
key
,
JSON
.
toJSONString
(
device
),
currentSecond
);
redisTemplate
.
opsForZSet
().
add
(
key
,
JSON
.
toJSONString
(
device
),
currentSecond
);
redisTemplate
.
expire
(
key
,
maxSize
+
1
,
TimeUnit
.
MINUTE
S
);
redisTemplate
.
expire
(
key
,
60
,
TimeUnit
.
SECOND
S
);
}
}
private
void
cacheBrDeviceData
(
DeviceInfo
device
,
long
currentSecond
)
{
private
void
cacheBrDeviceData
(
DeviceInfo
device
,
long
currentSecond
)
{
...
@@ -243,7 +243,7 @@ public class PushCallback implements MqttCallback {
...
@@ -243,7 +243,7 @@ public class PushCallback implements MqttCallback {
String
key
=
DEVICE_BR_ANALYSIS
+
device
.
getDeviceId
();
String
key
=
DEVICE_BR_ANALYSIS
+
device
.
getDeviceId
();
long
duration
=
getSleepTimeActionDuration
();
long
duration
=
getSleepTimeActionDuration
();
redisTemplate
.
opsForZSet
().
add
(
key
,
JSON
.
toJSONString
(
device
),
currentSecond
);
redisTemplate
.
opsForZSet
().
add
(
key
,
JSON
.
toJSONString
(
device
),
currentSecond
);
redisTemplate
.
expire
(
key
,
duration
+
3
,
TimeUnit
.
MINUTE
S
);
redisTemplate
.
expire
(
key
,
duration
+
180
,
TimeUnit
.
SECOND
S
);
}
}
private
Long
getSleepTimeActionDuration
()
{
private
Long
getSleepTimeActionDuration
()
{
...
...
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