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
1808f565
authored
Oct 09, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:iot定时任务
parent
99cfdb17
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderSleepServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderSleepServiceImpl.java
View file @
1808f565
...
...
@@ -98,7 +98,11 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
public
void
elderSleepSleepAnalysisTask
()
{
List
<
String
>
dayHourRangeList
=
getLastDayHourRange
();
String
currentDate
=
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATE_PATTERN
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
new
Date
());
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
Date
previousDate
=
calendar
.
getTime
();
String
currentDate
=
DateUtil
.
format
(
previousDate
,
DatePattern
.
NORM_DATE_PATTERN
);
SaasSleepAnalysisModel
analysisModel
=
saasSleepAnalysisModelService
.
getOne
(
new
QueryWrapper
<
SaasSleepAnalysisModel
>().
lambda
()
.
orderByDesc
(
BaseEntity:
:
getCreateBy
)
...
...
@@ -157,8 +161,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
continue
;
}
String
tenantId
=
elder
.
getTenantId
();
/*
String reportStartTime = "";
String reportEndTime = "";
*/
String
reportStartTime
=
""
;
String
reportEndTime
=
""
;
for
(
String
hourRange
:
dayHourRangeList
)
{
String
[]
hourRangeArray
=
hourRange
.
split
(
"~"
);
List
<
DeviceOperationLogEntity
>
deviceOperationLogEntities
=
productDeviceService
.
getDeviceLogByTimeRange
(
platDevice
.
getOriDeviceId
(),
"reportProperty"
,
5000
,
hourRangeArray
[
0
],
hourRangeArray
[
1
]);
...
...
@@ -180,10 +184,10 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
Map
<
String
,
AnalysisVO
>
statisticsMap
=
Maps
.
newHashMap
();
List
<
DeviceInfoContentBreathe
>
deviceInfoContentBreathes
;
for
(
Map
.
Entry
<
String
,
List
<
DeviceInfoContentBreathe
>>
entry
:
minuteMap
.
entrySet
())
{
/*
if (StringUtils.isEmpty(reportStartTime)) {
if
(
StringUtils
.
isEmpty
(
reportStartTime
))
{
reportStartTime
=
entry
.
getKey
();
}
reportEndTime = entry.getKey();
*/
reportEndTime
=
entry
.
getKey
();
deviceInfoContentBreathes
=
entry
.
getValue
();
DeviceInfoContentBreathe
.
Properties
breatheProperties
;
...
...
@@ -500,10 +504,10 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
int
timeHourRange
=
24
;
/*
if (StringUtils.isNotEmpty(reportStartTime) && StringUtils.isNotEmpty(reportEndTime)) {
if
(
StringUtils
.
isNotEmpty
(
reportStartTime
)
&&
StringUtils
.
isNotEmpty
(
reportEndTime
))
{
Long
durationRange
=
getDurationRange
(
reportStartTime
,
reportEndTime
);
timeHourRange
=
(
int
)
(
durationRange
/
60
);
}
*/
}
// 判断是否满足配置的呼吸心率异常类型
BigDecimal
dayBrStopRate
=
brStopCount
==
0
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
timeHourRange
).
divide
(
new
BigDecimal
(
brStopCount
),
2
,
RoundingMode
.
HALF_UP
);
...
...
@@ -610,7 +614,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
platElderBreatheAbnormal
.
setTenantId
(
tenantId
);
platElderBreatheAbnormalList
.
add
(
platElderBreatheAbnormal
);
}
//
platElderBreatheAbnormalService.saveBatch(platElderBreatheAbnormalList);
//platElderBreatheAbnormalService.saveBatch(platElderBreatheAbnormalList);
int
totalActionCount
=
0
;
...
...
@@ -1030,7 +1034,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
elderSleep
.
setTenantId
(
tenantId
);
}
// TODO 起床时间和入睡时间
//
platElderSleepService.saveBatch(elderSleepList);
platElderSleepService
.
saveBatch
(
elderSleepList
);
EvaluateReportVO
elderReport
=
saasElderReportConfigService
.
getByScore
(
totalScore
);
...
...
@@ -1048,7 +1052,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
elderSleepAnalysis
.
setSleepResult
(
sleepReport
.
getResult
());
elderSleepAnalysis
.
setTenantId
(
tenantId
);
elderSleepAnalysis
.
setSleepEvaluate
(
elderReport
==
null
?
""
:
elderReport
.
getEvaluate
());
//
platElderSleepAnalysisService.save(elderSleepAnalysis);
platElderSleepAnalysisService
.
save
(
elderSleepAnalysis
);
}
}
...
...
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