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
551202ae
authored
Jan 30, 2024
by
汪志阳
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:bug fix
parent
7036d554
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
11 deletions
server-common/src/main/java/com/makeit/module/iot/vo/analysis/SleepTimeAnalysisVO.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderSleepServiceImpl.java
server-common/src/main/java/com/makeit/module/iot/vo/analysis/SleepTimeAnalysisVO.java
View file @
551202ae
...
...
@@ -31,6 +31,15 @@ public class SleepTimeAnalysisVO {
*/
private
String
type
;
/**
* 体动次数
*/
private
Integer
actionCount
;
/**
* 翻身次数
*/
private
Integer
turnedCount
;
private
List
<
SleepTimeAnalysisVO
>
deepList
;
private
List
<
SleepTimeAnalysisVO
>
midList
;
/**
...
...
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderSleepServiceImpl.java
View file @
551202ae
...
...
@@ -224,6 +224,9 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
int
sleepMinute
=
0
;
int
riseActionDuration
=
Integer
.
parseInt
(
analysisModel
.
getRiseActionDuration
());
double
riseLeaveThreshold
=
Double
.
parseDouble
(
analysisModel
.
getRiseLeaveThreshold
());
Integer
totalActionCount
=
0
;
Integer
totalTurnedCount
=
0
;
for
(
Map
.
Entry
<
String
,
AnalysisVO
>
entry
:
totalMap
.
entrySet
())
{
AnalysisVO
analysisVO
=
entry
.
getValue
();
// 非离床且体动值<20
...
...
@@ -232,6 +235,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
startSleepTime
=
entry
.
getKey
();
}
sleepMinute
++;
totalActionCount
+=
analysisVO
.
getActionCount
();
totalTurnedCount
+=
analysisVO
.
getTurnedCount
();
continue
;
}
if
(
StringUtils
.
isEmpty
(
startSleepTime
)
&&
sleepMinute
==
0
)
{
...
...
@@ -242,6 +247,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
sleepTimeAnalysisVO
.
setStartTime
(
startSleepTime
);
sleepTimeAnalysisVO
.
setEndTime
(
entry
.
getKey
());
sleepTimeAnalysisVO
.
setType
(
SleepTypeEnum
.
DAY_SLEEP
.
getCode
());
sleepTimeAnalysisVO
.
setActionCount
(
totalActionCount
);
sleepTimeAnalysisVO
.
setTurnedCount
(
totalTurnedCount
);
isSleep
=
true
;
}
getUpTime
=
sleepTimeAnalysisVO
.
getGetUpTime
();
...
...
@@ -291,6 +298,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
if
(!
isSleep
)
{
startSleepTime
=
null
;
sleepMinute
=
0
;
totalActionCount
=
0
;
totalTurnedCount
=
0
;
}
if
(
isSleep
&&
StrUtil
.
isNotBlank
(
getUpTime
))
{
...
...
@@ -303,6 +312,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
minuteActionCount
=
0
;
getUpTime
=
null
;
isSleep
=
false
;
totalActionCount
=
0
;
totalTurnedCount
=
0
;
}
}
TreeMap
<
String
,
TreeMap
<
String
,
AnalysisVO
>>
sleepTypeMap
=
new
TreeMap
<>();
...
...
@@ -339,17 +350,17 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
*
* @param totalMap
*/
private
void
countTotal
(
TreeMap
<
String
,
AnalysisVO
>
totalMap
,
private
void
countTotal
(
TreeMap
<
String
,
TreeMap
<
String
,
AnalysisVO
>
>
totalMap
,
SleepCountDTO
sleepCountDTO
)
{
Integer
actionCount
=
0
;
Integer
turnedCount
=
0
;
for
(
Map
.
Entry
<
String
,
AnalysisVO
>
entry
:
totalMap
.
entrySet
())
{
AnalysisVO
analysisVO
=
entry
.
getValue
();
actionCount
+=
analysisVO
.
getActionCount
(
);
turnedCount
+=
analysisVO
.
getTurnedCount
(
);
}
sleepCountDTO
.
setTotalActionCount
(
actionCount
);
sleepCountDTO
.
setTotalTurnedCount
(
turnedCount
);
AtomicReference
<
Integer
>
actionCount
=
new
AtomicReference
<>(
0
)
;
AtomicReference
<
Integer
>
turnedCount
=
new
AtomicReference
<>(
0
)
;
totalMap
.
forEach
((
k
,
v
)
->
v
.
forEach
((
k2
,
v2
)
->
{
actionCount
.
updateAndGet
(
v1
->
v1
+
v2
.
getActionCount
()
);
turnedCount
.
updateAndGet
(
v1
->
v1
+
v2
.
getTurnedCount
()
);
}
));
sleepCountDTO
.
setTotalActionCount
(
actionCount
.
get
()
);
sleepCountDTO
.
setTotalTurnedCount
(
turnedCount
.
get
()
);
}
/**
...
...
@@ -843,7 +854,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
middleSleep
(
daySleepMap
,
analysisModel
,
sleepTimeAnalysisVOList
);
// 清醒
sober
(
sleepTypeMap
,
sleepTimeAnalysisVOList
);
countTotal
(
total
Map
,
sleepCountDTO
);
countTotal
(
sleepType
Map
,
sleepCountDTO
);
//浅睡
SleepTimeDTO
sleepTimeDTO
=
groupSleepData
(
sleepTimeAnalysisVOList
);
List
<
PlatElderSleep
>
platElderSleeps
=
saveElderSleep
(
sleepTimeDTO
,
elder
.
getId
(),
elder
.
getTenantId
(),
currentDate
);
...
...
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