mobile CCTV,mobile surveillance,police body worn cameras

标题: 设备文件检索接口对接报错 登录接口可以调通 是我哪块配置有问题吗 [打印本页]

author: huayi    time: 2022-9-5 09:53
标题: 设备文件检索接口对接报错 登录接口可以调通 是我哪块配置有问题吗


author: besovideo    time: 2022-9-5 10:02
请详细描述,给出具体的代码和问题。
author: huayi    time: 2022-9-5 10:36
接口代码: @RequestMapping("/sendHttps")
    public void sendHttps() throws ParseException {
        Map<String,String> map=new HashMap<>();
        map.put("page","1");
        map.put("pageSize","10");
        Map<String,Object> map1=new HashMap<>();
        SimpleDateFormat  sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String str="2022-09-02 12:00:00";
        Date startTime=sdf.parse(str);
        Long beginTime=startTime.getTime();
        Long endTime=System.currentTimeMillis();
        map1.put("beginTime",beginTime);
        map1.put("endTime",endTime);
        map1.put("puID","UA_2644F61C");
        map.put("filter",map1.toString());
        doPost("https://localhost:9781/bvcsp/v1/pu/recordfile/filter/:UA_2644F61C",map,"utf8");

    }

    public String doPost(String url, Map<String, String> map, String charset) {
        HttpClient httpClient = null;
        HttpPost httpPost = null;
        String result = null;
        try {
            httpClient = new SSLClient();
            httpPost = new HttpPost(url);
            httpPost.setHeader("Content-Type","application/json");
            httpPost.setHeader("Authorization","Y3UrQ1VfYWRtaW4rYWRtaW4rMjYrMjc4NTExKzE2NjIzMzg2NTcrYnZodHRwY21kZjgwNzRmZGMzZTI4YzE4YQ");
            //设置参数
            List<NameValuePair> list = new ArrayList<NameValuePair>();
            Iterator iterator = map.entrySet().iterator();
            while (iterator.hasNext()) {
                Map.Entry<String, String> elem = (Map.Entry<String, String>) iterator.next();
                list.add(new BasicNameValuePair(elem.getKey(), elem.getValue()));
            }
            if (list.size() > 0) {
                UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, charset);
                httpPost.setEntity(entity);
            }
            HttpResponse response = httpClient.execute(httpPost);
            if (response != null) {
                HttpEntity resEntity = response.getEntity();
                if (resEntity != null) {
                    result = EntityUtils.toString(resEntity, charset);
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        System.out.println(result);
        return result;
    }

报错信息: {"code":4,"msg":"invalid character 'i' in literal false (expecting 'a')"}
author: huayi    time: 2022-9-5 11:24
besovideo post on2022-9-5 10:02
请详细描述,给出具体的代码和问题。

我用postman测试又报这个错误   {"code":10,"msg":"device offline"}  
author: admin    time: 2022-9-5 11:56
平台提供的http接口,但是前端目前还不支持接入。
author: fanghj90    time: 2022-9-5 12:10
huayi post on2022-9-5 11:24
我用postman测试又报这个错误   {"code":10,"msg":"device offline"}

https://localhost:9781/bvcsp/v1/pu/recordfile/filter/:UA_2644F61C
改成:https://localhost:9781/bvcsp/v1/pu/recordfile/filter/UA_2644F61C 试试。
api路径中的:表示这里是路径参数,真实请求的路径中不要有,要是真实的参数。
author: huayi    time: 2022-9-5 14:02
fanghj90 post on2022-9-5 12:10
https://localhost:9781/bvcsp/v1/pu/recordfile/filter/:UA_2644F61C
改成:https://localhost:9781/bv ...

我改成   https://localhost:9781/bvcsp/v1/pu/recordfile/filter/UA_2644F61C  还是不行 现在不是路径的问题 是我根本就访问不过去  我用postman测试 报{
    "code": 10,
    "msg": "device offline"
}

我看报错码  这是 Forbidden = 10;  // 拒绝请求,服务器繁忙  我重启电脑 也没用 但是我请求登录接口一直是ok的
author: fanghj90    time: 2022-9-5 16:10
huayi post on2022-9-5 14:02
我改成   https://localhost:9781/bvcsp/v1/pu/recordfile/filter/UA_2644F61C  还是不行 现在不是路径的 ...

UA_2644F61C是否在线?
后台管理->历史记录->媒体数据  中检索这个设备文件试试
author: dingjian    time: 2022-9-5 16:16
查询设备文件时,设备要在线
author: huayi    time: 2022-9-5 16:27
dingjian post on2022-9-5 16:16
查询设备文件时,设备要在线

没用的  还是这个错


author: huayi    time: 2022-9-5 16:28
huayi post on2022-9-5 16:27
没用的  还是这个错

再添加张图片

author: besovideo    time: 2022-9-5 16:35
图片没传上来
author: huayi    time: 2022-9-5 16:46
besovideo post on2022-9-5 16:35
图片没传上来

我这边显示上传上去了  你可以登我的账号看一下 账号:huayi  密码:123456
author: dingjian    time: 2022-9-5 16:58
请参照对比一下,是否有所不同

author: besovideo    time: 2022-9-5 17:06






author: huayi    time: 2022-9-5 17:09
dingjian post on2022-9-5 16:58
请参照对比一下,是否有所不同

我给你粘代码吧  我这个是9781端口:
http://192.168.110.13:9781/bvcsp ... /filter/UA_2644F61C
{
    "page": 0,
    "pageSize": 10,
    "filter": {
        "beginTime": 1630832074,
        "endTime": 1662368074,
        "puID": "UA_2644F61C"
    }
}

报错:<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx</center>
</body>
</html>

换成9780端口  报错:{"code":10,"msg":"device offline"}


author: dingjian    time: 2022-9-5 17:12
设备不在线,你仔细检查一下,设备是否是登陆状态
author: huayi    time: 2022-9-5 17:15
dingjian post on2022-9-5 17:12
设备不在线,你仔细检查一下,设备是否是登陆状态

我添加你微信了 你同意下  设备我刚关了  刚刚设备在线也是这个报错




欢迎光临 mobile CCTV,mobile surveillance,police body worn cameras (http://bbs.besovideo.com:8067/) Powered by Discuz! X3.2