|
@@ -464,7 +464,8 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
throw new StatusException("008002", "考生不存在");
|
|
|
}
|
|
|
|
|
|
- if (!examStudent.getStudentId().equals(user.getUserId().longValue())) {
|
|
|
+ Long studentId = examStudent.getStudentId();
|
|
|
+ if (!studentId.equals(user.getUserId().longValue())) {
|
|
|
throw new StatusException("008003", "考生与当前用户不吻合");
|
|
|
}
|
|
|
|
|
@@ -476,10 +477,13 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
throw new StatusException("008004", "已经有考试中的科目");
|
|
|
}
|
|
|
|
|
|
+ Long examId=examStudent.getExamId();
|
|
|
+ Long examStageId = examStudent.getExamStageId();
|
|
|
+
|
|
|
ExamSettingsCacheBean examSettingsCacheBean = ExamCacheTransferHelper.getCachedExam(examStudent.getExamId(),
|
|
|
- examStudent.getStudentId(), examStudent.getExamStageId());
|
|
|
+ studentId, examStageId);
|
|
|
|
|
|
- StudentCacheBean studentCacheBean = CacheHelper.getStudent(examStudent.getStudentId());
|
|
|
+ StudentCacheBean studentCacheBean = CacheHelper.getStudent(studentId);
|
|
|
|
|
|
CourseCacheBean courseCacheBean = CacheHelper.getCourse(examStudent.getCourseId());
|
|
|
if (!courseCacheBean.getEnable()) {
|
|
@@ -488,7 +492,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
|
|
|
// 如果启用了了特殊设置,并且无特殊设置时结束考试 配置 设置为true..且实际未设置特殊设置则不允许考试
|
|
|
ExamPropertyCacheBean limitedIfNoSpecialSettings = ExamCacheTransferHelper.getDefaultCachedExamProperty(
|
|
|
- examSettingsCacheBean.getId(), ExamProperties.LIMITED_IF_NO_SPECIAL_SETTINGS.toString());
|
|
|
+ examId, ExamProperties.LIMITED_IF_NO_SPECIAL_SETTINGS.toString());
|
|
|
|
|
|
if (examSettingsCacheBean.getSpecialSettingsEnabled() && (limitedIfNoSpecialSettings.getHasValue()
|
|
|
&& Boolean.valueOf(limitedIfNoSpecialSettings.getValue()))) {
|
|
@@ -496,7 +500,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
// 学生特殊设置开启未配置,不允许考试
|
|
|
if (examSettingsCacheBean.getSpecialSettingsType() == ExamSpecialSettingsType.STUDENT_BASED) {
|
|
|
ExamStudentSettingsCacheBean specialSettings = CacheHelper
|
|
|
- .getExamStudentSettings(examSettingsCacheBean.getId(), examStudent.getStudentId());
|
|
|
+ .getExamStudentSettings(examId, studentId);
|
|
|
if (!specialSettings.getHasValue()) {
|
|
|
throw new StatusException("100014", "考试配置未完成,不允许考试");
|
|
|
}
|
|
@@ -505,9 +509,8 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
// 机构特殊设置开启但未配置,不允许考试
|
|
|
if (examSettingsCacheBean.getSpecialSettingsType() == ExamSpecialSettingsType.ORG_BASED) {
|
|
|
// 需求调整,所有的组织机构取学生表所关联的orgId
|
|
|
- Long orgId = CacheHelper.getStudent(examStudent.getStudentId()).getOrgId();
|
|
|
- ExamOrgSettingsCacheBean specialSettings = CacheHelper.getExamOrgSettings(examSettingsCacheBean.getId(),
|
|
|
- orgId);
|
|
|
+ Long orgId = CacheHelper.getStudent(studentId).getOrgId();
|
|
|
+ ExamOrgSettingsCacheBean specialSettings = CacheHelper.getExamOrgSettings(examId, orgId);
|
|
|
if (!specialSettings.getHasValue()) {
|
|
|
throw new StatusException("100015", "考试配置未完成,不允许考试");
|
|
|
}
|
|
@@ -564,11 +567,11 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
examingSession.setCourseId(courseCacheBean.getId());
|
|
|
examingSession.setCreationTime(new Date());
|
|
|
examingSession.setExamDuration((long) examSettingsCacheBean.getDuration() * 60 * 1000);
|
|
|
- examingSession.setExamId(examSettingsCacheBean.getId());
|
|
|
+ examingSession.setExamId(examId);
|
|
|
examingSession.setExamingStatus(ExamingStatus.INFORMAL);
|
|
|
|
|
|
ExamPropertyCacheBean examReconnectTime = ExamCacheTransferHelper.getDefaultCachedExamProperty(
|
|
|
- examSettingsCacheBean.getId(), ExamProperties.EXAM_RECONNECT_TIME.toString());
|
|
|
+ examId, ExamProperties.EXAM_RECONNECT_TIME.toString());
|
|
|
if (null == examReconnectTime || !examReconnectTime.getHasValue()) {
|
|
|
throw new StatusException("100022", "断点续考时间未配置");
|
|
|
}
|
|
@@ -579,14 +582,14 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
examingSession.setExamType(examSettingsCacheBean.getExamType());
|
|
|
|
|
|
ExamPropertyCacheBean freezeTime = ExamCacheTransferHelper
|
|
|
- .getDefaultCachedExamProperty(examSettingsCacheBean.getId(), ExamProperties.FREEZE_TIME.toString());
|
|
|
+ .getDefaultCachedExamProperty(examId, ExamProperties.FREEZE_TIME.toString());
|
|
|
if (null == freezeTime || !freezeTime.getHasValue()) {
|
|
|
throw new StatusException("100023", "交卷冻结时间未配置");
|
|
|
}
|
|
|
|
|
|
Date now = new Date();
|
|
|
long totalMilliSeconds = calcExamTotalMilliSeconds(examStudent.getExamId(),
|
|
|
- examStudent.getStudentId(), examStudent.getExamStageId(), now);
|
|
|
+ studentId, examStageId, now);
|
|
|
if (totalMilliSeconds <= 0) {
|
|
|
throw new StatusException("100024", "已超过定点交卷时间,不允许开考");
|
|
|
}
|
|
@@ -596,11 +599,22 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
examingSession.setPaperType(examStudent.getPaperType());
|
|
|
examingSession.setRootOrgId(studentCacheBean.getRootOrgId());
|
|
|
examingSession.setStudentId(studentCacheBean.getId());
|
|
|
- examingSession.setExamStageId(examStudent.getExamStageId());
|
|
|
+ examingSession.setExamStageId(examStageId);
|
|
|
+
|
|
|
+ //是否为定点交卷
|
|
|
+ if (isTimingEnd(examId, studentId, examStageId)) {
|
|
|
+ examingSession.setTimingEnd(true);
|
|
|
+
|
|
|
+ //定点交卷时间 = 开始进入考试的起始值 + 定点交卷时长
|
|
|
+ ExamStageCacheBean examStage = CacheHelper.getExamStage(examId, examStageId);
|
|
|
+ Date fixedSubmitTime = DateUtils.addMinutes(examStage.getStartTime(), examStage.getSubmitDuration());
|
|
|
+ examingSession.setFixedSubmitTime(fixedSubmitTime);
|
|
|
+ } else {
|
|
|
+ examingSession.setTimingEnd(false);
|
|
|
+ }
|
|
|
|
|
|
redisClient.set(examingSessionKey, examingSession, 10);
|
|
|
redisClient.set(examBossKey, examBoss, 60);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1552,17 +1566,10 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
delayHandInExamIfLocked(examingRecord.getId());
|
|
|
return null;
|
|
|
}
|
|
|
- Long examId = examSessionInfo.getExamId();
|
|
|
- Long studentId = examSessionInfo.getStudentId();
|
|
|
- Long examStageId = examSessionInfo.getExamStageId();
|
|
|
|
|
|
//如果设置了定点交卷,且超过了定点交卷时间,自动交卷
|
|
|
- if (isTimingEnd(examId, studentId, examStageId)) {
|
|
|
- ExamStageCacheBean examStage = CacheHelper.getExamStage(examId, examStageId);
|
|
|
- //定点交卷时间 = 开始进入考试的起始值 + 定点交卷时长
|
|
|
- Date fixedSubmitTime = DateUtils.addMinutes(examStage.getStartTime(), examStage.getSubmitDuration());
|
|
|
-
|
|
|
- if (now >= fixedSubmitTime.getTime()) {
|
|
|
+ if (examSessionInfo.getTimingEnd()) {
|
|
|
+ if (now >= examSessionInfo.getFixedSubmitTime().getTime()) {
|
|
|
delayHandInExamIfLocked(examingRecord.getId());
|
|
|
return null;
|
|
|
}
|