|
@@ -70,9 +70,9 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
throw new StatusException("考试会话已过期");
|
|
|
}
|
|
|
|
|
|
- int times = 0;
|
|
|
- boolean hasSuccess = false;
|
|
|
- Long faceLiveVerifyId = null;
|
|
|
+ int finishCount = 0;// 已完成几次活检
|
|
|
+ boolean hasSuccess = false;// 是否成功过
|
|
|
+ Long faceLiveVerifyId = null;// 当前活检记录ID
|
|
|
|
|
|
List<ExamFaceLiveVerifyEntity> entities = examFaceLiveVerifyRepo.findByExamRecordDataId(examRecordData.getId());
|
|
|
if (!CollectionUtils.isEmpty(entities)) {
|
|
@@ -82,24 +82,35 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
}
|
|
|
|
|
|
if (entity.getFinished()) {
|
|
|
- times++;
|
|
|
+ finishCount++;
|
|
|
} else {
|
|
|
+ // 进行中的活检
|
|
|
faceLiveVerifyId = entity.getId();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 是否考中活体不通过强制退出
|
|
|
+ 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(times);
|
|
|
+ info.setTimes(finishCount);
|
|
|
info.setHasSuccess(hasSuccess);
|
|
|
|
|
|
- if (times > 1) {
|
|
|
- log.warn("活检次数已超过2次!studentId:{} examRecordDataId:{} 第{}次", studentId, examRecordDataId, times);
|
|
|
+ if (!isFaceVerifyForceExit && finishCount == 1) {
|
|
|
+ // 若“考中活体不通过强制退出为false”,则首次活体不通过时,不结束考试继续作答,也不再次活体检测
|
|
|
+ log.warn("[pcClient]活检已完成{}次,考中活体不通过强制退出未开启,不再继续活检!studentId:{} examRecordDataId:{} ", finishCount, studentId, examRecordDataId);
|
|
|
+ return info;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (finishCount > 1) {
|
|
|
+ log.warn("[pcClient]活检已完成{}次,当前限制2次机会!studentId:{} examRecordDataId:{} ", finishCount, studentId, examRecordDataId);
|
|
|
return info;
|
|
|
}
|
|
|
|
|
|
if (hasSuccess) {
|
|
|
- log.warn("活检已检测成功过!studentId:{} examRecordDataId:{} 第{}次", studentId, examRecordDataId, times);
|
|
|
+ log.warn("[pcClient]活检已完成{}次,已成功过,不再继续活检!studentId:{} examRecordDataId:{} ", finishCount, studentId, examRecordDataId);
|
|
|
return info;
|
|
|
}
|
|
|
|
|
@@ -111,15 +122,15 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
entity.setStatus(FaceLiveVerifyStatus.ERROR);
|
|
|
examFaceLiveVerifyRepo.save(entity);
|
|
|
faceLiveVerifyId = entity.getId();
|
|
|
- times++;
|
|
|
+ finishCount++;
|
|
|
}
|
|
|
info.setFaceLiveVerifyId(faceLiveVerifyId);
|
|
|
- info.setTimes(times);
|
|
|
+ info.setTimes(finishCount);
|
|
|
|
|
|
Integer startMinute = this.calculateStartFaceVerifyMinute(examRecordDataId);
|
|
|
info.setStartMinute(startMinute);
|
|
|
|
|
|
- log.warn("[pcClient]活检检测开始! studentId:{} examRecordDataId:{} 第{}次", studentId, examRecordDataId, times);
|
|
|
+ log.warn("[pcClient]活检开始,当前第{}次!studentId:{} examRecordDataId:{}", finishCount, studentId, examRecordDataId);
|
|
|
return info;
|
|
|
}
|
|
|
|
|
@@ -151,7 +162,7 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
|
|
|
ExamFaceLiveVerifyEntity entity = optional.get();
|
|
|
if (entity.getFinished()) {
|
|
|
- log.warn("当前活检记录已完成!examRecordDataId:{} faceLiveVerifyId:{}", req.getExamRecordDataId(), req.getFaceLiveVerifyId());
|
|
|
+ log.warn("当前活检记录已完成,跳过重复保存!examRecordDataId:{} faceLiveVerifyId:{}", req.getExamRecordDataId(), req.getFaceLiveVerifyId());
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -172,7 +183,7 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
|
|
|
examRecordData.setFaceVerifyResult(FaceLiveVerifyStatus.SUCCESS == req.getStatus() ? IsSuccess.SUCCESS : IsSuccess.FAILED);
|
|
|
if (isFaceVerifyForceExit && FaceLiveVerifyStatus.SUCCESS != req.getStatus()) {
|
|
|
- // 活检失败,则认为违纪
|
|
|
+ // 强制活检 且 活检失败,则认为违纪
|
|
|
examRecordData.setIsIllegality(true);
|
|
|
}
|
|
|
examRecordDataService.saveExamRecordDataCache(req.getExamRecordDataId(), examRecordData);
|