Forráskód Böngészése

开考代码调试

lideyin 4 éve
szülő
commit
e8f01b6253

+ 20 - 12
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamControlServiceImpl.java

@@ -270,6 +270,13 @@ public class ExamControlServiceImpl implements ExamControlService {
             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());
         if (eb == null) {
@@ -282,19 +289,20 @@ public class ExamControlServiceImpl implements ExamControlService {
         eb.setStartCount(eb.getStartCount() + 1);
         examBossService.saveExamBoss(examStudentId, eb);
 
-        // 初始化考试会话
-        startTime = System.currentTimeMillis();
-        initializeExamRecordSession(examingSession, examRecordData, examBean);
-        if (log.isDebugEnabled()) {
-            log.debug("9 初始化考试会话耗时:" + (System.currentTimeMillis() - startTime) + " ms");
+        //更新场次的开考状态
+        if (null != examStudent.getExamStageId()) {
+            ExamSettingsCacheBean cachedExam =
+                    ExamCacheTransferHelper.getCachedExam(examId, studentId, examStudent.getExamStageId());
+            if (cachedExam.getSpecialSettingsEnabled()
+                    && ExamSpecialSettingsType.STAGE_BASED == cachedExam.getSpecialSettingsType()) {
+                //更改考务中的考试状态 TODO 高并发下此处可能会影响开考的性能
+                ModifyExamStageStartExamStatusReq req = new ModifyExamStageStartExamStatusReq();
+                req.setExamStageId(examStudent.getExamStageId());
+                req.setExamStageStartExamStatus(ExamStageStartExamStatus.STARTED.name());
+                examStageCloudService.modifyExamStageStartExamStatus(req);
+            }
         }
 
-        //更改考务中的考试状态 TODO 高并发下此处可能会影响开考的性能
-        ModifyExamStageStartExamStatusReq req = new ModifyExamStageStartExamStatusReq();
-        req.setExamStageId(examStudent.getExamStageId());
-        req.setExamStageStartExamStatus(ExamStageStartExamStatus.STARTED.name());
-        examStageCloudService.modifyExamStageStartExamStatus(req);
-
         //设置并保存上次活动时间
         setAndSaveActiveTime(examRecordData.getId());
 
@@ -1385,7 +1393,7 @@ public class ExamControlServiceImpl implements ExamControlService {
     public void initializeExamRecordSession(ExamingSession examSessionInfo, ExamRecordData examRecordData,
                                             final ExamSettingsCacheBean examBean) {
         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:断点续考时间