|
|
@ -17,19 +17,20 @@ public class EpmetUtils { |
|
|
|
/** |
|
|
|
* 应用id |
|
|
|
*/ |
|
|
|
public String appId; |
|
|
|
public static String appId = "dbfad3110c124c89948d16e8b06a8888"; |
|
|
|
/** |
|
|
|
* 客户id |
|
|
|
*/ |
|
|
|
private String customerId; |
|
|
|
private static String customerId = "b09527201c4409e19d1dbc5e3c3429a1"; |
|
|
|
/** |
|
|
|
* 秘钥 |
|
|
|
*/ |
|
|
|
private String secret; |
|
|
|
|
|
|
|
private static String secret = "0f7e983b017ac180b0da1877abe11bab22ab6288580e64d39b5e415dbb0fcc8f"; |
|
|
|
/** |
|
|
|
* 地址 |
|
|
|
*/ |
|
|
|
private String commonUrl; |
|
|
|
private static String commonUrl = "http://192.168.1.130:8080/api"; |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成token |
|
|
@ -37,7 +38,7 @@ public class EpmetUtils { |
|
|
|
|
|
|
|
* @return String |
|
|
|
*/ |
|
|
|
public String getToken (){ |
|
|
|
public static String getToken (){ |
|
|
|
Map<String,Object> claims = new HashMap<String,Object>(); |
|
|
|
claims.put("appId",appId); |
|
|
|
claims.put("customerId",customerId); |
|
|
@ -51,7 +52,7 @@ public class EpmetUtils { |
|
|
|
* @param param |
|
|
|
* @return String |
|
|
|
*/ |
|
|
|
public String httpPost(String url,String param) { |
|
|
|
public static String httpPost(String url,String param) { |
|
|
|
|
|
|
|
String requestUrl = commonUrl + url; |
|
|
|
HttpResponse response = null; |
|
|
@ -61,6 +62,7 @@ public class EpmetUtils { |
|
|
|
.header("Content-Type", "application/json") |
|
|
|
.header("AccessToken", getToken()) |
|
|
|
.header("AppId",appId) |
|
|
|
.header("Date-Type","fake") |
|
|
|
.execute(); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|