|
@ -48,8 +48,8 @@ public class HttpService implements IHttpService{ |
|
|
try { |
|
|
try { |
|
|
List<HttpVo.Groups> groupsList = new ArrayList<>(); |
|
|
List<HttpVo.Groups> groupsList = new ArrayList<>(); |
|
|
HttpDto.Login login = new HttpDto.Login(); |
|
|
HttpDto.Login login = new HttpDto.Login(); |
|
|
login.setLoginName("t210510sxck"); |
|
|
login.setLoginName(Constant.USERNAME); |
|
|
login.setPassword("ccsens123"); |
|
|
login.setPassword(Constant.PASSWORD); |
|
|
//调取登录接口 获取userId
|
|
|
//调取登录接口 获取userId
|
|
|
String userId = getUserId(login); |
|
|
String userId = getUserId(login); |
|
|
//获取设备分组列表
|
|
|
//获取设备分组列表
|
|
@ -63,7 +63,7 @@ public class HttpService implements IHttpService{ |
|
|
// }
|
|
|
// }
|
|
|
|
|
|
|
|
|
//循环查询分组id下的设备数据并存入数据库
|
|
|
//循环查询分组id下的设备数据并存入数据库
|
|
|
String getDataAndSaveOfUrl = "http://iot.0531yun.cn/wsjc/app/GetDeviceData?groupId="; |
|
|
String getDataAndSaveOfUrl = Constant.FIND_DATA_URL; |
|
|
String environmentOfData = getBody(getDataAndSaveOfUrl, userId); |
|
|
String environmentOfData = getBody(getDataAndSaveOfUrl, userId); |
|
|
|
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(environmentOfData); |
|
|
JSONObject jsonObject = JSONObject.parseObject(environmentOfData); |
|
@ -126,7 +126,7 @@ public class HttpService implements IHttpService{ |
|
|
* @return userId |
|
|
* @return userId |
|
|
*/ |
|
|
*/ |
|
|
public String getUserId(HttpDto.Login login){ |
|
|
public String getUserId(HttpDto.Login login){ |
|
|
String requestUrl = "http://iot.0531yun.cn/app/Login"; |
|
|
String requestUrl = Constant.LOGIN_URL; |
|
|
String s = RestTemplateUtil.postBody(requestUrl, login); |
|
|
String s = RestTemplateUtil.postBody(requestUrl, login); |
|
|
JsonResponse<JSONObject> a = JSONObject.parseObject(s, JsonResponse.class); |
|
|
JsonResponse<JSONObject> a = JSONObject.parseObject(s, JsonResponse.class); |
|
|
JSONObject data = a.getData(); |
|
|
JSONObject data = a.getData(); |
|
|