change - 设备监控温度曲线修改

main
wenjy 3 years ago
parent 7c8c8f8edb
commit e9894f2c0b

@ -49,6 +49,16 @@ public class RecordSensorDataController {
@GetMapping("/getTemperatureTrend")
public String getTemperatureTrend(@RequestParam("id") String id, ModelMap mmap) {
mmap.put("sensorId", id);
String s = id.split(",")[0];
List<BaseSensorInfoDto> baseSensorInfoDtos = baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo(id.split(",")[0]));
if(baseSensorInfoDtos.size()>0){
List<BaseSensorInfoDto> baseSensorInfoDtos1 = baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo(null, null, null, baseSensorInfoDtos.get(0).getMonitorunitId()));
mmap.put("type", baseSensorInfoDtos1);
}
return prefix + "/temperatureTrend";
}
@ -121,7 +131,7 @@ public class RecordSensorDataController {
recordStatisticalTemperature.setEndRecordTime(formatter.format(new Date()));
}
List<BaseSensorInfoDto> baseSensorInfoDtos =
/*List<BaseSensorInfoDto> baseSensorInfoDtos =
baseSensorInfoService.selectBaseSensorInfoList(
new BaseSensorInfo(recordStatisticalTemperature.getSensorId()));
@ -129,15 +139,22 @@ public class RecordSensorDataController {
recordStatisticalTemperature.setMonitorunitId(
baseSensorInfoDtos.get(baseSensorInfoDtos.size() - 1).getMonitorunitId());
recordStatisticalTemperature.setSensorId(null);
}
}*/
String[] split = recordStatisticalTemperature.getSensorId().split(",");
List<RecordStatisticalTemperature> recordStatisticalTemperatureList = new ArrayList<>();
for (String s : split) {
recordStatisticalTemperature.setSensorId(s);
List<RecordStatisticalTemperature> recordStatisticalTemperatures =
iRecordSensorDataService.selectRecordStatisticalTemperatureList(
recordStatisticalTemperature);
if (recordStatisticalTemperatures.size() > 0) {
recordStatisticalTemperatureList.addAll(recordStatisticalTemperatures);
}
if (recordStatisticalTemperatureList.size() > 0) {
Map<String, List<RecordStatisticalTemperature>> collect =
recordStatisticalTemperatures.stream()
recordStatisticalTemperatureList.stream()
.collect(Collectors.groupingBy(RecordStatisticalTemperature::getSensorName));
for (Map.Entry<String, List<RecordStatisticalTemperature>> stringListEntry :

@ -2,6 +2,24 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('传感器数据趋势')"/>
<th:block th:include="include :: select2-css" />
<style>
.select2-container--bootstrap .select2-selection--multiple .select2-selection__rendered {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
display: block;
line-height: 1.42857143;
list-style: none;
margin: 0;
overflow: hidden;
padding: 0;
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
</head>
<body class="gray-bg">
<div class="container-div">
@ -31,6 +49,13 @@
</select>
</li>
<li>
<label class="font-noraml">传感器:</label>
<select id="sensoridArray" class="form-control select2-multiple" multiple>
<option th:each="dict : ${type}" th:text="${dict.sensorName}"th:value="${dict.sensorId}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="searchOnclick()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
@ -64,6 +89,7 @@
<th:block th:include="include :: FileSaver-xlsx-Base64-js"/>
<th:block th:include="include :: echarts-js"/>
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
@ -86,13 +112,23 @@
const searchOnclick = function () {
tableRefresh();
temperatureTrend();
}
/*曲线趋势*/
const temperatureTrend = function () {
let sensorId = [[${sensorId}]].split(",");
let formData = new FormData();
let sensorIdlist = $("#sensoridArray").val();
if(sensorIdlist.length > 0) {
formData.append("sensorId", sensorIdlist);
}else{
formData.append("sensorId", sensorId[0]);
}
formData.append("beginRecordTime", $("#startTime").val());
formData.append("endRecordTime", $("#endTime").val());

@ -88,7 +88,7 @@
</insert>
<select id="selectRecordStatisticalTemperatureList" fetchSize="50000" parameterType="RecordStatisticalTemperature" resultMap="RecordStatisticalTemperatureResult">
select t2.sensorId,t1.Sensor_Name as sensorName,t2.sensorValue,t2.recordTime
<!--select t2.sensorId,t1.Sensor_Name as sensorName,t2.sensorValue,t2.recordTime
from base_sensor_info t1
left join record_statisticaltemperature t2 on t1.Sensor_Id = t2.sensorId
<where>
@ -98,7 +98,19 @@
#{beginRecordTime} and #{endRecordTime}
</if>
</where>
order by t2.recordTime
order by t2.recordTime-->
select t2.sensorId, t1.Sensor_Name as sensorName, t2.value as sensorValue, t2.collectTime as recordTime
from base_sensor_info t1
left join record_temperature t2 on t1.Sensor_Id = t2.sensorId
<where>
<if test="monitorunitId != null and monitorunitId != ''">and t1.MonitorUnit_Id = #{monitorunitId}</if>
<if test="sensorId != null and sensorId != ''">and t2.sensorId = #{sensorId}</if>
<if test="beginRecordTime != null and beginRecordTime != '' and endRecordTime != null and endRecordTime != '' ">and t2.collectTime between
#{beginRecordTime} and #{endRecordTime}
</if>
</where>
order by t2.collectTime
</select>

Loading…
Cancel
Save