diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/controller/UfaceRecognitionController.java b/src/main/java/com/zhgd/xmgl/modules/worker/controller/UfaceRecognitionController.java index 117f25951..25bebcd09 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/controller/UfaceRecognitionController.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/controller/UfaceRecognitionController.java @@ -15,6 +15,7 @@ import com.zhgd.xmgl.modules.project.entity.Project; import com.zhgd.xmgl.modules.project.mapper.ProjectMapper; import com.zhgd.xmgl.modules.worker.entity.WorkerInfo; import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService; +import com.zhgd.xmgl.util.Base64Util; import com.zhgd.xmgl.util.MessageUtil; import com.zhgd.xmgl.util.PathUtil; import io.swagger.annotations.Api; @@ -118,12 +119,15 @@ public class UfaceRecognitionController { } JSONObject param = new JSONObject(); String fileUrl = MapUtils.getString(map, "fileUrl"); - if (StrUtil.isBlank(fileUrl)) { - throw new OpenAlertException("fileUrl不能为空"); + String facePicBinaryData = MapUtils.getString(map, "facePicBinaryData"); + if (StrUtil.isBlank(fileUrl) && StrUtil.isBlank(facePicBinaryData)) { + throw new OpenAlertException("fileUrl和facePicBinaryData不能同时为空"); + } + if (StrUtil.isNotBlank(fileUrl)) { + param.put("facePicUrl", PathUtil.reviseSlash(imageUrlPrefix + "/" + fileUrl)); + } else { + param.put("facePicBinaryData", Base64Util.convertFileToBase64(PathUtil.reviseSlash(basePath + "/" + fileUrl))); } - //base64可能卡 - //param.put("facePicBinaryData", Base64Util.convertFileToBase64(PathUtil.reviseSlash(basePath + "/" + fileUrl))); - param.put("facePicUrl", PathUtil.reviseSlash(imageUrlPrefix + "/" + fileUrl)); boolean b = hikvisionCall.faceScore(project, param); //boolean b = true; if (b) {