Commit 820ffaaa by huangjy

fix:log

parent 6e9fb814
......@@ -143,6 +143,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
continue;
}
String tenantId = elder.getTenantId();
String reportStartTime = "";
String reportEndTime = "";
for (String hourRange : dayHourRangeList) {
String[] hourRangeArray = hourRange.split("~");
List<DeviceOperationLogEntity> deviceOperationLogEntities = productDeviceService.getDeviceLogByTimeRange(platRoomBedDevice.getDeviceId(), "reportProperty", 5000, hourRangeArray[0], hourRangeArray[1]);
......@@ -163,7 +165,13 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
List<DeviceInfoContentBreathe> deviceInfoContentBreathes;
// 统计每小时的体动和翻身
Map<String, AnalysisVO> statisticsMap = Maps.newHashMap();
for (Map.Entry<String, List<DeviceInfoContentBreathe>> entry : minuteMap.entrySet()) {
if (StringUtils.isEmpty(reportStartTime)) {
reportStartTime = entry.getKey();
}
reportEndTime = entry.getKey();
deviceInfoContentBreathes = entry.getValue();
DeviceInfoContentBreathe.Properties breatheProperties;
Integer bodymove;
......@@ -453,12 +461,19 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
}
int timeHourRange = 24;
if (StringUtils.isNotEmpty(reportStartTime) && StringUtils.isNotEmpty(reportEndTime)) {
Long durationRange = getDurationRange(reportStartTime, reportEndTime);
timeHourRange = (int) (durationRange / 60);
}
// 判断是否满足配置的呼吸心率异常类型
BigDecimal dayBrStopRate = brStopCount == 0 ? BigDecimal.ZERO : new BigDecimal(24).divide(new BigDecimal(brStopCount), 2, RoundingMode.HALF_UP);
BigDecimal dayBrSlowRate = brSlowCount == 0 ? BigDecimal.ZERO : new BigDecimal(24).divide(new BigDecimal(brSlowCount), 2, RoundingMode.HALF_UP);
BigDecimal dayBrFastRate = brFastCount == 0 ? BigDecimal.ZERO : new BigDecimal(24).divide(new BigDecimal(brFastCount), 2, RoundingMode.HALF_UP);
BigDecimal dayHrFastRate = hrFastCount == 0 ? BigDecimal.ZERO : new BigDecimal(24).divide(new BigDecimal(hrFastCount), 2, RoundingMode.HALF_UP);
BigDecimal dayHrSlowRate = hrSlowCount == 0 ? BigDecimal.ZERO : new BigDecimal(24).divide(new BigDecimal(hrSlowCount), 2, RoundingMode.HALF_UP);
BigDecimal dayBrStopRate = brStopCount == 0 ? BigDecimal.ZERO : new BigDecimal(timeHourRange).divide(new BigDecimal(brStopCount), 2, RoundingMode.HALF_UP);
BigDecimal dayBrSlowRate = brSlowCount == 0 ? BigDecimal.ZERO : new BigDecimal(timeHourRange).divide(new BigDecimal(brSlowCount), 2, RoundingMode.HALF_UP);
BigDecimal dayBrFastRate = brFastCount == 0 ? BigDecimal.ZERO : new BigDecimal(timeHourRange).divide(new BigDecimal(brFastCount), 2, RoundingMode.HALF_UP);
BigDecimal dayHrFastRate = hrFastCount == 0 ? BigDecimal.ZERO : new BigDecimal(timeHourRange).divide(new BigDecimal(hrFastCount), 2, RoundingMode.HALF_UP);
BigDecimal dayHrSlowRate = hrSlowCount == 0 ? BigDecimal.ZERO : new BigDecimal(timeHourRange).divide(new BigDecimal(hrSlowCount), 2, RoundingMode.HALF_UP);
boolean brStopFlag = false;
boolean brFastFlag = false;
......@@ -537,8 +552,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
// 插入呼吸分析表
PlatElderBreatheAnalysis platElderBreatheAnalysis = new PlatElderBreatheAnalysis();
platElderBreatheAnalysis.setElderId(elder.getId());
platElderBreatheAnalysis.setAvgBreatheRate(String.valueOf(dayTotalBr / 86400));
platElderBreatheAnalysis.setAvgHeartRate(String.valueOf(dayTotalHr / 86400));
platElderBreatheAnalysis.setAvgBreatheRate(String.valueOf(dayTotalBr / (timeHourRange * 60 * 60)));
platElderBreatheAnalysis.setAvgHeartRate(String.valueOf(dayTotalHr / (timeHourRange * 60 * 60)));
platElderBreatheAnalysis.setBreatheScore(finalReport.getScore());
platElderBreatheAnalysis.setHappenDate(currentDate);
platElderBreatheAnalysis.setTenantId(tenantId);
......
......@@ -91,15 +91,6 @@ public class IotSyncTask {
}
@Scheduled(cron = "0 0 */1 * * ?")
public void syncDeviceLog() {
log.info("开始同步设备日志");
log.info("同步设备日志结束");
}
private Collection<PlatDevice> convertToPlatDevice(List<DeviceInstanceEntity> iotDeviceList, List<PlatDevice> deviceList, String tenantId, Map<String, String> dicNameIdMap) {
Map<String, PlatDevice> deviceMap = deviceList.stream().collect(Collectors.toMap(PlatDevice::getOriDeviceId, v -> v, (a, b) -> a));
iotDeviceList.forEach(iotDevice -> {
......
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