From 646e30ea0b94d90668482f7dd34da21777be4be8 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Mon, 26 Mar 2018 14:12:56 +0800 Subject: [PATCH] 数据查询 越界处理 --- src/main/java/com/moral/service/impl/HistoryMinutelyServiceImpl.java | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/moral/service/impl/HistoryMinutelyServiceImpl.java b/src/main/java/com/moral/service/impl/HistoryMinutelyServiceImpl.java index a35f50d..984d382 100644 --- a/src/main/java/com/moral/service/impl/HistoryMinutelyServiceImpl.java +++ b/src/main/java/com/moral/service/impl/HistoryMinutelyServiceImpl.java @@ -477,7 +477,7 @@ } /** - * ������������������������������������������������������������������ + * ������������������������������������������������������������������,������ ������������������ * @param sensorKeys * @param timePeriod * @param dataCondition @@ -508,8 +508,12 @@ // list to map int finalN = n; sensorKeys.forEach(sensorKey -> { - Double sensorValue = rowData.get(sensorKey)!= null?new Double(rowData.get(sensorKey).toString()):null; - lineChartDatasWithEmpty.get(sensorKey).set(finalN,sensorValue); + Object value = rowData.get(sensorKey); + List<Double> lineChartDatasWithEmptyTemp = lineChartDatasWithEmpty.get(sensorKey); + if(finalN < lineChartDatasWithEmptyTemp.size()){ + Double sensorValue = value!= null?new Double(value.toString()):null; + lineChartDatasWithEmptyTemp.set(finalN,sensorValue); + } }); // ������ -1��������������� m = m<dataLength ? m+1 : -1; -- Gitblit v1.8.0