From cefed27c64c40cc7f31332b9a17b9b42c5918e37 Mon Sep 17 00:00:00 2001 From: pengjie <17373303529@163.com> Date: Mon, 11 Nov 2024 10:11:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zhgd/review/base/api/CameraPreview.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/zhgd/review/base/api/CameraPreview.java b/src/main/java/com/zhgd/review/base/api/CameraPreview.java index edb966d..8138854 100644 --- a/src/main/java/com/zhgd/review/base/api/CameraPreview.java +++ b/src/main/java/com/zhgd/review/base/api/CameraPreview.java @@ -67,16 +67,21 @@ public class CameraPreview { /** * STEP6:调用接口 */ - String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, - contentType, header);// post请求application/json类型参数 - JSONObject jsonResult = JSONObject.parseObject(result); - if (result != null) { - String code = jsonResult.getString("code"); - if (!code.equals("0")) { - log.error("调用海康开发平台接口出现错误,请求接口:" + requestUrl + "请求参数 :" + body + "返回错误码:" + code); - jsonResult = null; + try { + String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, + contentType, header);// post请求application/json类型参数 + JSONObject jsonResult = JSONObject.parseObject(result); + if (result != null) { + String code = jsonResult.getString("code"); + if (!code.equals("0")) { + log.error("调用海康开发平台接口出现错误,请求接口:" + requestUrl + "请求参数 :" + body + "返回错误码:" + code); + jsonResult = null; + } } + return jsonResult; + } catch (Exception e) { + log.error("调用海康接口错误" + e.getMessage()); } - return jsonResult; + return null; } }