PLSUtil工具类新增告警统计方法

pull/4/head
WenShiJun 2024-01-15 15:14:16 +08:00
parent 500456a892
commit 3d8221128d
2 changed files with 1553 additions and 6 deletions

File diff suppressed because it is too large Load Diff

View File

@ -86,7 +86,7 @@ public class PLSUtil {
String url = pd.getString("POST_URL") + "/deploy/psnmgmt/insertPsnInfo";
Response response = sendPostHttpRequest(url,employeeData.toString(),token);
if (!response.isSuccessful()) {
throw new IOException(String.valueOf(response));
throw new IOException("请求失败:" + response);
}
} else {
throw new Exception("无法获取有效的Token");
@ -113,7 +113,7 @@ public class PLSUtil {
Response response = sendPutHttpRequest(url, card.toString(), token);
if (!response.isSuccessful()) {
throw new IOException(String.valueOf(response));
throw new IOException("请求失败:" + response);
}
}else {
throw new Exception("无法获取有效的Token");
@ -139,7 +139,7 @@ public class PLSUtil {
String responseBody = response.body().string();
result = new JSONObject(responseBody.isEmpty());
}else {
throw new Exception("请求失败" + response.code());
throw new IOException("请求失败:" + response);
}
}else {
throw new Exception("无法获取有效的Token");
@ -174,7 +174,7 @@ public class PLSUtil {
Response response = sendPostHttpRequest(url, String.valueOf(camera), token);
if (!response.isSuccessful()){
throw new IOException(String.valueOf(response));
throw new IOException("请求失败:" + response);
}
}else {
throw new Exception("无法获取有效的Token");
@ -206,7 +206,7 @@ public class PLSUtil {
String url = pd.getString("POST_URL") + "/device/camera";
Response response = sendPutHttpRequest(url, String.valueOf(camera), token);
if (!response.isSuccessful()){
throw new IOException(String.valueOf(response));
throw new IOException("请求失败:" + response);
}
}else {
throw new Exception("无法获取有效的Token");
@ -230,7 +230,34 @@ public class PLSUtil {
String responseBody = response.body().string();
return new JSONObject(responseBody.isEmpty());
}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 {
throw new Exception("无法获取有效的Token");