|
@@ -8,6 +8,7 @@ import cn.com.qmth.examcloud.core.oe.student.dao.entity.ExamCaptureQueueEntity;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.dao.enums.ExamCaptureQueueStatus;
|
|
|
import cn.com.qmth.examcloud.core.oe.task.service.ExamRecordDataService;
|
|
|
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.ImageBase64Parm;
|
|
|
import cn.com.qmth.examcloud.starters.face.verify.model.param.ImageParm;
|
|
@@ -114,6 +115,7 @@ public class FaceVerifyJobHandler {
|
|
|
// 将抓拍照图片转成Base64格式
|
|
|
ImageParm capturePhoto = new ImageBase64Parm(CommonUtils.toBase64(FileStorageUtil.realPath(queue.getFileUrl())));
|
|
|
|
|
|
+ String extMsg = "";
|
|
|
boolean errFace = false;
|
|
|
|
|
|
try {
|
|
@@ -129,10 +131,8 @@ public class FaceVerifyJobHandler {
|
|
|
faceCompareResult = faceVerifyService.faceCompareByFacePlus(basePhoto, capturePhoto);
|
|
|
}
|
|
|
|
|
|
- if (!faceCompareResult.isApiNeedRetry()) {
|
|
|
- queue.setExtMsg(faceCompareResult.getError());
|
|
|
- this.saveExamCaptureAndDeleteQueue(queue);
|
|
|
- continue;
|
|
|
+ if (faceCompareResult.isApiNeedRetry()) {
|
|
|
+ throw new FaceVerifyException(faceCompareResult.getError());
|
|
|
}
|
|
|
|
|
|
queue.setIsPass(faceCompareResult.isFacePass());
|
|
@@ -140,7 +140,13 @@ public class FaceVerifyJobHandler {
|
|
|
queue.setStatus(ExamCaptureQueueStatus.PROCESS_FACE_COMPARE_COMPLETE);
|
|
|
queue.setIsStranger(false);
|
|
|
|
|
|
+ if (!faceCompareResult.isFacePass()) {
|
|
|
+ extMsg = "比对:" + faceCompareResult.getError();
|
|
|
+ queue.setExtMsg(extMsg);
|
|
|
+ }
|
|
|
+
|
|
|
if (faceCompareResult.getFaceNum() == 0) {
|
|
|
+ // 百度人脸比对接口(不支持人脸数量检测)
|
|
|
if (!useBaiduApi) {
|
|
|
errFace = true;
|
|
|
}
|
|
@@ -155,12 +161,6 @@ public class FaceVerifyJobHandler {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (!faceCompareResult.isFacePass()) {
|
|
|
- queue.setExtMsg(faceCompareResult.getError());
|
|
|
- }
|
|
|
-
|
|
|
- examCaptureQueueRepo.save(queue);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
int errorNum = queue.getErrorNum() != null ? queue.getErrorNum() : 0;
|
|
@@ -185,14 +185,13 @@ public class FaceVerifyJobHandler {
|
|
|
FaceResult faceLivenessResult = faceVerifyService.faceVerifyByBaidu(capturePhoto);
|
|
|
queue.setFacelivenessResult(faceLivenessResult.getJsonResult());
|
|
|
|
|
|
- if (!faceLivenessResult.isApiNeedRetry()) {
|
|
|
- queue.setExtMsg(faceLivenessResult.getError());
|
|
|
- this.saveExamCaptureAndDeleteQueue(queue);
|
|
|
- continue;
|
|
|
+ if (faceLivenessResult.isApiNeedRetry()) {
|
|
|
+ throw new FaceVerifyException(faceLivenessResult.getError());
|
|
|
}
|
|
|
|
|
|
if (!faceLivenessResult.isFacePass()) {
|
|
|
- queue.setExtMsg(faceLivenessResult.getError());
|
|
|
+ extMsg = extMsg + " 活检:" + faceLivenessResult.getError();
|
|
|
+ queue.setExtMsg(extMsg);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
int errorNum = queue.getErrorNum() != null ? queue.getErrorNum() : 0;
|
|
@@ -220,6 +219,7 @@ public class FaceVerifyJobHandler {
|
|
|
if (examCaptureRepo.exists(example)) {
|
|
|
// 照片处理结果中若已存在则以已有的数据为准,删除该队列记录
|
|
|
examCaptureQueueRepo.deleteById(queue.getId());
|
|
|
+ log.info("==>ExamCaptureQueue clear... examRecordDataId:{} fileName:{}", queue.getExamRecordDataId(), queue.getFileName());
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -236,10 +236,12 @@ public class FaceVerifyJobHandler {
|
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
|
// 从创建队列到处理完毕的时间
|
|
|
result.setProcessTime(currentTimeMillis - queue.getCreationTime().getTime());
|
|
|
+
|
|
|
// 从开始处理到处理完毕的时间
|
|
|
result.setUsedTime(currentTimeMillis - queue.getFaceCompareStartTime());
|
|
|
|
|
|
- result.setHasVirtualCamera(queue.getHasVirtualCamera());
|
|
|
+ result.setHasVirtualCamera(queue.getHasVirtualCamera() != null ? queue.getHasVirtualCamera() : false);
|
|
|
+
|
|
|
if (StringUtils.length(queue.getCameraInfos()) >= Constants.VM_CAMERA_SIZE_LIMIT) {
|
|
|
log.warn("虚拟摄像头信息超长!examRecordDataId:{} queueId:{}", queue.getExamRecordDataId(), queue.getId());
|
|
|
result.setCameraInfos(Constants.VM_CAMERA_WARN);
|
|
@@ -251,6 +253,7 @@ public class FaceVerifyJobHandler {
|
|
|
|
|
|
// 删除该队列记录
|
|
|
examCaptureQueueRepo.deleteById(queue.getId());
|
|
|
+ log.info("-->ExamCaptureQueue clear... examRecordDataId:{} fileName:{}", queue.getExamRecordDataId(), queue.getFileName());
|
|
|
}
|
|
|
|
|
|
}
|