|
@@ -776,22 +776,21 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
throw new StatusException("400X01", CryptoConstant.REQUEST_PARAM_ERROR);
|
|
|
}
|
|
|
|
|
|
- this.manualEndExam(user.getUserId(), requestIP);
|
|
|
+ this.manualEndExam(user.getUserId(), requestIP, false);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void manualEndExam(Long studentId, String ip) {
|
|
|
+ public void manualEndExam(Long studentId, String ip, Boolean force) {
|
|
|
String sequenceLockKey = Constants.EXAM_CONTROL_LOCK_PREFIX + studentId;
|
|
|
//系统在请求结束后会,自动释放锁,无需手动解锁
|
|
|
SequenceLockHelper.getLock(sequenceLockKey);
|
|
|
|
|
|
- long startTime = System.currentTimeMillis();
|
|
|
ExamingSession examingSession = examingSessionService.getExamingSession(studentId);
|
|
|
if (examingSession == null) {
|
|
|
throw new StatusException("8010", "无效的会话,请离开考试");
|
|
|
}
|
|
|
|
|
|
- this.handInExam(examingSession.getExamRecordDataId(), HandInExamType.MANUAL, ip);
|
|
|
+ this.handInExam(examingSession.getExamRecordDataId(), HandInExamType.MANUAL, ip, force);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -802,7 +801,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
*/
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public void handInExam(Long examRecordDataId, HandInExamType handInExamType, String ip) {
|
|
|
+ public void handInExam(Long examRecordDataId, HandInExamType handInExamType, String ip, Boolean force) {
|
|
|
// 此锁是为了避免自动交卷服务与断点续考交卷或活检失败交卷,同一时刻交卷争抢资源导致死锁
|
|
|
String sequenceLockKey = Constants.HAND_IN_EXAM_LOCK_PREFIX + examRecordDataId;
|
|
|
// 系统在请求结束后会,自动释放锁,无需手动解锁
|
|
@@ -1855,7 +1854,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
*/
|
|
|
private void delayHandInExamIfLocked(Long examRecordDataId) {
|
|
|
try {
|
|
|
- handInExam(examRecordDataId, HandInExamType.AUTO, null);
|
|
|
+ this.handInExam(examRecordDataId, HandInExamType.AUTO, null, true);
|
|
|
} catch (SequenceLockException e) {
|
|
|
// 如果发现自动服务正在交卷,则重试1500毫秒获取考试记录状态,判断是否已交卷
|
|
|
int loopTimes = 0;
|