瀏覽代碼

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	themis-business/src/main/java/com/qmth/themis/business/service/TEExamService.java
wangliang 4 年之前
父節點
當前提交
e7fe727e81

+ 20 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/exam/AnswerSubmitBean.java

@@ -0,0 +1,20 @@
+package com.qmth.themis.business.bean.exam;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel("提交作答结果返回信息")
+public class AnswerSubmitBean {
+	@ApiModelProperty("updateTime")
+	private Long version;
+
+	public Long getVersion() {
+		return version;
+	}
+
+	public void setVersion(Long version) {
+		this.version = version;
+	}
+
+
+}

+ 21 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/exam/AudioLeftPlayCountSubmitBean.java

@@ -0,0 +1,21 @@
+package com.qmth.themis.business.bean.exam;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel("更新音频剩余播放次数返回信息")
+public class AudioLeftPlayCountSubmitBean {
+	@ApiModelProperty("updateTime")
+	private Integer count;
+
+	public Integer getCount() {
+		return count;
+	}
+
+	public void setCount(Integer count) {
+		this.count = count;
+	}
+
+
+
+}

+ 19 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/exam/StudentPaperStructBean.java

@@ -0,0 +1,19 @@
+package com.qmth.themis.business.bean.exam;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel("上传试卷结构返回信息")
+public class StudentPaperStructBean {
+	@ApiModelProperty("updateTime")
+	private Long updateTime;
+
+	public Long getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Long updateTime) {
+		this.updateTime = updateTime;
+	}
+
+}

+ 8 - 6
themis-business/src/main/java/com/qmth/themis/business/service/TEExamService.java

@@ -3,19 +3,21 @@ package com.qmth.themis.business.service;
 import java.util.List;
 import java.util.Map;
 
-import com.qmth.themis.business.dto.response.TEExamDto;
-import com.qmth.themis.business.dto.response.TEExamQueryDto;
 import org.springframework.web.multipart.MultipartFile;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.themis.business.bean.exam.AnswerSubmitBean;
+import com.qmth.themis.business.bean.exam.AudioLeftPlayCountSubmitBean;
 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.bean.exam.StudentPaperStructBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
+import com.qmth.themis.business.dto.response.TEExamDto;
 import com.qmth.themis.business.entity.TEExam;
 
 /**
@@ -38,7 +40,7 @@ public interface TEExamService extends IService<TEExam> {
      * @param enable
      * @return
      */
-    public IPage<TEExamQueryDto> examQuery(IPage<Map> iPage, Long id, String code, String name, Integer mode, Integer enable);
+    public IPage<TEExam> examQuery(IPage<Map> iPage, Long id, String code, String name, Integer mode, Integer enable);
 
     /**
      * 获取考试待考列表
@@ -79,7 +81,7 @@ public interface TEExamService extends IService<TEExam> {
 	 * @param content
 	 * @return
 	 */
-	public Long studentPaperStruct(Long studentId, Long recordId,String content);
+	public StudentPaperStructBean studentPaperStruct(Long studentId, Long recordId,String content);
 	
 	/**提交作答结果
 	 * @param studentId
@@ -92,7 +94,7 @@ public interface TEExamService extends IService<TEExam> {
 	 * @param durationSeconds
 	 * @return
 	 */
