瀏覽代碼

考试次数bug修复

lideyin 5 年之前
父節點
當前提交
bf2e8e4797

+ 3 - 3
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/ExamStudentService.java

@@ -30,14 +30,14 @@ public interface ExamStudentService {
 	public Integer countExamTimes(ExamStudentEntity examStudentInfo,ExamBean examBean);
 
 	/**
-	 * 开始考试时,更新考生信息
+	 * 开始考试时,更新考生信息,并返回已考的考试次数
 	 * @param id 考生主键id
 	 * @param isReExamine 是否重考
 	 * @param reExamineCompleted 重考是否完成
 	 * @param normalExamTimes 已考次数
 	 * @param examBean 考试实体
-	 * @return
+	 * @return int 已考的考试次数
 	 */
-	public void updateExamStudentByStartExam(Long id,Boolean isReExamine,Boolean reExamineCompleted,
+	public int updateExamStudentByStartExam(Long id,Boolean isReExamine,Boolean reExamineCompleted,
 														  Integer normalExamTimes, final ExamBean examBean);
 }

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

@@ -256,23 +256,22 @@ public class ExamControlServiceImpl implements ExamControlService {
             log.debug("6 保存考试试卷结构耗时:" + (System.currentTimeMillis() - startTime) + " ms");
         }
 
-        // 更新考生信息
+        // 更新考生信息,并返回已考的考试次数
         startTime = System.currentTimeMillis();
-        examStudentService.updateExamStudentByStartExam(originalExamStudent.getId(),
+
+        int examedTimes = examStudentService.updateExamStudentByStartExam(originalExamStudent.getId(),
                 originalExamStudent.getIsReExamine(), originalExamStudent.getReExamineCompleted(),
                 originalExamStudent.getNormalExamTimes(), examBean);
         if (log.isDebugEnabled()) {
             log.debug("7 更新考生信息耗时:" + (System.currentTimeMillis() - startTime) + " ms");
         }
-        //获取更新完以后的考试记录实体
-        ExamStudentEntity newExamStudent = GlobalHelper.getEntity(examStudentRepo, originalExamStudent.getId(), ExamStudentEntity.class);
 
         // 生成考试记录
         startTime = System.currentTimeMillis();
-        ExamRecordEntity examRecord = examRecordService.createExamRecord(newExamStudent, examBean, courseBean,
+        ExamRecordEntity examRecord = examRecordService.createExamRecord(originalExamStudent, examBean, courseBean,
                 paperId, examRecordPaperStruct.getId());
         ExamRecordDataEntity examRecordData = examRecordDataService.createExamRecordData(examRecord,
-                newExamStudent.getNormalExamTimes(), examBean.getExamTimes(), originalExamStudent.getIsReExamine(),
+                examedTimes, examBean.getExamTimes(), originalExamStudent.getIsReExamine(),
                 extractConfigPaper.getDefaultPaper().getFullyObjective());
 
         //生成进行中的考试记录
@@ -302,7 +301,7 @@ public class ExamControlServiceImpl implements ExamControlService {
         // 创建考试会话
         startTime = System.currentTimeMillis();
 
-        initializeExamRecordSession(newExamStudent, examRecordData, examBean);
+        initializeExamRecordSession(originalExamStudent, examRecordData, examBean);
         if (log.isDebugEnabled()) {
             log.debug("11 创建考试会话耗时:" + (System.currentTimeMillis() - startTime) + " ms");
         }
@@ -310,7 +309,7 @@ public class ExamControlServiceImpl implements ExamControlService {
         if (log.isDebugEnabled()) {
             log.debug("12 合计 耗时:" + (System.currentTimeMillis() - st) + " ms");
         }
-        return buildStartExamInfo(examRecordData.getId(), newExamStudent, examBean, courseBean);
+        return buildStartExamInfo(examRecordData.getId(), originalExamStudent, examBean, courseBean);
 //        } finally {
 //
 //        }

+ 2 - 3
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamStudentServiceImpl.java

@@ -1,8 +1,6 @@
 package cn.com.qmth.examcloud.core.oe.student.service.impl;
 
 import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
-import cn.com.qmth.examcloud.core.basic.api.bean.OrgBean;
-import cn.com.qmth.examcloud.core.basic.api.bean.StudentBean;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.CommonUtil;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamStudentEntity;
 import cn.com.qmth.examcloud.core.oe.common.enums.CourseLevel;
@@ -180,7 +178,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
     }
 
     @Override
-    public void updateExamStudentByStartExam(Long id,Boolean isReExamine,Boolean reExamineCompleted,
+    public int updateExamStudentByStartExam(Long id,Boolean isReExamine,Boolean reExamineCompleted,
                                                           Integer normalExamTimes,final ExamBean examBean) {
         //考试完的最终状态
         Boolean finalIsReExamine=isReExamine;
@@ -206,5 +204,6 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         //更新相关属性
         examStudentRepo.updateExamStudentStartExamStatusInfo(id, true,
                 finalNormalExamTimes, finalIsReExamine, finalReExamineCompleted, now);
+        return finalNormalExamTimes;
     }
 }