From 5dc1025f4f67a8750b8dd802f8def1fa2dfa116a Mon Sep 17 00:00:00 2001 From: 17808 <1780814303@qq.com> Date: 星期二, 07 十一月 2023 17:43:48 +0800 Subject: [PATCH] 成绩统计后端 --- src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java b/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java index a16fe1a..15957bc 100644 --- a/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java +++ b/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java @@ -372,7 +372,6 @@ keys.remove(index); } } - if (!values.isEmpty()) { int index = random.nextInt(values.size()); int score = values.get(index); @@ -481,6 +480,8 @@ * @param titleItemsVM title */ private void randomQuestionType(ExamPaperEditRequestVM examPaperEditRequestVM, List<ExamPaperTitleItemObject> frameTextContentList, List<ExamPaperTitleItemVM> titleItemsVM) throws QuestionException { + + //鍗曢�� Integer singleChoice = examPaperEditRequestVM.getQuestionTypeVMS().stream().mapToInt(QuestionTypeVM::getSingleChoice).sum(); //澶氶�� @@ -522,10 +523,10 @@ //鍒ゆ柇 - Map<Integer, Integer> judgmentMap = list.stream() - .filter(e -> e.getQuestionType().equals(QuestionTypeEnum.TrueFalse.getCode())) - .collect(Collectors.toMap(Question::getId, Question::getScore)); - Integer trueFalse = questionTypeVM.getTrueFalse() * 2; + List<Question> collect1 = list.stream().filter(e -> e.getQuestionType().equals(QuestionTypeEnum.TrueFalse.getCode())).collect(Collectors.toList()); + Map<Integer, Integer> judgmentMap = collect1.stream().collect(Collectors.toMap(Question::getId, Question::getScore)); + Integer trueFalse1 = questionTypeVM.getTrueFalse(); + Integer trueFalse = trueFalse1 * 2; selectRandomScores(multiple, judgmentMap, questionTypeVM.getTrueFalse(), trueFalse); //鍗曢�夊垎鏁� -- Gitblit v1.8.0