From d983773edd0083d2c50848ad597e6f03e66914a9 Mon Sep 17 00:00:00 2001 From: wenjy Date: Tue, 31 May 2022 09:41:51 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E6=B8=A9=E5=BA=A6=E6=9B=B2?= =?UTF-8?q?=E7=BA=BFy=E8=BD=B4=E6=95=B0=E6=8D=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../record/RecordSensorDataController.java | 29 +++++++------ .../templates/base/sensorInfo/sensorInfo.html | 2 +- .../recordSensorData/temperatureTrend.html | 41 +------------------ 3 files changed, 20 insertions(+), 52 deletions(-) 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 @@
  • - +