From c4dcb0c4cc67ebb3f22e8e8712e63b6f2b209561 Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Mon, 31 Oct 2022 18:08:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=8F=E5=B0=91=E6=95=B0=E6=8D=AE=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataResource/domain/TsingtaoDataResourceService.java | 4 ++++ .../domain/TsingtaoXHADataResourceService.java | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dataResource/domain/TsingtaoDataResourceService.java b/renren-admin/src/main/java/io/renren/modules/resource/dataResource/domain/TsingtaoDataResourceService.java index feb4d2df..3293ee83 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dataResource/domain/TsingtaoDataResourceService.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dataResource/domain/TsingtaoDataResourceService.java @@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; +import org.springframework.web.client.ResourceAccessException; import org.springframework.web.client.RestTemplate; import java.nio.charset.Charset; @@ -77,6 +78,9 @@ public class TsingtaoDataResourceService extends AbstractDataResourceService { result.put("data", objects); return result; + } catch (ResourceAccessException e) { + logger.error("青岛市资源数据接口连接超时!!!"); + return null; } catch (Exception e) { logger.error("青岛市资源数据调用失败!!!", e); return null; diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dataResource/domain/TsingtaoXHADataResourceService.java b/renren-admin/src/main/java/io/renren/modules/resource/dataResource/domain/TsingtaoXHADataResourceService.java index a8a66e95..4b2fc8bb 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dataResource/domain/TsingtaoXHADataResourceService.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dataResource/domain/TsingtaoXHADataResourceService.java @@ -11,6 +11,7 @@ import okhttp3.Request; import okhttp3.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.web.client.ResourceAccessException; import java.util.concurrent.TimeUnit; @@ -47,8 +48,12 @@ public class TsingtaoXHADataResourceService extends AbstractDataResourceService } else { logger.error("西海岸数据资源列表获取失败"); } - } catch (Exception exception) { - logger.error("西海岸数据资源列表获取失败", exception); + } catch (ResourceAccessException e) { + logger.error("西海岸资源数据接口连接超时!!!"); + return null; + } catch (Exception e) { + logger.error("西海岸资源数据调用失败!!!", e); + return null; } return result; }