Преглед на файлове

考试模式:采用千人千卷还是采用成卷调用,不根据考试来设置,改为在调卷页面根据课程来选择

deason преди 1 година
родител
ревизия
e1a7c063e9

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

@@ -264,7 +264,7 @@ public class ExamControlServiceImpl implements ExamControlService {
                 courseBean.getCode());
 
         // 是否采用千人千卷规则
-        boolean randomPaper = CallType.RANDOM_PAPER.name().equals(examBean.getCallType());
+        boolean randomPaper = CallType.RANDOM_PAPER.name().equals(extractConfig.getCallType());
 
         DefaultPaper defaultPaper;
         try {
@@ -292,7 +292,10 @@ public class ExamControlServiceImpl implements ExamControlService {
 
         // 小题乱序,选项乱序
         if (!randomPaper) {
+            examingSession.setCallType(CallType.WHOLE_SET.getName());
             reorderPaperStruct(extractConfig, defaultPaper);
+        } else {
+            examingSession.setCallType(CallType.RANDOM_PAPER.getName());
         }
 
         // 保存考试试卷结构
@@ -699,7 +702,7 @@ public class ExamControlServiceImpl implements ExamControlService {
         examingSession = new ExamingSession();
         ExamPropertyCacheBean examCycleEnabledCache = CacheHelper.getExamProperty(examId, ExamProperties.EXAM_CYCLE_ENABLED.name());
         if (examCycleEnabledCache != null && StringUtil.isTrue(examCycleEnabledCache.getValue())) {//设置周期的只校验周期
-            checkExamCycle(examingSession,examId);
+            checkExamCycle(examingSession, examId);
         } else {
             if (new Date().before(examSettingsCacheBean.getBeginTime())) {
                 throw new StatusException("100017", "考试未开始");
@@ -754,7 +757,7 @@ public class ExamControlServiceImpl implements ExamControlService {
         examingSession.setExamRecordDataId(null);
         examingSession.setExamStudentId(examStudent.getExamStudentId());
         examingSession.setExamType(examSettingsCacheBean.getExamType());
-        examingSession.setCallType(examSettingsCacheBean.getCallType());
+        // examingSession.setCallType(CallType.WHOLE_SET.getName());
 
         ExamPropertyCacheBean freezeTime = ExamCacheTransferHelper
                 .getDefaultCachedExamProperty(examId, ExamProperties.FREEZE_TIME.toString());
@@ -770,11 +773,11 @@ public class ExamControlServiceImpl implements ExamControlService {
         }
 
         //冻结时间计算类型
-        FreezeTimeType freezeTimeType=FreezeTimeType.DURATION;
+        FreezeTimeType freezeTimeType = FreezeTimeType.DURATION;
         ExamPropertyCacheBean freezeTimeTypeVal = ExamCacheTransferHelper
                 .getDefaultCachedExamProperty(examId, ExamProperties.FREEZE_TIME_TYPE.toString());
-        if (null!= freezeTimeTypeVal && freezeTimeTypeVal.getHasValue()) {
-        	freezeTimeType=FreezeTimeType.valueOf(freezeTimeTypeVal.getValue());
+        if (null != freezeTimeTypeVal && freezeTimeTypeVal.getHasValue()) {
+            freezeTimeType = FreezeTimeType.valueOf(freezeTimeTypeVal.getValue());
         }
         examingSession.setFreezeTime(StringUtil.toInteger(freezeTime.getValue()));
         examingSession.setFreezeTimeType(freezeTimeType);
@@ -1699,11 +1702,11 @@ public class ExamControlServiceImpl implements ExamControlService {
         }
         examSessionInfo.setFreezeTime(Integer.valueOf(freezeTimeStr));
         //冻结时间计算类型
-        FreezeTimeType freezeTimeType=FreezeTimeType.DURATION;
+        FreezeTimeType freezeTimeType = FreezeTimeType.DURATION;
         ExamPropertyCacheBean freezeTimeTypeVal = ExamCacheTransferHelper.getDefaultCachedExamProperty(
-        		examBean.getId(), ExamProperties.FREEZE_TIME_TYPE.toString());
-        if (null!= freezeTimeTypeVal && freezeTimeTypeVal.getHasValue()) {
-        	freezeTimeType=FreezeTimeType.valueOf(freezeTimeTypeVal.getValue());
+                examBean.getId(), ExamProperties.FREEZE_TIME_TYPE.toString());
+        if (null != freezeTimeTypeVal && freezeTimeTypeVal.getHasValue()) {
+            freezeTimeType = FreezeTimeType.valueOf(freezeTimeTypeVal.getValue());
         }
         examSessionInfo.setFreezeTimeType(freezeTimeType);
 
@@ -2089,16 +2092,16 @@ public class ExamControlServiceImpl implements ExamControlService {
                 // 强制交卷,则不校验冻结时间
                 return examUsedMilliSeconds;
             }
-            if(FreezeTimeType.BEGINTIME.equals(examingSession.getFreezeTimeType())) {//按开始考试时间
-            	Date subDate=DateUtils.addMinutes(examingSession.getExamStartTime(), examingSession.getFreezeTime());
-            	if(subDate.getTime()>System.currentTimeMillis()) {
-            		throw new StatusException(DateUtil.format(subDate, DateUtil.DatePatterns.CHINA_DEFAULT) + "才能交卷!");
-            	}
-            }else {//按实际考试时长
-            	long freezeTime = examingSession.getFreezeTime() * 60 * 1000;
-	            if (examUsedMilliSeconds < freezeTime) {
-	                throw new StatusException("开考" + examingSession.getFreezeTime() + "分钟后才能交卷!");
-	            }
+            if (FreezeTimeType.BEGINTIME.equals(examingSession.getFreezeTimeType())) {//按开始考试时间
+                Date subDate = DateUtils.addMinutes(examingSession.getExamStartTime(), examingSession.getFreezeTime());
+                if (subDate.getTime() > System.currentTimeMillis()) {
+                    throw new StatusException(DateUtil.format(subDate, DateUtil.DatePatterns.CHINA_DEFAULT) + "才能交卷!");
+                }
+            } else {//按实际考试时长
+                long freezeTime = examingSession.getFreezeTime() * 60 * 1000;
+                if (examUsedMilliSeconds < freezeTime) {
+                    throw new StatusException("开考" + examingSession.getFreezeTime() + "分钟后才能交卷!");
+                }
             }
 
         }
@@ -2317,7 +2320,7 @@ public class ExamControlServiceImpl implements ExamControlService {
      *
      * @param examId
      */
-    private void checkExamCycle(ExamingSession examingSession,Long examId) {
+    private void checkExamCycle(ExamingSession examingSession, Long examId) {
 
         Date now = new Date();
 
@@ -2343,11 +2346,11 @@ public class ExamControlServiceImpl implements ExamControlService {
             JSONArray timeRange = jo.getJSONArray("timeRange");
             String joStart = timeRange.getString(0);
             String joEnd = timeRange.getString(1);
-            Date startDate=DateUtil.parse(day + " " + joStart + ":00", DatePatterns.CHINA_DEFAULT);
+            Date startDate = DateUtil.parse(day + " " + joStart + ":00", DatePatterns.CHINA_DEFAULT);
             long start = startDate.getTime();
             long end = DateUtil.parse(day + " " + joEnd + ":59", DatePatterns.CHINA_DEFAULT).getTime();
             if (start <= now.getTime() && end >= now.getTime()) {
-            	examingSession.setExamStartTime(startDate);
+                examingSession.setExamStartTime(startDate);
                 return;
             }
         }