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