|
@@ -68,14 +68,14 @@ public class RestClientService {
|
|
* des: 调用IoTEdge接口 获取所有设备信息
|
|
* des: 调用IoTEdge接口 获取所有设备信息
|
|
* date: 2024/5/29
|
|
* date: 2024/5/29
|
|
*/
|
|
*/
|
|
- public JSONObject getAllDevicesInfo(){
|
|
|
|
|
|
+ public JSONObject getAllDevicesInfo(String elToken){
|
|
//String url = "http://127.0.0.1:8082/v1/devices?deviceType=&projectID=all&productID=all";
|
|
//String url = "http://127.0.0.1:8082/v1/devices?deviceType=&projectID=all&productID=all";
|
|
String url = configService.getConfigValue(ConfigInfo.GETALLDEVICESINFO);
|
|
String url = configService.getConfigValue(ConfigInfo.GETALLDEVICESINFO);
|
|
- String accessToken = getAccessToken();
|
|
|
|
|
|
+ //String accessToken = getAccessToken();
|
|
HttpHeaders headers = new HttpHeaders();
|
|
HttpHeaders headers = new HttpHeaders();
|
|
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
|
|
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
|
|
headers.setContentType(type);
|
|
headers.setContentType(type);
|
|
- headers.add("Authorization", "Bearer " + accessToken);
|
|
|
|
|
|
+ headers.add("Authorization", "Bearer " + elToken);
|
|
HttpEntity<String> httpEntity = new HttpEntity<String>(null, headers);
|
|
HttpEntity<String> httpEntity = new HttpEntity<String>(null, headers);
|
|
ResponseEntity<JSONObject> response = restTemplate.exchange(url, HttpMethod.GET,httpEntity, JSONObject.class);
|
|
ResponseEntity<JSONObject> response = restTemplate.exchange(url, HttpMethod.GET,httpEntity, JSONObject.class);
|
|
return response.getBody();
|
|
return response.getBody();
|
|
@@ -88,14 +88,14 @@ public class RestClientService {
|
|
* des: 调用IoTEdge接口 获取指定设备下的点位信息(根据设备ID)
|
|
* des: 调用IoTEdge接口 获取指定设备下的点位信息(根据设备ID)
|
|
* date: 2024/5/29
|
|
* date: 2024/5/29
|
|
*/
|
|
*/
|
|
- public JSONObject getAllDevicesInfoById(String deviceId){
|
|
|
|
|
|
+ public JSONObject getAllDevicesInfoById(String deviceId,String elToken){
|
|
//String url = "http://127.0.0.1:8082/v1/devices/"+deviceId+"/deviceshadow";
|
|
//String url = "http://127.0.0.1:8082/v1/devices/"+deviceId+"/deviceshadow";
|
|
String url = configService.getConfigValue(ConfigInfo.GETALLDEVICESINFOBYID)+"/"+deviceId+"/deviceshadow";
|
|
String url = configService.getConfigValue(ConfigInfo.GETALLDEVICESINFOBYID)+"/"+deviceId+"/deviceshadow";
|
|
- String accessToken = getAccessToken();
|
|
|
|
|
|
+ //String accessToken = getAccessToken();
|
|
HttpHeaders headers = new HttpHeaders();
|
|
HttpHeaders headers = new HttpHeaders();
|
|
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
|
|
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
|
|
headers.setContentType(type);
|
|
headers.setContentType(type);
|
|
- headers.add("Authorization", "Bearer " + accessToken);
|
|
|
|
|
|
+ headers.add("Authorization", "Bearer " + elToken);
|
|
HttpEntity<String> httpEntity = new HttpEntity<String>(null, headers);
|
|
HttpEntity<String> httpEntity = new HttpEntity<String>(null, headers);
|
|
ResponseEntity<JSONObject> response = restTemplate.exchange(url, HttpMethod.GET,httpEntity, JSONObject.class);
|
|
ResponseEntity<JSONObject> response = restTemplate.exchange(url, HttpMethod.GET,httpEntity, JSONObject.class);
|
|
return response.getBody();
|
|
return response.getBody();
|