|
@@ -3,6 +3,9 @@ package com.qmth.themis.business.service.impl;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -409,6 +412,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
return UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
}
|
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
public ExamResumeBean resume(Long studentId, Long recordId) {
|
|
|
ExamRecordCacheBean er = (ExamRecordCacheBean) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId));
|
|
@@ -434,7 +438,57 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
ret.setStructUrl(OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), ep.getStructPath()));
|
|
|
ret.setHasAudio((ep.getHasAudio()!=null&&ep.getHasAudio().intValue()==1?true:false));
|
|
|
ret.setAudioPlayCount(ep.getAudioPlayCount());
|
|
|
+ //TODO 9527
|
|
|
+ ret.setMonitorKey(recordId.toString());
|
|
|
+
|
|
|
+ ExamStudentPaperStructCacheBean struct=(ExamStudentPaperStructCacheBean)redisUtil.get(RedisKeyHelper.studentPaperStructKey(recordId));
|
|
|
+ if(struct!=null) {
|
|
|
+ ret.setStudentPaperStruct(struct.getContent());
|
|
|
+ }
|
|
|
+ Map<String,ExamStudentAnswerCacheBean> answers=redisUtil.getHashEntries(RedisKeyHelper.examAnswerKey(recordId));
|
|
|
+ if(answers!=null&&answers.size()>0) {
|
|
|
+ ret.setAnswerList(sortAnswers(answers));
|
|
|
+ }
|
|
|
+ Map<String,Integer> audioLeftPlayCounts=redisUtil.getHashEntries(RedisKeyHelper.audioLeftPlayCountKey(recordId));
|
|
|
+ if(audioLeftPlayCounts!=null&&audioLeftPlayCounts.size()>0) {
|
|
|
+ ret.setAudioLeftPlayCount(audioLeftPlayCounts);
|
|
|
+ }
|
|
|
return ret;
|
|
|
}
|
|
|
+
|
|
|
+ //作答排序
|
|
|
+ private List<ExamStudentAnswerCacheBean> sortAnswers(Map<String,ExamStudentAnswerCacheBean> answers) {
|
|
|
+ List<ExamStudentAnswerCacheBean> ret = new ArrayList<ExamStudentAnswerCacheBean>(answers.values());
|
|
|
+ Collections.sort(ret, new Comparator<ExamStudentAnswerCacheBean>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int compare(ExamStudentAnswerCacheBean o1, ExamStudentAnswerCacheBean o2) {
|
|
|
+ if (o1.getMainNumber() > o2.getMainNumber()) {
|
|
|
+ return 1;
|
|
|
+ } else if (o1.getMainNumber() < o2.getMainNumber()) {
|
|
|
+ return -1;
|
|
|
+ } else {
|
|
|
+ if (o1.getSubNumber() > o2.getSubNumber()) {
|
|
|
+ return 1;
|
|
|
+ } else if (o1.getSubNumber() < o2.getSubNumber()) {
|
|
|
+ return -1;
|
|
|
+ } else {
|
|
|
+ if (o1.getSubIndex()==null || o2.getSubIndex()==null) {
|
|
|
+ return 0;
|
|
|
+ }else {
|
|
|
+ if (o1.getSubIndex() > o2.getSubIndex()) {
|
|
|
+ return 1;
|
|
|
+ } else if (o1.getSubIndex() < o2.getSubIndex()) {
|
|
|
+ return -1;
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ });
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
}
|