Default Changelist
This commit is contained in:
@ -14,15 +14,16 @@ import java.util.Map;
|
||||
*/
|
||||
public class ManagementUtil {
|
||||
public static JsonNode getManagement() {
|
||||
String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.0.0/device?deviceCode=100001";
|
||||
String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.0.0/device?deviceCode=1001339";
|
||||
Map<String, String> map = new HashMap<>(3);
|
||||
JsonNode jsonNode = RequestUtil.doGetJsonNode(url, map);
|
||||
return jsonNode;
|
||||
}
|
||||
|
||||
//https://{{host}}/evo-apigw/evo-brm/{{version}}/device/1001339
|
||||
public static String getPaging(String para) {
|
||||
String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.2.0/device/subsystem/page";
|
||||
String jsonNode = RequestUtil.doPostJson(url, para);
|
||||
String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.2.0/devic?deviceCode="+para;
|
||||
String jsonNode = RequestUtil.getPost(url);
|
||||
return jsonNode;
|
||||
|
||||
}
|
||||
|
@ -124,6 +124,48 @@ public class RequestUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get设备详细信息查询
|
||||
* @param url
|
||||
* @return String
|
||||
*/
|
||||
public static String getPost(String url) {
|
||||
// 创建Httpclient对象
|
||||
CloseableHttpClient httpclient = HttpClients.createDefault();
|
||||
|
||||
String resultString = "";
|
||||
CloseableHttpResponse response = null;
|
||||
try {
|
||||
|
||||
URI uri = new URI(url);
|
||||
// 创建http GET请求
|
||||
HttpGet httpGet = new HttpGet(uri);
|
||||
// 执行请求
|
||||
response = httpclient.execute(httpGet);
|
||||
// 判断返回状态是否为200
|
||||
if (response.getStatusLine().getStatusCode() == 200) {
|
||||
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
//使用ObjectMapper对象对 User对象进行转换
|
||||
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
httpclient.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return resultString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 带参数的get请求
|
||||
* @param url
|
||||
|
Reference in New Issue
Block a user