Răsfoiți Sursa

ignore update..

deason 11 luni în urmă
părinte
comite
048c79d60f

+ 20 - 35
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/SyncExamDataCloudServiceProvider.java

@@ -18,7 +18,6 @@ import cn.com.qmth.examcloud.examwork.api.response.CheckExamSkipFaceResp;
 import cn.com.qmth.examcloud.question.commons.core.question.AnswerType;
 import cn.com.qmth.examcloud.support.CacheConstants;
 import cn.com.qmth.examcloud.support.cache.CacheHelper;
-import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
 import cn.com.qmth.examcloud.support.cache.bean.ExamPropertyCacheBean;
 import cn.com.qmth.examcloud.support.cache.bean.ExamSettingsCacheBean;
 import cn.com.qmth.examcloud.support.enums.ExamProperties;
@@ -455,10 +454,17 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
         result.setStudentName(examStudentEntity.getStudentName());
         result.setIdentityNumber(examStudentEntity.getIdentityNumber());
         result.setInfoCollector(examStudentEntity.getInfoCollector());
+
+        // 已考次数
         Integer usedNum = examStudentEntity.getUsedNum();
-        result.setExamOrder(getExamOrder(examId, studentId, usedNum));//考试次数
-        boolean isReexamine = isReexamine(examId, studentId, usedNum);
-        result.setIsReexamine(isReexamine);//是否重考
+        // 允许考试次数
+        ExamSettingsCacheBean examCache = ExamCacheTransferHelper.getDefaultCachedExam(examId);
+        int examTimes = examCache.getExamTimes() == null ? 0 : examCache.getExamTimes().intValue();
+        // 第几次考试
+        result.setExamOrder(getExamOrder(examTimes, usedNum));
+        // 是否重考
+        boolean isReexamine = isReexamine(examTimes, usedNum);
+        result.setIsReexamine(isReexamine);
         //如果有重考,则需要保存重考相关数据
         if (isReexamine) {
             result.setReexamineType(examStudentEntity.getReexamineType());
@@ -466,6 +472,8 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
         }
 
         result.setCourseId(examRecordData.getCourseId());
+        result.setCourseLevel(examStudentEntity.getCourseLevel());
+
         result.setOrgId(examRecordData.getOrgId());
         result.setRootOrgId(examRecordData.getRootOrgId());
         result.setBasePaperId(examRecordData.getBasePaperId());
@@ -476,9 +484,6 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
         // result.setPaperStructId(examRecordData.getPaperStructId());
         result.setPaperType(examRecordData.getPaperType());
 
-        CourseCacheBean course = CacheHelper.getCourse(examRecordData.getCourseId());
-        result.setCourseLevel(course.getLevel());
-
         result.setStartTime(examRecordData.getStartTime() != null ? examRecordData.getStartTime() : examRecordData.getEnterExamTime());
         result.setEndTime(examRecordData.getEndTime());
         result.setCleanTime(examRecordData.getCleanTime());
@@ -519,44 +524,24 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
 
     /**
      * 计算考试次数
-     *
-     * @param examId      考试id
-     * @param studentId   学生id
-     * @param usedExamNum 已考次数
-     * @return
      */
-    private Integer getExamOrder(Long examId, Long studentId, Integer usedExamNum) {
-        ExamSettingsCacheBean cachedExam = ExamCacheTransferHelper.getDefaultCachedExam(examId);
-        Integer canExamTimes = cachedExam.getExamTimes() == null ? 0 : cachedExam.getExamTimes().intValue();//可考次数
-
-        //超过可考次数,始终为可考次数+1
-        if (usedExamNum > canExamTimes) {
-            return canExamTimes + 1;
+    private Integer getExamOrder(Integer examTimes, Integer usedNum) {
+        // 超过可考次数,始终为可考次数+1
+        if (usedNum > examTimes) {
+            return examTimes + 1;
         }
-
-        return usedExamNum;
-
+        return usedNum;
     }
 
     /**
      * 计算是否为重考
-     *
-     * @param examId      考试id
-     * @param studentId   学生id
-     * @param usedExamNum 已考次数
-     * @return
      */
-    private boolean isReexamine(Long examId, Long studentId, Integer usedExamNum) {
-        ExamSettingsCacheBean cachedExam = ExamCacheTransferHelper.getDefaultCachedExam(examId);
-        Integer canExamTimes = cachedExam.getExamTimes() == null ? 0 : cachedExam.getExamTimes().intValue();//可考次数
-
-        //超过可考次数,则认为有重考
-        if (usedExamNum > canExamTimes) {
+    private boolean isReexamine(Integer examTimes, Integer usedNum) {
+        // 超过可考次数,则认为有重考
+        if (usedNum > examTimes) {
             return true;
         }
-
         return false;
-
     }
 
     private void syncExamRecordQuestions(ExamRecordQuestionsBean examRecordQuestions, ExamRecordDataEntity examRecordData) {