|
@@ -189,12 +189,6 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
prepare4Exam(examStudentId, userId, allowOnline);
|
|
|
|
|
|
Long studentId = userId;
|
|
|
- long st = System.currentTimeMillis();
|
|
|
-
|
|
|
- long startTime = System.currentTimeMillis();
|
|
|
- if (log.isDebugEnabled()) {
|
|
|
- log.debug("1 获取考生信息耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
- }
|
|
|
// 检查redis session
|
|
|
ExamingSession examingSession = examingSessionService.getExamingSession(studentId);
|
|
|
if (examingSession == null) {
|
|
@@ -205,23 +199,13 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
}
|
|
|
|
|
|
// 检查并获取考试信息
|
|
|
- startTime = System.currentTimeMillis();
|
|
|
ExamSettingsCacheBean examBean = checkExam(examingSession.getExamId(),
|
|
|
examingSession.getStudentId(), examingSession.getExamStageId());
|
|
|
- if (log.isDebugEnabled()) {
|
|
|
- log.debug("2 检查并获取考试信息耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
- }
|
|
|
|
|
|
// 检查并获取课程信息
|
|
|
- startTime = System.currentTimeMillis();
|
|
|
CourseCacheBean courseBean = checkCourse(examingSession.getCourseId());
|
|
|
- if (log.isDebugEnabled()) {
|
|
|
- log.debug("3 检查并获取课程信息耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
- }
|
|
|
|
|
|
// 获取题库试卷结构(由于存在随机抽卷,所以不能缓存 )
|
|
|
- startTime = System.currentTimeMillis();
|
|
|
-
|
|
|
// 获取题库调卷规则
|
|
|
ExtractConfigCacheBean extractConfig = CacheHelper.getExtractConfig(examingSession.getExamId(),
|
|
|
courseBean.getCode());
|
|
@@ -239,12 +223,8 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
// 生成试卷结构
|
|
|
ExtractConfigPaperCacheBean extractConfigPaper = CacheHelper.getExtractConfigPaper(examingSession.getExamId(),
|
|
|
courseBean.getCode(), examingSession.getPaperType(), paperId);
|
|
|
- if (log.isDebugEnabled()) {
|
|
|
- log.debug("5 获取题库试卷结构耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
- }
|
|
|
|
|
|
// 生成考试记录
|
|
|
- startTime = System.currentTimeMillis();
|
|
|
ExamStudentCacheBean examStudent = CacheHelper.getExamStudent(examStudentId);
|
|
|
ExamRecordData examRecordData = examRecordDataService.createExamRecordData(examingSession, examBean, courseBean,
|
|
|
paperId, extractConfigPaper.getDefaultPaper().getFullyObjective(),
|
|
@@ -260,46 +240,25 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
examCaptureCloudService.saveExamCaptureSyncCompareResult(req);
|
|
|
}
|
|
|
|
|
|
- if (log.isDebugEnabled()) {
|
|
|
- log.debug("4 生成考试记录耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
// 小题乱序,选项乱序
|
|
|
- startTime = System.currentTimeMillis();
|
|
|
reorderPaperStruct(extractConfig, extractConfigPaper);
|
|
|
- if (log.isDebugEnabled()) {
|
|
|
- log.debug("6 小题乱序耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
- }
|
|
|
|
|
|
// 保存考试试卷结构
|
|
|
- startTime = System.currentTimeMillis();
|
|
|
ExamRecordPaperStruct paperStruct = new ExamRecordPaperStruct();
|
|
|
paperStruct.setId(UUID.randomUUID());
|
|
|
paperStruct.setDefaultPaper(extractConfigPaper.getDefaultPaper());
|
|
|
examRecordPaperStructService.saveExamRecordPaperStruct(examRecordData.getId(), paperStruct);
|
|
|
- if (log.isDebugEnabled()) {
|
|
|
- log.debug("7 保存考试试卷结构耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
- }
|
|
|
|
|
|
// 创建考试作答记录
|
|
|
- startTime = System.currentTimeMillis();
|
|
|
ExamRecordQuestions examRecordQuestions = examRecordQuestionsService
|
|
|
.createExamRecordQuestions(examRecordData.getId(), extractConfigPaper.getDefaultPaper());
|
|
|
// 记录试卷题目数量
|
|
|
examRecordData.setQuestionCount(examRecordQuestions.getExamQuestions().size());
|
|
|
examRecordData.setIsAllObjectivePaper(extractConfigPaper.getDefaultPaper().getFullyObjective());
|
|
|
examRecordDataService.saveExamRecordDataCache(examRecordData.getId(), examRecordData);
|
|
|
- if (log.isDebugEnabled()) {
|
|
|
- log.debug("8 创建考试作答记录耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
- }
|
|
|
|
|
|
// 初始化考试会话
|
|
|
- startTime = System.currentTimeMillis();
|
|
|
initializeExamRecordSession(examingSession, examRecordData, examBean);
|
|
|
- if (log.isDebugEnabled()) {
|
|
|
- log.debug("9 初始化考试会话耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
- }
|
|
|
|
|
|
// 保存考试次数控制信息
|
|
|
ExamBoss eb = examBossService.getExamBoss(examingSession.getExamStudentId());
|
|
@@ -316,10 +275,6 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
//设置并保存上次活动时间
|
|
|
setAndSaveActiveTime(examRecordData.getId(), ip);
|
|
|
|
|
|
- if (log.isDebugEnabled()) {
|
|
|
- log.debug("10 合计 耗时:" + (System.currentTimeMillis() - st) + " ms");
|
|
|
- }
|
|
|
-
|
|
|
// 在线考生开考打点
|
|
|
ReportsUtil.report(new OnlineExamStudentReport(rootOrgId, userId, examBean.getId(), examStudentId));
|
|
|
|
|
@@ -328,6 +283,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
new ExamProcessRecordReport(examRecordData.getId(), ExamProcess.START, examRecordData.getEnterExamTime())
|
|
|
);
|
|
|
|
|
|
+ log.warn("startExam success! studentId:{}, examRecordDataId:{}, ip:{}", examRecordData.getStudentId(), examRecordData.getId(), ip);
|
|
|
return buildStartExamInfo(examRecordData.getId(), examingSession, examBean, courseBean);
|
|
|
}
|
|
|
|
|
@@ -429,6 +385,8 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
examingSessionService.saveExamingSession(examRecordData.getStudentId(), examingSession);
|
|
|
resultInfo.setUsedExamSeconds(calcUsedExamSeconds(examRecordData.getStudentId()));
|
|
|
resultInfo.setDuration(actualExamTotalMilliSeconds);
|
|
|
+
|
|
|
+ log.warn("--->startAnswer success! studentId:{}, examRecordDataId:{}", userId, examRecordDataId);
|
|
|
return resultInfo;
|
|
|
}
|
|
|
|
|
@@ -462,6 +420,8 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
|
|
|
resultInfo.setDuration(examingSession.getExamDuration());
|
|
|
resultInfo.setUsedExamSeconds(calcUsedExamSeconds(examRecordData.getStudentId()));
|
|
|
+
|
|
|
+ log.warn("===>startAnswer success! studentId:{}, examRecordDataId:{}", userId, examRecordDataId);
|
|
|
return resultInfo;
|
|
|
}
|
|
|
}
|
|
@@ -778,6 +738,8 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
|
|
|
redisClient.set(examingSessionKey, examingSession, 10);
|
|
|
redisClient.set(examBossKey, examBoss, 60);
|
|
|
+
|
|
|
+ log.info("prepareForExam success! studentId:{}, examStudentId:{}", studentId, examStudentId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -829,9 +791,6 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
}
|
|
|
|
|
|
this.handInExam(examingSession.getExamRecordDataId(), HandInExamType.MANUAL, ip);
|
|
|
- if (log.isDebugEnabled()) {
|
|
|
- log.debug("[manualEndExam] cost " + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -856,7 +815,6 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
Long rootOrgId = examRecordData.getRootOrgId();
|
|
|
|
|
|
if (handInExamType == HandInExamType.MANUAL) {
|
|
|
-
|
|
|
// 得到考试时长,校验是否达到冻结时间
|
|
|
long usedExamTime = checkAndComputeExamDuration(studentId);
|
|
|
examRecordData.setUsedExamTime(usedExamTime);
|
|
@@ -873,11 +831,9 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
req.setPriority(Constants.PROCESS_CAPTURE_HIGH_PRIORITY);
|
|
|
examCaptureCloudService.updateExamCaptureQueuePriority(req);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("[HAND_IN_EXAM-" + examRecordDataId + "]更新照片优先级时,出现异常", e);
|
|
|
+ log.error("updateExamCaptureQueuePriority examRecordDataId:{}, error: db deadlock {}", examRecordDataId, e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
} else if (handInExamType == HandInExamType.AUTO) {
|
|
|
examRecordData.setExamRecordStatus(ExamRecordStatus.EXAM_AUTO_HAND_IN);
|
|
|
examRecordData.setCleanTime(new Date());
|
|
@@ -914,6 +870,9 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
syncExamDataReq.setExamRecordPaperStruct(getExamRecordPaperStruct(examRecordDataId));
|
|
|
syncExamDataReq.setExamRecordQuestions(getExamRecordQuestions(examRecordDataId));
|
|
|
syncExamDataCloudService.syncExamData(syncExamDataReq);
|
|
|
+
|
|
|
+ // 同步成功后,更新同步状态
|
|
|
+ // examRecordData.setSyncStatus(SyncStatus.SYNCED);
|
|
|
}
|
|
|
|
|
|
// 保存考试记录
|
|
@@ -922,6 +881,8 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
// 删除redis会话
|
|
|
examingSessionService.deleteExamingSession(studentId);
|
|
|
|
|
|
+ log.warn("handInExam success! studentId:{}, examRecordDataId:{}, handInExamType:{}, ip:{}", studentId, examRecordDataId, handInExamType.name(), ip);
|
|
|
+
|
|
|
//考试过程记录(交卷)打点
|
|
|
ReportsUtil.report(new ExamProcessRecordReport(examRecordDataId,
|
|
|
(HandInExamType.MANUAL == handInExamType ? ExamProcess.MANUAL_HAND_IN : ExamProcess.AUTO_HAND_IN),
|
|
@@ -1676,33 +1637,32 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
maxSwitchScreenCount = Integer.valueOf(sc.getValue());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
examSessionInfo.setMaxSwitchScreenCount(maxSwitchScreenCount);
|
|
|
examSessionInfo.setRecordSwitchScreen(isRecordSwitchScreenCount);
|
|
|
-
|
|
|
examSessionInfo.setExamRecordDataId(examRecordData.getId());
|
|
|
- // examSessionInfo.setStartTime(examRecordData.getStartTime().getTime());//调整为在作答页面时赋值
|
|
|
+ // 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 保存考试会话结束 ");
|
|
|
+ log.warn("initExamingSession success! studentId:{}, examRecordDataId:{}", examRecordData.getStudentId(), examRecordData.getId());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1734,6 +1694,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
if (examSessionInfo == null || ExamingStatus.INFORMAL.equals(examSessionInfo.getExamingStatus())) {
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
// 检查考试会话是否存在,或者是否失效,如果没有失效,则返回考试中的考试记录实体,否则直接返回null
|
|
|
ExamRecordData examingRecord = checkExamSession(examSessionInfo);
|
|
|
if (examingRecord == null) {
|
|
@@ -1814,7 +1775,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
checkExamInProgressInfo.setExceedMaxSwitchScreenCount(examingRecord.getExceedMaxSwitchScreenCount());
|
|
|
checkExamInProgressInfo.setSwitchScreenCount(examingRecord.getSwitchScreenCount());
|
|
|
checkExamInProgressInfo.setMaxSwitchScreenCount(examSessionInfo.getMaxSwitchScreenCount());
|
|
|
-
|
|
|
+ log.warn("checkExamInProgress success! studentId:{}, examRecordDataId:{}, ip:{}", studentId, examRecordDataId, ip);
|
|
|
return checkExamInProgressInfo;
|
|
|
}
|
|
|
}
|