中文

Supports

Home/Sevices/Supports/

查询项目下近48小时内所有传感器的最新一条数据

本接口可根据项目的主键id来查找项目下所有传感器近48小时内的最新一条数据。

请求头参数

需要放到http请求头(Headers)里的参数,通常为token。

 Header参数名类型是否必填示例描述
cookieStringgenerator=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI0ODM5NzA5MTgxMjE0NzIwMDAiLCJzeXN0ZW1JZCI6MzMzMjE4NTQ1MTU4OTc5NTg0L将access token写入到cookie中,用于网关校验。

请求参数

Body参数类型是否必填示例描述
projectIdlong569项目的唯一id

示例代码

 请求方式 POST

 请求地址 https://api.njgn.com/api/get_data/select_last_data_by_project

public static String getAllSensorDataByProject() {    // 接口请求地址
    String url = "https://api.njgn.com/api/get_data/select_last_data_by_project";    // 获取的AccessToken组装成cookie
    String cookie = "generator=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI0ODM5NzA5MTgxMjE0NzIwMDAiLCJzeXN0ZW1JZCI6MzMzMjE4NTQ1MTU4OTc5NTg0LCJlbnYiOiJ0ZXN0IiwidHlwZSI6ImdlbmVyYXRpb24iLCJleHAiOjQ3NTEyMjc3MjQsInZlcnNpb24iOiIxLjAiLCJpYXQiOjE1OTU1NTQxMjR9.wTbTICUpp9siuILzSaUYWWoE9dn_Runpa1lURSk2WRY";    // 请求参数
    Map<String, String> requestParam = new HashMap<>();
    requestParam.put("projectId", "569");    // 请求头的参数
    Map<String, String> headerMap = new HashMap<>();
    headerMap.put("cookie", cookie);    // 调用提供的HttpUtil库,result即为本次调用的结果
    String result = HttpUtil.post(url, requestParam, headerMap);    
    return result;
  }

返回示例

{
    "result": [
        {
            "id": "117899209",
            "time": 1616112000000,
            "gcz1": 19.34,
            "f1": 19.34,
            "f2": 2840,
            "isCalculate": 1,
            "sensorId": "56577",
            "projectId": "572",
            "middle1": null,
            "middle2": null,
            "middle3": null,
            "temporary": 19.34,
            "modDatum": "",
            "temperatureDatum": "",
            "alarmSign": 0,
            "rangeAlarm": 0
        }
    ],
    "op": true,
    "message": "OK"
}

参数名称类型描述
opboolean调用是否成功
messageString调用失败时返回错误信息
result.idString数据唯一id
result.timelong数据采集时间
result.gcz1double数据结果值
result.f1double采集值1(数据通道1的采集值)
result.f2double采集值2(数据通道2的采集值)
result.isCalculateshort是否完成计算:1,已完成;0,未完成
result.sensorIdString所属传感器id
result.projectIdString所属项目id
result.middle1double中间值1,未设置中间值1公式则为null
result.middle2double中间值2,未设置中间值2公式则为null
result.middle3double中间值3,未设置中间值3公式则为null
result.temporarydouble临时计算值,有组合的情况下保存的时组合前的值
result.modDatumString采集值1的基准值
result.temperatureDatumString采集值2的基准值
result.alarmSignshort报警标识:1,报警;0,未报警
result.rangeAlarmshort采集值越限标识:1,值越限;0,未越限



logo

Reaching the Nature, Discovering the World
Reverence for heaven and earth, concern for people and safety
For that tranquil landscape
We are always on the road
Follow Us
Follow Us
Preview

Address

China Jiangsu
9th Floor, Building 34, Shanggu Center, No. 2 Junlan Road, Gulou District, Nanjing
+86 25 84443850
Mon-Sun 8:00 am- 18:00 pm

Cooperations