diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/record/RecordSensorDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/record/RecordSensorDataController.java index 88a60ab..9f7feb5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/record/RecordSensorDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/record/RecordSensorDataController.java @@ -131,16 +131,6 @@ public class RecordSensorDataController { recordStatisticalTemperature.setEndRecordTime(formatter.format(new Date())); } - /*List baseSensorInfoDtos = - baseSensorInfoService.selectBaseSensorInfoList( - new BaseSensorInfo(recordStatisticalTemperature.getSensorId())); - - if (baseSensorInfoDtos.size() > 0) { - recordStatisticalTemperature.setMonitorunitId( - baseSensorInfoDtos.get(baseSensorInfoDtos.size() - 1).getMonitorunitId()); - recordStatisticalTemperature.setSensorId(null); - }*/ - String[] split = recordStatisticalTemperature.getSensorId().split(","); List recordStatisticalTemperatureList = new ArrayList<>(); for (String s : split) { @@ -180,9 +170,18 @@ public class RecordSensorDataController { series.add(seriesInfo); } } + + BigDecimal minValue = null; + BigDecimal maxValue = null; + if(recordStatisticalTemperatureList.size() > 0){ + RecordStatisticalTemperature recordStatisticalTemperature1 = recordStatisticalTemperatureList.stream().max(Comparator.comparing(RecordStatisticalTemperature::getSensorValue)).get(); + RecordStatisticalTemperature recordStatisticalTemperature2 = recordStatisticalTemperatureList.stream().min(Comparator.comparing(RecordStatisticalTemperature::getSensorValue)).get(); + minValue = recordStatisticalTemperature2.getSensorValue(); + maxValue = recordStatisticalTemperature1.getSensorValue(); + } List collect = xAxis.stream().distinct().collect(Collectors.toList()); Collections.sort(collect); - String s = JSONArray.toJSONString(new Root(legend, collect, series)); + String s = JSONArray.toJSONString(new Root(minValue,maxValue,legend, collect, series)); return s; } @@ -201,12 +200,18 @@ class Root { public Root() {} - public Root(List legend, List xAxis, List series) { + public Root(BigDecimal minValue, BigDecimal maxValue, List legend, List xAxis, List series) { + this.minValue = minValue; + this.maxValue = maxValue; this.legend = legend; this.xAxis = xAxis; this.series = series; } + private BigDecimal minValue; + + private BigDecimal maxValue; + private List legend; private List xAxis; diff --git a/ruoyi-admin/src/main/resources/templates/base/sensorInfo/sensorInfo.html b/ruoyi-admin/src/main/resources/templates/base/sensorInfo/sensorInfo.html index 9ecb246..405a577 100644 --- a/ruoyi-admin/src/main/resources/templates/base/sensorInfo/sensorInfo.html +++ b/ruoyi-admin/src/main/resources/templates/base/sensorInfo/sensorInfo.html @@ -51,7 +51,7 @@
  • - +