|
@@ -698,7 +698,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
}
|
|
}
|
|
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(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", "考试未开始");
|
|
@@ -706,6 +706,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
if (examSettingsCacheBean.getEndTime().before(new Date())) {
|
|
if (examSettingsCacheBean.getEndTime().before(new Date())) {
|
|
throw new StatusException("100018", "本次考试已结束");
|
|
throw new StatusException("100018", "本次考试已结束");
|
|
}
|
|
}
|
|
|
|
+ examingSession.setExamStartTime(examSettingsCacheBean.getBeginTime());
|
|
}
|
|
}
|
|
|
|
|
|
if ((!ExamType.ONLINE.name().equals(examSettingsCacheBean.getExamType()))
|
|
if ((!ExamType.ONLINE.name().equals(examSettingsCacheBean.getExamType()))
|
|
@@ -766,8 +767,16 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
if (totalMilliSeconds <= 0) {
|
|
if (totalMilliSeconds <= 0) {
|
|
throw new StatusException("100024", "已超过定点交卷时间,不允许开考");
|
|
throw new StatusException("100024", "已超过定点交卷时间,不允许开考");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ //冻结时间计算类型
|
|
|
|
+ FreezeTimeType freezeTimeType=FreezeTimeType.DURATION;
|
|
|
|
+ ExamPropertyCacheBean freezeTimeTypeVal = ExamCacheTransferHelper
|
|
|
|
+ .getDefaultCachedExamProperty(examId, ExamProperties.FREEZE_TIME_TYPE.toString());
|
|
|
|
+ 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.setOrgId(studentCacheBean.getOrgId());
|
|
examingSession.setOrgId(studentCacheBean.getOrgId());
|
|
examingSession.setPaperType(examStudent.getPaperType());
|
|
examingSession.setPaperType(examStudent.getPaperType());
|
|
examingSession.setRootOrgId(studentCacheBean.getRootOrgId());
|
|
examingSession.setRootOrgId(studentCacheBean.getRootOrgId());
|
|
@@ -1688,6 +1697,14 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
throw new StatusException("6002", ExamProperties.FREEZE_TIME.getDesc() + "未设置");
|
|
throw new StatusException("6002", ExamProperties.FREEZE_TIME.getDesc() + "未设置");
|
|
}
|
|
}
|
|
examSessionInfo.setFreezeTime(Integer.valueOf(freezeTimeStr));
|
|
examSessionInfo.setFreezeTime(Integer.valueOf(freezeTimeStr));
|
|
|
|
+ //冻结时间计算类型
|
|
|
|
+ FreezeTimeType freezeTimeType=FreezeTimeType.DURATION;
|
|
|
|
+ String freezeTimeTypeVal = ExamCacheTransferHelper.getCachedExamProperty(examBean.getId(),
|
|
|
|
+ examSessionInfo.getStudentId(), ExamProperties.FREEZE_TIME_TYPE.name()).getValue();
|
|
|
|
+ if (!CommonUtil.isBlank(freezeTimeTypeVal)) {
|
|
|
|
+ freezeTimeType=FreezeTimeType.valueOf(freezeTimeTypeVal);
|
|
|
|
+ }
|
|
|
|
+ examSessionInfo.setFreezeTimeType(freezeTimeType);
|
|
|
|
|
|
examSessionInfo.setExamingStatus(ExamingStatus.FORMAL);
|
|
examSessionInfo.setExamingStatus(ExamingStatus.FORMAL);
|
|
examingSessionService.saveExamingSession(examSessionInfo.getStudentId(), examSessionInfo);
|
|
examingSessionService.saveExamingSession(examSessionInfo.getStudentId(), examSessionInfo);
|
|
@@ -2068,11 +2085,18 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
// 强制交卷,则不校验冻结时间
|
|
// 强制交卷,则不校验冻结时间
|
|
return examUsedMilliSeconds;
|
|
return examUsedMilliSeconds;
|
|
}
|
|
}
|
|
-
|
|
|
|
- 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() + "分钟后才能交卷!");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
return examUsedMilliSeconds;
|
|
return examUsedMilliSeconds;
|
|
@@ -2289,7 +2313,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
*
|
|
*
|
|
* @param examId
|
|
* @param examId
|
|
*/
|
|
*/
|
|
- private void checkExamCycle(Long examId) {
|
|
|
|
|
|
+ private void checkExamCycle(ExamingSession examingSession,Long examId) {
|
|
|
|
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
|
|
|
|
@@ -2315,9 +2339,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);
|
|
- long start = DateUtil.parse(day + " " + joStart + ":00", DatePatterns.CHINA_DEFAULT).getTime();
|
|
|
|
|
|
+ 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();
|
|
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);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|