|
@@ -51,6 +51,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.examing.ExamingSession;
|
|
|
import cn.com.qmth.examcloud.support.examing.ExamingStatus;
|
|
|
+import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
|
|
|
|
|
|
/**
|
|
|
* @author chenken
|
|
@@ -141,31 +142,30 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
// 如果开启人脸比对,将同步人脸比对结果存储到抓后结果表中
|
|
|
Long rootOrgId = examRecordData.getRootOrgId();
|
|
|
Long examId = examRecordData.getExamId();
|
|
|
- // TODO
|
|
|
- // if (FaceBiopsyHelper.isFaceEnable(rootOrgId, examId, studentId)) {
|
|
|
- // SaveExamCaptureSyncCompareResultReq req = new
|
|
|
- // SaveExamCaptureSyncCompareResultReq();
|
|
|
- // req.setExamRecordDataId(examRecordData.getId());
|
|
|
- // req.setStudentId(user.getUserId());
|
|
|
- // examCaptureCloudService.saveExamCaptureSyncCompareResult(req);
|
|
|
- // }
|
|
|
+ //TODO
|
|
|
+// if (FaceBiopsyHelper.isFaceEnable(rootOrgId, examId, studentId)) {
|
|
|
+// SaveExamCaptureSyncCompareResultReq req = new SaveExamCaptureSyncCompareResultReq();
|
|
|
+// req.setExamRecordDataId(examRecordData.getId());
|
|
|
+// req.setStudentId(user.getUserId());
|
|
|
+// examCaptureCloudService.saveExamCaptureSyncCompareResult(req);
|
|
|
+// }
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
- log.debug("8 生成考试记录耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ log.debug("4 生成考试记录耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
}
|
|
|
|
|
|
// 生成试卷结构
|
|
|
ExtractConfigPaperCacheBean extractConfigPaper = CacheHelper.getExtractConfigPaper(examingSession.getExamId(),
|
|
|
courseBean.getCode(), examingSession.getPaperType(), paperId);
|
|
|
if (log.isDebugEnabled()) {
|
|
|
- log.debug("4 获取题库试卷结构耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ log.debug("5 获取题库试卷结构耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
}
|
|
|
|
|
|
// 小题乱序,选项乱序
|
|
|
startTime = System.currentTimeMillis();
|
|
|
reorderPaperStruct(extractConfig, extractConfigPaper);
|
|
|
if (log.isDebugEnabled()) {
|
|
|
- log.debug("5 小题乱序耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ log.debug("6 小题乱序耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
}
|
|
|
|
|
|
// 保存考试试卷结构
|
|
@@ -173,7 +173,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
examRecordPaperStructService.saveExamRecordPaperStruct(examRecordData.getId(),
|
|
|
extractConfigPaper.getDefaultPaper());
|
|
|
if (log.isDebugEnabled()) {
|
|
|
- log.debug("6 保存考试试卷结构耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ log.debug("7 保存考试试卷结构耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
}
|
|
|
|
|
|
// 创建考试作答记录
|
|
@@ -181,28 +181,24 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
examRecordQuestionsService.createExamRecordQuestions(examRecordData.getId(),
|
|
|
extractConfigPaper.getDefaultPaper());
|
|
|
if (log.isDebugEnabled()) {
|
|
|
- log.debug("9 创建考试作答记录耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ log.debug("8 创建考试作答记录耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
}
|
|
|
|
|
|
- // 创建考试会话
|
|
|
+ // 初始化考试会话
|
|
|
startTime = System.currentTimeMillis();
|
|
|
- // TODO
|
|
|
- // initializeExamRecordSession(originalExamStudent, examRecordData,
|
|
|
- // examBean);
|
|
|
+ initializeExamRecordSession(examingSession, examRecordData, examBean);
|
|
|
if (log.isDebugEnabled()) {
|
|
|
- log.debug("11 创建考试会话耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ log.debug("9 初始化考试会话耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
}
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
- log.debug("12 合计 耗时:" + (System.currentTimeMillis() - st) + " ms");
|
|
|
+ log.debug("10 合计 耗时:" + (System.currentTimeMillis() - st) + " ms");
|
|
|
}
|
|
|
// 在线考生开考打点
|
|
|
ReportsUtil.report(
|
|
|
new OnlineExamStudentReport(user.getRootOrgId(), user.getUserId(), examBean.getId(), examStudentId));
|
|
|
- // TODO
|
|
|
- // return buildStartExamInfo(examRecordData.getId(),
|
|
|
- // originalExamStudent, examBean, courseBean);
|
|
|
- return null;
|
|
|
+ StartExamInfo startExamInfo = buildStartExamInfo(examRecordData.getId(), examingSession, examBean, courseBean);
|
|
|
+ return startExamInfo;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -407,20 +403,17 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
- // TODO
|
|
|
-
|
|
|
- // private StartExamInfo buildStartExamInfo(Long examRecordDataId,
|
|
|
- // ExamingSession examingSession, ExamBean examBean,
|
|
|
- // CourseBean courseBean) {
|
|
|
- // StartExamInfo startExamInfo = new StartExamInfo();
|
|
|
- // startExamInfo.setExamRecordDataId(examRecordDataId);
|
|
|
- // startExamInfo.setCourseName(courseBean.getName());
|
|
|
- // startExamInfo.setDuration(examBean.getDuration());
|
|
|
- // startExamInfo.setFaceVerifyMinute(getFaceVerifyMinute(examingSession.getRootOrgId(),
|
|
|
- // examBean.getId(),
|
|
|
- // examingSession.getOrgId(), examingSession.getStudentId()));
|
|
|
- // return startExamInfo;
|
|
|
- // }
|
|
|
+
|
|
|
+ private StartExamInfo buildStartExamInfo(Long examRecordDataId, ExamingSession examingSession, ExamBean examBean,
|
|
|
+ CourseBean courseBean) {
|
|
|
+ StartExamInfo startExamInfo = new StartExamInfo();
|
|
|
+ startExamInfo.setExamRecordDataId(examRecordDataId);
|
|
|
+ startExamInfo.setCourseName(courseBean.getName());
|
|
|
+ startExamInfo.setDuration(examBean.getDuration());
|
|
|
+ startExamInfo.setFaceVerifyMinute(getFaceVerifyMinute(examingSession.getRootOrgId(), examBean.getId(),
|
|
|
+ examingSession.getOrgId(), examingSession.getStudentId()));
|
|
|
+ return startExamInfo;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 确定活体检测开始分钟数
|
|
@@ -428,35 +421,65 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
* @param examId
|
|
|
* @return
|
|
|
*/
|
|
|
- // TODO
|
|
|
- // private Integer getFaceVerifyMinute(Long rootOrgId, Long examId, Long
|
|
|
- // orgId, Long studentId) {
|
|
|
- // // 如果开启了活体检测
|
|
|
- // if (FaceBiopsyHelper.isFaceVerify(rootOrgId, examId, studentId)) {
|
|
|
- // // 开始分钟数
|
|
|
- // String startMinuteStr = ExamCacheTransferHelper
|
|
|
- // .getCachedExamProperty(examId, studentId,
|
|
|
- // ExamProperties.FACE_VERIFY_START_MINUTE.name()).getValue();
|
|
|
- // if (CommonUtil.isBlank(startMinuteStr)) {
|
|
|
- // throw new
|
|
|
- // StatusException("ExamControlServiceImpl-getFaceVerifyMinute-001",
|
|
|
- // ExamProperties.FACE_VERIFY_START_MINUTE.getDesc() + "未设置");
|
|
|
- // }
|
|
|
- // Integer faceVerifyStartMinute = Integer.valueOf(startMinuteStr);
|
|
|
- //
|
|
|
- // // 结束分钟数
|
|
|
- // String endMinuteStr = ExamCacheTransferHelper
|
|
|
- // .getCachedExamProperty(examId, studentId,
|
|
|
- // ExamProperties.FACE_VERIFY_END_MINUTE.name()).getValue();
|
|
|
- // if (CommonUtil.isBlank(endMinuteStr)) {
|
|
|
- // throw new
|
|
|
- // StatusException("ExamControlServiceImpl-getFaceVerifyMinute-002",
|
|
|
- // ExamProperties.FACE_VERIFY_END_MINUTE.getDesc() + "未设置");
|
|
|
- // }
|
|
|
- // Integer faceVerifyEndMinute = Integer.valueOf(endMinuteStr);
|
|
|
- // return CommonUtil.calculationRandomNumber(faceVerifyStartMinute,
|
|
|
- // faceVerifyEndMinute);
|
|
|
- // }
|
|
|
- // return null;
|
|
|
- // }
|
|
|
+ private Integer getFaceVerifyMinute(Long rootOrgId, Long examId, Long orgId, Long studentId) {
|
|
|
+ // 如果开启了活体检测
|
|
|
+ if (FaceBiopsyHelper.isFaceVerify(rootOrgId, examId, studentId)) {
|
|
|
+ // 开始分钟数
|
|
|
+ String startMinuteStr = ExamCacheTransferHelper
|
|
|
+ .getCachedExamProperty(examId, studentId, ExamProperties.FACE_VERIFY_START_MINUTE.name())
|
|
|
+ .getValue();
|
|
|
+ if (CommonUtil.isBlank(startMinuteStr)) {
|
|
|
+ throw new StatusException("5001",
|
|
|
+ ExamProperties.FACE_VERIFY_START_MINUTE.getDesc() + "未设置");
|
|
|
+ }
|
|
|
+ Integer faceVerifyStartMinute = Integer.valueOf(startMinuteStr);
|
|
|
+
|
|
|
+ // 结束分钟数
|
|
|
+ String endMinuteStr = ExamCacheTransferHelper
|
|
|
+ .getCachedExamProperty(examId, studentId, ExamProperties.FACE_VERIFY_END_MINUTE.name()).getValue();
|
|
|
+ if (CommonUtil.isBlank(endMinuteStr)) {
|
|
|
+ throw new StatusException("5002",
|
|
|
+ ExamProperties.FACE_VERIFY_END_MINUTE.getDesc() + "未设置");
|
|
|
+ }
|
|
|
+ Integer faceVerifyEndMinute = Integer.valueOf(endMinuteStr);
|
|
|
+ return CommonUtil.calculationRandomNumber(faceVerifyStartMinute, faceVerifyEndMinute);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化考试会话
|
|
|
+ *
|
|
|
+ * @param examRecordData
|
|
|
+ * @param examBean
|
|
|
+ */
|
|
|
+ public void initializeExamRecordSession(ExamingSession examSessionInfo, ExamRecordDataEntity examRecordData,
|
|
|
+ final ExamBean examBean) {
|
|
|
+ examSessionInfo.setExamRecordDataId(examRecordData.getId());
|
|
|
+ examSessionInfo.setStartTime(examRecordData.getStartTime().getTime());
|
|
|
+ examSessionInfo.setExamType(examBean.getExamType());
|
|
|
+ examSessionInfo.setExamId(examBean.getId());
|
|
|
+ // EXAM_RECONNECT_TIME:断点续考时间
|
|
|
+ String examReconnectTimeStr = ExamCacheTransferHelper.getCachedExamProperty(examBean.getId(),
|
|
|
+ examSessionInfo.getStudentId(), ExamProperties.EXAM_RECONNECT_TIME.name()).getValue();
|
|
|
+ log.debug("11.2 断点时间:" + examReconnectTimeStr);
|
|
|
+ if (CommonUtil.isBlank(examReconnectTimeStr)) {
|
|
|
+ throw new StatusException("6001",
|
|
|
+ ExamProperties.EXAM_RECONNECT_TIME.getDesc() + "未设置");
|
|
|
+ }
|
|
|
+ examSessionInfo.setExamReconnectTime(Integer.valueOf(examReconnectTimeStr));
|
|
|
+ // FREEZE_TIME:冻结时间
|
|
|
+ String freezeTimeStr = ExamCacheTransferHelper.getCachedExamProperty(examBean.getId(),
|
|
|
+ examSessionInfo.getStudentId(), ExamProperties.FREEZE_TIME.name()).getValue();
|
|
|
+ log.debug("11.3 冻结时间:" + freezeTimeStr);
|
|
|
+ if (CommonUtil.isBlank(freezeTimeStr)) {
|
|
|
+ throw new StatusException("6002",
|
|
|
+ ExamProperties.FREEZE_TIME.getDesc() + "未设置");
|
|
|
+ }
|
|
|
+ examSessionInfo.setFreezeTime(Integer.valueOf(freezeTimeStr));
|
|
|
+ examSessionInfo.setExamingStatus(ExamingStatus.FORMAL);
|
|
|
+ log.debug("11.4 开始保存考试会话...studentId=" + examSessionInfo.getStudentId());
|
|
|
+ examingSessionService.saveExamingSession(examSessionInfo.getStudentId(), examSessionInfo);
|
|
|
+ log.debug("11.5 保存考试会话结束 ");
|
|
|
+ }
|
|
|
}
|