|
@@ -1,11 +1,45 @@
|
|
package com.qmth.themis.business.service.impl;
|
|
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.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.Objects;
|
|
|
|
+import java.util.UUID;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+
|
|
|
|
+import org.apache.commons.codec.digest.DigestUtils;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
+
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
-import com.qmth.themis.business.bean.exam.*;
|
|
|
|
|
|
+import com.qmth.themis.business.bean.exam.ExamFileUploadBean;
|
|
|
|
+import com.qmth.themis.business.bean.exam.ExamFinishBean;
|
|
|
|
+import com.qmth.themis.business.bean.exam.ExamPrepareBean;
|
|
|
|
+import com.qmth.themis.business.bean.exam.ExamResultBean;
|
|
|
|
+import com.qmth.themis.business.bean.exam.ExamResumeBean;
|
|
|
|
+import com.qmth.themis.business.bean.exam.ExamStartBean;
|
|
import com.qmth.themis.business.cache.ExamRecordCacheUtil;
|
|
import com.qmth.themis.business.cache.ExamRecordCacheUtil;
|
|
import com.qmth.themis.business.cache.RedisKeyHelper;
|
|
import com.qmth.themis.business.cache.RedisKeyHelper;
|
|
-import com.qmth.themis.business.cache.bean.*;
|
|
|
|
|
|
+import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
|
|
|
|
+import com.qmth.themis.business.cache.bean.ExamCacheBean;
|
|
|
|
+import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
|
|
|
|
+import com.qmth.themis.business.cache.bean.ExamPaperCacheBean;
|
|
|
|
+import com.qmth.themis.business.cache.bean.ExamStudentAnswerCacheBean;
|
|
|
|
+import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
|
|
|
|
+import com.qmth.themis.business.cache.bean.ExamStudentPaperStructCacheBean;
|
|
import com.qmth.themis.business.config.SystemConfig;
|
|
import com.qmth.themis.business.config.SystemConfig;
|
|
import com.qmth.themis.business.dao.TEExamMapper;
|
|
import com.qmth.themis.business.dao.TEExamMapper;
|
|
import com.qmth.themis.business.dto.response.TEExamActivityDto;
|
|
import com.qmth.themis.business.dto.response.TEExamActivityDto;
|
|
@@ -13,23 +47,15 @@ import com.qmth.themis.business.dto.response.TEExamDto;
|
|
import com.qmth.themis.business.entity.TEExam;
|
|
import com.qmth.themis.business.entity.TEExam;
|
|
import com.qmth.themis.business.enums.ExamRecordStatusEnum;
|
|
import com.qmth.themis.business.enums.ExamRecordStatusEnum;
|
|
import com.qmth.themis.business.enums.FinishTypeEnum;
|
|
import com.qmth.themis.business.enums.FinishTypeEnum;
|
|
-import com.qmth.themis.business.service.*;
|
|
|
|
|
|
+import com.qmth.themis.business.service.TEExamActivityService;
|
|
|
|
+import com.qmth.themis.business.service.TEExamCourseService;
|
|
|
|
+import com.qmth.themis.business.service.TEExamPaperService;
|
|
|
|
+import com.qmth.themis.business.service.TEExamService;
|
|
|
|
+import com.qmth.themis.business.service.TEExamStudentService;
|
|
|
|
+import com.qmth.themis.business.service.TOeExamRecordService;
|
|
import com.qmth.themis.business.util.OssUtil;
|
|
import com.qmth.themis.business.util.OssUtil;
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
-import org.apache.commons.codec.digest.DigestUtils;
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
|
-import org.springframework.cache.annotation.Cacheable;
|
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
|
-
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
-import java.io.IOException;
|
|
|
|
-import java.io.InputStream;
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
|
-import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 考试批次 服务实现类
|
|
* @Description: 考试批次 服务实现类
|
|
@@ -113,6 +139,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
// return teExamMapper.getWaitingExamForJob();
|
|
// return teExamMapper.getWaitingExamForJob();
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *开始候考
|
|
|
|
+ */
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public ExamPrepareBean prepare(Long studentId, Long examStudentId) {
|
|
public ExamPrepareBean prepare(Long studentId, Long examStudentId) {
|
|
@@ -216,6 +245,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *开始候考
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public ExamStartBean start(Long studentId, Long recordId) {
|
|
public ExamStartBean start(Long studentId, Long recordId) {
|
|
ExamStartBean ret = null;
|
|
ExamStartBean ret = null;
|
|
@@ -266,6 +298,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *上传个人试卷结构
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public Long studentPaperStruct(Long studentId, Long recordId, String content) {
|
|
public Long studentPaperStruct(Long studentId, Long recordId, String content) {
|
|
|
|
|
|
@@ -291,6 +326,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
return struct.getTime();
|
|
return struct.getTime();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *提交作答结果
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public Long answerSubmit(Long studentId, Long recordId, Integer mainNumber, Integer subNumber, Integer subIndex,
|
|
public Long answerSubmit(Long studentId, Long recordId, Integer mainNumber, Integer subNumber, Integer subIndex,
|
|
String answer, Long version, Integer durationSeconds) {
|
|
String answer, Long version, Integer durationSeconds) {
|
|
@@ -338,6 +376,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
return version;
|
|
return version;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *更新音频剩余播放次数
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public Integer audioLeftPlayCountSubmit(Long studentId, Long recordId, String key, Integer count) {
|
|
public Integer audioLeftPlayCountSubmit(Long studentId, Long recordId, String key, Integer count) {
|
|
|
|
|
|
@@ -361,6 +402,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
return count;
|
|
return count;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *文件上传
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public ExamFileUploadBean fileUpload(Long studentId, Long recordId, MultipartFile file, String suffix, String md5) {
|
|
public ExamFileUploadBean fileUpload(Long studentId, Long recordId, MultipartFile file, String suffix, String md5) {
|
|
|
|
|
|
@@ -408,6 +452,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
return UUID.randomUUID().toString().replaceAll("-", "");
|
|
return UUID.randomUUID().toString().replaceAll("-", "");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *断点恢复
|
|
|
|
+ */
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|
|
@Override
|
|
@Override
|
|
public ExamResumeBean resume(Long studentId, Long recordId) {
|
|
public ExamResumeBean resume(Long studentId, Long recordId) {
|
|
@@ -459,7 +506,10 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
- // 作答排序
|
|
|
|
|
|
+ /**作答排序
|
|
|
|
+ * @param answers
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
private List<ExamStudentAnswerCacheBean> sortAnswers(Map<String, ExamStudentAnswerCacheBean> answers) {
|
|
private List<ExamStudentAnswerCacheBean> sortAnswers(Map<String, ExamStudentAnswerCacheBean> answers) {
|
|
List<ExamStudentAnswerCacheBean> ret = new ArrayList<ExamStudentAnswerCacheBean>(answers.values());
|
|
List<ExamStudentAnswerCacheBean> ret = new ArrayList<ExamStudentAnswerCacheBean>(answers.values());
|
|
Collections.sort(ret, new Comparator<ExamStudentAnswerCacheBean>() {
|
|
Collections.sort(ret, new Comparator<ExamStudentAnswerCacheBean>() {
|
|
@@ -495,6 +545,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *结束考试
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public ExamFinishBean finish(Long studentId, Long recordId, String type, Integer durationSeconds) {
|
|
public ExamFinishBean finish(Long studentId, Long recordId, String type, Integer durationSeconds) {
|
|
|
|
|
|
@@ -538,6 +591,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *查询交卷结果
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public ExamResultBean result(Long studentId, Long recordId) {
|
|
public ExamResultBean result(Long studentId, Long recordId) {
|
|
// 校验当前登录用户和参数一致性
|
|
// 校验当前登录用户和参数一致性
|
|
@@ -563,4 +619,5 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
ret.setReviewResult("");
|
|
ret.setReviewResult("");
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|