|
@@ -12,6 +12,8 @@ import cn.com.qmth.examcloud.core.oe.task.service.bean.FaceApiParam;
|
|
|
import cn.com.qmth.examcloud.starters.face.verify.common.CommonUtils;
|
|
|
import cn.com.qmth.examcloud.starters.face.verify.common.FaceVerifyException;
|
|
|
import cn.com.qmth.examcloud.starters.face.verify.model.FaceResult;
|
|
|
+import cn.com.qmth.examcloud.starters.face.verify.model.param.FaceApiType;
|
|
|
+import cn.com.qmth.examcloud.starters.face.verify.model.param.FaceParam;
|
|
|
import cn.com.qmth.examcloud.starters.face.verify.model.param.ImageBase64Parm;
|
|
|
import cn.com.qmth.examcloud.starters.face.verify.model.param.ImageParm;
|
|
|
import cn.com.qmth.examcloud.starters.face.verify.service.FaceVerifyService;
|
|
@@ -139,10 +141,17 @@ public class ExamCaptureQueueServiceImpl implements ExamCaptureQueueService {
|
|
|
|
|
|
FaceResult faceCompareResult;
|
|
|
if (useBaiduApi) {
|
|
|
- faceCompareResult = faceVerifyService.faceCompareByBaidu(basePhoto, capturePhoto,
|
|
|
- baiduExpectFaceCompareScore, param.isUseLocalBaiduApiForFaceCompare());
|
|
|
+ // faceCompareResult = faceVerifyService.faceCompareByBaidu(basePhoto, capturePhoto,
|
|
|
+ // baiduExpectFaceCompareScore, param.isUseLocalBaiduApiForFaceCompare());
|
|
|
+ faceCompareResult = faceVerifyService.faceCompare(FaceParam.builder()
|
|
|
+ .images(basePhoto, capturePhoto)
|
|
|
+ .expectFaceCompareScore(baiduExpectFaceCompareScore)
|
|
|
+ .apiType(param.isUseLocalBaiduApiForFaceCompare() ? FaceApiType.PRIVATE_BAIDU_API : FaceApiType.BAIDU_API));
|
|
|
} else {
|
|
|
- faceCompareResult = faceVerifyService.faceCompareByFacePlus(basePhoto, capturePhoto);
|
|
|
+ // faceCompareResult = faceVerifyService.faceCompareByFacePlus(basePhoto, capturePhoto);
|
|
|
+ faceCompareResult = faceVerifyService.faceCompare(FaceParam.builder()
|
|
|
+ .images(basePhoto, capturePhoto)
|
|
|
+ .apiType(FaceApiType.FACE_PLUS));
|
|
|
}
|
|
|
|
|
|
if (faceCompareResult.isApiNeedRetry()) {
|
|
@@ -197,9 +206,9 @@ public class ExamCaptureQueueServiceImpl implements ExamCaptureQueueService {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- // 人脸活体检测开始
|
|
|
- FaceResult faceLivenessResult = faceVerifyService.faceVerifyByBaidu(capturePhoto,
|
|
|
- param.isUseLocalBaiduApiForFaceLiveness());
|
|
|
+ // 人脸真实性检测开始
|
|
|
+ FaceResult faceLivenessResult = faceVerifyService.faceVerify(FaceParam.builder().images(capturePhoto)
|
|
|
+ .apiType(param.isUseLocalBaiduApiForFaceLiveness() ? FaceApiType.PRIVATE_BAIDU_API : FaceApiType.BAIDU_API));
|
|
|
queue.setFacelivenessResult(faceLivenessResult.getJsonResult());
|
|
|
|
|
|
if (faceLivenessResult.isApiNeedRetry()) {
|
|
@@ -207,7 +216,7 @@ public class ExamCaptureQueueServiceImpl implements ExamCaptureQueueService {
|
|
|
}
|
|
|
|
|
|
if (!faceLivenessResult.isFacePass()) {
|
|
|
- extMsg = extMsg + " 活检:" + Optional.ofNullable(faceLivenessResult.getError()).orElse("不通过");
|
|
|
+ extMsg = extMsg + " 真实性:" + Optional.ofNullable(faceLivenessResult.getError()).orElse("不通过");
|
|
|
queue.setExtMsg(extMsg);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -216,7 +225,7 @@ public class ExamCaptureQueueServiceImpl implements ExamCaptureQueueService {
|
|
|
queue.setErrorMsg(e.getMessage());
|
|
|
queue.setStatus(ExamCaptureQueueStatus.PROCESS_FACELIVENESS_FAILED);
|
|
|
|
|
|
- log.error("人脸活体检测错误!examRecordDataId:{} queueId:{} errorNum:{} error:{}",
|
|
|
+ log.error("人脸真实性检测错误!examRecordDataId:{} queueId:{} errorNum:{} error:{}",
|
|
|
queue.getExamRecordDataId(), queue.getId(), queue.getErrorNum(), e.getMessage());
|
|
|
examCaptureQueueRepo.save(queue);
|
|
|
continue;
|