|
@@ -30,12 +30,13 @@ import cn.com.qmth.examcloud.core.oe.student.base.utils.CommonUtil;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.base.utils.QuestionTypeUtil;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.bean.CheckExamInProgressInfo;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.bean.StartExamInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.dao.enums.HandInExamType;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.service.ExamControlService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.service.ExamFaceLivenessVerifyService;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordDataService;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordPaperStructService;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordQuestionsService;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.service.ExamingSessionService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.service.FaceBiopsyService;
|
|
|
import cn.com.qmth.examcloud.core.oe.task.api.ExamCaptureCloudService;
|
|
|
import cn.com.qmth.examcloud.core.oe.task.api.request.SaveExamCaptureSyncCompareResultReq;
|
|
|
import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
|
|
@@ -59,6 +60,7 @@ import cn.com.qmth.examcloud.support.cache.bean.ExtractConfigPaperCacheBean;
|
|
|
import cn.com.qmth.examcloud.support.cache.bean.SysPropertyCacheBean;
|
|
|
import cn.com.qmth.examcloud.support.enums.ExamRecordStatus;
|
|
|
import cn.com.qmth.examcloud.support.enums.FaceBiopsyScheme;
|
|
|
+import cn.com.qmth.examcloud.support.enums.HandInExamType;
|
|
|
import cn.com.qmth.examcloud.support.examing.ExamRecordData;
|
|
|
import cn.com.qmth.examcloud.support.examing.ExamingSession;
|
|
|
import cn.com.qmth.examcloud.support.examing.ExamingStatus;
|
|
@@ -93,7 +95,13 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
|
|
|
@Autowired
|
|
|
private ExamCloudService examCloudService;
|
|
|
-
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FaceBiopsyService faceBiopsyService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamFaceLivenessVerifyService examFaceLivenessVerifyService;
|
|
|
+
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public StartExamInfo startExam(Long examStudentId, User user) {
|
|
@@ -554,7 +562,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
// 如果是新活体检测方案,则使用新的计算方案计算活检开始时间
|
|
|
if (faceBiopsyScheme == FaceBiopsyScheme.NEW) {
|
|
|
faceVerifyMinute = faceBiopsyService.calculateFaceBiopsyStartMinute(examingRecord.getId());
|
|
|
- }else {// 非新活检,默认使用旧的活检计算方式
|
|
|
+ } else {// 非新活检,默认使用旧的活检计算方式
|
|
|
faceVerifyMinute = examFaceLivenessVerifyService.getFaceLivenessVerifyMinute(
|
|
|
examSessionInfo.getRootOrgId(), examSessionInfo.getOrgId(), examSessionInfo.getExamId(),
|
|
|
studentId, examSessionInfo.getExamRecordDataId(), examSessionInfo.getHeartbeat());
|
|
@@ -573,7 +581,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
}
|
|
|
|
|
|
// 如果考试时间结束,自动交卷
|
|
|
- if (examSessionInfo.getExamDuration() <= examSessionInfo.getCost()) {
|
|
|
+ if (examSessionInfo.getExamDuration() <= examSessionInfo.getCost()*1000) {
|
|
|
delayHandInExamIfLocked(examingRecord.getId());
|
|
|
return null;
|
|
|
}
|
|
@@ -633,4 +641,34 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 考试心跳每分钟调用一次
|
|
|
+ *
|
|
|
+ * @param user
|
|
|
+ * 学生
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public long examHeartbeat(User user) {
|
|
|
+ Long studentId = user.getUserId();
|
|
|
+ ExamingSession examSessionInfo = examingSessionService.getExamingSession(studentId);
|
|
|
+ if (examSessionInfo == null || examSessionInfo.getExamingStatus().equals(ExamingStatus.INFORMAL)
|
|
|
+ || examSessionInfo.getCost() >= examSessionInfo.getExamDuration()) {
|
|
|
+ throw new StatusException("8001", "无效的会话,请离开考试");
|
|
|
+ }
|
|
|
+ //考试耗时加60秒
|
|
|
+ examSessionInfo.setCost(examSessionInfo.getCost()+60);
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
+ if (now - examSessionInfo.getActiveTime() >= examSessionInfo.getExamReconnectTime().intValue() * 60 * 1000) {
|
|
|
+ delayHandInExamIfLocked(examSessionInfo.getExamRecordDataId());
|
|
|
+ return 0L;
|
|
|
+ }
|
|
|
+ // 更新考试会话过期时间
|
|
|
+ examingSessionService.saveExamingSession(examSessionInfo.getStudentId(), examSessionInfo);
|
|
|
+ // 在线考生心跳打点
|
|
|
+ ReportsUtil.report(new OnlineExamStudentReport(user.getRootOrgId(), user.getUserId(),
|
|
|
+ examSessionInfo.getExamId(), examSessionInfo.getExamStudentId()));
|
|
|
+ // 返回考试剩余时间
|
|
|
+ return examSessionInfo.getExamDuration() - (examSessionInfo.getCost() * 1000);
|
|
|
+ }
|
|
|
}
|