| | |
| | | listMap = historyMinutelyMapper.getSensorData(parameters);
|
| | | }
|
| | | List<List<Map<String, Object>>> listMaps = new ArrayList<>();
|
| | | Map<String, Object> mapAvg = new LinkedHashMap<>();
|
| | | Map<String, Object> mapMin = new LinkedHashMap<>();
|
| | | Map<String, Object> mapMax = new LinkedHashMap<>();
|
| | | List<Map<String, Object>> listMapAvg = new ArrayList<>();
|
| | | List<Map<String, Object>> listMapMin = new ArrayList<>();
|
| | | List<Map<String, Object>> listMapMax = new ArrayList<>();
|
| | | if (CollectionUtils.isNotEmpty(listMap)) {
|
| | | for (Map<String, Object> map : listMap) {
|
| | | mapAvg.put("时间", map.get("time"));
|
| | | mapMin.put("时间", map.get("time"));
|
| | | mapMax.put("时间", map.get("time"));
|
| | | Map<String, Object> mapAvg = new LinkedHashMap<>();
|
| | | Map<String, Object> mapMin = new LinkedHashMap<>();
|
| | | Map<String, Object> mapMax = new LinkedHashMap<>();
|
| | | mapAvg.put("time", map.get("time"));
|
| | | mapMin.put("time", map.get("time"));
|
| | | mapMax.put("time", map.get("time"));
|
| | | for (String key : map.keySet()) {
|
| | | for (Sensor sensor : sensors) {
|
| | | if (sensor.getSensorKey().equals(key)) {
|
| | | mapAvg.put(sensor.getDescription(), new BigDecimal(map.get(key).toString()).stripTrailingZeros().toPlainString() + sensor.getUnit());
|
| | | mapAvg.put(key, new BigDecimal(map.get(key).toString()).stripTrailingZeros().toPlainString() + sensor.getUnit());
|
| | | } else if (("min" + sensor.getSensorKey()).equals(key)) {
|
| | | mapMin.put(sensor.getDescription(), new BigDecimal(map.get(key).toString().replace("\"", "")).stripTrailingZeros().toPlainString());
|
| | | mapMin.put(key.substring(3), new BigDecimal(map.get(key).toString().replace("\"", "")).stripTrailingZeros().toPlainString());
|
| | | } else if (("max" + sensor.getSensorKey()).equals(key)) {
|
| | | mapMax.put(sensor.getDescription(), new BigDecimal(map.get(key).toString().replace("\"", "")).stripTrailingZeros().toPlainString());
|
| | | mapMax.put(key.substring(3), new BigDecimal(map.get(key).toString().replace("\"", "")).stripTrailingZeros().toPlainString());
|
| | | }
|
| | | }
|
| | | }
|
| | | listMapAvg.add(mapAvg);
|
| | | listMapMin.add(mapMin);
|
| | | listMapMax.add(mapMax);
|
| | | mapAvg = new LinkedHashMap<>();
|
| | | mapMin = new LinkedHashMap<>();
|
| | | mapMax = new LinkedHashMap<>();
|
| | | }
|
| | | listMaps.add(listMapAvg);
|
| | | listMaps.add(listMapMin);
|