Skip to content

设备数据统计

功能概述

设备数据统计管理, 主要获取设备相关的统计信息

kotlin
QuecDeviceStatisticsService

数据统计

设备历史轨迹

接口说明

获取设备历史轨迹

kotlin
fun getLocationHistory(
    productKey: String,
    deviceKey: String,
    startTimestamp: Long,
    endTimestamp: Long,
    gatewayDk: String?,
    gatewayPk: String?,
    locateTypes: String?,
    callback: QuecCallback<List<QuecLocationHistoryModel>>
)

参数说明

参数是否必传说明
productKey产品key
deviceKey设备key
startTimestamp开始时间(毫秒时间戳)
endTimestamp结束时间(毫秒时间戳)
gatewayDk网关设备的 Device Key
gatewayPk网关设备的 Product Key
locateTypes定位类型(默认查询所有类型的定位),查询多种定位时使用英文逗号分隔 GNSS-全球导航卫星系统 GPS-美国导航定位系统 GL-俄罗斯格洛纳导航定位系统 GA-欧盟伽利略卫星导航系统 BD/PQ-中国导航定位系统 LBS-基于通信运营商的基站定位系统
callback请求回调

QuecLocationHistoryModel属性定义

字段类型描述
bdLatDouble设备纬度。BD09
bdLngDouble设备经度。BD09
deviceKeyString设备dk
gcjLatDouble设备纬度。GCJ02
gcjLngDouble设备经度。GCJ02
hdopDouble水平精度因子。0.5-99.99
locateIdString轨迹ID
locateTypeint定位方式(0:GNSS 1:LBS 2:手动标点)
locationTimeString定位时间
productKeyString设备pk
satellitesint当前卫星数
tsLocateTimeint最新定位时间(时间戳)
wgsLatDouble设备纬度。WGS84
wgsLngDouble设备经度。WGS84

示例代码

kotlin
QuecDeviceStatisticsService.getLocationHistory(
    "pk",
    "dk",
    System.currentTimeMillis() - 90000,
    System.currentTimeMillis(),
    null,
    null,
    "GNSS"
) {
    if (it.isSuccess) {
        val data = it.data //请求成功
    } else {
        val code = it.code //请求失败, 错误码
        val msg = it.msg //请求失败, 错误信息
    }
}

设备属性图表列表

接口说明

获取设备属性图表列表

kotlin
fun getPropertyChartList(
    productKey: String,
    deviceKey: String,
    startTimestamp: Long,
    endTimestamp: Long,
    attributeCode: String,
    gatewayDk: String?,
    gatewayPk: String?,
    countType: Int,
    timeGranularity: Int,
    callback: QuecCallback<List<QuecPropertyChartListModel>>
)

参数说明

参数是否必传说明
productKey产品key
deviceKey设备key
startTimestamp开始时间(毫秒时间戳)
endTimestamp结束时间(毫秒时间戳)
attributeCode物模型属性标识符,查询多个属性时使用英文逗号分隔
gatewayDk网关设备的 Device Key
gatewayPk网关设备的 Product Key
countType聚合类型(默认3):1-最大值 2-最小值 3-平均值 4-差值
timeGranularity统计时间粒度(默认2):1-月 2-日 3-小时 4-分钟 5-秒
callback请求回调

QuecPropertyChartListModel属性定义

字段类型描述
propertyCodeString物模型code
xaxisDataList<String>记录时间
xaxisDataTsList<Double>时间戳
yaxisDataList<Any>属性内容

示例代码

kotlin
QuecDeviceStatisticsService.getPropertyChartList(
    "pk",
    "dk",
    System.currentTimeMillis() - 90000,
    System.currentTimeMillis(),
    "temperature",
    null,
    null,
    3,
    1
) {
    if (it.isSuccess) {
        val data = it.data //请求成功
    } else {
        val code = it.code //请求失败, 错误码
        val msg = it.msg //请求失败, 错误信息
    }
}

设备属性环比统计数据

接口说明

获取设备属性环比统计数据

kotlin
fun getPropertyStatisticsPath(
    productKey: String,
    deviceKey: String,
    currentTimestamp: Long,
    attributeCode: String,
    gatewayDk: String?,
    gatewayPk: String?,
    countType: Int,
    timeGranularities: String?,
    callback: QuecCallback<List<QuecPropertyStatisticsModel>>
)

参数说明

参数是否必传说明
productKey产品key
deviceKey设备key
currentTimestamp当前时间(毫秒时间戳)
attributeCode物模型属性标识符,查询多个属性时使用英文逗号分隔
gatewayDk网关设备的 Device Key
gatewayPk网关设备的 Product Key
countType聚合类型(默认3):1-最大值 2-最小值 3-平均值 4-差值
timeGranularities统计时间粒度,查询多个粒度时使用英文逗号分隔(默认1):1-日 2-周 3-月 4-年
callback请求回调

QuecPropertyStatisticsModel属性定义

字段类型描述
statValueListList<Any>当期环比值
timeGranularityint时间单位 【1-日,2-周,3-月,4-年】

示例代码

kotlin
QuecDeviceStatisticsService.getPropertyStatisticsPath(
    "pk",
    "dk",
    System.currentTimeMillis(),
    "temperature",
    null,
    null,
    3,
    "1,2,3"
) {
    if (it.isSuccess) {
        val data = it.data //请求成功
    } else {
        val code = it.code //请求失败, 错误码
        val msg = it.msg //请求失败, 错误信息
    }
}

设备属性数据列表

接口说明

获取设备属性数据列表

kotlin
fun getPropertyDataList(
    productKey: String,
    deviceKey: String,
    startTimestamp: Long,
    endTimestamp: Long,
    attributeCode: String,
    gatewayDk: String?,
    gatewayPk: String?,
    pageNumber: Int,
    pageSize: Int,
    callback: QuecCallback<QuecPageResponse<QuecPropertyDataListModel>>
)

参数说明

参数是否必传说明
productKey产品key
deviceKey设备key
startTimestamp开始时间(毫秒时间戳)
endTimestamp结束时间(毫秒时间戳)
attributeCode物模型属性标识符,查询多个属性时使用英文逗号分隔
gatewayDk网关设备的 Device Key
gatewayPk网关设备的 Product Key
pageNumber当前页,默认为第 1 页
pageSize页大小,默认为 10 条
callback请求回调

示例代码

kotlin
QuecDeviceStatisticsService.getPropertyDataList(
    "pk",
    "dk",
    System.currentTimeMillis() - 90000,
    System.currentTimeMillis(),
    "temperature",
    null,
    null,
    1,
    10
) {
    if (it.isSuccess) {
        val data = it.data //请求成功
    } else {
        val code = it.code //请求失败, 错误码
        val msg = it.msg //请求失败, 错误信息
    }
}