From beade68fb37125ae7de4becb3802b7f359755f09 Mon Sep 17 00:00:00 2001 From: qirong <2032486488@qq.com> Date: 星期三, 28 二月 2024 10:07:40 +0800 Subject: [PATCH] 修改 --- src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java | 13 ++++++++----- 1 files changed, 8 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..9d80ead 100644 --- a/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java +++ b/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java @@ -128,6 +128,7 @@ examPaper.setCreateTime(now); examPaper.setCreateUser(user.getId()); examPaper.setDeleted(false); + examPaper.setUserIds(examPaperEditRequestVM.getMenuIds()); examPaperFromVM(examPaperEditRequestVM, examPaper, titleItemsVM); examPaperMapper.insertSelective(examPaper); @@ -154,6 +155,7 @@ ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(id); ExamPaperEditRequestVM vm = modelMapper.map(examPaper, ExamPaperEditRequestVM.class); vm.setLevel(examPaper.getGradeLevel()); + vm.setMenuIds(examPaper.getUserIds()); TextContent frameTextContent = textContentService.selectById(examPaper.getFrameTextContentId()); List<ExamPaperTitleItemObject> examPaperTitleItemObjects = JsonUtil.toJsonListObject(frameTextContent.getContent(), ExamPaperTitleItemObject.class); List<Integer> questionIds = examPaperTitleItemObjects.stream() @@ -372,7 +374,6 @@ keys.remove(index); } } - if (!values.isEmpty()) { int index = random.nextInt(values.size()); int score = values.get(index); @@ -481,6 +482,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 +525,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