Pārlūkot izejas kodu

获取天气添加日志

tags/v1.2.0^2
wanjing pirms 1 gada
vecāks
revīzija
08ec86cf5b
1 mainītis faili ar 4 papildinājumiem un 3 dzēšanām
  1. +4
    -3
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java

+ 4
- 3
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java Parādīt failu

@@ -222,11 +222,9 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper,
String url = CommonConfig.airportURL + "/api/airportInterface/getWeather";
String param = "airportId=" + airportId;
String weatherStr = HttpUtils.sendGet(url, param);
log.info("获取天气信息,weatherStr={}", weatherStr);
JsonResult jsonResult;
try {
jsonResult = JacksonUtil.json2pojo(weatherStr, JsonResult.class);
log.info("获取天气信息,jsonResult={}", jsonResult);
if (ObjectUtil.isEmpty(jsonResult) || Objects.requireNonNull(jsonResult).getCode() != 0) {
log.info("获取天气信息失败,返回为空或code不为0");
log.info("获取天气信息失败,url={}", url);
@@ -237,7 +235,10 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper,
log.info("获取天气信息,返回数据为空");
return new AirWeatherVO();
}
return JSONObject.parseObject(JSONObject.toJSONString(jsonResult.getData()), AirWeatherVO.class);
log.info("获取天气信息,jsonResult Data={}", jsonResult.getData());
AirWeatherVO airWeatherVO = JSONObject.parseObject(JSONObject.toJSONString(jsonResult.getData()), AirWeatherVO.class);
log.info("获取天气信息,airWeatherVO={}", airWeatherVO);
return airWeatherVO;
} catch (Exception e) {
log.info("获取天气信息异常,url={}", url);
log.info("获取天气信息异常,param={}", param);

Notiek ielāde…
Atcelt
Saglabāt