diff --git a/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java b/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java index 7d9e38e..877445c 100644 --- a/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java +++ b/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java @@ -145,8 +145,12 @@ public class IndexServiceImpl implements IndexService { try { String result = warnUtil.call(WarnInfo.get7DayWarnTrend.getUrl(), "GET"); - log.info("result:"+result); - return new GeneralResult(true, "查询成功"); + JSONObject jsonObject = JSONObject.parseObject(result); + if (!"200".equals(jsonObject.getString("code"))) { + log.info("result:" + result); + return new GeneralResult(false, "查询失败"); + } + return new GeneralResult(true, jsonObject, "查询成功"); } catch (Exception e) { log.info("查询失败", e); return new GeneralResult(false, "查询失败"); @@ -158,8 +162,12 @@ public class IndexServiceImpl implements IndexService { try { String result = warnUtil.call(WarnInfo.get1DayWarnCount.getUrl(), "GET"); - log.info("result:"+result); - return new GeneralResult(true, "查询成功"); + JSONObject jsonObject = JSONObject.parseObject(result); + if (!"200".equals(jsonObject.getString("code"))) { + log.info("result:" + result); + return new GeneralResult(false, "查询失败"); + } + return new GeneralResult(true, jsonObject, "查询成功"); } catch (Exception e) { log.info("查询失败", e); return new GeneralResult(false, "查询失败"); @@ -170,8 +178,12 @@ public class IndexServiceImpl implements IndexService { public GeneralResult warnList(RequestContext requestContext) { try { String result = warnUtil.call(WarnInfo.getWarnList.getUrl(), "GET"); - log.info("result:"+result); - return new GeneralResult(true, "查询成功"); + JSONObject jsonObject = JSONObject.parseObject(result); + if (!"200".equals(jsonObject.getString("code"))) { + log.info("result:" + result); + return new GeneralResult(false, "查询失败"); + } + return new GeneralResult(true, jsonObject, "查询成功"); } catch (Exception e) { log.info("查询失败", e); return new GeneralResult(false, "查询失败");