|  |  |  | 
|---|
|  |  |  | dataMap.put("mac", mac); | 
|---|
|  |  |  | dataMap.put("time", start); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //中间变量,用于计算除臭氧外其它因子 | 
|---|
|  |  |  | List<Map<String, Object>> tempValue = new ArrayList<>(value); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //移除第一天数据(0点的),O3滑动值第一条数据是从1点-8点 | 
|---|
|  |  |  | value.removeIf(map -> ((Date) map.get("time")).getTime() == start.getTime()); | 
|---|
|  |  |  | Map<String, Object> params = new HashMap<>(); | 
|---|
|  |  |  | params.put("data", value); | 
|---|
|  |  |  | params.put("type", "day"); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(o3AvgOfDay)) { | 
|---|
|  |  |  | jsonMap.putAll(o3AvgOfDay); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //除臭氧外其他因子均值计算 | 
|---|
|  |  |  | tempValue.removeIf(o -> ((Date) o.get("time")).getTime() == end.getTime()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //风向均值计算并修约 | 
|---|
|  |  |  | params.put("data", tempValue); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> windDirAvg = AmendUtils.getWindDirAvg(params); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(windDirAvg)) { | 
|---|
|  |  |  | jsonMap.putAll(windDirAvg); | 
|---|
|  |  |  | 
|---|
|  |  |  | String sensorCode = sensor.getCode(); | 
|---|
|  |  |  | Double upper = sensor.getUpper(); | 
|---|
|  |  |  | Double lower = sensor.getLower(); | 
|---|
|  |  |  | OptionalDouble optionalDouble = tempValue.parallelStream() | 
|---|
|  |  |  | OptionalDouble optionalDouble = value.parallelStream() | 
|---|
|  |  |  | .flatMapToDouble(v -> { | 
|---|
|  |  |  | Map<String, Object> dataValue = JSONObject.parseObject((String) v.get("value"), Map.class); | 
|---|
|  |  |  | Object sensorValue = dataValue.get(sensorCode); | 
|---|
|  |  |  | 
|---|
|  |  |  | //剔除数据超过上下限的数据 | 
|---|
|  |  |  | double aDouble = Double.parseDouble(sensorValue.toString()); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(upper)) { | 
|---|
|  |  |  | if (aDouble < upper) { | 
|---|
|  |  |  | if (aDouble > upper) { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(lower)) { | 
|---|
|  |  |  | if (aDouble > lower) { | 
|---|
|  |  |  | if (aDouble < lower) { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|