11dda318d00aea0ca51133d3dd397ee8a3cfaa1e..44aaa355ecf9430f8b182654d03c2914287bcba6
2024-06-26 xiangpei
Merge remote-tracking branch 'origin/dev' into dev
44aaa3 对比 | 目录
2024-06-26 xiangpei
随机试卷开始考试也是基于小标题
2314da 对比 | 目录
1个文件已修改
19 ■■■■■ 已修改文件
src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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();