|
@@ -91,26 +91,31 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
}
|
|
|
|
|
|
// 是否考中活体不通过强制退出
|
|
|
- ExamPropertyCacheBean examProperty = CacheHelper.getExamProperty(examRecordData.getExamId(), ExamProperties.FACE_VERIFY_FORCE_EXIT.name());
|
|
|
+ ExamPropertyCacheBean examProperty = CacheHelper.getExamProperty(examRecordData.getExamId(),
|
|
|
+ ExamProperties.FACE_VERIFY_FORCE_EXIT.name());
|
|
|
boolean isFaceVerifyForceExit = examProperty != null && StringUtil.isTrue(examProperty.getValue());
|
|
|
|
|
|
FaceLiveVerifyInfo info = new FaceLiveVerifyInfo();
|
|
|
- info.setTimes(finishCount);
|
|
|
+ info.setTimes(finishCount + 1);
|
|
|
info.setHasSuccess(hasSuccess);
|
|
|
|
|
|
if (!isFaceVerifyForceExit && finishCount == 1) {
|
|
|
// 若“考中活体不通过强制退出为false”,则首次活体不通过时,不结束考试继续作答,也不再次活体检测
|
|
|
- log.warn("[pcClient]活检已完成{}次,考中活体不通过强制退出未开启,不再继续活检!studentId:{} examRecordDataId:{} ", finishCount, studentId, examRecordDataId);
|
|
|
+ log.warn(
|
|
|
+ "[pcClient]活检已完成{}次,考中活体不通过强制退出未开启,不再继续活检!studentId:{} examRecordDataId:{} ",
|
|
|
+ finishCount, studentId, examRecordDataId);
|
|
|
return info;
|
|
|
}
|
|
|
|
|
|
if (finishCount > 1) {
|
|
|
- log.warn("[pcClient]活检已完成{}次,当前限制2次机会!studentId:{} examRecordDataId:{} ", finishCount, studentId, examRecordDataId);
|
|
|
+ log.warn("[pcClient]活检已完成{}次,当前限制2次机会!studentId:{} examRecordDataId:{} ", finishCount,
|
|
|
+ studentId, examRecordDataId);
|
|
|
return info;
|
|
|
}
|
|
|
|
|
|
if (hasSuccess) {
|
|
|
- log.warn("[pcClient]活检已完成{}次,已成功过,不再继续活检!studentId:{} examRecordDataId:{} ", finishCount, studentId, examRecordDataId);
|
|
|
+ log.warn("[pcClient]活检已完成{}次,已成功过,不再继续活检!studentId:{} examRecordDataId:{} ", finishCount,
|
|
|
+ studentId, examRecordDataId);
|
|
|
return info;
|
|
|
}
|
|
|
|
|
@@ -122,15 +127,14 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
entity.setStatus(FaceLiveVerifyStatus.ERROR);
|
|
|
examFaceLiveVerifyRepo.save(entity);
|
|
|
faceLiveVerifyId = entity.getId();
|
|
|
- finishCount++;
|
|
|
}
|
|
|
info.setFaceLiveVerifyId(faceLiveVerifyId);
|
|
|
- info.setTimes(finishCount);
|
|
|
|
|
|
Integer startMinute = this.calculateStartFaceVerifyMinute(examRecordDataId);
|
|
|
info.setStartMinute(startMinute);
|
|
|
|
|
|
- log.warn("[pcClient]活检开始,当前第{}次!studentId:{} examRecordDataId:{}", finishCount, studentId, examRecordDataId);
|
|
|
+ log.warn("[pcClient]活检开始,当前第{}次!studentId:{} examRecordDataId:{}", info.getTimes(), studentId,
|
|
|
+ examRecordDataId);
|
|
|
return info;
|
|
|
}
|
|
|
|
|
@@ -144,30 +148,35 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
|
|
|
ExamRecordData examRecordData = examRecordDataService.getExamRecordDataCache(req.getExamRecordDataId());
|
|
|
if (examRecordData == null || ExamRecordStatus.EXAM_ING != examRecordData.getExamRecordStatus()) {
|
|
|
- log.warn("保存活检结果,考试记录无效!studentId:{} examRecordDataId:{}", req.getStudentId(), req.getExamRecordDataId());
|
|
|
+ log.warn("保存活检结果失败,考试记录无效!studentId:{} examRecordDataId:{} faceLiveVerifyId:{}",
|
|
|
+ req.getStudentId(), req.getExamRecordDataId(), req.getFaceLiveVerifyId());
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
ExamingSession examingSession = examingSessionService.getExamingSession(req.getStudentId());
|
|
|
if (examingSession == null || ExamingStatus.INFORMAL.equals(examingSession.getExamingStatus())) {
|
|
|
- log.warn("保存活检结果,考试会话已过期!studentId:{} examRecordDataId:{}", req.getStudentId(), req.getExamRecordDataId());
|
|
|
+ log.warn("保存活检结果失败,考试会话已过期!studentId:{} examRecordDataId:{} faceLiveVerifyId:{}",
|
|
|
+ req.getStudentId(), req.getExamRecordDataId(), req.getFaceLiveVerifyId());
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
Optional<ExamFaceLiveVerifyEntity> optional = examFaceLiveVerifyRepo.findById(req.getFaceLiveVerifyId());
|
|
|
if (!optional.isPresent()) {
|
|
|
- log.warn("当前活检记录不存在!examRecordDataId:{} faceLiveVerifyId:{}", req.getExamRecordDataId(), req.getFaceLiveVerifyId());
|
|
|
+ log.warn("保存活检结果失败,活检记录ID无效!studentId:{} examRecordDataId:{} faceLiveVerifyId:{}",
|
|
|
+ req.getStudentId(), req.getExamRecordDataId(), req.getFaceLiveVerifyId());
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
ExamFaceLiveVerifyEntity entity = optional.get();
|
|
|
if (entity.getFinished()) {
|
|
|
- log.warn("当前活检记录已完成,跳过重复保存!examRecordDataId:{} faceLiveVerifyId:{}", req.getExamRecordDataId(), req.getFaceLiveVerifyId());
|
|
|
+ log.warn("保存活检结果失败,跳过重复保存!studentId:{} examRecordDataId:{} faceLiveVerifyId:{}",
|
|
|
+ req.getStudentId(), req.getExamRecordDataId(), req.getFaceLiveVerifyId());
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 是否考中活体不通过强制退出
|
|
|
- ExamPropertyCacheBean examProperty = CacheHelper.getExamProperty(examRecordData.getExamId(), ExamProperties.FACE_VERIFY_FORCE_EXIT.name());
|
|
|
+ ExamPropertyCacheBean examProperty = CacheHelper.getExamProperty(examRecordData.getExamId(),
|
|
|
+ ExamProperties.FACE_VERIFY_FORCE_EXIT.name());
|
|
|
boolean isFaceVerifyForceExit = examProperty != null && StringUtil.isTrue(examProperty.getValue());
|
|
|
|
|
|
entity.setFinished(true);
|
|
@@ -181,15 +190,18 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
entity.setUpdateTime(new Date());
|
|
|
examFaceLiveVerifyRepo.save(entity);
|
|
|
|
|
|
- examRecordData.setFaceVerifyResult(FaceLiveVerifyStatus.SUCCESS == req.getStatus() ? IsSuccess.SUCCESS : IsSuccess.FAILED);
|
|
|
+ examRecordData.setFaceVerifyResult(
|
|
|
+ FaceLiveVerifyStatus.SUCCESS == req.getStatus() ? IsSuccess.SUCCESS : IsSuccess.FAILED);
|
|
|
if (isFaceVerifyForceExit && FaceLiveVerifyStatus.SUCCESS != req.getStatus()) {
|
|
|
// 强制活检 且 活检失败,则认为违纪
|
|
|
examRecordData.setIsIllegality(true);
|
|
|
}
|
|
|
examRecordDataService.saveExamRecordDataCache(req.getExamRecordDataId(), examRecordData);
|
|
|
|
|
|
- log.warn("[pcClient]保存活检结果!examRecordDataId:{} faceLiveVerifyId:{} status:{} isIllegality:{} isFaceVerifyForceExit:{}",
|
|
|
- req.getExamRecordDataId(), req.getFaceLiveVerifyId(), req.getStatus(), examRecordData.getIsIllegality(), isFaceVerifyForceExit);
|
|
|
+ log.warn(
|
|
|
+ "[pcClient]保存活检结果!examRecordDataId:{} faceLiveVerifyId:{} status:{} isIllegality:{} isFaceVerifyForceExit:{}",
|
|
|
+ req.getExamRecordDataId(), req.getFaceLiveVerifyId(), req.getStatus(), examRecordData.getIsIllegality(),
|
|
|
+ isFaceVerifyForceExit);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -200,7 +212,8 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
}
|
|
|
|
|
|
//开启了人脸检测
|
|
|
- if (!FaceBiopsyHelper.isFaceVerify(examRecordData.getRootOrgId(), examRecordData.getExamId(), examRecordData.getStudentId())) {
|
|
|
+ if (!FaceBiopsyHelper.isFaceVerify(examRecordData.getRootOrgId(), examRecordData.getExamId(),
|
|
|
+ examRecordData.getStudentId())) {
|
|
|
//如果未开启人脸活体检测,则返回null
|
|
|
return null;
|
|
|
}
|
|
@@ -211,12 +224,12 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
}
|
|
|
|
|
|
// 活体检测开始分钟数
|
|
|
- int faceVerifyStartMinute = this.getExamPropertyValue(examRecordData.getExamId(),
|
|
|
- examRecordData.getStudentId(), ExamProperties.FACE_VERIFY_START_MINUTE);
|
|
|
+ int faceVerifyStartMinute = this.getExamPropertyValue(examRecordData.getExamId(), examRecordData.getStudentId(),
|
|
|
+ ExamProperties.FACE_VERIFY_START_MINUTE);
|
|
|
|
|
|
// 活体检测结束分钟数(默认 <= 交卷冻结时间)
|
|
|
- int faceVerifyEndMinute = this.getExamPropertyValue(examRecordData.getExamId(),
|
|
|
- examRecordData.getStudentId(), ExamProperties.FACE_VERIFY_END_MINUTE);
|
|
|
+ int faceVerifyEndMinute = this.getExamPropertyValue(examRecordData.getExamId(), examRecordData.getStudentId(),
|
|
|
+ ExamProperties.FACE_VERIFY_END_MINUTE);
|
|
|
|
|
|
String examingHeartbeatKey = RedisKeyHelper.getBuilder().examingHeartbeatKey(examRecordDataId);
|
|
|
ExamingHeartbeat examingHeartbeat = redisClient.get(examingHeartbeatKey, ExamingHeartbeat.class);
|
|
@@ -243,7 +256,8 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
}
|
|
|
|
|
|
private int getExamPropertyValue(Long examId, Long studentId, ExamProperties propKey) {
|
|
|
- ExamPropertyCacheBean property = ExamCacheTransferHelper.getCachedExamProperty(examId, studentId, propKey.name());
|
|
|
+ ExamPropertyCacheBean property = ExamCacheTransferHelper.getCachedExamProperty(examId, studentId,
|
|
|
+ propKey.name());
|
|
|
if (property == null || StringUtils.isEmpty(property.getValue())) {
|
|
|
throw new StatusException(propKey.getDesc() + "未设置");
|
|
|
}
|