Prechádzať zdrojové kódy

Merge branch 'dev' of http://git.qmth.com.cn/themis/backend-service.git into dev

xiatian 4 rokov pred
rodič
commit
8ad8a792c4

+ 16 - 5
themis-exam/src/main/java/com/qmth/themis/exam/api/TEStudentController.java

@@ -5,6 +5,8 @@ import com.google.gson.Gson;
 import com.qmth.themis.business.annotation.ApiJsonObject;
 import com.qmth.themis.business.annotation.ApiJsonProperty;
 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.constant.SystemConstant;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
@@ -176,16 +178,25 @@ public class TEStudentController {
         //测试
         String test = SignatureInfo.build(SignatureType.TOKEN, sessionId, token);
         Map<String, Object> map = new HashMap<>();
-        //获取未完/待考列表
-        Map unFinishExam = tOeExamRecordService.getUnFinishExam(teStudent.getId(), examId, orgId);
-        if (Objects.isNull(unFinishExam)) {
+        //获取未完考试
+        if(Objects.isNull(teStudentCacheDto.getUnFinishedRecordId())){
+            //获取待考列表
             List<TEExamDto> list = teExamService.getWaitingExam(teStudent.getId(), examId, orgId);
             if (Objects.nonNull(list) && list.size() > 0) {
                 map.put("waiting", list);
             }
-        } else {
-            map.put("unFinished", unFinishExam);
+        }else{
+            //获取考试记录缓存
+            Map<String,Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(teStudentCacheDto.getUnFinishedRecordId()));
+            //获取考试缓存
+            ExamCacheBean ec = teExamService.getExamCacheBean(Long.parseLong(String.valueOf(objectMap.get("examId"))));
+            Map finalMap = new HashMap();
+            finalMap.put("waiting", ec);
+            finalMap.put("activity",objectMap);
+            map.put("unFinished", finalMap);
         }
+//        Map unFinishExam = tOeExamRecordService.getUnFinishExam(teStudent.getId(), examId, orgId);
+//        map.put("unFinished", unFinishExam);
         //获取全局考试配置
         TEConfig teConfig = teConfigService.getGlobalConfig();
 //        map.put(SystemConstant.ACCESS_TOKEN, token);