-	public Long answerSubmit(Long studentId, Long recordId, Integer mainNumber, Integer subNumber, Integer subIndex,
+	public AnswerSubmitBean answerSubmit(Long studentId, Long recordId, Integer mainNumber, Integer subNumber, Integer subIndex,
 			String answer, Long version, Integer durationSeconds);
 
 	/**更新音频剩余播放次数
@@ -102,7 +104,7 @@ public interface TEExamService extends IService<TEExam> {
 	 * @param count
 	 * @return
 	 */
-	public Integer audioLeftPlayCountSubmit(Long studentId, Long recordId, String key, Integer count);
+	public AudioLeftPlayCountSubmitBean audioLeftPlayCountSubmit(Long studentId, Long recordId, String key, Integer count);
 
 	
 	/**文件上传

+ 57 - 24
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -1,12 +1,49 @@
 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.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+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.extension.service.impl.ServiceImpl;
-import com.qmth.themis.business.bean.exam.*;
+import com.qmth.themis.business.bean.exam.AnswerSubmitBean;
+import com.qmth.themis.business.bean.exam.AudioLeftPlayCountSubmitBean;
+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.bean.exam.StudentPaperStructBean;
 import com.qmth.themis.business.cache.ExamActivityRecordCacheUtil;
 import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 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.dao.TEExamMapper;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
@@ -17,24 +54,15 @@ import com.qmth.themis.business.entity.TEExam;
 import com.qmth.themis.business.entity.TOeExamRecord;
 import com.qmth.themis.business.enums.ExamRecordStatusEnum;
 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.RedisUtil;
-import com.qmth.themis.business.util.ServletUtil;
 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: 考试批次 服务实现类
@@ -303,7 +331,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
      * 上传个人试卷结构
      */
     @Override
-    public Long studentPaperStruct(Long studentId, Long recordId, String content) {
+    public StudentPaperStructBean studentPaperStruct(Long studentId, Long recordId, String content) {
 
         // 校验当前登录用户和参数一致性
         if (ExamRecordCacheUtil.getId(recordId) == null) {
@@ -324,14 +352,16 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         struct.setTime(System.currentTimeMillis());
         // 更新考生试卷结构
         redisUtil.set(RedisKeyHelper.studentPaperStructKey(recordId), struct);
-        return struct.getTime();
+        StudentPaperStructBean ret=new StudentPaperStructBean();
+        ret.setUpdateTime(struct.getTime());
+        return ret;
     }
 
     /**
      * 提交作答结果
      */
     @Override
-    public Long answerSubmit(Long studentId, Long recordId, Integer mainNumber, Integer subNumber, Integer subIndex,
+    public AnswerSubmitBean answerSubmit(Long studentId, Long recordId, Integer mainNumber, Integer subNumber, Integer subIndex,
                              String answer, Long version, Integer durationSeconds) {
 
         // 校验当前登录用户和参数一致性
@@ -374,14 +404,16 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
                 RedisKeyHelper.examAnswerHashKey(mainNumber, subNumber, subIndex), answerCache);
         // 重置考试记录客观题得分
         ExamRecordCacheUtil.setObjectiveScore(recordId, null);
-        return version;
+        AnswerSubmitBean ret=new AnswerSubmitBean();
+        ret.setVersion(version);
+        return ret;
     }
 
     /**
      * 更新音频剩余播放次数
      */
     @Override
-    public Integer audioLeftPlayCountSubmit(Long studentId, Long recordId, String key, Integer count) {
+    public AudioLeftPlayCountSubmitBean audioLeftPlayCountSubmit(Long studentId, Long recordId, String key, Integer count) {
 
         // 校验当前登录用户和参数一致性
         if (ExamRecordCacheUtil.getId(recordId) == null) {
@@ -399,8 +431,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
 
         // 音频剩余播放次数缓存
         redisUtil.set(RedisKeyHelper.audioLeftPlayCountKey(recordId), key, count);
-
-        return count;
+        AudioLeftPlayCountSubmitBean ret=new AudioLeftPlayCountSubmitBean();
+        ret.setCount(count);
+        return ret;
     }
 
     /**

+ 2 - 1
themis-exam/src/main/java/com/qmth/themis/exam/api/TEExamController.java

@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.qmth.themis.business.bean.exam.AnswerSubmitBean;
 import com.qmth.themis.business.bean.exam.AnswerSubmitParamBean;
 import com.qmth.themis.business.bean.exam.AudioLeftPlayCountSubmitParamBean;
 import com.qmth.themis.business.bean.exam.ExamStartParamBean;
@@ -183,7 +184,7 @@ public class TEExamController {
 			if (param.getVersion() == null) {
 				throw new BusinessException("时间戳不能为空");
 			}
-			Long ret = teExamService.answerSubmit(teStudent.getId(), param.getRecordId(), param.getMainNumber(),
+			AnswerSubmitBean ret = teExamService.answerSubmit(teStudent.getId(), param.getRecordId(), param.getMainNumber(),
 					param.getSubNumber(), param.getSubIndex(), param.getAnswer(), param.getVersion(),
 					param.getDurationSeconds());
 			// 发消息计算客观分