Просмотр исходного кода

修复 首页获取气象信息失败的问题

zhaiyifei 11 месяцев назад
Родитель
Сommit
630c03f593

+ 1 - 24
src/main/java/com/yunfeiyun/agmp/fms/controller/FmsConsoleController.java

@@ -74,30 +74,6 @@ public class FmsConsoleController {
     @Autowired
     private WeatherService weatherService;
 
-    public void getWeather(ScreenDataReqVo reqVo, Map<String, Object> resultMap) {
-        FmsWeatherInfoResVo fmsWeatherInfoResVo = null;
-        try {
-            JSONObject resultObj = weatherService.getProjectWeather();
-            fmsWeatherInfoResVo = JSONObject.parseObject(resultObj.toString(), FmsWeatherInfoResVo.class);
-            Map<String, Object> map = new HashMap<>();
-            List<FmsWeatherInfoResVo> weatherList = new ArrayList<>();
-            JSONArray data = resultObj.getJSONArray("data");
-            if (data != null) {
-                for (int i = 0; i < data.size(); i++) {
-                    String str = data.getString(i);
-                    FmsWeatherInfoResVo weatherResVo = JSONObject.parseObject(str, FmsWeatherInfoResVo.class);
-                    weatherResVo.setCity(fmsWeatherInfoResVo.getCity());
-                    weatherResVo.setZoneProvincezh(map.get("zoneProvincezh") == null ? "" : map.get("zoneProvincezh").toString());
-                    weatherResVo.setZoneCapitalzh(map.get("zoneCapitalzh") == null ? "" : map.get("zoneCapitalzh").toString());
-                    weatherList.add(weatherResVo);
-                }
-            }
-            resultMap.put("weather", weatherList);
-        }catch (Exception e){
-            throw new BizException(ErrorCode.FMS_WEATHER_SEARCH_FAILED);
-        }
-    }
-
     /**
      * 查询节气信息
      */
@@ -142,6 +118,7 @@ public class FmsConsoleController {
             }
             resultMap.put("weather", weatherList);
         }catch (Exception e){
+            log.error("获取天气信息失败", e);
             throw new BizException(ErrorCode.FMS_WEATHER_SEARCH_FAILED);
         }