|
@@ -9,11 +9,12 @@ import cn.com.qmth.examcloud.commons.util.UrlUtil;
|
|
|
import cn.com.qmth.examcloud.commons.util.Util;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.base.Constants;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.base.helper.ExamCacheTransferHelper;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.base.utils.CommonUtil;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.base.utils.QuestionTypeUtil;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.entity.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.enums.*;
|
|
|
+import cn.com.qmth.examcloud.core.oe.common.helper.ExamCacheTransferHelper;
|
|
|
+import cn.com.qmth.examcloud.core.oe.common.helper.FaceBiopsyHelper;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.repository.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.service.ExamScoreObtainQueueService;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.service.ExamScorePushQueueService;
|
|
@@ -174,8 +175,6 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
@Value("${$upyun.site.1.domain}")
|
|
|
private String upyunFileUrl;
|
|
|
|
|
|
- private final String NEW_FACE_BIOPSY_SCHEME = "S2";
|
|
|
-
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public StartExamInfo startExam(Long examStudentId, User user) {
|
|
@@ -277,13 +276,16 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
originalExamStudent.getIsReExamine(), extractConfigPaper.getDefaultPaper().getFullyObjective());
|
|
|
|
|
|
// 生成进行中的考试记录
|
|
|
- examRecordDataService.createExamingRecord(examRecordData.getId(), examRecordData.getStudentId(),
|
|
|
+ Long studentId = examRecordData.getStudentId();
|
|
|
+ examRecordDataService.createExamingRecord(examRecordData.getId(), studentId,
|
|
|
examRecordData.getExamType());
|
|
|
|
|
|
// 如果开启人脸比对,将同步人脸比对结果存储到抓后结果表中
|
|
|
- String isFaceEnable = ExamCacheTransferHelper.getCachedExamProperty(examRecordData.getExamId(), examRecordData.getOrgId(),
|
|
|
- examRecordData.getStudentId(), ExamProperties.IS_FACE_ENABLE.name()).getValue();
|
|
|
- if (isFaceEnable != null && Constants.isTrue.equals(isFaceEnable)) {
|
|
|
+ Long rootOrgId = examRecordData.getRootOrgId();
|
|
|
+ Long examId = examRecordData.getExamId();
|
|
|
+ Long orgId = examRecordData.getOrgId();
|
|
|
+
|
|
|
+ if (FaceBiopsyHelper.isFaceEnable(rootOrgId, examId, orgId, studentId)) {
|
|
|
SaveExamCaptureSyncCompareResultReq req = new SaveExamCaptureSyncCompareResultReq();
|
|
|
req.setExamRecordDataId(examRecordData.getId());
|
|
|
req.setStudentId(user.getUserId());
|
|
@@ -395,7 +397,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
startExamInfo.setCourseCode(examStudentEntity.getCourseCode());
|
|
|
startExamInfo.setCourseName(courseBean.getName());
|
|
|
startExamInfo.setDuration(examBean.getDuration());
|
|
|
- startExamInfo.setFaceVerifyMinute(getFaceVerifyMinute(examBean.getId(), examStudentEntity.getOrgId(),
|
|
|
+ startExamInfo.setFaceVerifyMinute(getFaceVerifyMinute(examStudentEntity.getRootOrgId(), examBean.getId(), examStudentEntity.getOrgId(),
|
|
|
examStudentEntity.getStudentId()));
|
|
|
return startExamInfo;
|
|
|
}
|
|
@@ -406,11 +408,9 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
* @param examId
|
|
|
* @return
|
|
|
*/
|
|
|
- private Integer getFaceVerifyMinute(Long examId, Long orgId, Long studentId) {
|
|
|
- String isFaceVerifyStr = ExamCacheTransferHelper.getCachedExamProperty(examId, orgId,
|
|
|
- studentId, ExamProperties.IS_FACE_VERIFY.name()).getValue();
|
|
|
+ private Integer getFaceVerifyMinute(Long rootOrgId, Long examId, Long orgId, Long studentId) {
|
|
|
// 如果开启了活体检测
|
|
|
- if (Constants.isTrue.equals(isFaceVerifyStr)) {
|
|
|
+ if (FaceBiopsyHelper.isFaceVerify(rootOrgId, examId, orgId, studentId)) {
|
|
|
// 开始分钟数
|
|
|
String startMinuteStr = ExamCacheTransferHelper
|
|
|
.getCachedExamProperty(examId, orgId, studentId, ExamProperties.FACE_VERIFY_START_MINUTE.name()).getValue();
|
|
@@ -720,20 +720,22 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
log.debug("1 [HAND_IN_EXAM]获取考试记录耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
}
|
|
|
|
|
|
+ Long studentId = examRecordData.getStudentId();
|
|
|
if (handInExamType == HandInExamType.MANUAL) {
|
|
|
startTime = System.currentTimeMillis();
|
|
|
|
|
|
// 得到考试时长,校验是否达到冻结时间
|
|
|
- long usedExamTime = checkAndComputeExamDuration(examRecordData.getStudentId());
|
|
|
+ long usedExamTime = checkAndComputeExamDuration(studentId);
|
|
|
examRecordData.setUsedExamTime(usedExamTime);
|
|
|
examRecordData.setExamRecordStatus(ExamRecordStatus.EXAM_HAND_IN);
|
|
|
examRecordData.setEndTime(new Date());
|
|
|
|
|
|
// 手工手卷时,如果开启人脸检测,则更新抓拍队列优先级
|
|
|
- String isFaceEnable = ExamCacheTransferHelper.getCachedExamProperty(examRecordData.getExamId(),
|
|
|
- examRecordData.getOrgId(),
|
|
|
- examRecordData.getStudentId(), ExamProperties.IS_FACE_ENABLE.name()).getValue();
|
|
|
- if (isFaceEnable != null && Constants.isTrue.equals(isFaceEnable)) {
|
|
|
+ Long rootOrgId = examRecordData.getRootOrgId();
|
|
|
+ Long examId = examRecordData.getExamId();
|
|
|
+ Long orgId = examRecordData.getOrgId();
|
|
|
+
|
|
|
+ if (FaceBiopsyHelper.isFaceEnable(rootOrgId, examId, rootOrgId, studentId)) {
|
|
|
// 更新照片抓拍队列优先级为高优先级
|
|
|
examCaptureQueueRepo.updateExamCaptureQueuePriority(Constants.PROCESS_CAPTURE_HIGH_PRIORITY,
|
|
|
examRecordData.getId());
|
|
@@ -772,7 +774,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
|
|
|
startTime = System.currentTimeMillis();
|
|
|
// 把进行中的考试记录放入交卷队列中
|
|
|
- examRecordDataService.createHandInExamRecord(examRecordData.getId(), examRecordData.getStudentId());
|
|
|
+ examRecordDataService.createHandInExamRecord(examRecordData.getId(), studentId);
|
|
|
if (log.isDebugEnabled()) {
|
|
|
log.debug("4 [HAND_IN_EXAM]把进行中的考试记录放入交卷队列中耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
}
|
|
@@ -786,7 +788,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
|
|
|
startTime = System.currentTimeMillis();
|
|
|
// 删除redis会话
|
|
|
- examSessionInfoService.deleteExamSessionInfo(examRecordData.getStudentId());
|
|
|
+ examSessionInfoService.deleteExamSessionInfo(studentId);
|
|
|
if (log.isDebugEnabled()) {
|
|
|
log.debug("6 [HAND_IN_EXAM]删除redis会话:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
}
|
|
@@ -821,7 +823,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
.calculateFaceCheckResult(examRecordData);
|
|
|
examRecordData = calculateFaceCheckResultInfo.getExamRecordData();
|
|
|
// 计算活体检测结果(根据已检测出照片数据更新考试记录中的相关人脸检测的统计字段)
|
|
|
- examRecordData = examRecordDataService.calculateFaceLivenessVerifyResult(examRecordData);
|
|
|
+ examRecordDataService.calculateFaceLivenessVerifyResult(examRecordData);
|
|
|
// 违纪自动审核
|
|
|
examRecordData = examRecordDataService
|
|
|
.examRecordAutoAudit(calculateFaceCheckResultInfo.getIsNoPhotoAndIllegality(), examRecordData);
|
|
@@ -934,17 +936,17 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
|
|
|
// 断点续考时重新计算活体检测的分钟数
|
|
|
Integer faceVerifyMinute = null;
|
|
|
- OrgPropertyCacheBean orgProperty = CacheHelper.getOrgProperty(examStudentEntity.getRootOrgId(),
|
|
|
- Constants.IDENTIFICATION_OF_LIVING_BODY_SCHEME_KEY);
|
|
|
+ FaceBiopsyScheme faceBiopsyScheme = FaceBiopsyHelper.getFaceBiopsyScheme(examStudentEntity.getRootOrgId());
|
|
|
|
|
|
// 如果是新活体检测方案,则使用新的计算方案计算活检开始时间
|
|
|
- if (NEW_FACE_BIOPSY_SCHEME.equals(orgProperty.getValue())) {
|
|
|
+ if (faceBiopsyScheme == FaceBiopsyScheme.NEW) {
|
|
|
faceVerifyMinute = faceBiopsyService.getFaceBiopsyStartMinute(examingRecord.getExamRecordDataId());
|
|
|
}
|
|
|
// 非新活检,默认使用旧的活检计算方式
|
|
|
else {
|
|
|
faceVerifyMinute = examFaceLivenessVerifyService.getFaceLivenessVerifyMinute(
|
|
|
- examStudentEntity.getOrgId(), examStudentEntity.getExamId(), studentId,
|
|
|
+ examStudentEntity.getRootOrgId(), examStudentEntity.getOrgId(),
|
|
|
+ examStudentEntity.getExamId(), studentId,
|
|
|
examingRecord.getExamRecordDataId(), examSessionInfo.getHeartbeat());
|
|
|
}
|
|
|
|