From 182c1cde1f4507d12eb4b6b1a4ffd24a2be6c93b Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 10 七月 2024 11:48:40 +0800
Subject: [PATCH] 初始化缓存
---
src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java | 42 +++++++++++++++++++++++-------------------
1 files changed, 23 insertions(+), 19 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 cc6d54a..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,7 +116,7 @@
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("淇敼鎴愬姛");
}
@@ -249,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());
@@ -373,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 -> {
@@ -383,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())) {
--
Gitblit v1.8.0