|
@@ -109,19 +109,19 @@ public class AppDeviceService {
|
|
|
float temperatureUp = Math.abs(appDeviceData.getTemperatureUp() - sensorData.getTemperature());
|
|
|
float temperatureDown = Math.abs(appDeviceData.getTemperatureDown() - sensorData.getTemperature());
|
|
|
appDeviceData.setTemperatureStatus(getDataStatus(temperatureUp, temperatureDown,
|
|
|
- appDeviceData.getTemperatureUp(), appDeviceData.getTemperatureDown(), sensorData));
|
|
|
+ appDeviceData.getTemperatureUp(), appDeviceData.getTemperatureDown(), sensorData.getTemperature()));
|
|
|
}
|
|
|
if (Objects.nonNull(sensorData.getHumidity())) {
|
|
|
float humidityUp = Math.abs(appDeviceData.getHumidityUp() - sensorData.getHumidity());
|
|
|
float humidityDown = Math.abs(appDeviceData.getHumidityDown() - sensorData.getHumidity());
|
|
|
appDeviceData.setHumidityStatus(getDataStatus(humidityUp, humidityDown,
|
|
|
- appDeviceData.getHumidityUp(), appDeviceData.getHumidityDown(), sensorData));
|
|
|
+ appDeviceData.getHumidityUp(), appDeviceData.getHumidityDown(), sensorData.getHumidity()));
|
|
|
}
|
|
|
if (Objects.nonNull(sensorData.getCo2())) {
|
|
|
float co2Up = Math.abs(appDeviceData.getCo2Up() - sensorData.getCo2());
|
|
|
float co2Down = Math.abs(appDeviceData.getCo2Down() - sensorData.getCo2());
|
|
|
appDeviceData.setCo2Status(getDataStatus(co2Up, co2Down,
|
|
|
- appDeviceData.getCo2Up(), appDeviceData.getCo2Down(), sensorData));
|
|
|
+ appDeviceData.getCo2Up(), appDeviceData.getCo2Down(), sensorData.getCo2()));
|
|
|
}
|
|
|
appDeviceData.setHumidity(sensorData.getHumidity());
|
|
|
appDeviceData.setTemperature(sensorData.getTemperature());
|
|
@@ -155,19 +155,19 @@ public class AppDeviceService {
|
|
|
return pageResult;
|
|
|
}
|
|
|
|
|
|
- private static String getDataStatus(float absUp, float absDown, float up, float down, SensorData sensorData) {
|
|
|
+ private static String getDataStatus(float absUp, float absDown, float up, float down, float figures) {
|
|
|
if (absUp < absDown) {
|
|
|
- if (up > sensorData.getTemperature() && absUp > 5) {
|
|
|
+ if (up > figures && absUp > 5) {
|
|
|
return "0";
|
|
|
- } else if (up > sensorData.getTemperature() && absUp <= 5) {
|
|
|
+ } else if (up > figures && absUp <= 5) {
|
|
|
return "1";
|
|
|
} else {
|
|
|
return "2";
|
|
|
}
|
|
|
} else {
|
|
|
- if (down < sensorData.getTemperature() && absDown > 5) {
|
|
|
+ if (down < figures && absDown > 5) {
|
|
|
return "0";
|
|
|
- } else if (down < sensorData.getTemperature() && absDown <= 5) {
|
|
|
+ } else if (down < figures && absDown <= 5) {
|
|
|
return "1";
|
|
|
} else {
|
|
|
return "2";
|