Commit ee3d59e7 by huangjy

fix:修改bug

parent e68c8873
...@@ -238,21 +238,23 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -238,21 +238,23 @@ public class IotProductDeviceService extends IotCommonService {
int br = 0; int br = 0;
int hr = 0; int hr = 0;
long timestamp = 0; long timestamp = 0;
int noPersonCount = 0;
for (DeviceInfoContentBreathe deviceInfoContentBreathe : deviceInfoContentBreathes) { for (DeviceInfoContentBreathe deviceInfoContentBreathe : deviceInfoContentBreathes) {
timestamp = deviceInfoContentBreathe.getTimestamp();
breatheProperties = deviceInfoContentBreathe.getProperties(); breatheProperties = deviceInfoContentBreathe.getProperties();
if (breatheProperties.getPerson() == 0) { if (breatheProperties.getPerson() == 0) {
noPersonCount++;
continue; continue;
} }
hr += breatheProperties.getHr(); hr += breatheProperties.getHr();
br += breatheProperties.getBr(); br += breatheProperties.getBr();
bodymove += breatheProperties.getBodymove(); bodymove += breatheProperties.getBodymove();
timestamp = deviceInfoContentBreathe.getTimestamp();
} }
temp = new DeviceInfoContentBreathe(); temp = new DeviceInfoContentBreathe();
tempProperties = new DeviceInfoContentBreathe.Properties(); tempProperties = new DeviceInfoContentBreathe.Properties();
tempProperties.setHr(hr / 60); tempProperties.setHr(noPersonCount == 60 ? 0 : hr / (60 - noPersonCount));
tempProperties.setBr(br / 60); tempProperties.setBr(noPersonCount == 60 ? 0 : br / (60 - noPersonCount));
tempProperties.setBodymove(bodymove / 60); tempProperties.setBodymove(noPersonCount == 60 ? 0 : bodymove / (60- noPersonCount));
temp.setTimestamp(timestamp); temp.setTimestamp(timestamp);
temp.setProperties(tempProperties); temp.setProperties(tempProperties);
tempList.add(temp); tempList.add(temp);
......
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