| | |
| | | List<Double> data = new ArrayList<>(); |
| | | for (Map<String, Object> dataMap : list) { |
| | | Map<String, Object> dataValue = JSONObject.parseObject((String) dataMap.get("value"), Map.class); |
| | | if (ObjectUtils.isEmpty(dataValue.get(Constants.SENSOR_CODE_O3))){ |
| | | continue; |
| | | } |
| | | Double o3 = Double.parseDouble(dataValue.get(Constants.SENSOR_CODE_O3).toString()); |
| | | |
| | | //O3数据标记位 |
| | |
| | | public static double percentile(List<Double> data, int p) { |
| | | int n = data.size(); |
| | | Collections.sort(data); |
| | | double v = n / (100 / p); |
| | | if (n % (100 / p) == 0) { |
| | | if (v == n) { |
| | | return data.get(n - 1); |
| | | } |
| | | return (data.get((int) v - 1) + data.get((int) v)) / 2; |
| | | } |
| | | double v = MathUtils.division(MathUtils.mul(n, p),100d,1); |
| | | v = Math.ceil(v)-1; |
| | | return sciCal(data.get((int) v), 4); |
| | | } |
| | | |
| | | |
| | | |
| | | //一氧化碳周月均值计算 |
| | | public static Map<String, Object> getCOAvgOfWeekOrMonth(Map<String, Object> params) { |
| | | Map<String, Object> result = new HashMap<>(); |