From 3fbe2ea2ffaf92bcbda725200273d6c8e1eed5ab Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 19:12:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A5=BF=E6=B5=B7=E5=B2=B8=E6=8E=A5=E5=8F=A3?= =?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 --- .../resource/service/impl/ResourceServiceImpl.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 41db710e..707177bb 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -257,12 +257,14 @@ public class ResourceServiceImpl extends CrudServiceImpl { // 云脑专网 OkHttpClient client = new OkHttpClient(); - String url = String.format(tsingtao_xhaProperties.getCloudcam(), resourceDTO.getName(), pageNum, pageSize); + String url = String.format(tsingtao_xhaProperties.getCloudcam(), org.apache.commons.lang3.StringUtils.isNotEmpty(resourceDTO.getName()) ? resourceDTO.getName() : "", pageNum, pageSize); logger.info(url); Request request = new Request.Builder().url(url).build(); try (Response response = client.newCall(request).execute()) { if (response.isSuccessful()) { - JSONObject jsonObject_ = JSON.parseObject(response.body().string()); + String body = response.body().string(); + JSONObject jsonObject_ = JSON.parseObject(body); + logger.info("西海岸接口返回:{}" + body, url); if (jsonObject_.containsKey("data")) { if (jsonObject_.getJSONObject("data").containsKey("list")) { resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total")); @@ -296,12 +298,14 @@ public class ResourceServiceImpl extends CrudServiceImpl { // 金宏网 OkHttpClient client = new OkHttpClient(); - String url = String.format(tsingtao_xhaProperties.getLocalcam(), resourceDTO.getName(), pageNum, pageSize); + String url = String.format(tsingtao_xhaProperties.getLocalcam(), org.apache.commons.lang3.StringUtils.isNotEmpty(resourceDTO.getName()) ? resourceDTO.getName() : "", pageNum, pageSize); logger.info(url); Request request = new Request.Builder().url(url).build(); try (Response response = client.newCall(request).execute()) { if (response.isSuccessful()) { - JSONObject jsonObject_ = JSON.parseObject(response.body().string()); + String body = response.body().string(); + JSONObject jsonObject_ = JSON.parseObject(body); + logger.info("西海岸接口返回:{}" + body, url); if (jsonObject_.containsKey("data")) { if (jsonObject_.getJSONObject("data").containsKey("list")) { resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total"));