评分修改

This commit is contained in:
guoshengxiong 2024-05-30 13:52:14 +08:00
parent b45d9dfb21
commit cd75081b99

View File

@ -33,10 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
import static com.zhgd.xmgl.config.FaceRunner.faceEngine;
@ -107,6 +104,7 @@ public class UfaceRecognitionController {
@ApiOperation(value = "海康检测人脸评分", notes = "海康检测人脸评分", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "fileUrl", value = "照片路径", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "type", value = "1url、2base64", paramType = "body", required = false, dataType = "Integer"),
})
@PostMapping(value = "/checkfaceHikvision")
public Result<Map<String, Object>> checkfaceHikvision(@RequestBody Map<String, Object> map) throws Exception {
@ -119,14 +117,14 @@ public class UfaceRecognitionController {
}
JSONObject param = new JSONObject();
String fileUrl = MapUtils.getString(map, "fileUrl");
String facePicBinaryData = MapUtils.getString(map, "facePicBinaryData");
if (StrUtil.isBlank(fileUrl) && StrUtil.isBlank(facePicBinaryData)) {
throw new OpenAlertException("fileUrl和facePicBinaryData不能同时为空");
if (StrUtil.isBlank(fileUrl)) {
throw new OpenAlertException("fileUrl不能为空");
}
if (StrUtil.isNotBlank(fileUrl)) {
param.put("facePicUrl", PathUtil.reviseSlash(imageUrlPrefix + "/" + fileUrl));
} else {
Integer type = MapUtils.getInteger(map, "type");
if (Objects.equals(type, 2)) {
param.put("facePicBinaryData", Base64Util.convertFileToBase64(PathUtil.reviseSlash(basePath + "/" + fileUrl)));
} else {
param.put("facePicUrl", PathUtil.reviseSlash(imageUrlPrefix + "/" + fileUrl));
}
boolean b = hikvisionCall.faceScore(project, param);
//boolean b = true;