|
@@ -1,13 +1,16 @@
|
|
|
package cn.com.qmth.examcloud.core.oe.student.service.impl;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.util.FileUtil;
|
|
|
+import cn.com.qmth.examcloud.commons.util.JsonMapper;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.base.bean.CompareFaceSyncInfo;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.base.utils.Check;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.bean.client.FaceCaptureResult;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.bean.client.FaceCompareResult;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.bean.client.FaceLiveVerifyResult;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.dao.ExamCaptureRepo;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.dao.ExamFaceLiveVerifyRepo;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.dao.entity.ExamCaptureEntity;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.dao.entity.ExamFaceLiveVerifyEntity;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordDataService;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.service.FaceProcessService;
|
|
|
import cn.com.qmth.examcloud.support.Constants;
|
|
@@ -36,6 +39,9 @@ public class FaceProcessServiceImpl implements FaceProcessService {
|
|
|
@Autowired
|
|
|
private ExamCaptureRepo examCaptureRepo;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ExamFaceLiveVerifyRepo examFaceLiveVerifyRepo;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RedisClient redisClient;
|
|
|
|
|
@@ -109,7 +115,27 @@ public class FaceProcessServiceImpl implements FaceProcessService {
|
|
|
|
|
|
@Override
|
|
|
public void saveFaceLiveVerifyResult(FaceLiveVerifyResult req) {
|
|
|
- //todo
|
|
|
+ Check.isNull(req.getStudentId(), "学生ID不能为空");
|
|
|
+ Check.isNull(req.getExamRecordDataId(), "考试记录ID不能为空");
|
|
|
+ Check.isNull(req.getStatus(), "人脸活体验证状态不能为空");
|
|
|
+
|
|
|
+ ExamRecordData examRecordData = examRecordDataService.getExamRecordDataCache(req.getExamRecordDataId());
|
|
|
+ if (examRecordData == null || ExamRecordStatus.EXAM_ING != examRecordData.getExamRecordStatus()) {
|
|
|
+ // 考试记录无效
|
|
|
+ log.warn("Skip saveFaceLiveVerifyResult... examRecordDataId = {}", req.getExamRecordDataId());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ ExamFaceLiveVerifyEntity entity = new ExamFaceLiveVerifyEntity();
|
|
|
+ entity.setExamRecordDataId(req.getExamRecordDataId());
|
|
|
+ entity.setStatus(req.getStatus());
|
|
|
+ entity.setFaceCount(req.getFaceCount());
|
|
|
+ entity.setSimilarity(req.getSimilarity());
|
|
|
+ entity.setRealness(req.getRealness());
|
|
|
+ entity.setErrorMsg(req.getErrorMsg());
|
|
|
+ entity.setProcessTime(req.getProcessTime() != null ? req.getProcessTime() : 1L);
|
|
|
+ entity.setActions(new JsonMapper().toJson(req.getActions()));
|
|
|
+ examFaceLiveVerifyRepo.save(entity);
|
|
|
}
|
|
|
|
|
|
}
|