|
@@ -60,6 +60,7 @@ import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
|
|
|
import com.qmth.themis.business.cache.bean.ExamStudentPaperStructCacheBean;
|
|
|
import com.qmth.themis.business.cache.bean.ObjectiveAnswerCacheBean;
|
|
|
import com.qmth.themis.business.config.SystemConfig;
|
|
|
+import com.qmth.themis.business.constant.SpringContextHolder;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.dao.TEExamMapper;
|
|
|
import com.qmth.themis.business.dto.MqDto;
|
|
@@ -149,8 +150,6 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
@Resource
|
|
|
TEExamPaperService examPaperService;
|
|
|
|
|
|
- @Resource
|
|
|
- TEExamService teExamService;
|
|
|
|
|
|
/**
|
|
|
* 查询考试批次
|
|
@@ -194,7 +193,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
}
|
|
|
teExamActivityDtos.add(v);
|
|
|
map.put(v.getExamId(), teExamActivityDtos);
|
|
|
- ExamCacheBean examCache = getExamCacheBean(v.getExamId());
|
|
|
+ ExamCacheBean examCache = getExamCacheBeanNative(v.getExamId());
|
|
|
ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(v.getExamStudentId());
|
|
|
v.setLeftExamCount(examCache.getExamCount() - examStudentCacheBean.getAlreadyExamCount());
|
|
|
if (Objects.nonNull(v.getInProcessLivenessFixedRangeStr())) {
|
|
@@ -257,7 +256,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
|
throw new BusinessException("考生Id和当前登录用户不一致");
|
|
|
}
|
|
|
- ExamCacheBean examCache = getExamCacheBean(es.getExamId());
|
|
|
+ ExamCacheBean examCache = getExamCacheBeanNative(es.getExamId());
|
|
|
|
|
|
if(examCache.getEnableIpLimit()!=null&&examCache.getEnableIpLimit().intValue()==1) {
|
|
|
String ipAllows=examCache.getIpAllow();
|
|
@@ -305,14 +304,13 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
if (examCache.getExamCount().intValue() <= es.getAlreadyExamCount().intValue()) {
|
|
|
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();
|
|
|
- if (ExamModeEnum.ANYTIME.equals(exam.getMode())) {
|
|
|
+ if (ExamModeEnum.ANYTIME.equals(examCache.getMode())) {
|
|
|
Long start = ac.getStartTime() - (ac.getPrepareSeconds() * 1000);
|
|
|
Long end = ac.getFinishTime();
|
|
|
if (now.getTime() < start) {
|
|
@@ -437,7 +435,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
|
throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
|
|
|
}
|
|
|
- ExamCacheBean exam = getExamCacheBean(es.getExamId());
|
|
|
+ ExamCacheBean exam = getExamCacheBeanNative(es.getExamId());
|
|
|
Long activityId = es.getExamActivityId();
|
|
|
ExamActivityCacheBean ac = teExamActivityService.getExamActivityCacheBean(activityId);
|
|
|
if (ac == null) {
|
|
@@ -498,23 +496,21 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
throw new BusinessException("移动端第二机位离线");
|
|
|
}
|
|
|
|
|
|
- Long examId = ExamRecordCacheUtil.getExamId(recordId);
|
|
|
- ExamCacheBean ec = teExamService.getExamCacheBean(examId);//考试缓存
|
|
|
ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
Integer durationSeconds = Objects.isNull(ExamRecordCacheUtil.getDurationSeconds(recordId)) ? 0 : ExamRecordCacheUtil.getDurationSeconds(recordId);
|
|
|
//获取断点时间
|
|
|
Long lastBreakTime = ExamRecordCacheUtil.getLastBreakTime(recordId);
|
|
|
//获取剩余断点次数
|
|
|
Integer alreadyBreakCount = Objects.isNull(ExamRecordCacheUtil.getAlreadyBreakCount(recordId)) ? 0 : ExamRecordCacheUtil.getAlreadyBreakCount(recordId);
|
|
|
- Integer leftBreakResumeCount = ec.getBreakResumeCount() - alreadyBreakCount;
|
|
|
- Integer breakExpireSeconds = Objects.isNull(ec.getBreakExpireSeconds()) ? 0 : ec.getBreakExpireSeconds();
|
|
|
+ Integer leftBreakResumeCount = exam.getBreakResumeCount() - alreadyBreakCount;
|
|
|
+ Integer breakExpireSeconds = Objects.isNull(exam.getBreakExpireSeconds()) ? 0 : exam.getBreakExpireSeconds();
|
|
|
//如果断点时间大于整体断点时间,则强制交卷
|
|
|
if (Objects.nonNull(lastBreakTime) && (System.currentTimeMillis() - lastBreakTime) / 1000 > breakExpireSeconds) {
|
|
|
- teExamService.finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
+ finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
} else {
|
|
|
//如果断点次数小于0,也强制交卷
|
|
|
if (leftBreakResumeCount < 0) {
|
|
|
- teExamService.finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
+ finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
}
|
|
|
}
|
|
|
ret = new ExamStartBean();
|
|
@@ -799,7 +795,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
throw new BusinessException("该考试已结束");
|
|
|
}
|
|
|
Long examId = ExamRecordCacheUtil.getExamId(recordId);
|
|
|
- ExamCacheBean ec = teExamService.getExamCacheBean(examId);//考试缓存
|
|
|
+ ExamCacheBean ec = getExamCacheBeanNative(examId);//考试缓存
|
|
|
ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
Integer durationSeconds = Objects.isNull(ExamRecordCacheUtil.getDurationSeconds(recordId)) ? 0 : ExamRecordCacheUtil.getDurationSeconds(recordId);
|
|
|
//获取断点时间
|
|
@@ -810,11 +806,11 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
Integer breakExpireSeconds = Objects.isNull(ec.getBreakExpireSeconds()) ? 0 : ec.getBreakExpireSeconds();
|
|
|
//如果断点时间大于整体断点时间,则强制交卷
|
|
|
if (Objects.nonNull(lastBreakTime) && (System.currentTimeMillis() - lastBreakTime) / 1000 > breakExpireSeconds) {
|
|
|
- teExamService.finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
+ finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
} else {
|
|
|
//如果断点次数小于0,也强制交卷
|
|
|
if (leftBreakResumeCount < 0) {
|
|
|
- teExamService.finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
+ finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -924,7 +920,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
ExamFinishBean ret = new ExamFinishBean();
|
|
|
ret.setFinishTime(now.getTime());
|
|
|
ret.setObjectiveScore(ExamRecordCacheUtil.getObjectiveScore(recordId));
|
|
|
- ExamCacheBean exam = getExamCacheBean(es.getExamId());
|
|
|
+ ExamCacheBean exam = getExamCacheBeanNative(es.getExamId());
|
|
|
//页面结果
|
|
|
if (exam.getShowObjectiveScore() != null && exam.getShowObjectiveScore().intValue() == 1) {//实时出分
|
|
|
if (InvigilateVerifyEnum.NOW.equals(exam.getInvigilateVerify())) {//实时审核
|
|
@@ -1015,6 +1011,11 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
public ExamCacheBean getExamCacheBean(Long examId) {
|
|
|
return cacheOperation(examId);
|
|
|
}
|
|
|
+
|
|
|
+ private ExamCacheBean getExamCacheBeanNative(Long examId) {
|
|
|
+ TEExamService examService = SpringContextHolder.getBean(TEExamService.class);
|
|
|
+ return examService.getExamCacheBean(examId);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 更新批次缓存
|
|
@@ -1063,7 +1064,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
}
|
|
|
|
|
|
//页面结果
|
|
|
- ExamCacheBean exam = getExamCacheBean(er.getExamId());
|
|
|
+ ExamCacheBean exam = getExamCacheBeanNative(er.getExamId());
|
|
|
if (exam.getShowObjectiveScore() != null && exam.getShowObjectiveScore().intValue() == 1) {//实时出分
|
|
|
if (InvigilateVerifyEnum.NOW.equals(exam.getInvigilateVerify())) {//实时审核
|
|
|
Integer warningCount = ExamRecordCacheUtil.getWarningCount(recordId);
|