|
@@ -25,6 +25,7 @@ import cn.com.qmth.examcloud.core.oe.student.api.request.GetExamRecordQuestionsR
|
|
|
import cn.com.qmth.examcloud.core.oe.student.api.response.CalcExamScoreResp;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.api.response.GetExamRecordPaperStructResp;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.api.response.GetExamRecordQuestionsResp;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.base.utils.Check;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.base.utils.CommonUtil;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.base.utils.QuestionTypeUtil;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.bean.*;
|
|
@@ -159,11 +160,18 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public StartExamInfo startExam(Long examStudentId, User user, String ip) {
|
|
|
+ public StartExamInfo startExam(Long examStudentId, Long userId, String ip) {
|
|
|
+ Check.isNull(examStudentId, "examStudentId不能为空");
|
|
|
+ Check.isNull(userId, "userId不能为空");
|
|
|
+
|
|
|
+ String sequenceLockKey = Constants.EXAM_CONTROL_LOCK_PREFIX + userId;
|
|
|
+ // 开始考试上锁,分布式锁,系统在请求结束后会,自动释放锁,无需手动解锁
|
|
|
+ SequenceLockHelper.getLock(sequenceLockKey);
|
|
|
+
|
|
|
// 开考预处理
|
|
|
- prepare4Exam(examStudentId, user);
|
|
|
+ prepare4Exam(examStudentId, userId);
|
|
|
|
|
|
- Long studentId = user.getUserId();
|
|
|
+ Long studentId = userId;
|
|
|
long st = System.currentTimeMillis();
|
|
|
|
|
|
long startTime = System.currentTimeMillis();
|
|
@@ -231,7 +239,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
if (FaceBiopsyHelper.isFaceEnable(rootOrgId, examId, studentId)) {
|
|
|
SaveExamCaptureSyncCompareResultReq req = new SaveExamCaptureSyncCompareResultReq();
|
|
|
req.setExamRecordDataId(examRecordData.getId());
|
|
|
- req.setStudentId(user.getUserId());
|
|
|
+ req.setStudentId(userId);
|
|
|
examCaptureCloudService.saveExamCaptureSyncCompareResult(req);
|
|
|
}
|
|
|
|
|
@@ -294,9 +302,10 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
if (log.isDebugEnabled()) {
|
|
|
log.debug("10 合计 耗时:" + (System.currentTimeMillis() - st) + " ms");
|
|
|
}
|
|
|
+
|
|
|
// 在线考生开考打点
|
|
|
- ReportsUtil.report(
|
|
|
- new OnlineExamStudentReport(user.getRootOrgId(), user.getUserId(), examBean.getId(), examStudentId));
|
|
|
+ ReportsUtil.report(new OnlineExamStudentReport(rootOrgId, userId, examBean.getId(), examStudentId));
|
|
|
+
|
|
|
//考试过程记录(开考)打点
|
|
|
ReportsUtil.report(
|
|
|
new ExamProcessRecordReport(examRecordData.getId(), ExamProcess.START, examRecordData.getEnterExamTime())
|
|
@@ -506,9 +515,9 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
* 开考预处理
|
|
|
*
|
|
|
* @param examStudentId
|
|
|
- * @param user
|
|
|
+ * @param userId
|
|
|
*/
|
|
|
- private void prepare4Exam(Long examStudentId, User user) {
|
|
|
+ private void prepare4Exam(Long examStudentId, Long userId) {
|
|
|
SysPropertyCacheBean stuClientLoginLimit = CacheHelper.getSysProperty("STU_CLIENT_LOGIN_LIMIT");
|
|
|
Boolean stuClientLoginLimitBoolean = false;
|
|
|
if (stuClientLoginLimit.getHasValue()) {
|
|
@@ -525,11 +534,11 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
}
|
|
|
|
|
|
Long studentId = examStudent.getStudentId();
|
|
|
- if (!studentId.equals(user.getUserId().longValue())) {
|
|
|
+ if (!studentId.equals(userId)) {
|
|
|
throw new StatusException("008003", "考生与当前用户不吻合");
|
|
|
}
|
|
|
|
|
|
- String examingSessionKey = RedisKeyHelper.getBuilder().examingSessionKey(user.getUserId());
|
|
|
+ String examingSessionKey = RedisKeyHelper.getBuilder().examingSessionKey(userId);
|
|
|
|
|
|
ExamingSession examingSession = redisClient.get(examingSessionKey, ExamingSession.class);
|
|
|
|