浏览代码

字段修改

wangliang 4 年之前
父节点
当前提交
1a5bd80e96

+ 3 - 3
themis-business/src/main/java/com/qmth/themis/business/dto/request/TEExamDto.java

@@ -159,7 +159,7 @@ public class TEExamDto extends BaseEntity {
 
     @ApiModelProperty(value = "开启监控的视频源")
     @TableField(value = "monitor_video_source")
-    private String monitorVideoSource;
+    private List<String> monitorVideoSource;
 
     @ApiModelProperty(value = "是否开始监控转录,0:开启,1:不开启")
     @TableField(value = "monitor_record")
@@ -449,11 +449,11 @@ public class TEExamDto extends BaseEntity {
         this.objectiveScorePolicy = objectiveScorePolicy;
     }
 
-    public String getMonitorVideoSource() {
+    public List<String> getMonitorVideoSource() {
         return monitorVideoSource;
     }
 
-    public void setMonitorVideoSource(String monitorVideoSource) {
+    public void setMonitorVideoSource(List<String> monitorVideoSource) {
         this.monitorVideoSource = monitorVideoSource;
     }
 

+ 1 - 1
themis-business/src/main/java/com/qmth/themis/business/entity/TEExam.java

@@ -213,7 +213,7 @@ public class TEExam extends BaseEntity {
         this.ipAllow = teExamDto.getIpAllow();
         this.scoreStatus = teExamDto.getScoreStatus();
         this.objectiveScorePolicy = teExamDto.getObjectiveScorePolicy();
-        this.monitorVideoSource = teExamDto.getMonitorVideoSource();
+        this.monitorVideoSource = teExamDto.getMonitorVideoSource().toString().replace("[", "").replace("]", "");
         this.monitorRecord = teExamDto.getMonitorRecord();
         this.progress = teExamDto.getProgress();
     }

+ 36 - 65
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -1,49 +1,12 @@
 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.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.bean.exam.*;
 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.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.cache.bean.*;
 import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.dao.TEExamMapper;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
@@ -55,15 +18,23 @@ import com.qmth.themis.business.entity.TOeExamRecord;
 import com.qmth.themis.business.enums.ExamRecordStatusEnum;
 import com.qmth.themis.business.enums.FinishExamResultEnum;
 import com.qmth.themis.business.enums.FinishTypeEnum;
-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.service.*;
 import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.RedisUtil;
 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: 考试批次 服务实现类
@@ -143,7 +114,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
                         v.setInProcessLivenessFixedRange(inProcessLivenessFixedRange);
                     }
                     if (Objects.nonNull(v.getMonitorVideoSourceStr())) {
-                        v.setMonitorVideoSource(Arrays.asList(v.getMonitorVideoSourceStr()));
+                        v.setMonitorVideoSource(Arrays.asList(v.getMonitorVideoSourceStr().split(",")));
                     }
                 });
                 s.setActivities(teExamActivityList);
@@ -249,8 +220,8 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         prepare.setPaperUrl(paperurl);
         prepare.setStructUrl(structurl);
 
-        ExamCacheBean exam=getExamCacheBean(es.getExamId());
-        Integer breakResumeCount=exam.getBreakResumeCount();
+        ExamCacheBean exam = getExamCacheBean(es.getExamId());
+        Integer breakResumeCount = exam.getBreakResumeCount();
         // 更新考生缓存
         redisUtil.set(RedisKeyHelper.examStudentCacheKey(examStudentId), es);
         //更新场次-考试记录缓存
@@ -356,7 +327,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         struct.setTime(System.currentTimeMillis());
         // 更新考生试卷结构
         redisUtil.set(RedisKeyHelper.studentPaperStructKey(recordId), struct);
-        StudentPaperStructBean ret=new StudentPaperStructBean();
+        StudentPaperStructBean ret = new StudentPaperStructBean();
         ret.setUpdateTime(struct.getTime());
         return ret;
     }
@@ -366,7 +337,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
      */
     @Override
     public AnswerSubmitBean answerSubmit(Long studentId, Long recordId, Integer mainNumber, Integer subNumber, Integer subIndex,
-                             String answer, Long version, Integer durationSeconds) {
+                                         String answer, Long version, Integer durationSeconds) {
 
         // 校验当前登录用户和参数一致性
         if (ExamRecordCacheUtil.getId(recordId) == null) {
@@ -395,9 +366,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
             answerCache.setDurationSeconds(durationSeconds);
         } else {
             if (version.longValue() > answerCache.getVersion().longValue()) {
-	            answerCache.setAnswer(answer);
-	            answerCache.setVersion(version);
-	            answerCache.setDurationSeconds(durationSeconds);
+                answerCache.setAnswer(answer);
+                answerCache.setVersion(version);
+                answerCache.setDurationSeconds(durationSeconds);
             }
         }
         // 每次提交,清空得分
@@ -407,7 +378,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
                 RedisKeyHelper.examAnswerHashKey(mainNumber, subNumber, subIndex), answerCache);
         // 重置考试记录客观题得分
         ExamRecordCacheUtil.setObjectiveScore(recordId, null);
-        AnswerSubmitBean ret=new AnswerSubmitBean();
+        AnswerSubmitBean ret = new AnswerSubmitBean();
         ret.setVersion(version);
         return ret;
     }
@@ -434,7 +405,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
 
         // 音频剩余播放次数缓存
         redisUtil.set(RedisKeyHelper.audioLeftPlayCountKey(recordId), key, count);
-        AudioLeftPlayCountSubmitBean ret=new AudioLeftPlayCountSubmitBean();
+        AudioLeftPlayCountSubmitBean ret = new AudioLeftPlayCountSubmitBean();
         ret.setCount(count);
         return ret;
     }
@@ -459,7 +430,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
             throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
         }
 
-        String filePath = "upload/" + sdf.format(new Date()) + "/" + uuid() + "."+suffix;
+        String filePath = "upload/" + sdf.format(new Date()) + "/" + uuid() + "." + suffix;
         InputStream in = null;
         try {
             String fileMd5 = DigestUtils.md5Hex(file.getBytes());
@@ -608,16 +579,16 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         ExamFinishBean ret = new ExamFinishBean();
         ret.setFinishTime(now.getTime());
         ret.setObjectiveScore(ExamRecordCacheUtil.getObjectiveScore(recordId));
-        ExamCacheBean exam=getExamCacheBean(es.getExamId());
+        ExamCacheBean exam = getExamCacheBean(es.getExamId());
         //TODO
-        if(exam.getShowObjectiveScore()!=null&&exam.getShowObjectiveScore().intValue()==1) {//实时出分
-        	if(ret.getObjectiveScore()==null) {
-        		ret.setStatus(FinishExamResultEnum.SCORE_CALCULATE);
-        	}else {
-        		ret.setStatus(FinishExamResultEnum.SCORE_VIEW);
-        	}
-        }else {
-        	ret.setStatus(FinishExamResultEnum.NORMAL);
+        if (exam.getShowObjectiveScore() != null && exam.getShowObjectiveScore().intValue() == 1) {//实时出分
+            if (ret.getObjectiveScore() == null) {
+                ret.setStatus(FinishExamResultEnum.SCORE_CALCULATE);
+            } else {
+                ret.setStatus(FinishExamResultEnum.SCORE_VIEW);
+            }
+        } else {
+            ret.setStatus(FinishExamResultEnum.NORMAL);
         }
         // TODO
         ret.setReviewResult("");