|
@@ -64,6 +64,7 @@ import com.qmth.themis.business.entity.TBTaskHistory;
|
|
|
import com.qmth.themis.business.entity.TEExam;
|
|
|
import com.qmth.themis.business.entity.TOeExamRecord;
|
|
|
import com.qmth.themis.business.enums.EntryAuthenticationPolicyEnum;
|
|
|
+import com.qmth.themis.business.enums.ExamModeEnum;
|
|
|
import com.qmth.themis.business.enums.ExamRecordStatusEnum;
|
|
|
import com.qmth.themis.business.enums.FinishExamResultEnum;
|
|
|
import com.qmth.themis.business.enums.FinishTypeEnum;
|
|
@@ -252,20 +253,33 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
if (es.getLeftExamCount() == 0) {
|
|
|
throw new BusinessException("没有剩余考试次数");
|
|
|
}
|
|
|
+ ExamCacheBean exam = getExamCacheBean(es.getExamId());
|
|
|
Long activityId = es.getExamActivityId();
|
|
|
ExamActivityCacheBean ac = teExamActivityService.getExamActivityCacheBean(activityId);
|
|
|
if (ac == null) {
|
|
|
throw new BusinessException("未找到场次");
|
|
|
}
|
|
|
Date now = new Date();
|
|
|
- Long start = ac.getStartTime().getTime() - (ac.getPrepareSeconds() * 1000);
|
|
|
- Long end = ac.getStartTime().getTime() + (ac.getOpeningSeconds() * 1000);
|
|
|
- if (now.getTime() < start) {
|
|
|
- throw new BusinessException("没有到允许开考的时间");
|
|
|
- }
|
|
|
- if (now.getTime() > end) {
|
|
|
- throw new BusinessException("允许开考的时间已结束");
|
|
|
+ if(ExamModeEnum.ANYTIME.equals(exam.getMode())) {
|
|
|
+ Long start = ac.getStartTime().getTime() - (ac.getPrepareSeconds() * 1000);
|
|
|
+ Long end = ac.getFinishTime().getTime();
|
|
|
+ if (now.getTime() < start) {
|
|
|
+ throw new BusinessException("没有到允许开考的时间");
|
|
|
+ }
|
|
|
+ if (now.getTime() > end) {
|
|
|
+ throw new BusinessException("允许开考的时间已结束");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ Long start = ac.getStartTime().getTime() - (ac.getPrepareSeconds() * 1000);
|
|
|
+ Long end = ac.getStartTime().getTime() + (ac.getOpeningSeconds() * 1000);
|
|
|
+ if (now.getTime() < start) {
|
|
|
+ throw new BusinessException("没有到允许开考的时间");
|
|
|
+ }
|
|
|
+ if (now.getTime() > end) {
|
|
|
+ throw new BusinessException("允许开考的时间已结束");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
ExamCourseCacheBean ec = teExamCourseService.getExamCourseCacheBean(es.getExamId(), es.getCourseCode());
|
|
|
if (ec == null) {
|
|
|
throw new BusinessException("未找到考试科目");
|
|
@@ -317,7 +331,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
prepare.setMonitorUserId("s_" + tbSession.getId());
|
|
|
prepare.setMonitorUserSig(tencentYunUtil.getSign(prepare.getMonitorUserId(), SystemConstant.TENCENT_EXPIRE_TIME));
|
|
|
|
|
|
- ExamCacheBean exam = getExamCacheBean(es.getExamId());
|
|
|
+
|
|
|
Integer breakResumeCount = exam.getBreakResumeCount();
|
|
|
// 更新考生缓存
|
|
|
redisUtil.set(RedisKeyHelper.examStudentCacheKey(examStudentId), es);
|
|
@@ -369,20 +383,31 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
|
throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
|
|
|
}
|
|
|
-
|
|
|
+ ExamCacheBean exam = getExamCacheBean(es.getExamId());
|
|
|
Long activityId = es.getExamActivityId();
|
|
|
ExamActivityCacheBean ac = teExamActivityService.getExamActivityCacheBean(activityId);
|
|
|
if (ac == null) {
|
|
|
throw new BusinessException("未找到场次");
|
|
|
}
|
|
|
Date now = new Date();
|
|
|
- Long start = ac.getStartTime().getTime();
|
|
|
- Long end = ac.getStartTime().getTime() + (ac.getOpeningSeconds() * 1000);
|
|
|
- if (now.getTime() < start) {
|
|
|
- throw new BusinessException("没有到允许开考的时间");
|
|
|
- }
|
|
|
- if (now.getTime() > end) {
|
|
|
- throw new BusinessException("允许开考的时间已结束");
|
|
|
+ if(ExamModeEnum.ANYTIME.equals(exam.getMode())) {
|
|
|
+ Long start = ac.getStartTime().getTime();
|
|
|
+ Long end = ac.getFinishTime().getTime();
|
|
|
+ if (now.getTime() < start) {
|
|
|
+ throw new BusinessException("没有到允许开考的时间");
|
|
|
+ }
|
|
|
+ if (now.getTime() > end) {
|
|
|
+ throw new BusinessException("允许开考的时间已结束");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ Long start = ac.getStartTime().getTime();
|
|
|
+ Long end = ac.getStartTime().getTime() + (ac.getOpeningSeconds() * 1000);
|
|
|
+ if (now.getTime() < start) {
|
|
|
+ throw new BusinessException("没有到允许开考的时间");
|
|
|
+ }
|
|
|
+ if (now.getTime() > end) {
|
|
|
+ throw new BusinessException("允许开考的时间已结束");
|
|
|
+ }
|
|
|
}
|
|
|
ExamRecordStatusEnum sta = ExamRecordCacheUtil.getStatus(recordId);
|
|
|
if (ExamRecordStatusEnum.FINISHED.equals(sta) || ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|