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
14c8c200
authored
Nov 08, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:睡眠分析问题
parent
2299a7c1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
63 deletions
server-common/src/main/java/com/makeit/module/iot/service/IotProductDeviceService.java
server-common/src/main/java/com/makeit/module/iot/vo/analysis/AnalysisVO.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderReportMonthServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderSleepServiceImpl.java
server-common/src/main/java/com/makeit/module/iot/service/IotProductDeviceService.java
View file @
14c8c200
...
@@ -33,6 +33,7 @@ import java.io.IOException;
...
@@ -33,6 +33,7 @@ import java.io.IOException;
import
java.time.*
;
import
java.time.*
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.ChronoUnit
;
import
java.time.temporal.ChronoUnit
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
...
@@ -237,24 +238,30 @@ public class IotProductDeviceService extends IotCommonService {
...
@@ -237,24 +238,30 @@ public class IotProductDeviceService extends IotCommonService {
int
br
=
0
;
int
br
=
0
;
int
hr
=
0
;
int
hr
=
0
;
long
timestamp
=
0
;
long
timestamp
=
0
;
int
noPersonCount
=
0
;
for
(
DeviceInfoContentBreathe
deviceInfoContentBreathe
:
deviceInfoContentBreathes
)
{
for
(
DeviceInfoContentBreathe
deviceInfoContentBreathe
:
deviceInfoContentBreathes
)
{
timestamp
=
deviceInfoContentBreathe
.
getTimestamp
();
breatheProperties
=
deviceInfoContentBreathe
.
getProperties
();
breatheProperties
=
deviceInfoContentBreathe
.
getProperties
();
if
(
breatheProperties
.
getPerson
()
==
0
)
{
noPersonCount
++;
continue
;
}
hr
+=
breatheProperties
.
getHr
();
hr
+=
breatheProperties
.
getHr
();
br
+=
breatheProperties
.
getBr
();
br
+=
breatheProperties
.
getBr
();
bodymove
+=
breatheProperties
.
getBodymove
();
bodymove
+=
breatheProperties
.
getBodymove
();
timestamp
=
deviceInfoContentBreathe
.
getTimestamp
();
}
}
temp
=
new
DeviceInfoContentBreathe
();
temp
=
new
DeviceInfoContentBreathe
();
tempProperties
=
new
DeviceInfoContentBreathe
.
Properties
();
tempProperties
=
new
DeviceInfoContentBreathe
.
Properties
();
tempProperties
.
setHr
(
hr
/
60
);
tempProperties
.
setHr
(
noPersonCount
==
60
?
0
:
hr
/
(
60
-
noPersonCount
)
);
tempProperties
.
setBr
(
br
/
60
);
tempProperties
.
setBr
(
noPersonCount
==
60
?
0
:
br
/
(
60
-
noPersonCount
)
);
tempProperties
.
setBodymove
(
bodymove
/
60
);
tempProperties
.
setBodymove
(
noPersonCount
==
60
?
0
:
bodymove
/
(
60
-
noPersonCount
)
);
temp
.
setTimestamp
(
timestamp
);
temp
.
setTimestamp
(
timestamp
);
temp
.
setProperties
(
tempProperties
);
temp
.
setProperties
(
tempProperties
);
tempList
.
add
(
temp
);
tempList
.
add
(
temp
);
}
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
tempList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
tempList
))
{
tempList
=
tempList
.
stream
().
sorted
(
Comparator
.
comparing
(
DeviceInfoContentBreathe:
:
getTimestamp
)).
collect
(
Collectors
.
toList
());
return
tempList
;
return
tempList
;
}
}
return
Lists
.
newArrayList
();
return
Lists
.
newArrayList
();
...
...
server-common/src/main/java/com/makeit/module/iot/vo/analysis/AnalysisVO.java
View file @
14c8c200
...
@@ -13,6 +13,7 @@ public class AnalysisVO {
...
@@ -13,6 +13,7 @@ public class AnalysisVO {
private
Integer
avgBr
;
private
Integer
avgBr
;
private
Integer
maxBr
;
private
Integer
maxBr
;
private
Integer
minBr
;
private
Integer
minBr
;
private
Integer
hrBrCount
;
private
Integer
actionCount
=
0
;
// 体动次数
private
Integer
actionCount
=
0
;
// 体动次数
private
Integer
turnedCount
=
0
;
// 翻身次数
private
Integer
turnedCount
=
0
;
// 翻身次数
...
...
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderReportMonthServiceImpl.java
View file @
14c8c200
...
@@ -9,6 +9,7 @@ import com.makeit.entity.platform.elder.PlatElder;
...
@@ -9,6 +9,7 @@ import com.makeit.entity.platform.elder.PlatElder;
import
com.makeit.entity.platform.elder.PlatElderReportMonth
;
import
com.makeit.entity.platform.elder.PlatElderReportMonth
;
import
com.makeit.entity.platform.elder.PlatElderSleepAnalysis
;
import
com.makeit.entity.platform.elder.PlatElderSleepAnalysis
;
import
com.makeit.enums.platform.alarm.PlatAlarmConfigEnum
;
import
com.makeit.enums.platform.alarm.PlatAlarmConfigEnum
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.mapper.platform.elder.PlatElderReportMonthMapper
;
import
com.makeit.mapper.platform.elder.PlatElderReportMonthMapper
;
import
com.makeit.module.iot.service.IotProductDeviceService
;
import
com.makeit.module.iot.service.IotProductDeviceService
;
import
com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe
;
import
com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe
;
...
@@ -140,6 +141,7 @@ public class PlatElderReportMonthServiceImpl extends ServiceImpl<PlatElderReport
...
@@ -140,6 +141,7 @@ public class PlatElderReportMonthServiceImpl extends ServiceImpl<PlatElderReport
}
}
@Override
@Override
@TenantIdIgnore
public
void
reportMonthJob
()
{
public
void
reportMonthJob
()
{
LocalDate
nowDate
=
LocalDate
.
now
();
LocalDate
nowDate
=
LocalDate
.
now
();
LocalDate
yesDate
=
nowDate
.
minusDays
(
1
);
LocalDate
yesDate
=
nowDate
.
minusDays
(
1
);
...
@@ -151,59 +153,59 @@ public class PlatElderReportMonthServiceImpl extends ServiceImpl<PlatElderReport
...
@@ -151,59 +153,59 @@ public class PlatElderReportMonthServiceImpl extends ServiceImpl<PlatElderReport
List
<
PlatElderReportMonth
>
reportMonthList
=
new
ArrayList
<>(
10
);
List
<
PlatElderReportMonth
>
reportMonthList
=
new
ArrayList
<>(
10
);
platTenantService
.
executeTenantList
(()
->
{
List
<
PlatElder
>
elderList
=
platElderService
.
list
(
new
QueryWrapper
<
PlatElder
>().
lambda
()
List
<
PlatElder
>
elderList
=
platElderService
.
list
(
new
QueryWrapper
<
PlatElder
>().
lambda
()
.
isNotNull
(
PlatElder:
:
getBedId
));
.
isNotNull
(
PlatElder:
:
getBedId
));
List
<
PlatElderSleepAnalysis
>
sleepAnalysesList
=
platElderSleepAnalysisService
.
list
(
new
QueryWrapper
<
PlatElderSleepAnalysis
>().
lambda
()
List
<
PlatElderSleepAnalysis
>
sleepAnalysesList
=
platElderSleepAnalysisService
.
list
(
new
QueryWrapper
<
PlatElderSleepAnalysis
>().
lambda
()
.
in
(
PlatElderSleepAnalysis:
:
getElderId
,
StreamUtil
.
mapId
(
elderList
,
PlatElder:
:
getId
))
.
in
(
PlatElderSleepAnalysis:
:
getElderId
,
StreamUtil
.
mapId
(
elderList
,
PlatElder:
:
getId
))
.
eq
(
PlatElderSleepAnalysis:
:
getHappenDate
,
dateTimeFormatter
.
format
(
yesDate
))
.
eq
(
PlatElderSleepAnalysis:
:
getHappenDate
,
dateTimeFormatter
.
format
(
yesDate
))
);
);
Map
<
String
,
PlatElderSleepAnalysis
>
sleepAnalysisMap
=
StreamUtil
.
toMap
(
sleepAnalysesList
,
PlatElderSleepAnalysis:
:
getElderId
);
List
<
PlatAlarmRecord
>
recordList
=
platAlarmRecordService
.
list
(
new
QueryWrapper
<
PlatAlarmRecord
>().
lambda
()
.
in
(
PlatAlarmRecord:
:
getElderIds
,
StreamUtil
.
mapId
(
elderList
,
PlatElder:
:
getId
)));
Map
<
String
,
List
<
PlatAlarmRecord
>>
recordMap
=
StreamUtil
.
groupBy
(
recordList
,
PlatAlarmRecord:
:
getElderIds
);
elderList
.
forEach
(
e
->
{
PlatElderReportMonth
reportMonth
=
new
PlatElderReportMonth
();
reportMonth
.
setElderId
(
e
.
getBedId
());
reportMonth
.
setDay
(
yesDate
);
MapUtil
.
setIfPresent
(
sleepAnalysisMap
,
e
.
getId
(),
sa
->
{
reportMonth
.
setSleepResult
(
sa
.
getSleepResult
());
});
PlatDevice
platDevice
=
platElderRealTimeService
.
getBreathDevice
(
e
.
getId
(),
null
);
Map
<
String
,
PlatElderSleepAnalysis
>
sleepAnalysisMap
=
StreamUtil
.
toMap
(
sleepAnalysesList
,
PlatElderSleepAnalysis:
:
getElderId
);
List
<
DeviceInfoContentBreathe
>
breatheList
=
iotProductDeviceService
.
getDeviceLogByTimeRangeBreathe
(
platDevice
.
getOriDeviceId
(),
2
*
24
*
3600
,
yesStart
,
yesEnd
);
List
<
PlatAlarmRecord
>
recordList
=
platAlarmRecordService
.
list
(
new
QueryWrapper
<
PlatAlarmRecord
>().
lambda
()
.
ge
(
PlatAlarmRecord:
:
getAlarmDate
,
yesStart
)
.
le
(
PlatAlarmRecord:
:
getAlarmDate
,
yesEnd
)
.
eq
(
PlatAlarmRecord:
:
getMisinformationFlag
,
0
)
.
in
(
PlatAlarmRecord:
:
getElderIds
,
StreamUtil
.
mapId
(
elderList
,
PlatElder:
:
getId
)));
if
(
CollectionUtils
.
isNotEmpty
(
breatheList
))
{
Map
<
String
,
List
<
PlatAlarmRecord
>>
recordMap
=
StreamUtil
.
groupBy
(
recordList
,
PlatAlarmRecord:
:
getElderIds
);
reportMonth
.
setBreatheDeviceId
(
platDevice
.
getId
());
for
(
PlatElder
e
:
elderList
)
{
reportMonth
.
setBreatheOriDeviceId
(
platDevice
.
getOriDeviceId
());
PlatElderReportMonth
reportMonth
=
new
PlatElderReportMonth
();
reportMonth
.
setElderId
(
e
.
getId
());
reportMonth
.
setDay
(
yesDate
);
reportMonth
.
setHeartRate
((
int
)
(
StreamUtil
.
reduce
(
breatheList
,
i
->
(
long
)
i
.
getProperties
().
getHr
(),
0L
,
Long:
:
sum
)
/
breatheList
.
size
()));
MapUtil
.
setIfPresent
(
sleepAnalysisMap
,
e
.
getId
(),
sa
->
{
reportMonth
.
setRespiratoryRate
((
int
)
(
StreamUtil
.
reduce
(
breatheList
,
i
->
(
long
)
i
.
getProperties
().
getBr
(),
0L
,
Long:
:
sum
)
/
breatheList
.
size
()
));
reportMonth
.
setSleepResult
(
sa
.
getSleepResult
(
));
}
});
List
<
PlatAlarmRecord
>
rList
=
Optional
.
ofNullable
(
recordMap
.
get
(
e
.
getId
())).
orElse
(
new
ArrayList
<>(
10
));
PlatDevice
platDevice
=
platElderRealTimeService
.
getBreathDevice
(
e
.
getId
(),
null
);
if
(
platDevice
==
null
)
{
continue
;
}
reportMonth
.
setFailCount
((
int
)
StreamUtil
.
count
(
rList
,
i
->
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
FALL
.
getValue
().
equals
(
i
.
getAlarmType
())));
List
<
DeviceInfoContentBreathe
>
breatheList
=
iotProductDeviceService
.
getDeviceLogByTimeRangeBreathe
(
platDevice
.
getOriDeviceId
(),
2
*
24
*
3600
,
yesStart
,
yesEnd
);
reportMonth
.
setHeartExceptionCount
((
int
)
StreamUtil
.
count
(
rList
,
i
->
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
HEART
.
getValue
().
equals
(
i
.
getAlarmType
())));
reportMonth
.
setRespiratoryExceptionCount
((
int
)
StreamUtil
.
count
(
rList
,
i
->
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
BREATHE
.
getValue
().
equals
(
i
.
getAlarmType
())));
reportMonth
.
setBehaviorExceptionCount
((
int
)
StreamUtil
.
count
(
rList
,
i
->
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
BEHAVIOR
.
getValue
().
equals
(
i
.
getAlarmType
())));
reportMonthList
.
add
(
reportMonth
);
if
(
CollectionUtils
.
isNotEmpty
(
breatheList
))
{
});
reportMonth
.
setBreatheDeviceId
(
platDevice
.
getId
());
reportMonth
.
setBreatheOriDeviceId
(
platDevice
.
getOriDeviceId
());
saveBatch
(
reportMonthList
);
reportMonth
.
setHeartRate
((
int
)
(
StreamUtil
.
reduce
(
breatheList
,
i
->
(
long
)
i
.
getProperties
().
getHr
(),
0L
,
Long:
:
sum
)
/
breatheList
.
size
()));
reportMonth
.
setRespiratoryRate
((
int
)
(
StreamUtil
.
reduce
(
breatheList
,
i
->
(
long
)
i
.
getProperties
().
getBr
(),
0L
,
Long:
:
sum
)
/
breatheList
.
size
()));
}
List
<
PlatAlarmRecord
>
rList
=
Optional
.
ofNullable
(
recordMap
.
get
(
e
.
getId
())).
orElse
(
new
ArrayList
<>(
10
));
});
reportMonth
.
setFailCount
((
int
)
StreamUtil
.
count
(
rList
,
i
->
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
FALL
.
getValue
().
equals
(
i
.
getAlarmType
())));
reportMonth
.
setHeartExceptionCount
((
int
)
StreamUtil
.
count
(
rList
,
i
->
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
HEART
.
getValue
().
equals
(
i
.
getAlarmType
())));
reportMonth
.
setRespiratoryExceptionCount
((
int
)
StreamUtil
.
count
(
rList
,
i
->
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
BREATHE
.
getValue
().
equals
(
i
.
getAlarmType
())));
reportMonth
.
setBehaviorExceptionCount
((
int
)
StreamUtil
.
count
(
rList
,
i
->
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
BEHAVIOR
.
getValue
().
equals
(
i
.
getAlarmType
())));
reportMonth
.
setTenantId
(
e
.
getTenantId
());
reportMonthList
.
add
(
reportMonth
);
}
saveBatch
(
reportMonthList
);
}
}
}
}
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderSleepServiceImpl.java
View file @
14c8c200
...
@@ -201,6 +201,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -201,6 +201,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
int
maxHr
=
0
;
int
maxHr
=
0
;
int
minHr
=
0
;
int
minHr
=
0
;
int
totalHr
=
0
;
int
totalHr
=
0
;
int
hrBrCount
=
0
;
// 呼吸率心率统计次数
// 呼吸暂停
// 呼吸暂停
int
brStopCount
=
0
;
int
brStopCount
=
0
;
...
@@ -364,8 +365,11 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -364,8 +365,11 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
minHr
=
hr
;
minHr
=
hr
;
}
}
totalBr
+=
br
;
if
(
breatheProperties
.
getPerson
()
==
1
)
{
totalHr
+=
hr
;
totalBr
+=
br
;
totalHr
+=
hr
;
hrBrCount
++;
}
}
}
/* int brStopThreshold = brStopCount / breatheDuration;
/* int brStopThreshold = brStopCount / breatheDuration;
int brFastThreshold = brFastCount / breatheDuration;
int brFastThreshold = brFastCount / breatheDuration;
...
@@ -401,7 +405,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -401,7 +405,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
analysisVO
.
setAvgHr
(
totalHr
/
60
);
analysisVO
.
setAvgHr
(
totalHr
/
60
);
analysisVO
.
setMaxHr
(
maxHr
);
analysisVO
.
setMaxHr
(
maxHr
);
analysisVO
.
setMinHr
(
minHr
);
analysisVO
.
setMinHr
(
minHr
);
analysisVO
.
setHrBrCount
(
hrBrCount
);
analysisVO
.
setActionCount
(
bodymoveCount
);
analysisVO
.
setActionCount
(
bodymoveCount
);
analysisVO
.
setTurnedCount
(
turnoverCount
);
analysisVO
.
setTurnedCount
(
turnoverCount
);
...
@@ -456,6 +460,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -456,6 +460,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
int
hrSlowCount
=
0
;
int
hrSlowCount
=
0
;
int
dayTotalHr
=
0
;
int
dayTotalHr
=
0
;
int
dayTotalBr
=
0
;
int
dayTotalBr
=
0
;
int
dayBrHrCount
=
0
;
// 计算异常的信息,并且统计异常的次数
// 计算异常的信息,并且统计异常的次数
List
<
BreatheAbnormalVO
>
breatheAbnormalVOList
=
Lists
.
newArrayList
();
List
<
BreatheAbnormalVO
>
breatheAbnormalVOList
=
Lists
.
newArrayList
();
...
@@ -499,6 +504,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -499,6 +504,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
}
}
dayTotalHr
+=
analysisVO
.
getTotalHr
();
dayTotalHr
+=
analysisVO
.
getTotalHr
();
dayTotalBr
+=
analysisVO
.
getTotalBr
();
dayTotalBr
+=
analysisVO
.
getTotalBr
();
dayBrHrCount
+=
analysisVO
.
getHrBrCount
();
}
}
...
@@ -593,8 +599,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -593,8 +599,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
// 插入呼吸分析表
// 插入呼吸分析表
PlatElderBreatheAnalysis
platElderBreatheAnalysis
=
new
PlatElderBreatheAnalysis
();
PlatElderBreatheAnalysis
platElderBreatheAnalysis
=
new
PlatElderBreatheAnalysis
();
platElderBreatheAnalysis
.
setElderId
(
elder
.
getId
());
platElderBreatheAnalysis
.
setElderId
(
elder
.
getId
());
platElderBreatheAnalysis
.
setAvgBreatheRate
(
String
.
valueOf
(
dayTotalBr
/
(
timeHourRange
*
60
*
60
)));
platElderBreatheAnalysis
.
setAvgBreatheRate
(
String
.
valueOf
(
dayTotalBr
/
(
timeHourRange
*
dayBrHrCount
)));
platElderBreatheAnalysis
.
setAvgHeartRate
(
String
.
valueOf
(
dayTotalHr
/
(
timeHourRange
*
60
*
60
)));
platElderBreatheAnalysis
.
setAvgHeartRate
(
String
.
valueOf
(
dayTotalHr
/
(
timeHourRange
*
dayBrHrCount
)));
platElderBreatheAnalysis
.
setBreatheScore
(
finalReport
.
getScore
());
platElderBreatheAnalysis
.
setBreatheScore
(
finalReport
.
getScore
());
platElderBreatheAnalysis
.
setHappenDate
(
currentDate
);
platElderBreatheAnalysis
.
setHappenDate
(
currentDate
);
platElderBreatheAnalysis
.
setTenantId
(
tenantId
);
platElderBreatheAnalysis
.
setTenantId
(
tenantId
);
...
@@ -614,7 +620,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -614,7 +620,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
platElderBreatheAbnormal
.
setTenantId
(
tenantId
);
platElderBreatheAbnormal
.
setTenantId
(
tenantId
);
platElderBreatheAbnormalList
.
add
(
platElderBreatheAbnormal
);
platElderBreatheAbnormalList
.
add
(
platElderBreatheAbnormal
);
}
}
platElderBreatheAbnormalService
.
saveBatch
(
platElderBreatheAbnormalList
);
platElderBreatheAbnormalService
.
saveBatch
(
platElderBreatheAbnormalList
);
int
totalActionCount
=
0
;
int
totalActionCount
=
0
;
...
@@ -1079,29 +1085,27 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -1079,29 +1085,27 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
public
List
<
String
>
getLastDayHourRange
()
{
public
List
<
String
>
getLastDayHourRange
()
{
int
count
=
24
;
int
count
=
24
;
LocalDateTime
now
=
LocalDateTime
.
now
(
);
LocalDateTime
localDateTime
=
getDayStart
(
LocalDate
.
now
()).
plusHours
(
8
);
List
<
String
>
list
=
Lists
.
newArrayList
();
List
<
String
>
list
=
Lists
.
newArrayList
();
String
startTime
;
String
startTime
;
String
endTime
;
String
endTime
;
for
(
int
i
=
count
;
i
>
0
;
i
--)
{
for
(
int
i
=
count
;
i
>
0
;
i
--)
{
startTime
=
DateUtil
.
format
(
now
.
minusHours
(
i
),
DatePattern
.
NORM_DATETIME_PATTERN
);
startTime
=
DateUtil
.
format
(
localDateTime
.
minusHours
(
i
),
DatePattern
.
NORM_DATETIME_PATTERN
);
endTime
=
DateUtil
.
format
(
now
.
minusHours
(
i
-
1
),
DatePattern
.
NORM_DATETIME_PATTERN
);
endTime
=
DateUtil
.
format
(
localDateTime
.
minusHours
(
i
-
1
),
DatePattern
.
NORM_DATETIME_PATTERN
);
list
.
add
(
startTime
+
"~"
+
endTime
);
list
.
add
(
startTime
+
"~"
+
endTime
);
}
}
return
list
;
return
list
;
}
}
public
static
LocalDateTime
getDayStart
(
LocalDate
time
)
{
return
time
.
atTime
(
0
,
0
,
0
);
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
int
days
=
30
;
PlatElderSleepServiceImpl
platElderSleepService1
=
new
PlatElderSleepServiceImpl
();
DateTimeFormatter
timeFormatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
LocalDateTime
localDateTime
=
LocalDateTime
.
now
().
minusDays
(
28
);
List
<
String
>
lastDayHourRange
=
platElderSleepService1
.
getLastDayHourRange
();
for
(
int
i
=
0
;
i
<
days
;
i
++)
{
System
.
out
.
println
();
int
i1
=
RandomUtils
.
nextInt
(
0
,
4
);
System
.
out
.
println
(
i1
);
localDateTime
=
localDateTime
.
plusDays
(
1
);
String
currentDate
=
localDateTime
.
format
(
timeFormatter
);
System
.
out
.
println
(
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