基于Springboot+vue的组卷系统(源码+参考论文+使用视频)

演示

系统是考试系统的改进版增加了了自动组卷功能 ,原来是将用的选的题目类型 /参数/难度拿到后台后,

生成随机数,从题库中随机获取题目。

实现的代码

@Autowired
QuestionService questionService;
/*自动生成试卷*/
@RequestMapping(value = "/edit", method = RequestMethod.POST)
public RestResponse<ExamPaperEditRequestVM> edit(@RequestBody Map map) {
System.out.print(map);
Integer difficulty = (Integer) map.get("difficulty");
Integer multipleChoice = (Integer) map.get("multipleChoice");
Integer shortAnswer = (Integer) map.get("shortAnswer");
Integer trueFalse = (Integer) map.get("trueFalse");
ExamPaperEditRequestVM model = new ExamPaperEditRequestVM();
Instant instant = Instant.now();
String timestamp = String.valueOf(instant.toEpochMilli());
model.setLevel(1);
model.setPaperType(1);
model.setSubjectId(1);
model.setName("自动生成试卷"+timestamp);
model.setSuggestTime(30);
model.setScore("100");
ArrayList<ExamPaperTitleItemVM> titleitems = new ArrayList<ExamPaperTitleItemVM>();
ExamPaperTitleItemVM examPaperTitleItemVM = new ExamPaperTitleItemVM();
examPaperTitleItemVM.setName("智能试卷"+timestamp );
ArrayList<QuestionEditRequestVM> questionEditRequestVMS = new ArrayList<>();
List<Question> page = questionMapper.page(new QuestionPageRequestVM());
ArrayList<Integer> integers = new ArrayList<>();
Random random = new Random();
List<Integer> ids1 = page.stream()
.filter(question -> question.getQuestionType() == 1) // 过滤指定类型的题目
.filter(question -> question.getDifficult() == difficulty) // 过滤指定类型的题目
.map(Question::getId) // 获取题目的ID
.limit(multipleChoice)
.collect(Collectors.toList());// 转换为列表
List<Integer> ids3 = page.stream()
.filter(question -> question.getQuestionType() == 3) // 过滤指定类型的题目
.filter(question -> question.getDifficult() == difficulty) // 过滤指定类型的题目
.map(Question::getId) // 获取题目的ID
.distinct() // 去重
.limit(shortAnswer)
.collect(Collectors.toList());// 转换为列表
List<Integer> ids5 = page.stream()
.filter(question -> question.getQuestionType() == 5) // 过滤指定类型的题目
.filter(question -> question.getDifficult() == difficulty) // 过滤指定类型的题目
.map(Question::getId) // 获取题目的ID
.distinct() // 去重
.limit(trueFalse)
.collect(Collectors.toList());// 转换为列表
// 创建一个新的ArrayList用于合并
List<Integer> mergedList = new ArrayList<>();
mergedList.addAll(ids1);
mergedList.addAll(ids3);
mergedList.addAll(ids5);
for (Integer id : mergedList) {
QuestionEditRequestVM questionEditRequestVM = questionService.getQuestionEditRequestVM(id);
questionEditRequestVMS.add(questionEditRequestVM);
}
examPaperTitleItemVM.setQuestionItems(questionEditRequestVMS);
titleitems.add(examPaperTitleItemVM);
model.setTitleItems(titleitems);
ExamPaper examPaper = examPaperService.savePaperFromVM(model, getCurrentUser());
ExamPaperEditRequestVM newVM = examPaperService.examPaperToVM(examPaper.getId());
return RestResponse.ok(newVM);
}
@Autowired
    QuestionService questionService;
    /*自动生成试卷*/
    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    public RestResponse<ExamPaperEditRequestVM> edit(@RequestBody Map map) {
        System.out.print(map);

        Integer difficulty = (Integer) map.get("difficulty");
        Integer multipleChoice = (Integer) map.get("multipleChoice");
        Integer shortAnswer = (Integer) map.get("shortAnswer");
        Integer trueFalse = (Integer) map.get("trueFalse");

        ExamPaperEditRequestVM model = new ExamPaperEditRequestVM();
        Instant instant = Instant.now();
        String timestamp = String.valueOf(instant.toEpochMilli());
        model.setLevel(1);
        model.setPaperType(1);
        model.setSubjectId(1);
        model.setName("自动生成试卷"+timestamp);
        model.setSuggestTime(30);
        model.setScore("100");

        ArrayList<ExamPaperTitleItemVM>  titleitems = new ArrayList<ExamPaperTitleItemVM>();


        ExamPaperTitleItemVM examPaperTitleItemVM = new ExamPaperTitleItemVM();

        examPaperTitleItemVM.setName("智能试卷"+timestamp );

        ArrayList<QuestionEditRequestVM> questionEditRequestVMS = new ArrayList<>();


        List<Question> page = questionMapper.page(new QuestionPageRequestVM());

        ArrayList<Integer> integers = new ArrayList<>();


        Random random = new Random();
        List<Integer> ids1 = page.stream()
                .filter(question -> question.getQuestionType() == 1) // 过滤指定类型的题目
                .filter(question -> question.getDifficult() == difficulty) // 过滤指定类型的题目
                .map(Question::getId) // 获取题目的ID
                .limit(multipleChoice)
                .collect(Collectors.toList());// 转换为列表


        List<Integer> ids3 = page.stream()
                .filter(question -> question.getQuestionType() == 3) // 过滤指定类型的题目
                .filter(question -> question.getDifficult() == difficulty) // 过滤指定类型的题目
                .map(Question::getId) // 获取题目的ID
                .distinct() // 去重
                .limit(shortAnswer)
                .collect(Collectors.toList());// 转换为列表


        List<Integer> ids5 = page.stream()
                .filter(question -> question.getQuestionType() == 5) // 过滤指定类型的题目
                .filter(question -> question.getDifficult() == difficulty) // 过滤指定类型的题目
                .map(Question::getId) // 获取题目的ID
                .distinct() // 去重
                .limit(trueFalse)
                .collect(Collectors.toList());// 转换为列表


        // 创建一个新的ArrayList用于合并
        List<Integer> mergedList = new ArrayList<>();
        mergedList.addAll(ids1);
        mergedList.addAll(ids3);
        mergedList.addAll(ids5);





        for (Integer id : mergedList) {
            QuestionEditRequestVM questionEditRequestVM = questionService.getQuestionEditRequestVM(id);
            questionEditRequestVMS.add(questionEditRequestVM);
        }

        examPaperTitleItemVM.setQuestionItems(questionEditRequestVMS);
        titleitems.add(examPaperTitleItemVM);

        model.setTitleItems(titleitems);

        ExamPaper examPaper = examPaperService.savePaperFromVM(model, getCurrentUser());
        ExamPaperEditRequestVM newVM = examPaperService.examPaperToVM(examPaper.getId());
        return RestResponse.ok(newVM);
    }
