|
@@ -571,11 +571,8 @@ public class RealExamService {
|
|
|
if (StringUtils.equals(re.getExamStatus(), RealExam.State.SUBMITTED)) {
|
|
|
return AjaxResult.error("已经交卷,禁止重复交卷,<br/>请刷新自动结束考试!");
|
|
|
}
|
|
|
- RealExamCollection rec = realExamCollectionService.selectRealExamCollectionByExamCollectionId(re.getExamCollectionId());
|
|
|
- // 允许考试时长,毫秒
|
|
|
- Long millisecondsAllowed = rec.getLimitDuration() * 60 * 1000 + DURATION_10_MIN;
|
|
|
// Check:已经超时的交卷。
|
|
|
- if (DateUtils.getNowDate().getTime() > re.getStartTime().getTime() + millisecondsAllowed) {
|
|
|
+ if (checkRealExamIsTimeout(re.getExamId())) {
|
|
|
// 修改考试状态
|
|
|
re.setExamStatus(RealExam.State.SUBMITTED);
|
|
|
// 修改真实考试结束时间。
|
|
@@ -583,7 +580,6 @@ public class RealExamService {
|
|
|
updateRealExam(re);
|
|
|
return AjaxResult.success("考试时间已经超时,自动结束考试!");
|
|
|
}
|
|
|
-
|
|
|
// Check:检查参数studentBindIp有效性
|
|
|
if (StringUtils.isBlank(studentBindIp)) {
|
|
|
return AjaxResult.error("IP地址无效!");
|
|
@@ -599,7 +595,7 @@ public class RealExamService {
|
|
|
if (!Objects.equals(seatStart.getSeatId(), seatNow.getSeatId())) {
|
|
|
return AjaxResult.error("没有在原始座次上交卷,请回到原座次[" + seatStart.getSeatNum() + "]上进行交卷!");
|
|
|
}
|
|
|
-
|
|
|
+ RealExamCollection rec = realExamCollectionService.selectRealExamCollectionByExamCollectionId(re.getExamCollectionId());
|
|
|
// Check:检查参数examCollectionType有效性
|
|
|
if (!StringUtils.equals(examCollectionType, rec.getExamCollectionType())) {
|
|
|
return AjaxResult.error("考试集合类型不对应!");
|
|
@@ -679,6 +675,32 @@ public class RealExamService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void systemSubmitTimeoutRealExam(Long examId) {
|
|
|
+ RealExam re = selectRealExamByExamId(examId);
|
|
|
+ if (re != null &&
|
|
|
+ re.getExamId() != 0L &&
|
|
|
+ RealExam.State.ANSWERING.equals(re.getExamStatus()) &&
|
|
|
+ checkRealExamIsTimeout(re.getExamId())) {
|
|
|
+ re.setExamStatus(RealExam.State.SUBMITTED);
|
|
|
+ updateRealExam(re);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param examId
|
|
|
+ * @return true 已经超时
|
|
|
+ */
|
|
|
+ public boolean checkRealExamIsTimeout(Long examId) {
|
|
|
+ RealExam re = selectRealExamByExamId(examId);
|
|
|
+ if (re == null || re.getExamId() == 0L) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ RealExamCollection rec = realExamCollectionService.selectRealExamCollectionByExamCollectionId(re.getExamCollectionId());
|
|
|
+ // 允许考试时长,毫秒
|
|
|
+ Long millisecondsAllowed = rec.getLimitDuration() * 60 * 1000 + DURATION_10_MIN;
|
|
|
+ return DateUtils.getNowDate().getTime() > (re.getStartTime().getTime() + millisecondsAllowed);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* [轮询][学生]结束考试界面。
|
|
|
*
|