|
@@ -166,7 +166,6 @@ public class AppDeviceService {
|
|
|
return getEmptyResult();
|
|
|
}
|
|
|
String sensorType = monitorTarget.getSensorType();
|
|
|
-
|
|
|
// 如果传感器类型为空,直接返回空的结果
|
|
|
if (StrUtil.isBlank(sensorType)) {
|
|
|
return getEmptyResult();
|
|
@@ -176,10 +175,8 @@ public class AppDeviceService {
|
|
|
"s", "humidity", // 湿度
|
|
|
"c", "co2" // 二氧化碳
|
|
|
);
|
|
|
-
|
|
|
// 创建结果对象
|
|
|
SensorEchartDataResult result = new SensorEchartDataResult();
|
|
|
-
|
|
|
// 遍历传感器类型映射
|
|
|
AggregationWindow finalWindow = window;
|
|
|
AggregationWindow finalWindow1 = window;
|
|
@@ -188,14 +185,20 @@ public class AppDeviceService {
|
|
|
if (sensorType.toLowerCase().contains(key)) {
|
|
|
// 获取相应的数据
|
|
|
List<SensorData> sensorData = monitorDeviceService.queryDataByDeviceIdAndRoads(appDeviceQueryParams.getSensorCode(), appDeviceQueryParams.getSensorRoute(), appDeviceQueryParams.getStartTime(), appDeviceQueryParams.getEndTime(), dataType, finalWindow);
|
|
|
-
|
|
|
// 处理数据并设置到对应的字段
|
|
|
SensorEchartData echartData = SensorDataTransformer.processSensorData(sensorData, dataType, finalWindow1);
|
|
|
if ("temperature".equals(dataType)) {
|
|
|
+ echartData.setUp(monitorTarget.getTemperatureUp());
|
|
|
+ echartData.setDown(monitorTarget.getTemperatureDown());
|
|
|
result.setTemperature(echartData);
|
|
|
+
|
|
|
} else if ("humidity".equals(dataType)) {
|
|
|
+ echartData.setUp(monitorTarget.getHumidityUp());
|
|
|
+ echartData.setDown(monitorTarget.getHumidityDown());
|
|
|
result.setHumidity(echartData);
|
|
|
} else if ("co2".equals(dataType)) {
|
|
|
+ echartData.setUp(monitorTarget.getCo2Up());
|
|
|
+ echartData.setDown(monitorTarget.getCo2Down());
|
|
|
result.setCo2(echartData);
|
|
|
}
|
|
|
}
|