| | |
| | | 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){ |
| | |
| | | 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){ |
| | |
| | | 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()){ |
| | |
| | | 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){ |
| | |
| | | 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()){ |
| | |
| | | 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){ |
| | |
| | | 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失效,重新登录"); |
| | |
| | | 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){ |
| | |
| | | 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失效,重新登录"); |
| | |
| | | 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){ |
| | |
| | | post.header("token", accountLogin.getToken()); |
| | | 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()){ |
| | |
| | | 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){ |
| | |
| | | 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失效,重新登录"); |
| | |
| | | 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){ |
| | |
| | | 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失效,重新登录"); |
| | |
| | | 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){ |
| | |
| | | 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失效,重新登录"); |
| | |
| | | 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){ |