设备

## 概述 > 设备 类名 ` DeviceApi.java ` 成员方法 名称 | 方法 | Method | Path ------------- | ------------- | ------------- | ------------- [绑定/或更换设备序列号](#bindDevice) | [**bindDevice**](#bindDevice) | POST | /api-business/device/bindDevice [数据同步](#dataSynchronization) | [**dataSynchronization**](#dataSynchronization) | POST | /api-business/device/dataSynchronization [查询设备详细信息](#getDeviceInfoList) | [**getDeviceInfoList**](#getDeviceInfoList) | POST | /api-business/device/getDeviceInfoList [查询设备列表](#getDeviceList) | [**getDeviceList**](#getDeviceList) | POST | /api-business/device/getDeviceList [查询设备状态信息](#getDeviceStatusInfoList) | [**getDeviceStatusInfoList**](#getDeviceStatusInfoList) | POST | /api-business/device/getDeviceStatusInfoList [查询设备列表](#getPlcList) | [**getPlcList**](#getPlcList) | POST | /api-business/device/getPlcList [根据项目id](#getSimCardFlowInfoListByProjectIds) | [**getSimCardFlowInfoListByProjectIds**](#getSimCardFlowInfoListByProjectIds) | POST | /api-business/device/getSimCardFlowInfoListByProjectIds [远程重启](#remoteRestart) | [**remoteRestart**](#remoteRestart) | POST | /api-business/device/remoteRestart [恢复采集](#restoreCollect) | [**restoreCollect**](#restoreCollect) | POST | /api-business/device/restoreCollect [恢复上传](#restoreUpload) | [**restoreUpload**](#restoreUpload) | POST | /api-business/device/restoreUpload [停止采集](#stopCollect) | [**stopCollect**](#stopCollect) | POST | /api-business/device/stopCollect [停止上传](#stopUpload) | [**stopUpload**](#stopUpload) | POST | /api-business/device/stopUpload [解绑device](#unbindDevice) | [**unbindDevice**](#unbindDevice) | POST | /api-business/device/unbindDevice <a id="bindDevice"></a> ## **绑定/或更换设备序列号** > Result bindDevice(bindDeviceForm) 绑定/或更换设备序列号 ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **bindDeviceForm** | **BindDeviceForm**| bindDeviceForm | #### BindDeviceForm 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **deviceId** | **String** | 设备id | **serialNumber** | **String** | device序列号 | - ### 返回参数 Result 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | | - **data** | **Object** | | - **msg** | **String** | | - **time** | **OffsetDateTime** | | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 BindDeviceForm bindDeviceForm = new BindDeviceForm(); try { Result result = apiInstance.bindDevice(bindDeviceForm); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.bindDevice异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/bindDevice| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "deviceId":"", "serialNumber":"" } ``` <a id="dataSynchronization"></a> ## **数据同步** > Result dataSynchronization(deviceId) 数据同步 ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **deviceId** | **String**| 设备ID | ### 返回参数 Result 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | | - **data** | **Object** | | - **msg** | **String** | | - **time** | **OffsetDateTime** | | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 String deviceId = "deviceId_example"; try { Result result = apiInstance.dataSynchronization(deviceId); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.dataSynchronization异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/dataSynchronization| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "deviceId":"" } ``` <a id="getDeviceInfoList"></a> ## **查询设备详细信息** > ResultListDeviceInfoVo getDeviceInfoList(deviceIds) 获取多个项目设备(不可查模板)的详细信息 ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **deviceIds** | **List&lt;String&gt;**| 多个设备id | ### 返回参数 ResultListDeviceInfoVo 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | 响应码 | - **data** | **List&lt;DeviceInfoVo&gt;** | 响应数据 | - **msg** | **String** | 响应消息 | - **time** | **OffsetDateTime** | 响应时间 | - DeviceInfoVo 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **cloudVersion** | **String** | 配置版本号(云端) | - **deviceProperties** | **Map&lt;String, DevicePropertiesVo&gt;** | Device信息 key:字段,DevicePropertiesPojo: 详情 | - **id** | **String** | Device的id | - **isGps** | **Boolean** | 是否是GPS设备 | - **isThirdDevice** | **Boolean** | 是否是第三方设备 | - **model** | **String** | BOX型号版本号 | - **name** | **String** | Device名称 | - **serialNumber** | **String** | Device序列号 | - **thirdDeviceId** | **String** | 第三方设备id | - DevicePropertiesVo 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **createdTime** | **OffsetDateTime** | 创建时间 | - **name** | **String** | 属性名称(如卡号/ip/版本等等) | - **serialNumber** | **Long** | 设备序列号,12位数字 | - **updatedTime** | **OffsetDateTime** | 更新时间 | - **value** | **String** | 属性值 | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 List<String> deviceIds = Arrays.asList(new List<String>()); try { ResultListDeviceInfoVo result = apiInstance.getDeviceInfoList(deviceIds); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.getDeviceInfoList异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/getDeviceInfoList| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "deviceIds":[] } ``` <a id="getDeviceList"></a> ## **查询设备列表** > ResultListDeviceVo getDeviceList(queryDeviceListParam) 获取企业、用户、项目的采集器列表 ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **queryDeviceListParam** | **QueryDeviceListParam**| queryDeviceListParam | #### QueryDeviceListParam 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **resourceIds** | **List&lt;String&gt;** | 项目或模板id的数组 | **resourceType** | **String** | 查询类型,project:项目的device列表,template:模板的device列表 | ### 返回参数 ResultListDeviceVo 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | 响应码 | - **data** | **List&lt;DeviceVo&gt;** | 响应数据 | - **msg** | **String** | 响应消息 | - **time** | **OffsetDateTime** | 响应时间 | - DeviceVo 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **id** | **String** | 设备Id | - **name** | **String** | 设备名称 | - **resourceId** | **String** | 项目或模板id | - **serialNumber** | **String** | 序列号 | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 QueryDeviceListParam queryDeviceListParam = new QueryDeviceListParam(); try { ResultListDeviceVo result = apiInstance.getDeviceList(queryDeviceListParam); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.getDeviceList异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/getDeviceList| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "resourceType":"" } ``` <a id="getDeviceStatusInfoList"></a> ## **查询设备状态信息** > ResultListDeviceStatusInfoVo getDeviceStatusInfoList(deviceIds) 获取设备的状态信息,包裹plc的状态 ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **deviceIds** | **List&lt;String&gt;**| 多个设备id | ### 返回参数 ResultListDeviceStatusInfoVo 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | 响应码 | - **data** | **List&lt;DeviceStatusInfoVo&gt;** | 响应数据 | - **msg** | **String** | 响应消息 | - **time** | **OffsetDateTime** | 响应时间 | - DeviceStatusInfoVo 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **id** | **String** | 设备id | - **name** | **String** | 设备名称 | - **offLineCount** | **Integer** | 离线次数 | - **offLineDuration** | **Long** | 离线时长(秒) | - **onLineDuration** | **Long** | 在线时长(秒) | - **onLineTime** | **String** | 在线时间(天/时/分/秒) | - **onlineStatus** | **Boolean** | 设备的在线状态,true:在线,false 离线 | - **plcList** | **List&lt;PlcStatusVo&gt;** | plc的状态信息 | - PlcStatusVo 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **deviceId** | **String** | 设备id | - **name** | **String** | plc名称 | - **onlineStatus** | **Boolean** | plc的在线状态,true:在线,false 离线 | - **plcId** | **Integer** | plcid | - **time** | **Long** | | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 List<String> deviceIds = Arrays.asList(new List<String>()); try { ResultListDeviceStatusInfoVo result = apiInstance.getDeviceStatusInfoList(deviceIds); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.getDeviceStatusInfoList异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/getDeviceStatusInfoList| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "deviceIds":[] } ``` <a id="getPlcList"></a> ## **查询设备列表** > ResultListPlc getPlcList(param) 获取企业、用户、项目的采集器列表 ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **param** | **QueryPlcListParam**| param | #### QueryPlcListParam 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **resourceIds** | **List&lt;String&gt;** | 项目或模板id的数组 | **resourceType** | **String** | 查询类型,project:项目的device列表,template:模板的device列表 | ### 返回参数 ResultListPlc 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | 响应码 | - **data** | **List&lt;Plc&gt;** | 响应数据 | - **msg** | **String** | 响应消息 | - **time** | **OffsetDateTime** | 响应时间 | - Plc 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **deviceId** | **String** | 虚拟设备id | - **name** | **String** | PLC设备名称 | - **plcId** | **Integer** | PLC设备ID | - **resourceId** | **String** | 项目或模板id | - **sort** | **Integer** | 排序号 | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 QueryPlcListParam param = new QueryPlcListParam(); try { ResultListPlc result = apiInstance.getPlcList(param); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.getPlcList异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/getPlcList| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "resourceType":"" } ``` <a id="getSimCardFlowInfoListByProjectIds"></a> ## **根据项目id** > ResultListSim getSimCardFlowInfoListByProjectIds(projectIds, keyword, status) 根据项目id ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **projectIds** | **List&lt;String&gt;**| 项目id | **keyword** | **String**| keyword | - **status** | **String**| 0:停机,1:正常,2:注销,3:其它 | - ### 返回参数 ResultListSim 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | 响应码 | - **data** | **List&lt;Sim&gt;** | 响应数据 | - **msg** | **String** | 响应消息 | - **time** | **OffsetDateTime** | 响应时间 | - Sim 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **balanceFlow** | **Double** | 剩余流量 | - **deviceId** | **String** | 设备Id | - **deviceName** | **String** | 设备名称 | - **expirationTime** | **String** | 过期时间 | - **iccid** | **String** | iccid | - **monthUse** | **Double** | 月用流量 | - **operator** | **String** | 运营商 | - **operatorId** | **String** | 运营商分组 | - **projectId** | **String** | 项目id | - **projectName** | **String** | 项目名称 | - **rechargeStatus** | **String** | 开的充值状态0:不可充值,1:可充值 | - **serialNumber** | **String** | 设备序列号 | - **status** | **String** | 过滤状态,0:停机,1:正常,2:注销,3:其它 | - **statusDescription** | **String** | 卡的状态描述信息 | - **totalFlow** | **Double** | 总流量 | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 List<String> projectIds = Arrays.asList(new List<String>()); String keyword = "keyword_example"; String status = "status_example"; try { ResultListSim result = apiInstance.getSimCardFlowInfoListByProjectIds(projectIds, keyword, status); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.getSimCardFlowInfoListByProjectIds异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/getSimCardFlowInfoListByProjectIds| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "keyword":"", "projectIds":[], "status":"" } ``` <a id="remoteRestart"></a> ## **远程重启** > Result remoteRestart(deviceId) 远程重启 ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **deviceId** | **String**| 设备ID | ### 返回参数 Result 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | | - **data** | **Object** | | - **msg** | **String** | | - **time** | **OffsetDateTime** | | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 String deviceId = "deviceId_example"; try { Result result = apiInstance.remoteRestart(deviceId); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.remoteRestart异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/remoteRestart| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "deviceId":"" } ``` <a id="restoreCollect"></a> ## **恢复采集** > Result restoreCollect(deviceId) 恢复采集 ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **deviceId** | **String**| 设备ID | ### 返回参数 Result 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | | - **data** | **Object** | | - **msg** | **String** | | - **time** | **OffsetDateTime** | | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 String deviceId = "deviceId_example"; try { Result result = apiInstance.restoreCollect(deviceId); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.restoreCollect异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/restoreCollect| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "deviceId":"" } ``` <a id="restoreUpload"></a> ## **恢复上传** > Result restoreUpload(deviceId) 恢复上传 ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **deviceId** | **String**| 设备ID | ### 返回参数 Result 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | | - **data** | **Object** | | - **msg** | **String** | | - **time** | **OffsetDateTime** | | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 String deviceId = "deviceId_example"; try { Result result = apiInstance.restoreUpload(deviceId); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.restoreUpload异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/restoreUpload| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "deviceId":"" } ``` <a id="stopCollect"></a> ## **停止采集** > Result stopCollect(deviceId) 停止采集 ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **deviceId** | **String**| 设备ID | ### 返回参数 Result 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | | - **data** | **Object** | | - **msg** | **String** | | - **time** | **OffsetDateTime** | | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 String deviceId = "deviceId_example"; try { Result result = apiInstance.stopCollect(deviceId); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.stopCollect异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/stopCollect| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "deviceId":"" } ``` <a id="stopUpload"></a> ## **停止上传** > ResultObject stopUpload(deviceId) 停止上传 ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **deviceId** | **String**| 设备ID | ### 返回参数 ResultObject 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | 响应码 | - **data** | **Object** | 响应数据 | - **msg** | **String** | 响应消息 | - **time** | **OffsetDateTime** | 响应时间 | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 String deviceId = "deviceId_example"; try { ResultObject result = apiInstance.stopUpload(deviceId); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.stopUpload异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/stopUpload| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "deviceId":"" } ``` <a id="unbindDevice"></a> ## **解绑device** > Result unbindDevice(deviceId) 解绑device ### 请求参数 名称 | 类型 | 描述 | 备注 ------------- | ------------- | ------------- | ------------- **deviceId** | **String**| 设备ID | ### 返回参数 Result 名称 | 类型 | 描述 | 备注 ------------ | ------------- | ------------- | ------------- **code** | **String** | | - **data** | **Object** | | - **msg** | **String** | | - **time** | **OffsetDateTime** | | - ### java-sdk 调用示例 ```java //实例化api类,传入token DeviceApi apiInstance = new DeviceApi(token); //实例化请求参数 String deviceId = "deviceId_example"; try { Result result = apiInstance.unbindDevice(deviceId); System.out.println(result); } catch (ApiException e) { System.err.println("调用DeviceApi.unbindDevice异常: " + e.getMessage()); e.printStackTrace(); } ``` ### HTTP 调用示例 | 属性 | 名称 | | --------------- | ------------------------ | | HTTP请求地址 | http://[server]:[port]/api-business/device/unbindDevice| | 请求方式 | POST | | Content-Type | application/json | | header:key | Authorization| | header:value |Bearer *YOUR_ACCESS_TOKEN*| 请求参数: ```json { "deviceId":"" } ```