@Autowired QuestionService questionService; /*自动生成试卷*/ @RequestMapping(value = "/edit", method = RequestMethod.POST) public RestResponse<ExamPaperEditRequestVM> edit(@RequestBody Map map) { System.out.print(map); Integer difficulty = (Integer) map.get("difficulty"); Integer multipleChoice = (Integer) map.get("multipleChoice"); Integer shortAnswer = (Integer) map.get("shortAnswer"); Integer trueFalse = (Integer) map.get("trueFalse"); ExamPaperEditRequestVM model = new ExamPaperEditRequestVM(); Instant instant = Instant.now(); String timestamp = String.valueOf(instant.toEpochMilli()); model.setLevel(1); model.setPaperType(1); model.setSubjectId(1); model.setName("自动生成试卷"+timestamp); model.setSuggestTime(30); model.setScore("100"); ArrayList<ExamPaperTitleItemVM> titleitems = new ArrayList<ExamPaperTitleItemVM>(); ExamPaperTitleItemVM examPaperTitleItemVM = new ExamPaperTitleItemVM(); examPaperTitleItemVM.setName("智能试卷"+timestamp ); ArrayList<QuestionEditRequestVM> questionEditRequestVMS = new ArrayList<>(); List<Question> page = questionMapper.page(new QuestionPageRequestVM()); ArrayList<Integer> integers = new ArrayList<>(); Random random = new Random(); List<Integer> ids1 = page.stream() .filter(question -> question.getQuestionType() == 1) // 过滤指定类型的题目 .filter(question -> question.getDifficult() == difficulty) // 过滤指定类型的题目 .map(Question::getId) // 获取题目的ID .limit(multipleChoice) .collect(Collectors.toList());// 转换为列表 List<Integer> ids3 = page.stream() .filter(question -> question.getQuestionType() == 3) // 过滤指定类型的题目 .filter(question -> question.getDifficult() == difficulty) // 过滤指定类型的题目 .map(Question::getId) // 获取题目的ID .distinct() // 去重 .limit(shortAnswer) .collect(Collectors.toList());// 转换为列表 List<Integer> ids5 = page.stream() .filter(question -> question.getQuestionType() == 5) // 过滤指定类型的题目 .filter(question -> question.getDifficult() == difficulty) // 过滤指定类型的题目 .map(Question::getId) // 获取题目的ID .distinct() // 去重 .limit(trueFalse) .collect(Collectors.toList());// 转换为列表 // 创建一个新的ArrayList用于合并 List<Integer> mergedList = new ArrayList<>(); mergedList.addAll(ids1); mergedList.addAll(ids3); mergedList.addAll(ids5); for (Integer id : mergedList) { QuestionEditRequestVM questionEditRequestVM = questionService.getQuestionEditRequestVM(id); questionEditRequestVMS.add(questionEditRequestVM); } examPaperTitleItemVM.setQuestionItems(questionEditRequestVMS); titleitems.add(examPaperTitleItemVM); model.setTitleItems(titleitems); ExamPaper examPaper = examPaperService.savePaperFromVM(model, getCurrentUser()); ExamPaperEditRequestVM newVM = examPaperService.examPaperToVM(examPaper.getId()); return RestResponse.ok(newVM); }

修改密码

7a08e9b695a0ac64b6143c7f7027135

智能组卷

dc79eb463d7d752eef76be17abc31e1

image

image

效果演示视频

【智能组卷系统的实现】 https://www.bilibili.com/video/BV16m411B7yV/?share_source=copy_web&vd_source=df4184718591e6cbac58f83db35ea5fe

源码下载

基于Springboot+vue的组卷系统(源码+参考论文+使用视频)-学长代码-毕业设计源码网
基于Springboot+vue的组卷系统(源码+参考论文+使用视频)
此内容为付费阅读,请付费后查看
450
立即下载
您当前未登录!建议登陆后购买,可保存购买订单
联系客服qiqi8899sm
付费阅读
已售 3
© 版权声明
THE END
喜欢就支持一下吧
点赞11 分享
Life must be lived with love, happiness, and dreams.
人生一定要有爱,有快乐,有梦想
评论 共1条
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片
    • 热门评论
      头像Johan Purdy0