|
@@ -30,7 +30,10 @@ import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
import com.google.common.cache.Cache;
|
|
import com.google.common.cache.Cache;
|
|
import com.google.common.cache.CacheBuilder;
|
|
import com.google.common.cache.CacheBuilder;
|
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -43,6 +46,8 @@ import java.util.concurrent.TimeUnit;
|
|
@Service("examRecordQuestionsService")
|
|
@Service("examRecordQuestionsService")
|
|
public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsService {
|
|
public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsService {
|
|
|
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(ExamRecordQuestionsServiceImpl.class);
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 考生作答内容长度界限,超过此长度的答案内容存入mongo
|
|
* 考生作答内容长度界限,超过此长度的答案内容存入mongo
|
|
*/
|
|
*/
|
|
@@ -230,6 +235,17 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void submitQuestionAnswer(Long studentId, List<ExamStudentQuestionInfo> examQuestionInfos, String referer, String agent) {
|
|
public void submitQuestionAnswer(Long studentId, List<ExamStudentQuestionInfo> examQuestionInfos, String referer, String agent) {
|
|
|
|
+ if (CollectionUtils.isEmpty(examQuestionInfos)) {
|
|
|
|
+ log.warn("submitQuestionAnswer is empty. studentId = {} ", studentId);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (ExamStudentQuestionInfo examStudentQuestionInfo : examQuestionInfos) {
|
|
|
|
+ if (examStudentQuestionInfo.getOrder() == null) {
|
|
|
|
+ throw new StatusException("2001", "题目序号不能为空");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
ExamingSession examSessionInfo = examingSessionService.getExamingSession(studentId);
|
|
ExamingSession examSessionInfo = examingSessionService.getExamingSession(studentId);
|
|
if (examSessionInfo == null
|
|
if (examSessionInfo == null
|
|
|| examSessionInfo.getExamingStatus().equals(ExamingStatus.INFORMAL)) {
|
|
|| examSessionInfo.getExamingStatus().equals(ExamingStatus.INFORMAL)) {
|