33import cn .hutool .core .lang .Assert ;
44import cn .iocoder .yudao .framework .common .pojo .CommonResult ;
55import cn .iocoder .yudao .module .iot .core .biz .IotDeviceCommonApi ;
6- import cn .iocoder .yudao .module .iot .core .biz .dto .IotDeviceAuthReqDTO ;
7- import cn .iocoder .yudao .module .iot .core .biz .dto .IotDeviceGetReqDTO ;
8- import cn .iocoder .yudao .module .iot .core .biz .dto .IotDeviceRespDTO ;
9- import cn .iocoder .yudao .module .iot .core .biz .dto .IotModbusDeviceConfigListReqDTO ;
10- import cn .iocoder .yudao .module .iot .core .biz .dto .IotModbusDeviceConfigRespDTO ;
11- import cn .iocoder .yudao .module .iot .core .biz .dto .IotSubDeviceRegisterFullReqDTO ;
6+ import cn .iocoder .yudao .module .iot .core .biz .dto .*;
127import cn .iocoder .yudao .module .iot .core .topic .auth .IotDeviceRegisterReqDTO ;
138import cn .iocoder .yudao .module .iot .core .topic .auth .IotDeviceRegisterRespDTO ;
149import cn .iocoder .yudao .module .iot .core .topic .auth .IotSubDeviceRegisterRespDTO ;
1510import cn .iocoder .yudao .module .iot .gateway .config .IotGatewayProperties ;
16-
17- import java .util .List ;
18- import jakarta .annotation .PostConstruct ;
19- import jakarta .annotation .Resource ;
2011import lombok .extern .slf4j .Slf4j ;
2112import org .springframework .boot .web .client .RestTemplateBuilder ;
2213import org .springframework .core .ParameterizedTypeReference ;
2617import org .springframework .stereotype .Service ;
2718import org .springframework .web .client .RestTemplate ;
2819
20+ import javax .annotation .PostConstruct ;
21+ import javax .annotation .Resource ;
2922import java .util .List ;
3023
3124import static cn .iocoder .yudao .framework .common .exception .enums .GlobalErrorCodeConstants .INTERNAL_SERVER_ERROR ;
@@ -49,34 +42,34 @@ public void init() {
4942 IotGatewayProperties .RpcProperties rpc = gatewayProperties .getRpc ();
5043 restTemplate = new RestTemplateBuilder ()
5144 .rootUri (rpc .getUrl ())
52- .readTimeout (rpc .getReadTimeout ())
53- .connectTimeout (rpc .getConnectTimeout ())
45+ .setConnectTimeout (rpc .getReadTimeout ())
46+ .setConnectTimeout (rpc .getConnectTimeout ())
5447 .build ();
5548 }
5649
5750 @ Override
5851 public CommonResult <Boolean > authDevice (IotDeviceAuthReqDTO authReqDTO ) {
59- return doPost ("/rpc-api/iot/device/auth" , authReqDTO , new ParameterizedTypeReference <>() { });
52+ return doPost ("/rpc-api/iot/device/auth" , authReqDTO , new ParameterizedTypeReference <CommonResult < Boolean > >() { });
6053 }
6154
6255 @ Override
6356 public CommonResult <IotDeviceRespDTO > getDevice (IotDeviceGetReqDTO getReqDTO ) {
64- return doPost ("/rpc-api/iot/device/get" , getReqDTO , new ParameterizedTypeReference <>() { });
57+ return doPost ("/rpc-api/iot/device/get" , getReqDTO , new ParameterizedTypeReference <CommonResult < IotDeviceRespDTO > >() { });
6558 }
6659
6760 @ Override
6861 public CommonResult <List <IotModbusDeviceConfigRespDTO >> getModbusDeviceConfigList (IotModbusDeviceConfigListReqDTO listReqDTO ) {
69- return doPost ("/rpc-api/iot/modbus/config-list" , listReqDTO , new ParameterizedTypeReference <>() { });
62+ return doPost ("/rpc-api/iot/modbus/config-list" , listReqDTO , new ParameterizedTypeReference <CommonResult < List < IotModbusDeviceConfigRespDTO >> >() { });
7063 }
7164
7265 @ Override
7366 public CommonResult <IotDeviceRegisterRespDTO > registerDevice (IotDeviceRegisterReqDTO reqDTO ) {
74- return doPost ("/rpc-api/iot/device/register" , reqDTO , new ParameterizedTypeReference <>() { });
67+ return doPost ("/rpc-api/iot/device/register" , reqDTO , new ParameterizedTypeReference <CommonResult < IotDeviceRegisterRespDTO > >() { });
7568 }
7669
7770 @ Override
7871 public CommonResult <List <IotSubDeviceRegisterRespDTO >> registerSubDevices (IotSubDeviceRegisterFullReqDTO reqDTO ) {
79- return doPost ("/rpc-api/iot/device/register-sub" , reqDTO , new ParameterizedTypeReference <>() { });
72+ return doPost ("/rpc-api/iot/device/register-sub" , reqDTO , new ParameterizedTypeReference <CommonResult < List < IotSubDeviceRegisterRespDTO >> >() { });
8073 }
8174
8275 private <T , R > CommonResult <R > doPost (String url , T body ,
0 commit comments