From 254c2a69441dbd9ee9bcb1d134a05eb9da407d17 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 10 七月 2024 14:03:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java |   55 +++++++++++++++++++++++++++++++++----------------------
 1 files changed, 33 insertions(+), 22 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 03ff2fa..98b9c3a 100644
--- a/src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java
+++ b/src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java
@@ -116,9 +116,8 @@
         entity.setStatus(ExamStatusEnum.getStatusByTime(form.getStartTime(), form.getEndTime(), null));
         // 濡傛灉淇敼鎴愬姛鍙戦�乵q娑堟伅
         if (baseMapper.updateById(entity) > 0) {
-            this.sendMQ(entity, entity.getUpdateVersion() + 1);
+            this.sendMQ(entity, entity.getUpdateVersion());
         }
-
         return Result.ok("淇敼鎴愬姛");
     }
 
@@ -250,6 +249,10 @@
                 .eq(ExamSubmitTemp::getUserId, webContext.getCurrentUser().getId())
                 .one();
         if (Objects.nonNull(hasJoin)) {
+            //TODO锛氬紑鍙戠幆澧冨厛鍏抽棴
+//            if(ExamSubmitTempStatusEnum.finish.equals(hasJoin.getStatus())){
+//                throw new RuntimeException("鎮ㄥ凡鎻愪氦璇曞嵎锛岃鍕块噸澶嶄綔绛�");
+//            }
             StartExamVO startExamVO = new StartExamVO();
             startExamVO.setExamName(exam.getExamName());
             startExamVO.setId(hasJoin.getExamId());
@@ -374,6 +377,24 @@
                 doQuestionVO.setQuestionType(item.getQuestionType());
                 //澧炲姞棰樼洰鍒嗘暟
                 doQuestionVO.setQuestionScore(question.getScore());
+
+                // 棰樼洰鍓湰
+                QuestionAnswerCopyVO copy = new QuestionAnswerCopyVO();
+                copy.setId(question.getId());
+                copy.setAnalyze(question.getAnalyze());
+                copy.setDifficult(question.getDifficult());
+                //濉┖鐨勭瓟妗堝湪Json閲�
+                if (QuestionTypeEnum.GapFilling.getCode().equals(item.getQuestionType())) {
+                    List<String> gapAnswer = new ArrayList<>();
+                    for (QuestionItemObject questionItemObject : question.getItems()) {
+                        gapAnswer.add(questionItemObject.getContent());
+                    }
+                    copy.setCorrect(String.join(ANSWER_SPLIT, gapAnswer));
+                } else {
+                    copy.setCorrect(question.getCorrect());
+                }
+                questionAnswerCopyVOList.add(copy);
+
                 // 濉┖棰橀渶瑕佹姽闄ontent(鍥犱负鏄瓟妗�)
                 if (QuestionTypeEnum.GapFilling.getCode().equals(doQuestionVO.getQuestionType())) {
                     question.getItems().stream().forEach(option -> {
@@ -384,24 +405,6 @@
                 doQuestionVO.setId(question.getId());
                 doQuestionVO.setOriginalFile(question.getOriginalFile());
                 doQuestionVO.setAudioFile(question.getAudioFile());
-
-                // 棰樼洰鍓湰
-                QuestionAnswerCopyVO copy = new QuestionAnswerCopyVO();
-                copy.setId(question.getId());
-                copy.setAnalyze(question.getAnalyze());
-                copy.setDifficult(question.getDifficult());
-                //濉┖鐨勭瓟妗堝湪Json閲�
-                if (QuestionTypeEnum.GapFilling.getCode().equals(item.getQuestionType())) {
-                    List<String> gapAnswer = new ArrayList<>();
-                    for (QuestionItemObject questionItemObject : doQuestionVO.getQuestionItemList()) {
-                        gapAnswer.add(questionItemObject.getContent());
-                    }
-                    copy.setCorrect(String.join(ANSWER_SPLIT, gapAnswer));
-                } else {
-                    copy.setCorrect(question.getCorrect());
-                }
-                questionAnswerCopyVOList.add(copy);
-
                 return doQuestionVO;
             }).collect(Collectors.toList());
             if (ExamPaperTypeEnum.RandomOrder.getCode().equals(examPaper.getPaperType())) {
@@ -882,8 +885,13 @@
 
     @Override
     public Result addTime(AddTimeForm form) {
+        if (! websocketServer.checkUserOnline(form.getUserId())) {
+            throw new RuntimeException("璇ュ鍛樹笉鍦ㄧ嚎锛屾棤娉曟墽琛岃鎿嶄綔");
+        }
         WebsocketDataVO websocket = new WebsocketDataVO();
-        websocket.setCommend(WebsocketCommendEnum.DELAYED.getCommend());
+        websocket.setCommend(WebsocketCommendEnum.DELAYED.getCommand());
+        BigDecimal sed = BigDecimal.valueOf(60).multiply(form.getAddTimeM());
+        form.setAddTimeM(sed);
         websocket.setData(form);
         // 鍙戦�亀ebsocket娑堟伅
         websocketServer.sendOneMessage(form.getUserId(), JSON.toJSONString(form));
@@ -892,8 +900,11 @@
 
     @Override
     public Result forceSubmit(ForceSubmitForm form) {
+        if (! websocketServer.checkUserOnline(form.getUserId())) {
+            throw new RuntimeException("璇ュ鍛樹笉鍦ㄧ嚎锛屾棤娉曟墽琛岃鎿嶄綔");
+        }
         WebsocketDataVO websocket = new WebsocketDataVO();
-        websocket.setCommend(WebsocketCommendEnum.FORCE_SUBMIT.getCommend());
+        websocket.setCommend(WebsocketCommendEnum.FORCE_SUBMIT.getCommand());
         websocket.setData(form);
         // 鍙戦�亀ebsocket娑堟伅
         websocketServer.sendOneMessage(form.getUserId(), JSON.toJSONString(form));

--
Gitblit v1.8.0