|
@@ -39,7 +39,7 @@ public class EnergyUtils {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public static String coreConnectToken() {
|
|
|
+ public static String getToken() {
|
|
|
String param = JSON.toJSONString(Levi.by("clientId", EbaSystemConstants.cliendId).set("clientSecret", EbaSystemConstants.clientSecret));
|
|
|
String result = HttpRequest.post(EnergyPlatformConstants.coreConnectToken)
|
|
|
.header("content-type", "application/x-www-form-urlencoded")
|
|
@@ -55,6 +55,15 @@ public class EnergyUtils {
|
|
|
return obj.getString("token_type") + " " + obj.getString("access_token");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 重新登录接口
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String refreshToken() {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 2、获取当前用户名下盒子列表
|
|
|
*
|
|
@@ -62,7 +71,7 @@ public class EnergyUtils {
|
|
|
*/
|
|
|
public static List<Map> apiClientBoxGrouped() {
|
|
|
String result = HttpRequest.get(EnergyPlatformConstants.apiClientBoxGrouped)
|
|
|
- .header("Authorization", coreConnectToken())
|
|
|
+ .header("Authorization", getToken())
|
|
|
.execute().body();
|
|
|
log.info("######### 2、获取当前用户名下盒子列表:{}", result);
|
|
|
return LeviUtils.getJsonFieldMany(result, null, Map.class);
|
|
@@ -76,7 +85,7 @@ public class EnergyUtils {
|
|
|
*/
|
|
|
public static Map apiClientBoxRegBoxNo(String boxNo) {
|
|
|
String result = HttpRequest.get(getUrl(EnergyPlatformConstants.apiClientBoxRegBoxNo, boxNo))
|
|
|
- .header("Authorization", coreConnectToken())
|
|
|
+ .header("Authorization", getToken())
|
|
|
.execute().body();
|
|
|
log.info("######### 3、根据boxNo获取单个盒子:{}", result);
|
|
|
return LeviUtils.getJsonFieldOne(result, null, Map.class);
|
|
@@ -90,7 +99,7 @@ public class EnergyUtils {
|
|
|
*/
|
|
|
public static List<Map> v2BoxDmonGroups(String boxId) {
|
|
|
String result = HttpRequest.get(getUrl(EnergyPlatformConstants.v2BoxDmonGroups, boxId))
|
|
|
- .header("Authorization", coreConnectToken())
|
|
|
+ .header("Authorization", getToken())
|
|
|
.execute().body();
|
|
|
log.info("######### 4、根据boxId获取监控点分组:{}", result);
|
|
|
return LeviUtils.getJsonFieldMany(result, null, Map.class);
|
|
@@ -104,7 +113,7 @@ public class EnergyUtils {
|
|
|
*/
|
|
|
public static List<Map> V2BoxDmonGroupsBoxNo(String boxNo) {
|
|
|
String result = HttpRequest.get(getUrl(EnergyPlatformConstants.V2BoxDmonGroupsBoxNo, boxNo))
|
|
|
- .header("Authorization", coreConnectToken())
|
|
|
+ .header("Authorization", getToken())
|
|
|
.execute().body();
|
|
|
log.info("######### 5、根据boxNo获取监控点分组:{}", result);
|
|
|
return LeviUtils.getJsonFieldMany(result, null, Map.class);
|
|
@@ -119,7 +128,7 @@ public class EnergyUtils {
|
|
|
*/
|
|
|
public static List<Map> v2BoxDmonGroupDmon(String boxId, String groupId) {
|
|
|
String result = HttpRequest.get(getUrl(EnergyPlatformConstants.v2BoxDmonGroupDmon, boxId, groupId))
|
|
|
- .header("Authorization", coreConnectToken())
|
|
|
+ .header("Authorization", getToken())
|
|
|
.execute().body();
|
|
|
log.info("######### 6、根据boxId和分组id获取监控点:{}", result);
|
|
|
return LeviUtils.getJsonFieldMany(result, null, Map.class);
|
|
@@ -135,7 +144,7 @@ public class EnergyUtils {
|
|
|
public static List<Map> v2BoxDmonGet(String boxId, String id) {
|
|
|
String param = JSON.toJSONString(Arrays.asList(id));
|
|
|
String result = HttpRequest.post(getUrl(EnergyPlatformConstants.v2BoxDmonGet, boxId))
|
|
|
- .header("Authorization", coreConnectToken())
|
|
|
+ .header("Authorization", getToken())
|
|
|
.header("content-type", "application/json")
|
|
|
.body(param)
|
|
|
.execute().body();
|
|
@@ -153,7 +162,7 @@ public class EnergyUtils {
|
|
|
public static List<Map> v2BoxDmonGetBoxNo(String boxNo, String id) {
|
|
|
String param = JSON.toJSONString(Arrays.asList(id));
|
|
|
String result = HttpRequest.post(getUrl(EnergyPlatformConstants.v2BoxDmonGetBoxNo, boxNo))
|
|
|
- .header("Authorization", coreConnectToken())
|
|
|
+ .header("Authorization", getToken())
|
|
|
.header("content-type", "application/json")
|
|
|
.body(param)
|
|
|
.execute().body();
|