diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/sdk/huawei/service/HuaWeiBoxApiService.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/sdk/huawei/service/HuaWeiBoxApiService.java index 84cdd90..b89ce15 100644 --- a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/sdk/huawei/service/HuaWeiBoxApiService.java +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/sdk/huawei/service/HuaWeiBoxApiService.java @@ -86,7 +86,7 @@ public class HuaWeiBoxApiService implements HuaWeiBoxApi { * @return Long */ @Override - public Long findPerson(String base64Img){ + public Long findPerson(String base64Img) { String url = "/sdk_service/rest/facerepositories/peoples"; FinaHWPersonReq req = new FinaHWPersonReq(); @@ -99,13 +99,18 @@ public class HuaWeiBoxApiService implements HuaWeiBoxApi { JSONObject jsonRes = JSONUtil.parseObj(jsonStrRes); if (jsonRes.getInt("resultCode") != 0) { - log.error("华为盒子人脸比对败,msg:{}", jsonRes.getStr("resultMsg")); + log.error("调用华为盒子人脸比对接口失败,code:{},msg:{}", jsonRes.getInt("resultCode"), jsonRes.getStr("resultMsg")); return null; } - JSONArray jsonArr = jsonRes.getJSONArray("algorithmCode"); + JSONArray jsonArr = jsonRes.getJSONArray("algorithmResults"); JSONObject obj = jsonArr.getJSONObject(0); + if (Integer.parseInt(obj.getStr("number")) == 0) { + log.error("无人脸比对数据"); + return null; + } + JSONArray peopleList = obj.getJSONArray("peopleList"); JSONObject people = peopleList.getJSONObject(0);