| | |
| | | import com.ruoyi.common.core.utils.CodeGenerateUtils; |
| | | import com.ruoyi.integration.api.vo.AddDeviceResp; |
| | | import com.ruoyi.integration.api.vo.DeleteDeviceResp; |
| | | import com.ruoyi.integration.api.vo.ShowDeviceResp; |
| | | import com.ruoyi.integration.iotda.builder.IotBuilder; |
| | | import com.ruoyi.integration.iotda.config.IotDAConfig; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询设备 |
| | | * @param deviceId |
| | | * @return |
| | | */ |
| | | public R<ShowDeviceResp> showDeviceRequest(String deviceId) { |
| | | ShowDeviceRequest request = new ShowDeviceRequest(); |
| | | request.withDeviceId(deviceId); |
| | | try { |
| | | ShowDeviceResponse response = iotBuilder.buildIot().showDevice(request); |
| | | log.info("查询设备:{}",response.toString()); |
| | | ShowDeviceResp showDeviceResp = new ShowDeviceResp(); |
| | | BeanUtils.copyProperties(response, showDeviceResp); |
| | | return R.ok(showDeviceResp); |
| | | } catch (ConnectionException e) { |
| | | e.printStackTrace(); |
| | | } catch (RequestTimeoutException e) { |
| | | e.printStackTrace(); |
| | | } catch (ServiceResponseException e) { |
| | | e.printStackTrace(); |
| | | System.out.println(e.getHttpStatusCode()); |
| | | System.out.println(e.getRequestId()); |
| | | System.out.println(e.getErrorCode()); |
| | | System.out.println(e.getErrorMsg()); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | } |