From 443dffce29daf6ed03b3c2137738925e315fb09f Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期一, 30 十二月 2024 20:16:52 +0800 Subject: [PATCH] 修改bug --- guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/videoGateway/VideoGateway.java | 52 ++++++++++++++++++++++++++++++---------------------- 1 files changed, 30 insertions(+), 22 deletions(-) diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/videoGateway/VideoGateway.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/videoGateway/VideoGateway.java index 5f74528..7274d05 100644 --- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/videoGateway/VideoGateway.java +++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/videoGateway/VideoGateway.java @@ -36,10 +36,10 @@ public static SessionId getSessionId(){ HttpRequest get = HttpUtil.createGet("https://zhyn.cg.gz.gov.cn/api/cws-auth/v1/session-id/third-platform"); get.header("operate-terminal", "4"); - log.info("请求参数:" + get); + log.info("【获取 SessionId】请求参数:" + get); HttpResponse execute = get.execute(); String body = execute.body(); - log.info("返回结果:" + body); + log.info("【获取 SessionId】返回结果:" + body); JSONObject result = JSON.parseObject(body); Integer code = result.getInteger("code"); if(-1 == code){ @@ -70,10 +70,10 @@ String encryptHex = sm4.encryptHex("Lti52D@#&J6q"); body.put("pwd", encryptHex); body.put("sessionId", sessionId.getSessionId()); - log.info("请求参数:" + JSON.toJSONString(body) + "\npublicKey:" + sessionId.getPublicKey() + "\n加密key:" + sessionId.getKey()); + log.info("【登录】请求参数:" + JSON.toJSONString(body) + "\npublicKey:" + sessionId.getPublicKey() + "\n加密key:" + sessionId.getKey()); post.body(JSON.toJSONString(body)); HttpResponse execute = post.execute(); - log.info("返回结果:" + execute.body()); + log.info("【登录】返回结果:" + execute.body()); JSONObject result = JSON.parseObject(execute.body()); Integer code = result.getInteger("code"); if(0 != code){ @@ -108,7 +108,7 @@ if(StringUtils.isNotEmpty(companyName)){ body.put("companyName", companyName); } - log.info("请求参数:" + JSON.toJSONString(body)); + log.info("【获取车辆列表】请求参数:" + JSON.toJSONString(body)); post.body(JSON.toJSONString(body)); HttpResponse execute = post.execute(); if(401 == execute.getStatus()){ @@ -121,7 +121,7 @@ num++; return getVehicleList(vehicleNum, companyId, companyName, num); } - log.info("返回结果:" + execute.body()); + log.info("【获取车辆列表】返回结果:" + execute.body()); JSONObject result = JSON.parseObject(execute.body()); Integer code = result.getInteger("code"); if(0 != code){ @@ -162,7 +162,7 @@ if(StringUtils.isNotEmpty(companyName)){ body.put("companyName", companyName); } - log.info("请求参数:" + JSON.toJSONString(body)); + log.info("【获取船舶列表】请求参数:" + JSON.toJSONString(body)); post.body(JSON.toJSONString(body)); HttpResponse execute = post.execute(); if(401 == execute.getStatus()){ @@ -175,7 +175,7 @@ accountLogin = null; return getShipList(shipNum, companyId, companyName, num); } - log.info("返回结果:" + execute.body()); + log.info("【获取船舶列表】返回结果:" + execute.body()); JSONObject result = JSON.parseObject(execute.body()); Integer code = result.getInteger("code"); if(0 != code){ @@ -204,6 +204,7 @@ post.header("operate-terminal", "4"); post.header("token", accountLogin.getToken()); post.body("{}"); + log.info("【2018年协议车辆在线】请求参数:" + post.getUrl()); HttpResponse execute = post.execute(); if(401 == execute.getStatus()){ log.error("token失效,重新登录"); @@ -215,7 +216,7 @@ accountLogin = null; return queryRuntimeInfoByCache(num); } - log.info("返回结果:" + execute.body()); + log.info("【2018年协议车辆在线】返回结果:" + execute.body()); JSONObject result = JSON.parseObject(execute.body()); Integer code = result.getInteger("code"); if(0 != code){ @@ -243,6 +244,7 @@ HttpRequest get = HttpUtil.createGet("https://zhyn.cg.gz.gov.cn/jttweb/api/v1/location/locationRealTimeInfoCache"); get.header("operate-terminal", "4"); get.header("token", accountLogin.getToken()); + log.info("【2023年协议车辆在线】请求参数:" + get.getUrl()); HttpResponse execute = get.execute(); if(401 == execute.getStatus()){ log.error("token失效,重新登录"); @@ -254,7 +256,7 @@ accountLogin = null; return locationRealTimeInfoCache(num); } - log.info("返回结果:" + execute.body()); + log.info("【2023年协议车辆在线】返回结果:" + execute.body()); JSONObject result = JSON.parseObject(execute.body()); Integer code = result.getInteger("code"); if(0 != code){ @@ -284,9 +286,10 @@ HttpRequest post = HttpUtil.createPost("https://zhyn.cg.gz.gov.cn/map/web/vehicleCtrl/" + terminalId + "/cameraShot"); post.header("operate-terminal", "4"); post.header("token", accountLogin.getToken()); + log.info("【2018年协议发送拍摄指令接口】请求地址:" + post.getUrl()); Map<String, Object> body = new HashMap<>(); body.put("channelId", channelId); - log.info("请求参数:" + JSON.toJSONString(body)); + log.info("【2018年协议发送拍摄指令接口】请求参数:" + JSON.toJSONString(body)); post.body(JSON.toJSONString(body)); HttpResponse execute = post.execute(); if(401 == execute.getStatus()){ @@ -299,7 +302,7 @@ accountLogin = null; return cameraShot2018(terminalId, channelId, num); } - log.info("返回结果:" + execute.body()); + log.info("【2018年协议发送拍摄指令接口】返回结果:" + execute.body()); JSONObject result = JSON.parseObject(execute.body()); Integer code = result.getInteger("code"); if(0 != code){ @@ -326,8 +329,7 @@ HttpRequest get = HttpUtil.createGet("https://zhyn.cg.gz.gov.cn/api/cws-business/biz-device-send-records/v1/cameraShot?vehicleId=" + vehicleId + "&vehicleType=" + vehicleType + "&terminalId=" + terminalId + "&channelId=" + channelId); get.header("operate-terminal", "4"); get.header("token", accountLogin.getToken()); - Map<String, Object> body = new HashMap<>(); - log.info("请求参数:" + get.getUrl()); + log.info("【2023年协议发送拍摄指令接口】请求参数:" + get.getUrl()); HttpResponse execute = get.execute(); if(401 == execute.getStatus()){ log.error("token失效,重新登录"); @@ -339,7 +341,7 @@ accountLogin = null; return cameraShot2023(vehicleId, vehicleType, terminalId, channelId, num); } - log.info("返回结果:" + execute.body()); + log.info("【2023年协议发送拍摄指令接口】返回结果:" + execute.body()); JSONObject result = JSON.parseObject(execute.body()); Integer code = result.getInteger("code"); if(0 != code){ @@ -364,7 +366,7 @@ HttpRequest get = HttpUtil.createGet("https://zhyn.cg.gz.gov.cn/map/web/vehicleCtrl/getCameraShotById?terminalId=" + terminalId + "&id=" + fileId); get.header("operate-terminal", "4"); get.header("token", accountLogin.getToken()); - log.info("请求参数:" + get.getUrl()); + log.info("【2018年协议车辆获取拍摄图片】请求参数:" + get.getUrl()); HttpResponse execute = get.execute(); if(401 == execute.getStatus()){ log.error("token失效,重新登录"); @@ -376,7 +378,7 @@ accountLogin = null; return getCameraShotByFileId2018(terminalId, fileId, num); } - log.info("返回结果:" + execute.body()); + log.info("【2018年协议车辆获取拍摄图片】返回结果:" + execute.body()); JSONObject result = JSON.parseObject(execute.body()); Integer code = result.getInteger("code"); if(0 != code){ @@ -388,6 +390,7 @@ if(null == data){ return null; } + data = data.replaceAll(";", ""); return "https://zhyn-pic.cg.gz.gov.cn" + data; } @@ -404,7 +407,7 @@ HttpRequest get = HttpUtil.createGet("https://zhyn.cg.gz.gov.cn/api/cws-business/biz-device-send-records/v1/getCameraShotById?id=" + fileId); get.header("operate-terminal", "4"); get.header("token", accountLogin.getToken()); - log.info("请求参数:" + get.getUrl()); + log.info("【2023年协议车辆获取拍摄图片】请求参数:" + get.getUrl()); HttpResponse execute = get.execute(); if(401 == execute.getStatus()){ log.error("token失效,重新登录"); @@ -416,7 +419,7 @@ accountLogin = null; return getCameraShotByFileId2023(fileId, num); } - log.info("返回结果:" + execute.body()); + log.info("【2023年协议车辆获取拍摄图片】返回结果:" + execute.body()); JSONObject result = JSON.parseObject(execute.body()); Integer code = result.getInteger("code"); if(0 != code){ @@ -428,6 +431,7 @@ if(null == data){ return null; } + data = data.replaceAll(";", ""); return "https://zhyn-pic.cg.gz.gov.cn" + data; } @@ -489,12 +493,16 @@ // String decryptStr = sm4.decryptStr("357b94ca60ce8140f3d22eceaaa5d71b0d25d6cd20c8218d9a3ddcd30881126d", CharsetUtil.CHARSET_UTF_8); // System.err.println(decryptStr); - accountLogin(); - System.err.println(accountLogin); +// accountLogin(); +// System.err.println(accountLogin); // getVehicleList(null, null, null); // getShipList(null, null, null); // queryRuntimeInfoByCache(); - locationRealTimeInfoCache(0); +// locationRealTimeInfoCache(0); + + + List<Vehicle> 粤AFX998 = VideoGateway.getVehicleList("粤AFX998", null, null, 0); + System.err.println(粤AFX998); } // public static void main(String[] args) { -- Gitblit v1.7.1