| | |
| | | @Override
|
| | | public List<List<Map<String, Object>>> getSensorData(Map<String, Object> parameters) {
|
| | | String startTime = parameters.get("startTime").toString();
|
| | | Boolean flag = null;
|
| | | Boolean flag = false;
|
| | | try {
|
| | | flag = DateUtils.isSameDay(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(startTime), new Date());
|
| | | } catch (ParseException e) {
|
| | |
| | | mapAvg.put("time", map.get("time"));
|
| | | mapMin.put("time", map.get("time"));
|
| | | mapMax.put("time", map.get("time"));
|
| | | for (String key : map.keySet()) {
|
| | | for (Entry<String,Object> entry : map.entrySet()) {
|
| | | for (Sensor sensor : sensors) {
|
| | | if (sensor.getSensorKey().equals(key)) {
|
| | | mapAvg.put(key, new BigDecimal(map.get(key).toString()).stripTrailingZeros().toPlainString() + sensor.getUnit());
|
| | | } else if (("min" + sensor.getSensorKey()).equals(key)) {
|
| | | mapMin.put(key.substring(3), new BigDecimal(map.get(key).toString().replace("\"", "")).stripTrailingZeros().toPlainString());
|
| | | } else if (("max" + sensor.getSensorKey()).equals(key)) {
|
| | | mapMax.put(key.substring(3), new BigDecimal(map.get(key).toString().replace("\"", "")).stripTrailingZeros().toPlainString());
|
| | | if (sensor.getSensorKey().equals(entry.getKey())) {
|
| | | mapAvg.put(entry.getKey(), new BigDecimal(entry.getValue().toString()).stripTrailingZeros().toPlainString() + sensor.getUnit());
|
| | | } else if (("min" + sensor.getSensorKey()).equals(entry.getKey())) {
|
| | | mapMin.put(entry.getKey().substring(3), new BigDecimal(entry.getValue().toString().replace("\"", "")).stripTrailingZeros().toPlainString());
|
| | | } else if (("max" + sensor.getSensorKey()).equals(entry.getKey())) {
|
| | | mapMax.put(entry.getKey().substring(3), new BigDecimal(entry.getValue().toString().replace("\"", "")).stripTrailingZeros().toPlainString());
|
| | | }
|
| | | }
|
| | | }
|