Browse Source

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

wangliang 4 năm trước cách đây
mục cha
commit
4aa8097988

+ 1 - 5
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -145,11 +145,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
     @Transactional
     @Override
     public ExamPrepareBean prepare(Long studentId, Long examStudentId) {
-        ExamStudentCacheBean es = null;
-        es = (ExamStudentCacheBean) redisUtil.get(RedisKeyHelper.examStudentCacheKey(examStudentId));
-        if (es == null) {
-            es = teExamStudentService.getExamStudnetCacheBean(examStudentId);
-        }
+        ExamStudentCacheBean es = teExamStudentService.getExamStudnetCacheBean(examStudentId);
         if (es == null) {
             throw new BusinessException("未找到考生");
         }

+ 3 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamStudentServiceImpl.java

@@ -5,6 +5,8 @@ import java.util.Map;
 import javax.annotation.Resource;
 
 import com.qmth.themis.business.dto.response.TEExamStudentDto;
+
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -46,6 +48,7 @@ public class TEExamStudentServiceImpl extends ServiceImpl<TEExamStudentMapper, T
         return teExamStudentMapper.examStudentQuery(iPage, examId, activityId, identity, name, roomCode, courseCode, grade, enable);
     }
     
+    @Cacheable(value = "exam_student", key = "#examStudentId", unless = "#result == null")
     @Override
     public ExamStudentCacheBean getExamStudnetCacheBean(Long examStudentId) {
     	ExamStudentCacheBean ret=null;

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -23,6 +23,7 @@ import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 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.ObjectiveAnswerCacheBean;
 import com.qmth.themis.business.config.SystemConfig;
@@ -30,6 +31,7 @@ import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dao.TOeExamRecordMapper;
 import com.qmth.themis.business.dto.response.TEExamUnFinishDto;
+import com.qmth.themis.business.entity.TEExamStudent;
 import com.qmth.themis.business.entity.TOeExamAnswer;
 import com.qmth.themis.business.entity.TOeExamRecord;
 import com.qmth.themis.business.enums.ExamRecordStatusEnum;
@@ -37,6 +39,7 @@ import com.qmth.themis.business.enums.ObjectiveScorePolicyEnum;
 import com.qmth.themis.business.enums.VerifyExceptionEnum;
 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.TOeExamAnswerService;
 import com.qmth.themis.business.service.TOeExamRecordService;
 import com.qmth.themis.business.util.OssUtil;
@@ -77,6 +80,9 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
     
     @Resource
     TOeExamAnswerService examAnswerService;
+    
+    @Resource
+    TEExamStudentService examStudentService;
 
     /**
      * 获取考试未完列表
@@ -316,6 +322,11 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
         		answer.setExamRecordId(recordId);
         		examAnswerService.saveOrUpdate(answer);
         	}
+        	//更新考生信息
+        	ExamStudentCacheBean examStudentCache = examStudentService.getExamStudnetCacheBean(er.getExamStudentId());
+        	TEExamStudent examStudent=new TEExamStudent();
+    		BeanUtils.copyProperties(examStudentCache, examStudent);
+    		examStudentService.saveOrUpdate(examStudent);
         	//上传个人试卷结构
             ExamStudentPaperStructCacheBean struct=(ExamStudentPaperStructCacheBean)redisUtil.get(RedisKeyHelper.studentPaperStructKey(recordId));
             File structFile = new File(dir+"struct.json");