ソースを参照

获取天气添加日志

tags/v1.2.0^2
wanjing 1年前
コミット
08ec86cf5b
1個のファイルの変更4行の追加3行の削除
  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 ファイルの表示

@@ -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);

読み込み中…
キャンセル
保存