Browse Source

更新视频监控接口, 使用json强求

wuweihao 3 years ago
parent
commit
be594ed5bc

+ 31 - 1
gis_common/src/main/java/com/gis/common/util/DoorUtils.java

@@ -355,7 +355,8 @@ public class DoorUtils {
         Map<String, Object> encryptMap = encrypt(param);
         log.warn("request param: " + param.toString());
         log.info("request url: "+ url);
-        log.info("encryptMap param: "+JSON.toJSONString(encryptMap));
+        String resJsonStr = JSON.toJSONString(encryptMap);
+        log.info("encryptMap param: "+ resJsonStr);
         String result = HttpUtil.post(url, encryptMap);
         log.info("result: {}", result);
         JSONObject resultJson = JSON.parseObject(result);
@@ -370,6 +371,35 @@ public class DoorUtils {
         }
     }
 
+    /**
+     * 涉及敏感信息以及为确保隐私安全,此接口返回值进行了AES加密处理;
+     * by owen 2022-07-11
+     * 使用json 请求
+     */
+    public static Result doPostDecryptJson(String url, TreeMap<String, Object> param) throws Exception {
+        Map<String, Object> encryptMap = encrypt(param);
+        log.warn("request param: " + param.toString());
+        log.info("request url: "+ url);
+        String resJsonStr = JSON.toJSONString(encryptMap);
+        log.info("encryptMap param: "+ resJsonStr);
+        String result = HttpUtil.createPost(url).body(resJsonStr, "application/json").execute().body();
+        log.info("result: {}", result);
+        JSONObject resultJson = JSON.parseObject(result);
+        int code = resultJson.getInteger("code");
+        if (code == 2000) {
+            // 解密
+            String data = resultJson.get("data").toString();
+            return Result.success(decrypt(data, encryptMap.get("aesKey").toString()));
+        } else {
+            log.error(result);
+            return Result.failure(resultJson.getString("msg"));
+        }
+    }
+
+
+
+
+
 
     public static Result doPost(String url, TreeMap<String, Object> param) throws Exception {
         log.info("request url: "+ url);

+ 3 - 2
gis_web/src/main/java/com/gis/web/controller/dafengSmartCommunityController/CommunityMonitor.java

@@ -157,7 +157,7 @@ public class CommunityMonitor {
         TreeMap<String, Object> param =  new TreeMap<>();
         param.put("code", code);
         param.put("pageSize", 200);
-        return DoorUtils.doPostDecrypt(apiUrl,param);
+        return DoorUtils.doPostDecryptJson(apiUrl,param);
     }
 
 
@@ -167,11 +167,12 @@ public class CommunityMonitor {
         String apiUrl =configConstant.apiVideo+"/bi/findVideoInfo";
         System.out.println("apiUrl: "+apiUrl);
         TreeMap<String, Object> param =  new TreeMap<>();
+
         param.put("code", videoDto.getCode());
         param.put("pageSize", videoDto.getPageSize());
         param.put("pageNum", videoDto.getPageNum());
         param.put("type", videoDto.getType());
-        return DoorUtils.doPostDecrypt(apiUrl,param);
+        return DoorUtils.doPostDecryptJson(apiUrl,param);
     }
 
     @ApiImplicitParams({