基于javaweb+mysql的springboot在线考试管理系统(java+springboot+vue+elementui+mysql)

基于javaweb+mysql的springboot在线考试管理系统(java+springboot+vue+elementui+mysql)

运行环境

Java≥8、MySQL≥5.7、Node.js≥10

开发工具

后端:eclipse/idea/myeclipse/sts等均可配置运行

前端:WebStorm/VSCode/HBuilderX等均可

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的SpringBoot在线考试管理系统(java+springboot+vue+elementui+mysql)

一、项目简述

本系统主要实现的功能有: 学生以及老师的注册登录,在线考试,错题查询,学生管理,问题管理,错题管理,错题查询,分数查询,试卷管 理,人工组卷。自动组卷,教师,班级,统计等等管理功能。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: VUE+Springboot+ SpringMVC + MyBatis + ThymeLeaf + JavaScript + JQuery + Ajax + maven等等

WrongQuestion wrongQuestion = new WrongQuestion();

try{

BeanUtils.copyProperties(wrongQuestion, answerQuestion);

wrongQuestion.setUsername(username);

wrongQuestion.setRightAnswer(question.getAnswer());

wrongQuestion.setAnalysis(question.getAnalysis());

if(wrongQuestionService.getWrongQuestion(wrongQuestion.getId()) == null) {

wrongQuestionService.saveQuestion(wrongQuestion);

}catch (Exception e) {

System.out.println(wrongQuestion.toString());

//计算正确率

@RequestMapping(value = "/papers/{paperId}/questions/{number}", method = RequestMethod.GET)

@PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "') or hasAuthority('" + Role.ROLE_STUDENT + "')")

public AnswerQuestion getQuestionByPaperIdAndQuestionId(@PathVariable String paperId, @PathVariable Integer number) {

AnswerQuestion answerQuestion = answerQuestionService.getAnswerQuestionByPaperIdAndQuestionNumber(paperId, number);

return answerQuestion;

/**

* 已分页方式获取数据

* @param username

* @param pageIndex

* @param pageSize

* @param limit

AnswerQuestion answerQuestion = answerQuestionService.getAnswerQuestionByPaperIdAndQuestionNumber(paperId, number);

return answerQuestion;

/**

* 已分页方式获取数据

* @param username

* @param pageIndex

* @param pageSize

* @param limit

* @param offset

* @return

*/


public PageInfo<AnswerPaper> getListByUser(@RequestParam(required = false) Integer pageIndex,

@RequestParam(required = false) Integer pageSize,

@RequestParam(required = false) Integer limit,

@RequestParam(required = false) Integer offset) {

if(pageIndex != null && pageSize != null) {

PageHelper.startPage(pageIndex, pageSize);

List<AnswerPaper> answerPapers = answerPaperService.getAnswerPaperList();

PageInfo pageInfo = new PageInfo(answerPapers);

return pageInfo;

/**


question.setScore(answerQuestion.getScore());

question.setType(answerQuestion.getType());

question.setOptionA(answerQuestion.getOptionA());

question.setOptionB(answerQuestion.getOptionB());

question.setOptionC(answerQuestion.getOptionC());

question.setOptionD(answerQuestion.getOptionD());

question.setAnswer(answerQuestion.getAnswer());

return question;

@RequestMapping(value = "/submit/{type}/{username}", method = RequestMethod.POST)

@PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "') or hasAuthority('" + Role.ROLE_STUDENT + "')")

public ResponseEntity<?> submit(@RequestBody Paper paper, @PathVariable String type,

@PathVariable String username,

@RequestParam(required = false) String answerPaperId) {

/**
* @param name

* @return

*/

@RequestMapping(value = "/name/{name}", method = RequestMethod.GET)

@PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')")

public List<AnswerPaper> getAnswerPaperByName(@PathVariable String name) {

return answerPaperService.getAnswerPaperFuzzy(name);

/**

* 根据答卷id和题目编号获取题目信息

* @param paperId

wrongQuestionService.saveQuestion(wrongQuestion);

}catch (Exception e) {

System.out.println(wrongQuestion.toString());

//计算正确率

correctRate = (right/(right + wrong)) * 100;

DtoResult result = new DtoResult();

result.setScore(score);

result.setRight(right);

result.setWrong(wrong);

result.setCorrectRate(correctRate);

result.setResults(results);


return new ResponseEntity<Object>(HttpStatus.OK);

/**

* 提交题目

* @param username

* @param dtoAnswerPaper

* @return

*/

@RequestMapping(value = "/submit/one/{username}", method = RequestMethod.POST)

@PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "') or hasAuthority('" + Role.ROLE_STUDENT + "')")

public ResponseEntity<?> submitOne(@PathVariable String username, @RequestBody DtoAnswerPaper dtoAnswerPaper) {


/**

* 1.接收提交的试卷

* 2.计算成绩

* 3.记录考试记录

* 4.返回计算结果

*/

int score = 0;

//正确题目数

double right = 0.0;

//错误题目数

double wrong = 0.0;

double correctRate = 0.0;

AnswerQuestionService answerQuestionService;

/**

* 获取试卷题目分页列表

* @param paperId

* @return

*/

@RequestMapping(value = "/{paperId}", method = RequestMethod.GET)

@PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "') or hasAuthority('" + Role.ROLE_STUDENT + "')")

public List<AnswerQuestion> getAnswerQuestionListByPaper(@PathVariable String paperId) {

return answerQuestionService.findByAnswerPaperId(paperId);

@RequestMapping(value = "", method = RequestMethod.PUT)

answerQuestion.setOptionD(question.getOptionD());

answerQuestion.setContent(question.getContent());

answerQuestion.setScore(question.getScore());

answerQuestion.setAnalysis(question.getAnalysis());

answerQuestion.setAnswer(question.getAnswer());

answerPaperQuestion = new AnswerPaperQuestion();

answerPaperQuestion.setAnswerPaperId(answerPaper.getId());

answerPaperQuestion.setAnswerQuestionId(answerQuestionId);

//保存

answerQuestionService.saveAnswerQuestion(answerQuestion);

answerPaperQuestionService.saveAnswerPaperQuestion(answerPaperQuestion);

return new ResponseEntity<Object>(answerPaper, HttpStatus.OK);

} else {


public PageInfo<AnswerPaper> getListByUser(@RequestParam(required = false) Integer pageIndex,

@RequestParam(required = false) Integer pageSize,

@RequestParam(required = false) Integer limit,

@RequestParam(required = false) Integer offset) {

if(pageIndex != null && pageSize != null) {

PageHelper.startPage(pageIndex, pageSize);

List<AnswerPaper> answerPapers = answerPaperService.getAnswerPaperList();

PageInfo pageInfo = new PageInfo(answerPapers);

return pageInfo;

/**

* 更新

* @param answerPaper

* @return


paper1.setPeoples(String.valueOf(Integer.parseInt(paper1.getPeoples() + 1)));

paperService.updatePaper(paper1);

return new ResponseEntity<Object>(HttpStatus.OK);

/**

* 提交题目

* @param username

* @param dtoAnswerPaper

* @return

*/

@RequestMapping(value = "/submit/one/{username}", method = RequestMethod.POST)


answerPaper.setType("simulate");

examService.updateAnswerPaper(answerPaper);

}else if(type.equals("practice")) {

/**

* 1.接收提交的试卷

* 2.计算成绩

* 3.记录考试记录

* 4.返回计算结果

*/

int score = 0;

//正确题目数


public Question getQuestionByPaperIdAndQuestionId(@RequestParam String paperId,

@RequestParam String username,

@RequestParam(required = false) String answerPaperId,

@PathVariable Integer number) {

Question question = null;

AnswerQuestion answerQuestion = null;

if(answerPaperId == null) {

Paper paper = paperService.getPaperById(paperId);

if(paper != null) {

AnswerPaper answerPaper = answerPaperService.findByAnswerUserAndPaperName(username, paper.getName());


PaperAnswerPaper paperAnswerPaper = new PaperAnswerPaper();

paperAnswerPaper.setPaperId(paper.getId());

paperAnswerPaper.setAnswerPaperId(answerPaperId);

paperAnswerPaperService.save(paperAnswerPaper);

//新记录

answerQuestion = new AnswerQuestion();

//初始化信息

answerQuestion.setId(answerQuestionId);

answerQuestion.setTitle(question.getTitle());

answerQuestion.setType(question.getType());

answerQuestion.setNumber(question.getNumber());

answerQuestion.setOptionA(question.getOptionA());

answerQuestion.setOptionB(question.getOptionB());


existAnswerQuestion = question1;//保存当前存在的记录

//记录不存在

if(count == 0) {

//新记录

answerQuestion = new AnswerQuestion();

answerPaperQuestion = new AnswerPaperQuestion();

answerQuestion = new AnswerQuestion();

//初始化信息

answerQuestion.setId(answerQuestionId);

answerQuestion.setTitle(question.getTitle());

answerQuestion.setType(question.getType());


@RequestMapping(value = "/name/{name}", method = RequestMethod.GET)

@PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')")

public List<AnswerPaper> getAnswerPaperByName(@PathVariable String name) {

return answerPaperService.getAnswerPaperFuzzy(name);

/**

* 根据答卷id和题目编号获取题目信息

* @param paperId

* @param number

* @return

*/

@RequestMapping(value = "/papers/{paperId}/questions/{number}", method = RequestMethod.GET)

@PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "') or hasAuthority('" + Role.ROLE_STUDENT + "')")

public AnswerQuestion getQuestionByPaperIdAndQuestionId(@PathVariable String paperId, @PathVariable Integer number) {

请添加图片描述

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值