From f3ebd4656c7f17938e15a1a6d1cc078770f4f288 Mon Sep 17 00:00:00 2001 From: coco1986509808 <1986509808@qq.com> Date: Tue, 28 Mar 2023 17:47:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E8=84=B8=E6=AF=94=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/impl/CompareServiceImpl.java | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/face-server/src/main/java/com/dkha/server/services/impl/CompareServiceImpl.java b/face-server/src/main/java/com/dkha/server/services/impl/CompareServiceImpl.java index 483b077..5a01f8a 100644 --- a/face-server/src/main/java/com/dkha/server/services/impl/CompareServiceImpl.java +++ b/face-server/src/main/java/com/dkha/server/services/impl/CompareServiceImpl.java @@ -160,14 +160,31 @@ public class CompareServiceImpl implements ICompareService { private void validateSingleFaceImage(String image) { //人脸检测url //String faceSearchUrl = apiRequestPrefix + ApiUrlEnum.FACE_SEARCH.getUrl(); - String faceSearchUrltest = 192.168.3.132:5000/message/mask; + + String faceSearchUrltest ="http://192.168.3.132:5000/message/mask"; //组装api请求数据 ReturnVO returnVO; - returnVO = (ReturnVO) httpUtil.post(faceSearchUrltest + "?url=" + image, null, ReturnVO.class); - if (returnVO.getCode() != 200) { - throw new DkException(returnVO.getMessage()); - } + returnVO = (ReturnVO) httpUtil.post(faceSearchUrltest + "?url=" + image, null, ReturnVO.class); + System.out.println(returnVO.getCode()+returnVO.getMessage()); + if (returnVO.getCode() != 200) { + throw new DkException(returnVO.getMessage()); + } //反序列化 + // 返回data格式{ + // "code": 200, + // "data": [ + // { + // "faceRect": { + // "h": 174, + // "w": 257, + // "x": 161, + // "y": 47 + // }, + // "url": "http://192.168.1.133:9000/middleware/456/1790226920.jpg" + // } + // ], + // "message": "检测到人脸" + //} List apiSearchFaceRectVOList = JsonUtil.string2Obj(JsonUtil.obj2String(returnVO.getData()), new TypeReference>() {}); if (UtilValidate.isEmpty(apiSearchFaceRectVOList)) { throw new DkException("当前上传中未检测到人脸,请重新上传");