fix:【iot 物联网】增强 jdk8 的兼容性

This commit is contained in:
YunaiV 2025-09-20 12:17:46 +08:00
parent a303e09ae9
commit 5573ce20db
3 changed files with 7 additions and 7 deletions

View File

@ -125,7 +125,7 @@ public class IotMqttConnectionManager {
*/
public IotMqttConnectionManager.ConnectionInfo getConnectionInfoByDeviceId(Long deviceId) {
// 通过设备 ID 获取连接端点
var endpoint = getDeviceEndpoint(deviceId);
MqttEndpoint endpoint = getDeviceEndpoint(deviceId);
if (endpoint == null) {
return null;
}

View File

@ -32,7 +32,7 @@ public class IotDeviceServiceImpl implements IotDeviceService {
*/
private final LoadingCache<Long, IotDeviceRespDTO> deviceCaches = buildAsyncReloadingCache(
CACHE_EXPIRE,
new CacheLoader<>() {
new CacheLoader<Long, IotDeviceRespDTO>() {
@Override
public IotDeviceRespDTO load(Long id) {
@ -51,7 +51,7 @@ public class IotDeviceServiceImpl implements IotDeviceService {
*/
private final LoadingCache<KeyValue<String, String>, IotDeviceRespDTO> deviceCaches2 = buildAsyncReloadingCache(
CACHE_EXPIRE,
new CacheLoader<>() {
new CacheLoader<KeyValue<String, String>, IotDeviceRespDTO>() {
@Override
public IotDeviceRespDTO load(KeyValue<String, String> kv) {

View File

@ -40,19 +40,19 @@ public class IotDeviceApiImpl implements IotDeviceCommonApi {
IotGatewayProperties.RpcProperties rpc = gatewayProperties.getRpc();
restTemplate = new RestTemplateBuilder()
.rootUri(rpc.getUrl() + "/rpc-api/iot/device")
.readTimeout(rpc.getReadTimeout())
.connectTimeout(rpc.getConnectTimeout())
.setConnectTimeout(rpc.getReadTimeout())
.setReadTimeout(rpc.getConnectTimeout())
.build();
}
@Override
public CommonResult<Boolean> authDevice(IotDeviceAuthReqDTO authReqDTO) {
return doPost("/auth", authReqDTO, new ParameterizedTypeReference<>() { });
return doPost("/auth", authReqDTO, new ParameterizedTypeReference<CommonResult<Boolean>>() { });
}
@Override
public CommonResult<IotDeviceRespDTO> getDevice(IotDeviceGetReqDTO getReqDTO) {
return doPost("/get", getReqDTO, new ParameterizedTypeReference<>() { });
return doPost("/get", getReqDTO, new ParameterizedTypeReference<CommonResult<IotDeviceRespDTO>>() { });
}
private <T, R> CommonResult<R> doPost(String url, T body,