Commit 1808f565 by huangjy

fix:iot定时任务

parent 99cfdb17
...@@ -98,7 +98,11 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper, ...@@ -98,7 +98,11 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
public void elderSleepSleepAnalysisTask() { public void elderSleepSleepAnalysisTask() {
List<String> dayHourRangeList = getLastDayHourRange(); 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() SaasSleepAnalysisModel analysisModel = saasSleepAnalysisModelService.getOne(new QueryWrapper<SaasSleepAnalysisModel>().lambda()
.orderByDesc(BaseEntity::getCreateBy) .orderByDesc(BaseEntity::getCreateBy)
...@@ -157,8 +161,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper, ...@@ -157,8 +161,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
continue; continue;
} }
String tenantId = elder.getTenantId(); String tenantId = elder.getTenantId();
/* String reportStartTime = ""; String reportStartTime = "";
String reportEndTime = "";*/ String reportEndTime = "";
for (String hourRange : dayHourRangeList) { for (String hourRange : dayHourRangeList) {
String[] hourRangeArray = hourRange.split("~"); String[] hourRangeArray = hourRange.split("~");
List<DeviceOperationLogEntity> deviceOperationLogEntities = productDeviceService.getDeviceLogByTimeRange(platDevice.getOriDeviceId(), "reportProperty", 5000, hourRangeArray[0], hourRangeArray[1]); List<DeviceOperationLogEntity> deviceOperationLogEntities = productDeviceService.getDeviceLogByTimeRange(platDevice.getOriDeviceId(), "reportProperty", 5000, hourRangeArray[0], hourRangeArray[1]);
...@@ -180,10 +184,10 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper, ...@@ -180,10 +184,10 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
Map<String, AnalysisVO> statisticsMap = Maps.newHashMap(); Map<String, AnalysisVO> statisticsMap = Maps.newHashMap();
List<DeviceInfoContentBreathe> deviceInfoContentBreathes; List<DeviceInfoContentBreathe> deviceInfoContentBreathes;
for (Map.Entry<String, List<DeviceInfoContentBreathe>> entry : minuteMap.entrySet()) { for (Map.Entry<String, List<DeviceInfoContentBreathe>> entry : minuteMap.entrySet()) {
/* if (StringUtils.isEmpty(reportStartTime)) { if (StringUtils.isEmpty(reportStartTime)) {
reportStartTime = entry.getKey(); reportStartTime = entry.getKey();
} }
reportEndTime = entry.getKey();*/ reportEndTime = entry.getKey();
deviceInfoContentBreathes = entry.getValue(); deviceInfoContentBreathes = entry.getValue();
DeviceInfoContentBreathe.Properties breatheProperties; DeviceInfoContentBreathe.Properties breatheProperties;
...@@ -500,10 +504,10 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper, ...@@ -500,10 +504,10 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
int timeHourRange = 24; int timeHourRange = 24;
/* if (StringUtils.isNotEmpty(reportStartTime) && StringUtils.isNotEmpty(reportEndTime)) { if (StringUtils.isNotEmpty(reportStartTime) && StringUtils.isNotEmpty(reportEndTime)) {
Long durationRange = getDurationRange(reportStartTime, reportEndTime); Long durationRange = getDurationRange(reportStartTime, reportEndTime);
timeHourRange = (int) (durationRange / 60); timeHourRange = (int) (durationRange / 60);
}*/ }
// 判断是否满足配置的呼吸心率异常类型 // 判断是否满足配置的呼吸心率异常类型
BigDecimal dayBrStopRate = brStopCount == 0 ? BigDecimal.ZERO : new BigDecimal(timeHourRange).divide(new BigDecimal(brStopCount), 2, RoundingMode.HALF_UP); 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, ...@@ -610,7 +614,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;
...@@ -1030,7 +1034,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper, ...@@ -1030,7 +1034,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
elderSleep.setTenantId(tenantId); elderSleep.setTenantId(tenantId);
} }
// TODO 起床时间和入睡时间 // TODO 起床时间和入睡时间
//platElderSleepService.saveBatch(elderSleepList); platElderSleepService.saveBatch(elderSleepList);
EvaluateReportVO elderReport = saasElderReportConfigService.getByScore(totalScore); EvaluateReportVO elderReport = saasElderReportConfigService.getByScore(totalScore);
...@@ -1048,7 +1052,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper, ...@@ -1048,7 +1052,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
elderSleepAnalysis.setSleepResult(sleepReport.getResult()); elderSleepAnalysis.setSleepResult(sleepReport.getResult());
elderSleepAnalysis.setTenantId(tenantId); elderSleepAnalysis.setTenantId(tenantId);
elderSleepAnalysis.setSleepEvaluate(elderReport == null ? "" : elderReport.getEvaluate()); 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