From fc7baea99b51916d97d77fa1771cba7ed5f2f0ed Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期二, 09 七月 2024 10:44:30 +0800
Subject: [PATCH] feat:排除标签保留无标签、试卷排序
---
src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java | 9 ++++++++-
1 files changed, 8 insertions(+), 1 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 88c8287..7049976 100644
--- a/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java
+++ b/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java
@@ -121,6 +121,7 @@
String frameTextContentStr = JsonUtil.toJsonStr(frameTextContentList);
ExamPaper examPaper;
+ Integer[] userIds = examPaperEditRequestVM.getUserIds();
if (actionEnum == ActionEnum.ADD) {
examPaper = modelMapper.map(examPaperEditRequestVM, ExamPaper.class);
TextContent frameTextContent = new TextContent(frameTextContentStr, now);
@@ -138,7 +139,10 @@
TextContent frameTextContent = textContentService.selectById(examPaper.getFrameTextContentId());
frameTextContent.setContent(frameTextContentStr);
textContentService.updateByIdFilter(frameTextContent);
+ examPaperEditRequestVM.setScore(null);
+ examPaperEditRequestVM.setUserIds(null);
modelMapper.map(examPaperEditRequestVM, examPaper);
+ examPaperEditRequestVM.setUserIds(userIds);
examPaperFromVM(examPaperEditRequestVM, examPaper, titleItemsVM);
examPaperMapper.updateByPrimaryKeySelective(examPaper);
//鎵归噺淇敼
@@ -167,6 +171,7 @@
throw new RuntimeException("璇ヨ瘯鍗锋病鏈夐鐩�");
}
List<Question> questions = questionMapper.selectByIds(questionIds);
+
//鍗曢�夋暟閲�
Integer singleChoice = questions.stream().filter(e -> e.getQuestionType() == 1).collect(Collectors.toList()).size();
//澶氶�夋暟閲�
@@ -182,6 +187,7 @@
List<ExamQuestionVO> questionItemsVM = t.getQuestionItems().stream().map(i -> {
Question question = questions.stream().filter(q -> q.getId().equals(i.getId())).findFirst().get();
ExamQuestionVO questionEditRequestVM = questionService.getQuestionEditRequestVM(question);
+
questionEditRequestVM.setTitle("(" + QuestionTypeEnum.fromCode(questionEditRequestVM.getQuestionType()).getName() + ") " + questionEditRequestVM.getTitle());
questionEditRequestVM.setItemOrder(generateRandomNumber(questionEditRequestVM.getQuestionType() == 1 ? 0 : ((questionEditRequestVM.getQuestionType() == 2 ? singleChoice : multipleChoice + singleChoice)),
questionEditRequestVM.getQuestionType() == 1 ? singleChoice : ((questionEditRequestVM.getQuestionType() == 2 ? multipleChoice + singleChoice : trueFalse + multipleChoice + singleChoice)),
@@ -523,9 +529,10 @@
Integer order = 0;
for (QuestionTypeVM questionTypeVM : questionTypeVMList) {
- List<Integer> questions = questionSubjectService.getSubject(questionTypeVM.getSubjectId())
+ List<Integer> questions = questionSubjectService.getSubjectBySubjectIds(examPaperEditRequestVM.getSubjectId())
.stream().map(QuestionSubject::getQuestionId).collect(Collectors.toList());
List<Question> list = questionService.selectByIds(questions);
+ // List<Question> list = questionService.getAll();
Map<Integer, Integer> multiple = new HashMap<>();
//澶氶��
--
Gitblit v1.8.0