From 2314da06436cd5c5b15c9a5fdf2a1634a90f04f5 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期三, 26 六月 2024 11:55:51 +0800 Subject: [PATCH] 随机试卷开始考试也是基于小标题 --- src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java | 19 ++++++++----------- 1 files changed, 8 insertions(+), 11 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 fe41ab9..04194a2 100644 --- a/src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java +++ b/src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java @@ -165,7 +165,6 @@ } // 杞崲 List<PaperFixQuestionVO> data = this.coverTo(examPaper); - return Result.ok().data(data); } else if (ExamPaperTypeEnum.Random.getCode().equals(examPaper.getPaperType())) { // 鏍规嵁闅忔満璇曞嵎鐨勯厤缃紝闅忔満鐢熸垚瀵瑰簲棰樼洰 @@ -173,8 +172,13 @@ throw new RuntimeException("璇曞嵎閰嶇疆寮傚父锛岃鑱旂郴鑰佸笀"); } List<PaperQuestionSettingDTO> paperSettingList = JSON.parseArray(examPaper.getContent(), PaperQuestionSettingDTO.class); - List<DoQuestionVO> questionList = new ArrayList<>(24); + + // 璇曞嵎鍐呭 + List<PaperFixQuestionVO> examData = new ArrayList<>(8); for (PaperQuestionSettingDTO paperSetting : paperSettingList) { + PaperFixQuestionVO paperFixQuestionVO = new PaperFixQuestionVO(); + paperFixQuestionVO.setTitle(paperSetting.getTitle()); + paperFixQuestionVO.setQuestionType(paperSetting.getQuestionType()); // 鎷垮埌璇剧洰涓嬫煇绫婚鍨嬬殑x閬撻殢鏈洪 List<Question> questions = questionMapper.getRandomQuestion(examPaper.getSubjectId(), paperSetting.getQuestionType(), paperSetting.getNum()); if (paperSetting.getNum() > questions.size()) { @@ -194,16 +198,9 @@ doQuestionVO.setAudioFile(item.getAudioFile()); return doQuestionVO; }).collect(Collectors.toList()); - questionList.addAll(childQuestions); - + paperFixQuestionVO.setQuestionList(childQuestions); + examData.add(paperFixQuestionVO); } - // 淇濇寔闅忔満璇曞嵎鍜屽浐瀹氳瘯鍗风殑鏍煎紡涓�鑷� - List<PaperFixQuestionVO> examData = new ArrayList<>(1); - PaperFixQuestionVO paperFixQuestionVO = new PaperFixQuestionVO(); - paperFixQuestionVO.setQuestionList(questionList); - paperFixQuestionVO.setTitle(""); - paperFixQuestionVO.setQuestionType(null); - examData.add(paperFixQuestionVO); return Result.ok(examData); } return Result.ok(); -- Gitblit v1.8.0