Commit 1808f565 by huangjy

fix:iot定时任务

parent 99cfdb17
......@@ -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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment