|
@@ -3,6 +3,7 @@ package cn.com.qmth.examcloud.core.oe.student.service.impl;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Optional;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
@@ -123,7 +124,15 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
|
|
|
erqs.setExamQuestions(examQuestions);
|
|
|
erqs.setExamRecordDataId(examRecordDataId);
|
|
|
for (int i = 1; i <= quesCount; i++) {
|
|
|
- examQuestions.add(getExamQuestion(examRecordDataId, i));
|
|
|
+ ExamQuestion eq=getExamQuestion(examRecordDataId, i);
|
|
|
+ if(eq.getIsInMongo()) {
|
|
|
+ Optional<ExamQuestionTempEntity> op=examRecordQuestionTempRepo.findById(eq.getExamQuestionTempId());
|
|
|
+ if(!op.isPresent()) {
|
|
|
+ throw new StatusException("1001", "试题内容未找到");
|
|
|
+ }
|
|
|
+ BeanUtils.copyProperties(op.get(), eq);
|
|
|
+ }
|
|
|
+ examQuestions.add(eq);
|
|
|
}
|
|
|
return erqs;
|
|
|
}
|
|
@@ -133,7 +142,7 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
|
|
|
ExamingSession examSessionInfo = examingSessionService.getExamingSession(studentId);
|
|
|
if (examSessionInfo == null || examSessionInfo.getExamingStatus().equals(ExamingStatus.INFORMAL)
|
|
|
|| examSessionInfo.getCost() >= examSessionInfo.getExamDuration()) {
|
|
|
- throw new StatusException("1001", "考试已结束,不允许获取试题内容");
|
|
|
+ throw new StatusException("2001", "考试已结束,不允许获取试题内容");
|
|
|
}
|
|
|
|
|
|
// 本地缓存key规则:examId_courseCode_paperType_questionId
|
|
@@ -167,7 +176,7 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
|
|
|
ExamingSession examSessionInfo = examingSessionService.getExamingSession(studentId);
|
|
|
if (examSessionInfo == null || examSessionInfo.getExamingStatus().equals(ExamingStatus.INFORMAL)
|
|
|
|| examSessionInfo.getCost() >= examSessionInfo.getExamDuration()) {
|
|
|
- throw new StatusException("2001", "考试会话已过期");
|
|
|
+ throw new StatusException("3001", "考试会话已过期");
|
|
|
}
|
|
|
long examRecordDataId = examSessionInfo.getExamRecordDataId();
|
|
|
|