From d0ebd33f5e4fdbff1f58a1af137d45b405366399 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 28 六月 2024 16:00:03 +0800
Subject: [PATCH] rabbitmq

---
 src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java |   39 ++++++++++++++++++++++++++++++---------
 1 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java b/src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java
index 34768a8..ce84882 100644
--- a/src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java
+++ b/src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java
@@ -19,6 +19,7 @@
 import com.ycl.jxkg.domain.question.QuestionObject;
 import com.ycl.jxkg.domain.vo.*;
 import com.ycl.jxkg.enums.ExamPaperTypeEnum;
+import com.ycl.jxkg.enums.QuestionTypeEnum;
 import com.ycl.jxkg.enums.WebsocketCommendEnum;
 import com.ycl.jxkg.enums.general.ExamStatusEnum;
 import com.ycl.jxkg.enums.general.ExamSubmitTempStatusEnum;
@@ -165,6 +166,20 @@
         if (Objects.isNull(examPaper)) {
             throw new RuntimeException("璇曞嵎涓嶅瓨鍦�");
         }
+        // 濡傛灉宸茬粡鍙傚姞杩囪�冭瘯锛岀洿鎺ヨ繑鍥炴暟鎹�
+        ExamSubmitTemp hasJoin = new LambdaQueryChainWrapper<>(examSubmitTempMapper)
+                .eq(ExamSubmitTemp::getExamId, id)
+                .eq(ExamSubmitTemp::getUserId, webContext.getCurrentUser().getId())
+                .one();
+        if (Objects.nonNull(hasJoin)) {
+            StartExamVO startExamVO = new StartExamVO();
+            startExamVO.setExamName(exam.getExamName());
+            startExamVO.setId(hasJoin.getExamId());
+            startExamVO.setTitleList(JSON.parseArray(hasJoin.getExamSubmit(), PaperFixQuestionVO.class));
+            startExamVO.setSuggestTime(examPaper.getSuggestTime());
+            startExamVO.setDoTime(hasJoin.getDoTime());
+            return Result.ok(startExamVO);
+        }
         // 灏嗛鐩浆鎹负鍙复鏃朵繚瀛樼殑棰樼洰缁撴瀯銆傚浐瀹氳瘯鍗峰拰闅忓簭璇曞嵎鐨勯鐩槸鐩存帴淇濆瓨鍒癱ontent瀛楁鐨�
         if (ExamPaperTypeEnum.Fixed.getCode().equals(examPaper.getPaperType())
                 || ExamPaperTypeEnum.RandomOrder.getCode().equals(examPaper.getPaperType())) {
@@ -246,6 +261,12 @@
                 DoQuestionVO doQuestionVO = new DoQuestionVO();
                 doQuestionVO.setTitle(question.getTitle());
                 doQuestionVO.setQuestionType(item.getQuestionType());
+                // 濉┖棰橀渶瑕佹姽闄ontent(鍥犱负鏄瓟妗�)
+                if (QuestionTypeEnum.GapFilling.getCode().equals(doQuestionVO.getQuestionType())) {
+                    question.getItems().stream().forEach(option -> {
+                        option.setContent("");
+                    });
+                }
                 doQuestionVO.setQuestionItemList(question.getItems());
                 doQuestionVO.setId(question.getId());
                 doQuestionVO.setOriginalFile(question.getOriginalFile());
@@ -295,9 +316,9 @@
      * @return
      */
     @Override
-    public Result examSubmit(ExamSubmitVO submitData) {
+    public Result examSubmit(StartExamVO submitData) {
         // 鏍¢獙
-        Exam exam = examMapper.selectById(submitData.getExamId());
+        Exam exam = examMapper.selectById(submitData.getId());
         if (Objects.isNull(exam)) {
             throw new RuntimeException("璇ヨ�冭瘯涓嶅瓨鍦�");
         }
@@ -340,7 +361,7 @@
      * @return
      */
     @Override
-    public Result timingSubmit(ExamSubmitVO submitData) {
+    public Result timingSubmit(StartExamVO submitData) {
         saveTempExam(submitData, ExamSubmitTempStatusEnum.TEMP);
         return Result.ok();
     }
@@ -351,9 +372,9 @@
      * @param submitData  鍓嶇浼犻�掔殑璇曞嵎鏁版嵁
      * @param status  璇曞嵎鐨勭姸鎬�
      */
-    public void saveTempExam(ExamSubmitVO submitData, ExamSubmitTempStatusEnum status) {
+    public void saveTempExam(StartExamVO submitData, ExamSubmitTempStatusEnum status) {
         ExamSubmitTemp one = new LambdaQueryChainWrapper<>(examSubmitTempMapper)
-                .eq(ExamSubmitTemp::getExamId, submitData.getExamId())
+                .eq(ExamSubmitTemp::getExamId, submitData.getId())
                 .eq(ExamSubmitTemp::getUserId, webContext.getCurrentUser().getId())
                 .one();
         if (Objects.nonNull(one)) {
@@ -361,17 +382,17 @@
                 return;
             }
             one.setDoTime(submitData.getDoTime());
-            one.setExamSubmit(JSON.toJSONString(submitData.getPaperQuestionList()));
+            one.setExamSubmit(JSON.toJSONString(submitData.getTitleList()));
             one.setCreateTime(new Date());
             one.setStatus(status);
             examSubmitTempMapper.updateById(one);
         } else {
             ExamSubmitTemp examSubmitTemp = new ExamSubmitTemp();
-            examSubmitTemp.setExamId(submitData.getExamId());
+            examSubmitTemp.setExamId(submitData.getId());
             examSubmitTemp.setDoTime(submitData.getDoTime());
             examSubmitTemp.setStatus(status);
             examSubmitTemp.setUserId(webContext.getCurrentUser().getId());
-            examSubmitTemp.setExamSubmit(JSON.toJSONString(submitData.getPaperQuestionList()));
+            examSubmitTemp.setExamSubmit(JSON.toJSONString(submitData.getTitleList()));
             examSubmitTemp.setMarkPaperStatus(ExamSubmitTempStatusEnum.TEMP);
             examSubmitTempMapper.insert(examSubmitTemp);
         }
@@ -441,7 +462,7 @@
     @Override
     public Result monitorList(ExamQuery query) {
         IPage<ExamSubmitTempVO> page = PageUtil.getPage(query, ExamSubmitTempVO.class);
-        return Result.ok().data(examSubmitTempMapper.monitorList(page, query));
+        return Result.ok((examSubmitTempMapper.monitorList(page, query)));
     }
 
     @Override

--
Gitblit v1.8.0