| | |
| | | //根据传过来的省市区,定位到区码cityId |
| | | Integer cityId = getId2(city); |
| | | if(cityId==0){ |
| | | model.setMsg("暂不支持当前城市天气查询"); |
| | | model.setII(0,"暂不支持当前城市天气查询"); |
| | | }else { |
| | | //首先从ApplicationContext中获取,如果不存在,则请求第三方接口,同时将值存入 |
| | | ServletContext application = ActionUtil.getApplication(); |
| | |
| | | |
| | | public Integer getId2(WeatherCity city){ |
| | | WeatherCity weatherCity = weatherCityMapper.getWeatherCity2(city); |
| | | //当前区不存在,则查询上一级市的 |
| | | if (weatherCity==null){ |
| | | WeatherCity weatherCity1 = weatherCityMapper.getWeatherCity(city); |
| | | city.setDistrict(city.getCity().replace("市","")); |
| | | WeatherCity weatherCity1 = weatherCityMapper.getWeatherCity2(city); |
| | | if (weatherCity1==null){ |
| | | return 0; |
| | | }else { |