Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
王兴琳 3 months ago
parent
commit
cd803c2d4b
  1. 17
      zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java

17
zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java

@ -896,11 +896,20 @@ private VideoController videoController;
}
OkHttp okHttp = new OkHttp();
Response response // 请求响应
= okHttp
.url(iotAddress + UniversalEnum.GETS_THE_LATEST_DATA_ABOUT_THE_SPECIFIED_ATTRIBUTES_OF_A_DEVICE.getValue() + deviceId + UniversalEnum.SLASH.getValue() + propertyId) // 请求地址
.get(); // 请求方法
String requestUrl = iotAddress + UniversalEnum.GETS_THE_LATEST_DATA_ABOUT_THE_SPECIFIED_ATTRIBUTES_OF_A_DEVICE.getValue() + deviceId + UniversalEnum.SLASH.getValue() + propertyId;
try {
Response response = okHttp.url(requestUrl).get();
return JSON.parseObject(response.body().string(), AjaxResult.class);
} catch (HttpException | IOException e) {
if (e instanceof io.netty.handler.timeout.ReadTimeoutException) {
// 捕获到超时异常,返回稍后再试的提示
return AjaxResult.success("");
} else {
// 其他异常,返回错误
return AjaxResult.error("请求失败:" + e.getMessage());
}
}
}
/**

Loading…
Cancel
Save