|  |  |  | 
|---|
|  |  |  | QueryWrapper<CityAqi> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | wrapper.select("city_code", "time", "value") | 
|---|
|  |  |  | .ge("time", DateUtils.dateToDateString(start)) | 
|---|
|  |  |  | .le("time", DateUtils.dateToDateString(end)); | 
|---|
|  |  |  | .lt("time", DateUtils.dateToDateString(end)); | 
|---|
|  |  |  | List<Map<String, Object>> dailyData = cityAqiService.listMaps(wrapper); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (dailyData.size() == 0) { | 
|---|
|  |  |  | 
|---|
|  |  |  | CityAqiDaily cityAqiDaily = new CityAqiDaily(); | 
|---|
|  |  |  | cityAqiDaily.setCityCode(Integer.parseInt(cityCode)); | 
|---|
|  |  |  | cityAqiDaily.setTime(start); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //中间变量,用于计算除臭氧外其它因子 | 
|---|
|  |  |  | List<Map<String, Object>> tempValue = new ArrayList<>(value); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //移除第一天数据(0点的),O3滑动值第一条数据是从1点-8点 | 
|---|
|  |  |  | value.removeIf(map -> ((Date) map.get("time")).getTime() == start.getTime()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //O3日均值单独计算,滑动值算法 | 
|---|
|  |  |  | Double o3OfDay = AmendUtils.o3OfDay(value); | 
|---|
|  |  |  | if (o3OfDay != null) { | 
|---|
|  |  |  | jsonMap.put("O3", o3OfDay); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(value)) { | 
|---|
|  |  |  | Double o3OfDay = AmendUtils.o3OfDay(value); | 
|---|
|  |  |  | if (o3OfDay != null) { | 
|---|
|  |  |  | jsonMap.put("O3", o3OfDay); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //除臭氧外其他因子均值计算 | 
|---|
|  |  |  | tempValue.removeIf(o -> ((Date) o.get("time")).getTime() == end.getTime()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | sensors.forEach(sensor -> { | 
|---|
|  |  |  | OptionalDouble optionalDouble = tempValue.parallelStream().flatMapToDouble(v -> { | 
|---|
|  |  |  | OptionalDouble optionalDouble = value.parallelStream().flatMapToDouble(v -> { | 
|---|
|  |  |  | Map<String, Object> dataValue = JSONObject.parseObject((String) v.get("value"), Map.class); | 
|---|
|  |  |  | Object sensorValue = dataValue.get(sensor); | 
|---|
|  |  |  | if (ObjectUtils.isEmpty(sensorValue)) { | 
|---|