fengxiang
2018-03-26 646e30ea0b94d90668482f7dd34da21777be4be8
数据查询 越界处理
1 files modified
10 ■■■■ changed files
src/main/java/com/moral/service/impl/HistoryMinutelyServiceImpl.java 10 ●●●● patch | view | raw | blame | history
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;