|
@@ -57,14 +57,12 @@ public class AlertAndSiteApi {
|
|
|
try {
|
|
|
String result = HttpUtils.postJson(LOGIN_URL, JsonUtils.toJson(params), null);
|
|
|
JsonNode arrNode = new ObjectMapper().readTree(result);
|
|
|
- log.info("获取登录接口信息"+arrNode);
|
|
|
if ("200".equals(arrNode.get("code").asText())){
|
|
|
token = arrNode.get("data").asText();
|
|
|
}else {
|
|
|
- log.error("调用登录api失败"+arrNode.get("msg"));
|
|
|
+ throw new BusinessException("登录api失败"+ arrNode.get("msg"));
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
- log.error("调用登录api异常"+ e.getMessage());
|
|
|
throw new BusinessException("调用登录api异常"+ e.getMessage());
|
|
|
}
|
|
|
return token;
|
|
@@ -90,7 +88,6 @@ public class AlertAndSiteApi {
|
|
|
try {
|
|
|
String result = HttpUtils.postJson(ALERT_URL, JsonUtils.toJson(params), header);
|
|
|
JsonNode arrNode = MAPPER.readTree(result);
|
|
|
- log.info("获取警情接口信息"+arrNode);
|
|
|
if ("200".equals(arrNode.get("code").asText())){
|
|
|
JsonNode data = arrNode.get("data");
|
|
|
JsonNode iterms = data.get("items");
|
|
@@ -98,10 +95,9 @@ public class AlertAndSiteApi {
|
|
|
alerts = MAPPER.readValue(iterms.traverse(), new TypeReference<List<Alert>>() {});
|
|
|
}
|
|
|
}else {
|
|
|
- log.error("调用警情api失败:"+arrNode.get("msg"));
|
|
|
+ throw new BusinessException("警情api失败"+ arrNode.get("msg"));
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
- log.error("调用警情api异常"+ e.getMessage());
|
|
|
throw new BusinessException("调用警情api异常:"+e.getMessage());
|
|
|
}
|
|
|
return alerts;
|
|
@@ -130,7 +126,6 @@ public class AlertAndSiteApi {
|
|
|
try {
|
|
|
String result = HttpUtils.postJson(FIRE_SITE_URL, JsonUtils.toJson(params), header);
|
|
|
JsonNode arrNode = MAPPER.readTree(result);
|
|
|
- log.info("获取警情接口信息"+arrNode);
|
|
|
if ("200".equals(arrNode.get("code").asText())){
|
|
|
JsonNode data = arrNode.get("data");
|
|
|
JsonNode iterms = data.get("items");
|
|
@@ -138,10 +133,9 @@ public class AlertAndSiteApi {
|
|
|
list = MAPPER.readValue(iterms.traverse(), new TypeReference<List<FireSite>>() {});
|
|
|
}
|
|
|
}else {
|
|
|
- log.error("调用站点api异常:"+arrNode.get("msg"));
|
|
|
+ throw new BusinessException("站点api失败"+arrNode.get("msg"));
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
- log.error("调用站点api异常:"+ e.getMessage());
|
|
|
throw new BusinessException("调用站点api异常:"+e.getMessage());
|
|
|
}
|
|
|
return list;
|