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
e7175bc7
authored
Oct 12, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: 调整时间
parent
dd21ef86
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
30 deletions
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
View file @
e7175bc7
...
@@ -382,46 +382,44 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
...
@@ -382,46 +382,44 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
}
}
return
vo
;
return
vo
;
}
}
DeviceInfoContentBreathe
deviceInfoContentBreathe
=
getNowDataBreathe
(
platElderIdDTO
.
getElderId
(),
platElderIdDTO
.
getDeviceId
());
if
(
deviceInfoContentBreathe
==
null
)
{
return
vo
;
}
int
heartRate
=
deviceInfoContentBreathe
.
getProperties
().
getHr
();
int
respiratoryRate
=
deviceInfoContentBreathe
.
getProperties
().
getBr
();
int
body
=
deviceInfoContentBreathe
.
getProperties
().
getBodymove
();
int
person
=
deviceInfoContentBreathe
.
getProperties
().
getPerson
();
if
(
heartRate
==
0
)
{
vo
.
setHeartRate
(
0
);
}
else
{
int
hrRange
=
RandomUtils
.
nextInt
(
1
,
11
)
-
5
;
vo
.
setHeartRate
(
Math
.
max
(
heartRate
+
hrRange
,
0
));
}
if
(
respiratoryRate
==
0
)
{
vo
.
setRespiratoryRate
(
0
);
}
else
{
int
brRange
=
RandomUtils
.
nextInt
(
1
,
7
)
-
3
;
vo
.
setRespiratoryRate
(
Math
.
max
(
respiratoryRate
+
brRange
,
0
));
}
if
(
body
==
0
)
{
vo
.
setBody
(
body
);
}
else
{
int
hrRange
=
RandomUtils
.
nextInt
(
1
,
11
)
-
5
;
vo
.
setBody
(
Math
.
max
(
body
+
hrRange
,
0
));
}
vo
.
setStatus
(
person
==
1
?
PlatElderRealtimeReportEnum
.
NowStatus
.
BED
.
getValue
()
:
PlatElderRealtimeReportEnum
.
NowStatus
.
RUN
.
getValue
());
return
vo
;
return
vo
;
/* String brResult = redisTemplate.opsForList().rightPop(ELDER_BR_HR + platElderIdDTO.getElderId());
/* String brResult = redisTemplate.opsForList().rightPop(ELDER_BR_HR + platElderIdDTO.getElderId());
if (brResult != null) {
if (brResult != null) {
return JSON.parseObject(brResult,PlatElderRealTimeHeartRespiratoryVO.class);
return JSON.parseObject(brResult,PlatElderRealTimeHeartRespiratoryVO.class);
}
}
DeviceInfoContentBreathe deviceInfoContentBreathe = getNowDataBreathe(platElderIdDTO.getElderId(), platElderIdDTO.getDeviceId());
if (deviceInfoContentBreathe == null) {
if (deviceInfoContentBreathe == null) {
return new PlatElderRealTimeHeartRespiratoryVO();
return new PlatElderRealTimeHeartRespiratoryVO();
}
}
int count = 10;
int count = 10;
int heartRate = deviceInfoContentBreathe.getProperties().getHr();
int respiratoryRate = deviceInfoContentBreathe.getProperties().getBr();
int body = deviceInfoContentBreathe.getProperties().getBodymove();
for (int i = 0; i < count; i++) {
for (int i = 0; i < count; i++) {
PlatElderRealTimeHeartRespiratoryVO platElderRealTimeHeartRespiratoryVO = new PlatElderRealTimeHeartRespiratoryVO();
platElderRealTimeHeartRespiratoryVO.setTime(LocalDateTime.now().plusSeconds(i));
if (i ==0) {
platElderRealTimeHeartRespiratoryVO.setHeartRate(heartRate);
platElderRealTimeHeartRespiratoryVO.setRespiratoryRate(respiratoryRate);
platElderRealTimeHeartRespiratoryVO.setBody(body);
} else {
if (heartRate == 0) {
platElderRealTimeHeartRespiratoryVO.setHeartRate(0);
} else {
int hrRange = RandomUtils.nextInt(1, 11) - 5;
platElderRealTimeHeartRespiratoryVO.setHeartRate(Math.max(heartRate + hrRange,0));
}
if (respiratoryRate == 0) {
platElderRealTimeHeartRespiratoryVO.setRespiratoryRate(0);
} else {
int brRange = RandomUtils.nextInt(1, 7) - 3;
platElderRealTimeHeartRespiratoryVO.setRespiratoryRate(Math.max(respiratoryRate + brRange,0));
}
if (body == 0) {
platElderRealTimeHeartRespiratoryVO.setBody(body);
} else {
int hrRange = RandomUtils.nextInt(1, 11) - 5;
platElderRealTimeHeartRespiratoryVO.setBody(Math.max(body + hrRange,0));
}
}
}
redisTemplate.opsForList().leftPush(ELDER_BR_HR + platElderIdDTO.getElderId(),JSON.toJSONString(platElderRealTimeHeartRespiratoryVO));
redisTemplate.opsForList().leftPush(ELDER_BR_HR + platElderIdDTO.getElderId(),JSON.toJSONString(platElderRealTimeHeartRespiratoryVO));
...
...
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