|  |  | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.util.ObjectUtils; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.HashMap; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  | import java.util.OptionalDouble; | 
 |  |  | import java.util.*; | 
 |  |  | import java.util.function.Supplier; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  | import java.util.stream.DoubleStream; | 
 |  |  | 
 |  |  |             Integer cityCode = Integer.parseInt(obj.toString()); | 
 |  |  |  | 
 |  |  |             //预测 | 
 |  |  |             List<CityWeatherForecast> cityWeatherForecasts = cityForecast.get(cityCode); | 
 |  |  |             List<CityWeatherForecast> cityWeatherForecasts = Objects.isNull(cityForecast.get(cityCode))?new ArrayList<>():cityForecast.get(cityCode); | 
 |  |  |  | 
 |  |  |             //获取城市历史气象数据 | 
 |  |  |             List<CityWeather> cityWeathers = cityHistoryWeather.get(cityCode); | 
 |  |  | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |        // forecastMapper.insertForecast(forecastList); | 
 |  |  |         if(forecastList.size()>0){ | 
 |  |  |             forecastMapper.insertForecast(forecastList); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private Double calculateAvg(List<Map<String, Object>> list, String param) { |