Commit 820ffaaa by huangjy

fix:log

parent 6e9fb814
...@@ -143,6 +143,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper, ...@@ -143,6 +143,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
continue; continue;
} }
String tenantId = elder.getTenantId(); String tenantId = elder.getTenantId();
String reportStartTime = "";
String reportEndTime = "";
for (String hourRange : dayHourRangeList) { for (String hourRange : dayHourRangeList) {
String[] hourRangeArray = hourRange.split("~"); String[] hourRangeArray = hourRange.split("~");
List<DeviceOperationLogEntity> deviceOperationLogEntities = productDeviceService.getDeviceLogByTimeRange(platRoomBedDevice.getDeviceId(), "reportProperty", 5000, hourRangeArray[0], hourRangeArray[1]); List<DeviceOperationLogEntity> deviceOperationLogEntities = productDeviceService.getDeviceLogByTimeRange(platRoomBedDevice.getDeviceId(), "reportProperty", 5000, hourRangeArray[0], hourRangeArray[1]);
...@@ -163,7 +165,13 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper, ...@@ -163,7 +165,13 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
List<DeviceInfoContentBreathe> deviceInfoContentBreathes; List<DeviceInfoContentBreathe> deviceInfoContentBreathes;
// 统计每小时的体动和翻身 // 统计每小时的体动和翻身
Map<String, AnalysisVO> statisticsMap = Maps.newHashMap(); Map<String, AnalysisVO> statisticsMap = Maps.newHashMap();
for (Map.Entry<String, List<DeviceInfoContentBreathe>> entry : minuteMap.entrySet()) { for (Map.Entry<String, List<DeviceInfoContentBreathe>> entry : minuteMap.entrySet()) {
if (StringUtils.isEmpty(reportStartTime)) {
reportStartTime = entry.getKey();
}
reportEndTime = entry.getKey();
deviceInfoContentBreathes = entry.getValue(); deviceInfoContentBreathes = entry.getValue();
DeviceInfoContentBreathe.Properties breatheProperties; DeviceInfoContentBreathe.Properties breatheProperties;
Integer bodymove; Integer bodymove;
...@@ -453,12 +461,19 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper, ...@@ -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 dayBrStopRate = brStopCount == 0 ? BigDecimal.ZERO : new BigDecimal(timeHourRange).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 dayBrSlowRate = brSlowCount == 0 ? BigDecimal.ZERO : new BigDecimal(timeHourRange).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 dayBrFastRate = brFastCount == 0 ? BigDecimal.ZERO : new BigDecimal(timeHourRange).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 dayHrFastRate = hrFastCount == 0 ? BigDecimal.ZERO : new BigDecimal(timeHourRange).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 dayHrSlowRate = hrSlowCount == 0 ? BigDecimal.ZERO : new BigDecimal(timeHourRange).divide(new BigDecimal(hrSlowCount), 2, RoundingMode.HALF_UP);
boolean brStopFlag = false; boolean brStopFlag = false;
boolean brFastFlag = false; boolean brFastFlag = false;
...@@ -537,8 +552,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper, ...@@ -537,8 +552,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 / 86400)); platElderBreatheAnalysis.setAvgBreatheRate(String.valueOf(dayTotalBr / (timeHourRange * 60 * 60)));
platElderBreatheAnalysis.setAvgHeartRate(String.valueOf(dayTotalHr / 86400)); platElderBreatheAnalysis.setAvgHeartRate(String.valueOf(dayTotalHr / (timeHourRange * 60 * 60)));
platElderBreatheAnalysis.setBreatheScore(finalReport.getScore()); platElderBreatheAnalysis.setBreatheScore(finalReport.getScore());
platElderBreatheAnalysis.setHappenDate(currentDate); platElderBreatheAnalysis.setHappenDate(currentDate);
platElderBreatheAnalysis.setTenantId(tenantId); platElderBreatheAnalysis.setTenantId(tenantId);
......
...@@ -91,15 +91,6 @@ public class IotSyncTask { ...@@ -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) { 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)); Map<String, PlatDevice> deviceMap = deviceList.stream().collect(Collectors.toMap(PlatDevice::getOriDeviceId, v -> v, (a, b) -> a));
iotDeviceList.forEach(iotDevice -> { 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