forked from integrated_whb/integrated_whb
PLSUtil工具类新增告警统计方法
parent
500456a892
commit
3d8221128d
File diff suppressed because it is too large
Load Diff
|
@ -86,7 +86,7 @@ public class PLSUtil {
|
||||||
String url = pd.getString("POST_URL") + "/deploy/psnmgmt/insertPsnInfo";
|
String url = pd.getString("POST_URL") + "/deploy/psnmgmt/insertPsnInfo";
|
||||||
Response response = sendPostHttpRequest(url,employeeData.toString(),token);
|
Response response = sendPostHttpRequest(url,employeeData.toString(),token);
|
||||||
if (!response.isSuccessful()) {
|
if (!response.isSuccessful()) {
|
||||||
throw new IOException(String.valueOf(response));
|
throw new IOException("请求失败:" + response);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("无法获取有效的Token");
|
throw new Exception("无法获取有效的Token");
|
||||||
|
@ -113,7 +113,7 @@ public class PLSUtil {
|
||||||
|
|
||||||
Response response = sendPutHttpRequest(url, card.toString(), token);
|
Response response = sendPutHttpRequest(url, card.toString(), token);
|
||||||
if (!response.isSuccessful()) {
|
if (!response.isSuccessful()) {
|
||||||
throw new IOException(String.valueOf(response));
|
throw new IOException("请求失败:" + response);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
throw new Exception("无法获取有效的Token");
|
throw new Exception("无法获取有效的Token");
|
||||||
|
@ -139,7 +139,7 @@ public class PLSUtil {
|
||||||
String responseBody = response.body().string();
|
String responseBody = response.body().string();
|
||||||
result = new JSONObject(responseBody.isEmpty());
|
result = new JSONObject(responseBody.isEmpty());
|
||||||
}else {
|
}else {
|
||||||
throw new Exception("请求失败" + response.code());
|
throw new IOException("请求失败:" + response);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
throw new Exception("无法获取有效的Token");
|
throw new Exception("无法获取有效的Token");
|
||||||
|
@ -174,7 +174,7 @@ public class PLSUtil {
|
||||||
|
|
||||||
Response response = sendPostHttpRequest(url, String.valueOf(camera), token);
|
Response response = sendPostHttpRequest(url, String.valueOf(camera), token);
|
||||||
if (!response.isSuccessful()){
|
if (!response.isSuccessful()){
|
||||||
throw new IOException(String.valueOf(response));
|
throw new IOException("请求失败:" + response);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
throw new Exception("无法获取有效的Token");
|
throw new Exception("无法获取有效的Token");
|
||||||
|
@ -206,7 +206,7 @@ public class PLSUtil {
|
||||||
String url = pd.getString("POST_URL") + "/device/camera";
|
String url = pd.getString("POST_URL") + "/device/camera";
|
||||||
Response response = sendPutHttpRequest(url, String.valueOf(camera), token);
|
Response response = sendPutHttpRequest(url, String.valueOf(camera), token);
|
||||||
if (!response.isSuccessful()){
|
if (!response.isSuccessful()){
|
||||||
throw new IOException(String.valueOf(response));
|
throw new IOException("请求失败:" + response);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
throw new Exception("无法获取有效的Token");
|
throw new Exception("无法获取有效的Token");
|
||||||
|
@ -230,7 +230,34 @@ public class PLSUtil {
|
||||||
String responseBody = response.body().string();
|
String responseBody = response.body().string();
|
||||||
return new JSONObject(responseBody.isEmpty());
|
return new JSONObject(responseBody.isEmpty());
|
||||||
}else {
|
}else {
|
||||||
throw new Exception("请求失败" + response.code());
|
throw new IOException("请求失败:" + response);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
throw new Exception("无法获取有效的Token");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警统计
|
||||||
|
* @param pd
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static JSONObject getAlarmStatistics(PageData pd) throws Exception {
|
||||||
|
JSONObject result = null;
|
||||||
|
if (getToken(pd)){
|
||||||
|
pd = corpplsinfoService.findById(pd);
|
||||||
|
String token = pd.getString("TOKEN");
|
||||||
|
Map<String,String> queryParams = new HashMap<>();
|
||||||
|
queryParams.put("type",pd.getString("week"));
|
||||||
|
String url = pd.getString("POST_URL") + "/region/alarm/alarmStatistics";
|
||||||
|
|
||||||
|
Response response = sendGetHttpRequest(url, queryParams, token);
|
||||||
|
if (response.isSuccessful()){
|
||||||
|
String responseBody = response.body().string();
|
||||||
|
return new JSONObject(responseBody.isEmpty());
|
||||||
|
}else {
|
||||||
|
throw new IOException("请求失败:" + response);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
throw new Exception("无法获取有效的Token");
|
throw new Exception("无法获取有效的Token");
|
||||||
|
|
Loading…
Reference in New Issue