From a5722617fcb4fec61551785e55d58a2be45dcc84 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 21 六月 2024 11:31:57 +0800
Subject: [PATCH] 问题优化
---
src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java | 374 ++++++++++++++++++++++++++++------------------------
1 files changed, 201 insertions(+), 173 deletions(-)
diff --git a/src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java b/src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java
index 5251e1e..928969f 100644
--- a/src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java
+++ b/src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java
@@ -1,20 +1,26 @@
package com.ycl.jxkg.service.impl;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
+import com.ycl.jxkg.base.Result;
+import com.ycl.jxkg.base.SystemCode;
import com.ycl.jxkg.context.WebContext;
import com.ycl.jxkg.domain.entity.ExamPaper;
-import com.ycl.jxkg.domain.entity.ExamTemplate;
-import com.ycl.jxkg.domain.entity.TextContent;
-import com.ycl.jxkg.domain.entity.User;
-import com.ycl.jxkg.domain.exam.ExamPaperQuestionItemObject;
-import com.ycl.jxkg.domain.exam.ExamPaperTempDTO;
-import com.ycl.jxkg.domain.exam.ExamPaperTitleItemObject;
+import com.ycl.jxkg.domain.entity.Question;
+import com.ycl.jxkg.domain.exam.PaperFixQuestionDTO;
+import com.ycl.jxkg.domain.exam.PaperQuestion;
+import com.ycl.jxkg.domain.exam.PaperQuestionSettingDTO;
import com.ycl.jxkg.domain.form.ExamPaperForm;
import com.ycl.jxkg.domain.other.KeyValue;
-import com.ycl.jxkg.domain.question.TemplateQuestionDTO;
+import com.ycl.jxkg.domain.question.QuestionItemObject;
+import com.ycl.jxkg.domain.question.QuestionObject;
+import com.ycl.jxkg.domain.question.RandomQuestionDTO;
import com.ycl.jxkg.domain.vo.admin.exam.ExamPaperEditRequestVO;
import com.ycl.jxkg.domain.vo.admin.exam.ExamPaperPageRequestVO;
import com.ycl.jxkg.domain.vo.admin.exam.ExamPaperTitleItemVO;
@@ -26,13 +32,11 @@
import com.ycl.jxkg.enums.QuestionTypeEnum;
import com.ycl.jxkg.enums.VisibilityEnum;
import com.ycl.jxkg.mapper.ExamPaperMapper;
-import com.ycl.jxkg.mapper.ExamTemplateMapper;
import com.ycl.jxkg.mapper.QuestionMapper;
import com.ycl.jxkg.service.ExamPaperService;
import com.ycl.jxkg.service.QuestionService;
import com.ycl.jxkg.service.SubjectService;
import com.ycl.jxkg.service.TextContentService;
-import com.ycl.jxkg.service.enums.ActionEnum;
import com.ycl.jxkg.utils.DateTimeUtil;
import com.ycl.jxkg.utils.JsonUtil;
import com.ycl.jxkg.utils.PageInfoHelper;
@@ -40,13 +44,10 @@
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.atomic.AtomicInteger;
+import java.util.*;
import java.util.stream.Collectors;
@Service
@@ -58,120 +59,163 @@
private final TextContentService textContentService;
private final QuestionService questionService;
private final SubjectService subjectService;
- private final ExamTemplateMapper examTemplateMapper;
private final WebContext webContext;
@Override
@Transactional(rollbackFor = Exception.class)
- public void addPaper(ExamPaperForm form) {
- ExamPaper examPaper = ExamPaperForm.getEntityByForm(form,null);
- baseMapper.insert(examPaper);
- if(ExamPaperTypeEnum.Random.getCode().equals(form.getPaperType())){
- ExamTemplate examTemplate = getExamTemplate(form, examPaper);
- examTemplateMapper.insert(examTemplate);
- baseMapper.updateById(examPaper);
- }
- //TODO:闅忓簭璇曞嵎鐢熸垚棰樼洰
+ public Result addPaper(ExamPaperForm form) {
+ ExamPaper examPaper = ExamPaperForm.getEntityByForm(form, null);
+ examPaper.setScore(new BigDecimal(form.getScore()));
+ //闅忔満璇曞嵎
+ if (ExamPaperTypeEnum.Random.getCode().equals(form.getPaperType())) {
+ //鏍¢獙棰樼洰鏁伴噺
+ List<PaperQuestionSettingDTO> questionSetting = form.getQuestionSetting();
+ //棰樼洰閰嶇疆閲岄厤鐨勮瘯鍗风被鍨�
+ List<Integer> types = questionSetting.stream().map(PaperQuestionSettingDTO::getQuestionType).collect(Collectors.toList());
+ Map<Integer, List<Integer>> map = questionMapper.selectBySubject(form.getSubjectId(), types)
+ .stream().collect(Collectors.groupingBy(RandomQuestionDTO::getQuestionType, Collectors.mapping(RandomQuestionDTO::getQuestionId, Collectors.toList())));
- }
-
- private ExamTemplate getExamTemplate(ExamPaperForm form, ExamPaper examPaper) {
- //闅忔満璇曞嵎瀛樻ā鏉�
- List<TemplateQuestionDTO> questionList = form.getQuestionList();
- BigDecimal score = BigDecimal.ZERO;
- Integer num=0;
- ExamTemplate examTemplate = new ExamTemplate();
- //璁剧疆棰樼洰淇℃伅
- for (TemplateQuestionDTO dto : questionList) {
- num += dto.getNum();
- score = score.add(dto.getScore().multiply(BigDecimal.valueOf(dto.getNum())));
- Integer questionType = dto.getQuestionType();
- //鏁寸悊List涓哄璞�
- switch (QuestionTypeEnum.fromCode(questionType)){
- //鍗曢��
- case SingleChoice:
- examTemplate.setSingleChoice(dto.getNum());
- examTemplate.setSingleScore(dto.getScore());
- break;
- //澶氶��
- case MultipleChoice:
- examTemplate.setMultipleChoice(dto.getNum());
- examTemplate.setMultipleScore(dto.getScore());
- break;
- //鍒ゆ柇
- case TrueFalse:
- examTemplate.setTrueFalse(dto.getNum());
- examTemplate.setTrueFalseScore(dto.getScore());
- break;
- //濉┖
- case GapFilling:
- examTemplate.setGapFilling(dto.getNum());
- examTemplate.setGapScore(dto.getScore());
- break;
- //绠�绛�
- case ShortAnswer:
- examTemplate.setShortAnswer(dto.getNum());
- examTemplate.setShortAnswerScore(dto.getScore());
- break;
+ for (PaperQuestionSettingDTO settingDTO : questionSetting) {
+ Integer num = settingDTO.getNum();
+ Integer questionType = settingDTO.getQuestionType();
+ //闇�瑕侀厤缃殑棰樼洰鏁伴噺涓�0鍒欒烦杩�
+ if(num ==null || num ==0 )continue;
+ List<Integer> questions = map.get(questionType);
+ if(CollectionUtils.isEmpty(questions) || num > questions.size())return Result.fail(SystemCode.InnerError.getCode(), QuestionTypeEnum.fromCode(questionType).getName()+"棰樼洰鏁伴噺涓嶈冻");
}
+ examPaper.setContent(JSON.toJSONString(form.getQuestionSetting()));
+ baseMapper.insert(examPaper);
+ return Result.ok();
+ } else if (ExamPaperTypeEnum.Fixed.getCode().equals(form.getPaperType())) {
+ //鍥哄畾璇曞嵎
+ examPaper.setContent(JSON.toJSONString(form.getQuestionTitleList()));
+ baseMapper.insert(examPaper);
+ return Result.ok();
+ } else {
+ //闅忓簭璇曞嵎
+ Integer subjectId = form.getSubjectId();
+ //棰樼洰閰嶇疆
+ List<PaperQuestionSettingDTO> questionSetting = form.getQuestionSetting();
+ //棰樼洰閰嶇疆閲岄厤鐨勮瘯鍗风被鍨�
+ List<Integer> types = questionSetting.stream().map(PaperQuestionSettingDTO::getQuestionType).collect(Collectors.toList());
+ if (CollectionUtils.isEmpty(types)) {
+ return Result.fail(SystemCode.InnerError.getCode(), "璇曞嵎棰樼洰绫诲瀷涓嶈兘涓虹┖");
+ }
+ Map<Integer, List<Integer>> map = questionMapper.selectBySubject(subjectId, types)
+ .stream().collect(Collectors.groupingBy(RandomQuestionDTO::getQuestionType, Collectors.mapping(RandomQuestionDTO::getQuestionId, Collectors.toList())));
+ List<PaperFixQuestionDTO> questionTitleList = new ArrayList<>();
+ // 閬嶅巻map
+ for (Integer questionType : map.keySet()) {
+ //鏁版嵁搴撻噷鐨勮繖涓被鍨嬬殑棰樼洰
+ List<Integer> questionIdList = map.get(questionType);
+ Result result = createQuestion(questionSetting, questionTitleList, questionType, questionIdList,QuestionTypeEnum.fromCode(questionType).getCode());
+ if (result != null) return result;
+ }
+ examPaper.setContent(JSON.toJSONString(questionTitleList));
+ baseMapper.insert(examPaper);
+ return Result.ok();
}
- examTemplate.setExamPaperId(examPaper.getId());
- //鍥炲~
- examPaper.setQuestionCount(num);
- examPaper.setScore(score);
- return examTemplate;
+ }
+ //鐢熸垚棰樼洰
+ private Result createQuestion(List<PaperQuestionSettingDTO> questionSetting, List<PaperFixQuestionDTO> questionTitleList, Integer questionType, List<Integer> questionIdList , Integer questionEnumCode) {
+ if (questionType.equals(questionEnumCode)) {
+ //寰幆鎵惧埌瀵瑰簲棰樼洰
+ PaperQuestionSettingDTO settingDTO = new PaperQuestionSettingDTO();
+ for (PaperQuestionSettingDTO dto : questionSetting) {
+ if (dto.getQuestionType().equals(questionType)) {
+ settingDTO = dto;
+ }
+ }// 闇�瑕佺敓鎴愮殑棰樼洰鏁伴噺
+ Integer num = settingDTO.getNum();
+ if(num ==null || num ==0 ){
+ //棰樼洰閰嶇疆姝ょ被鍨嬫暟閲忎负0锛岃烦杩囷紝涓嶇敓鎴愰鐩��
+ return null;
+ }
+ if (CollectionUtils.isEmpty(questionIdList) || num > questionIdList.size()) {
+ return Result.fail(SystemCode.InnerError.getCode(), QuestionTypeEnum.fromCode(questionType).getName()+"棰樼洰鏁伴噺涓嶈冻");
+ }
+
+ // 浣跨敤Random绫荤敓鎴愪笉閲嶅鐨勯殢鏈虹储寮�
+ Set<Integer> indexes = new HashSet<>();
+ Random random = new Random();
+ while (indexes.size() < num) {
+ int index = random.nextInt(questionIdList.size());
+ indexes.add(index);
+ }
+ // 鏍规嵁绱㈠紩鑾峰彇棰樼洰
+ List<Integer> questionIds = new ArrayList<>();
+ for (int index : indexes) {
+ questionIds.add(questionIdList.get(index));
+ }
+ QueryWrapper<Question> wrapper = new QueryWrapper<>();
+ wrapper.in("id",questionIds);
+ List<Question> questions = questionMapper.selectList(wrapper);
+ List<PaperQuestion> questionList = new ArrayList<>();
+ for (Question question : questions) {
+ PaperQuestion paperQuestion = new PaperQuestion();
+ BeanUtils.copyProperties(question,paperQuestion);
+ paperQuestion.setScore(settingDTO.getScore());
+ //杞崲
+ QuestionObject questionObject = JSONObject.parseObject(question.getContent(), QuestionObject.class);
+ if(questionObject != null){
+ paperQuestion.setItems(questionObject.getQuestionItemObjects());
+ paperQuestion.setAnalyze(questionObject.getAnalyze());
+ paperQuestion.setTitle(questionObject.getTitleContent());
+ }
+ questionList.add(paperQuestion);
+ }
+ PaperFixQuestionDTO dto = new PaperFixQuestionDTO();
+ dto.setTitle(settingDTO.getTitle());
+ dto.setQuestionType(questionType);
+ dto.setQuestionList(questionList);
+ questionTitleList.add(dto);
+ }
+ return null;
}
@Override
- public void updateExamPaper(ExamPaperForm form) {
- ExamPaper entity = ExamPaperForm.getEntityByForm(form,null);
- //濡傛灉鏄殢鏈鸿瘯鍗蜂慨鏀箃emplate琛�
- if(ExamPaperTypeEnum.Random.getCode().equals(form.getPaperType())){
- ExamTemplate examTemplate = getExamTemplate(form, entity);
- examTemplateMapper.removeById(form.getId());
- examTemplateMapper.insert(examTemplate);
+ public Result updateExamPaper(ExamPaperForm form) {
+ ExamPaper examPaper = ExamPaperForm.getEntityByForm(form, null);
+ examPaper.setScore(new BigDecimal(form.getScore()));
+ //闅忔満璇曞嵎
+ if (ExamPaperTypeEnum.Random.getCode().equals(form.getPaperType())) {
+ examPaper.setContent(JSON.toJSONString(form.getQuestionSetting()));
+ baseMapper.updateById(examPaper);
+ return Result.ok();
+ } else if (ExamPaperTypeEnum.Fixed.getCode().equals(form.getPaperType())) {
+ //鍥哄畾璇曞嵎
+ examPaper.setContent(JSON.toJSONString(form.getQuestionTitleList()));
+ baseMapper.updateById(examPaper);
+ return Result.ok();
+ } else {
+ //闅忓簭璇曞嵎
+ examPaper.setContent(JSON.toJSONString(form.getQuestionTitleList()));
+ baseMapper.updateById(examPaper);
+ return Result.ok();
}
- baseMapper.updateById(entity);
}
@Override
public PageInfo<ExamResponseVO> page(ExamPaperPageRequestVO requestVM) {
- PageInfo<ExamPaperTempDTO> page = PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() ->
+ PageInfo<ExamPaper> page = PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() ->
examPaperMapper.page(requestVM));
PageInfo<ExamResponseVO> pageVO = PageInfoHelper.copyMap(page, e -> {
ExamResponseVO vo = new ExamResponseVO();
BeanUtils.copyProperties(e, vo);
vo.setVisibility(VisibilityEnum.valueOf(vo.getVisibility()).getCode() + "");
vo.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime()));
- if(ExamPaperTypeEnum.Random.getCode().equals(e.getPaperType())) {
- //鏁寸悊棰樼洰淇℃伅涓洪泦鍚�
- ExamTemplate examTemplate = e.getExamTemplate();
- List<TemplateQuestionDTO> questionList = new ArrayList<>();
- addQuestionList(questionList, QuestionTypeEnum.SingleChoice.getCode(), examTemplate.getSingleScore(), examTemplate.getSingleChoice());
- addQuestionList(questionList, QuestionTypeEnum.MultipleChoice.getCode(), examTemplate.getMultipleScore(), examTemplate.getMultipleChoice());
- addQuestionList(questionList, QuestionTypeEnum.TrueFalse.getCode(), examTemplate.getTrueFalseScore(), examTemplate.getTrueFalse());
- addQuestionList(questionList, QuestionTypeEnum.GapFilling.getCode(), examTemplate.getGapScore(), examTemplate.getGapFilling());
- addQuestionList(questionList, QuestionTypeEnum.ShortAnswer.getCode(), examTemplate.getShortAnswerScore(), examTemplate.getShortAnswer());
- vo.setQuestionList(questionList);
- }
return vo;
});
return pageVO;
}
- private void addQuestionList(List<TemplateQuestionDTO> questionList, Integer code,BigDecimal score,Integer num) {
- TemplateQuestionDTO questionDTO = new TemplateQuestionDTO();
- questionDTO.setQuestionType(code);
- questionDTO.setScore(score);
- questionDTO.setNum(num);
- questionList.add(questionDTO);
- }
- @Override
- public PageInfo<ExamPaper> taskExamPage(ExamPaperPageRequestVO requestVM) {
- return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() ->
- examPaperMapper.taskExamPage(requestVM));
- }
+
+// @Override
+// public PageInfo<ExamPaper> taskExamPage(ExamPaperPageRequestVO requestVM) {
+// return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() ->
+// examPaperMapper.taskExamPage(requestVM));
+// }
@Override
public PageInfo<ExamPaper> studentPage(ExamPaperPageVO requestVM) {
@@ -180,69 +224,54 @@
}
- @Override
- @Transactional
- public ExamPaper savePaperFromVM(ExamPaperEditRequestVO examPaperEditRequestVO, User user) {
- ActionEnum actionEnum = (examPaperEditRequestVO.getId() == null) ? ActionEnum.ADD : ActionEnum.UPDATE;
- Date now = new Date();
- List<ExamPaperTitleItemVO> titleItemsVM = examPaperEditRequestVO.getTitleItems();
- List<ExamPaperTitleItemObject> frameTextContentList = frameTextContentFromVM(titleItemsVM);
- String frameTextContentStr = JsonUtil.toJsonStr(frameTextContentList);
-
- ExamPaper examPaper = new ExamPaper();
- BeanUtils.copyProperties(examPaperEditRequestVO, examPaper);
- if (actionEnum == ActionEnum.ADD) {
- TextContent frameTextContent = new TextContent();
- frameTextContent.setContent(frameTextContentStr);
- frameTextContent.setCreateTime(now);
- textContentService.save(frameTextContent);
- examPaper.setCreateTime(now);
- examPaper.setCreateUser(user.getId());
- examPaperFromVM(examPaperEditRequestVO, examPaper, titleItemsVM);
- examPaperMapper.insert(examPaper);
- } else {
- examPaper = examPaperMapper.selectById(examPaperEditRequestVO.getId());
- //TODO:
+// @Override
+// @Transactional
+// public ExamPaper savePaperFromVM(ExamPaperEditRequestVO examPaperEditRequestVO, User user) {
+// ActionEnum actionEnum = (examPaperEditRequestVO.getId() == null) ? ActionEnum.ADD : ActionEnum.UPDATE;
+// Date now = new Date();
+// List<ExamPaperTitleItemVO> titleItemsVM = examPaperEditRequestVO.getTitleItems();
+// List<ExamPaperTitleItemObject> frameTextContentList = frameTextContentFromVM(titleItemsVM);
+// String frameTextContentStr = JsonUtil.toJsonStr(frameTextContentList);
+//
+// ExamPaper examPaper = new ExamPaper();
+// BeanUtils.copyProperties(examPaperEditRequestVO, examPaper);
+// if (actionEnum == ActionEnum.ADD) {
+// TextContent frameTextContent = new TextContent();
+// frameTextContent.setContent(frameTextContentStr);
+// frameTextContent.setCreateTime(now);
+// textContentService.save(frameTextContent);
+// examPaper.setCreateTime(now);
+// examPaper.setCreateUser(user.getId());
+// examPaperFromVM(examPaperEditRequestVO, examPaper, titleItemsVM);
+// examPaperMapper.insert(examPaper);
+// } else {
+// examPaper = examPaperMapper.selectById(examPaperEditRequestVO.getId());
+// //TODO:
// TextContent frameTextContent = textContentService.getById(examPaper.getFrameTextContentId());
// frameTextContent.setContent(frameTextContentStr);
// textContentService.updateById(frameTextContent);
- examPaperFromVM(examPaperEditRequestVO, examPaper, titleItemsVM);
- examPaperMapper.updateById(examPaper);
- }
- return examPaper;
- }
+// examPaperFromVM(examPaperEditRequestVO, examPaper, titleItemsVM);
+// examPaperMapper.updateById(examPaper);
+// }
+// return examPaper;
+// }
@Override
public ExamPaperEditRequestVO examPaperToVM(Integer id) {
ExamPaper examPaper = examPaperMapper.selectById(id);
ExamPaperEditRequestVO vo = new ExamPaperEditRequestVO();
BeanUtils.copyProperties(examPaper, vo);
- //TODO:
-// TextContent frameTextContent = textContentService.getById(examPaper.getFrameTextContentId());
-// List<ExamPaperTitleItemObject> examPaperTitleItemObjects = JsonUtil.toJsonListObject(frameTextContent.getContent(), ExamPaperTitleItemObject.class);
-// List<Integer> questionIds = examPaperTitleItemObjects.stream()
-// .flatMap(t -> t.getQuestionItems().stream()
-// .map(q -> q.getId()))
-// .collect(Collectors.toList());
-// List<Question> questions = questionMapper.selectByIds(questionIds);
-// List<ExamPaperTitleItemVO> examPaperTitleItemVOS = examPaperTitleItemObjects.stream().map(t -> {
-// ExamPaperTitleItemVO tTitleVM = new ExamPaperTitleItemVO();
-// BeanUtils.copyProperties(t, tTitleVM);
-// List<QuestionEditRequestVO> questionItemsVM = t.getQuestionItems().stream().map(i -> {
-// Question question = questions.stream().filter(q -> q.getId().equals(i.getId())).findFirst().get();
-// QuestionEditRequestVO questionEditRequestVO = questionService.getQuestionEditRequestVM(question);
-// questionEditRequestVO.setItemOrder(i.getItemOrder());
-// return questionEditRequestVO;
-// }).collect(Collectors.toList());
-// tTitleVM.setQuestionItems(questionItemsVM);
-// return tTitleVM;
-// }).collect(Collectors.toList());
-// vo.setTitleItems(examPaperTitleItemVOS);
-// vo.setScore(ExamUtil.scoreToVM(examPaper.getScore()));
-// if (ExamPaperTypeEnum.Random == ExamPaperTypeEnum.fromCode(examPaper.getPaperType())) {
-// List<String> limitDateTime = Arrays.asList(DateTimeUtil.dateFormat(examPaper.getLimitStartTime()), DateTimeUtil.dateFormat(examPaper.getLimitEndTime()));
-// vo.setLimitDateTime(limitDateTime);
-// }
+ vo.setVisibility(VisibilityEnum.valueOf(vo.getVisibility()).getCode());
+ //闅忔満璇曞嵎
+ if (ExamPaperTypeEnum.Random.getCode().equals(examPaper.getPaperType())) {
+ vo.setQuestionSetting(JSONArray.parseArray(examPaper.getContent(), PaperQuestionSettingDTO.class));
+ } else if (ExamPaperTypeEnum.Fixed.getCode().equals(examPaper.getPaperType())) {
+ //鍥哄畾璇曞嵎
+ vo.setQuestionTitleList(JSONArray.parseArray(examPaper.getContent(), PaperFixQuestionDTO.class));
+ } else {
+ //闅忓簭璇曞嵎
+ vo.setQuestionTitleList(JSONArray.parseArray(examPaper.getContent(), PaperFixQuestionDTO.class));
+ }
return vo;
}
@@ -270,7 +299,6 @@
}
-
private void examPaperFromVM(ExamPaperEditRequestVO examPaperEditRequestVO, ExamPaper examPaper, List<ExamPaperTitleItemVO> titleItemsVM) {
//TODO:
// Integer gradeLevel = subjectService.levelBySubjectId(examPaperEditRequestVO.getSubjectId());
@@ -290,23 +318,23 @@
// }
}
- private List<ExamPaperTitleItemObject> frameTextContentFromVM(List<ExamPaperTitleItemVO> titleItems) {
- AtomicInteger index = new AtomicInteger(1);
- return titleItems.stream().map(t -> {
- ExamPaperTitleItemObject titleItem = new ExamPaperTitleItemObject();
- BeanUtils.copyProperties(t, titleItem);
- List<ExamPaperQuestionItemObject> questionItems = t.getQuestionItems().stream()
- .map(q -> {
- ExamPaperQuestionItemObject examPaperQuestionItemObject = new ExamPaperQuestionItemObject();
- BeanUtils.copyProperties(q, examPaperQuestionItemObject);
- examPaperQuestionItemObject.setItemOrder(index.getAndIncrement());
- return examPaperQuestionItemObject;
- })
- .collect(Collectors.toList());
- titleItem.setQuestionItems(questionItems);
- return titleItem;
- }).collect(Collectors.toList());
- }
+// private List<ExamPaperTitleItemObject> frameTextContentFromVM(List<ExamPaperTitleItemVO> titleItems) {
+// AtomicInteger index = new AtomicInteger(1);
+// return titleItems.stream().map(t -> {
+// ExamPaperTitleItemObject titleItem = new ExamPaperTitleItemObject();
+// BeanUtils.copyProperties(t, titleItem);
+// List<ExamPaperQuestionItemObject> questionItems = t.getQuestionItems().stream()
+// .map(q -> {
+// ExamPaperQuestionItemObject examPaperQuestionItemObject = new ExamPaperQuestionItemObject();
+// BeanUtils.copyProperties(q, examPaperQuestionItemObject);
+// examPaperQuestionItemObject.setItemOrder(index.getAndIncrement());
+// return examPaperQuestionItemObject;
+// })
+// .collect(Collectors.toList());
+// titleItem.setQuestionItems(questionItems);
+// return titleItem;
+// }).collect(Collectors.toList());
+// }
@Override
public List<ExamPaper> myExamPaper(Integer paperType) {
--
Gitblit v1.8.0