Java Online Exam在线考试系统怎么实现
发表于:2025-01-20 作者:千家信息网编辑
千家信息网最后更新 2025年01月20日,这篇文章主要介绍"Java Online Exam在线考试系统怎么实现",在日常操作中,相信很多人在Java Online Exam在线考试系统怎么实现问题上存在疑惑,小编查阅了各式资料,整理出简单好
千家信息网最后更新 2025年01月20日Java Online Exam在线考试系统怎么实现
这篇文章主要介绍"Java Online Exam在线考试系统怎么实现",在日常操作中,相信很多人在Java Online Exam在线考试系统怎么实现问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答"Java Online Exam在线考试系统怎么实现"的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
一、项目简述
本系统主要实现的功能有: 学生以及老师的注册登录,在线考试,错题查询,学生管理,问题管理,错题管理,错题查询,分数查询,试卷管 理,人工组卷。自动组卷,教师,班级,统计等等管理功能。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: VUE+Springboot+ SpringMVC + MyBatis + ThymeLeaf + JavaScript + JQuery + Ajax + maven等等
课程信息控制器:
/** * yy */@RestController@RequestMapping(value = "/v1/subjects")public class SubjectController { private static Logger logger = LoggerFactory.getLogger(SubjectController.class); @Autowired SubjectService subjectService; @ApiOperation(value = "获取科目列表", notes = "") @RequestMapping(value = "", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public PageInfogetSubjectList(@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 subjects = subjectService.getSubjectList(); PageInfo pageInfo = new PageInfo(subjects); return pageInfo; } @ApiOperation(value = "根据名字获取科目信息", notes = "根据科目名称获取科目详细信息") @ApiImplicitParam(name = "name", value = "科目名称", required = true, dataType = "String", paramType = "path") @RequestMapping(value = "/{name}/name", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public List getSubjectByName(@PathVariable String name) { return subjectService.getSubjectFuzzy(name); } @ApiOperation(value = "获取课程信息", notes = "根据课程id获取课程详细信息") @ApiImplicitParam(name = "idOrName", value = "课程ID或名称", required = true, dataType = "String", paramType = "path") @RequestMapping(value = "/search/{idOrName}", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public List getSubjectForSearch(@PathVariable String idOrName) { List subjects = new ArrayList (); Subject subject = subjectService.getSubjectByName(idOrName); if (subject == null) { try { subject = subjectService.getSubjectById(idOrName); } catch (Exception e) { } } if (subject != null) { subjects.add(subject); } return subjects; } @ApiOperation(value = "创建课程", notes = "创建课程") @ApiImplicitParam(name = "subject", value = "课程实体Subject", required = true, dataType = "Subject") @RequestMapping(value = "", method = RequestMethod.POST) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public ResponseEntity> postSubject(@RequestBody Subject subject) { if(subjectService.getSubjectByName(subject.getName()) != null) { return new ResponseEntity
题目信息控制器:
/** * yy */ @RestController@RequestMapping(value = "/v1/questions")public class QuestionController { private static Logger logger = LoggerFactory.getLogger(QuestionController.class); @Autowired QuestionService questionService; @Autowired PaperAnswerPaperService paperAnswerPaperService; @ApiOperation(value = "获取题目分页列表", notes = "") @RequestMapping(value = "", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public PageInfogetQuestionListByPage(@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 questions = questionService.getQuestionList(); PageInfo pageInfo = new PageInfo(questions); return pageInfo; } @ApiOperation(value = "获取试卷题目分页列表", notes = "") @RequestMapping(value = "/papers/{paperId}", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public PageInfo getQuestionListByPaper(@PathVariable String paperId, @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 questions = questionService.getQuestionListByPaper(paperId); PageInfo pageInfo = new PageInfo(questions); return pageInfo; } @ApiOperation(value = "获取试卷题目数量", notes = "") @RequestMapping(value = "/papers/{paperId}/count", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "') or hasAuthority('" + Role.ROLE_STUDENT + "')") public ResponseEntity> getQuestionCountByPaper(@PathVariable String paperId) { Integer count = questionService.countByPaperId(paperId); return new ResponseEntity
考试控制层,负责试卷提交等:
/** * 考试控制层,负责试卷提交等 */@RestController@RequestMapping("/v1/exam")public class ExamController { @Autowired ExamService examService; @Autowired AnswerPaperService answerPaperService; @Autowired AnswerQuestionService answerQuestionService; @Autowired AnswerPaperQuestionService answerPaperQuestionService; @Autowired QuestionService questionService; @Autowired PaperService paperService; @Autowired WrongQuestionService wrongQuestionService; @Autowired PaperAnswerPaperService paperAnswerPaperService; @ApiOperation(value = "根据试卷id和题目编号获取题目信息", notes = "根据题目id获取题目详细信息") @ApiImplicitParams({ @ApiImplicitParam(name = "paperId", value = "试卷ID", required = true, dataType = "String", paramType = "path"), @ApiImplicitParam(name = "number", value = "题目编号", required = true, dataType = "String", paramType = "path") }) @RequestMapping(value = "/questions/{number}", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "') or hasAuthority('" + Role.ROLE_STUDENT + "')") 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()); if(answerPaper != null) { answerQuestion = answerQuestionService.getAnswerQuestionByPaperIdAndQuestionNumber(answerPaper.getId(), number); } } }else { answerQuestion = answerQuestionService.getAnswerQuestionByPaperIdAndQuestionNumber(answerPaperId, number); } if(answerQuestion == null) { question = questionService.getQuestionByPaperIdAndQuestionNumber(paperId, number); if(question != null) { //答案不返回 question.setAnswer(""); } } else { question = new Question(); question.setId(answerQuestion.getId()); question.setNumber(answerQuestion.getNumber()); question.setTitle(answerQuestion.getTitle()); 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) { /** * 更改试卷状态,finished:true */ if(type.equals("official")) { /** * 正式考试 */ AnswerPaper answerPaper = new AnswerPaper(); if(answerPaperId != null) { answerPaper.setId(answerPaperId); }else { return new ResponseEntity
答卷控制层,用于获取已经提交的答卷:
/** * 答卷控制层,用于获取已经提交的答卷 */@RestController@RequestMapping("/v1/answer-papers")public class AnswerPaperController { @Autowired AnswerPaperService answerPaperService; @Autowired AnswerQuestionService answerQuestionService; /** * 根据ID查找 * @param id * @return */ @RequestMapping(value = "/{id}", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "') or hasAuthority('" + Role.ROLE_STUDENT + "')") public AnswerPaper getAnswerPaper(@PathVariable String id) { return answerPaperService.getAnswerPaperById(id); } /** * 根据name查找 * @param name * @return */ @RequestMapping(value = "/name/{name}", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public ListgetAnswerPaperByName(@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) { AnswerQuestion answerQuestion = answerQuestionService.getAnswerQuestionByPaperIdAndQuestionNumber(paperId, number); return answerQuestion; } /** * 已分页方式获取数据 * @param username * @param pageIndex * @param pageSize * @param limit * @param offset * @return */ @RequestMapping(value = "/users/{username}", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "') or hasAuthority('" + Role.ROLE_STUDENT + "')") public PageInfo getListByUser(@PathVariable("username") String username, @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 answerPapers = answerPaperService.getAnswerPaperListByAnswerUser(username); PageInfo pageInfo = new PageInfo(answerPapers); return pageInfo; } @RequestMapping(value = "/users/{username}/type/{type}", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "') or hasAuthority('" + Role.ROLE_STUDENT + "')") public PageInfo getListByUserAndType(@PathVariable("username") String username, @PathVariable("type") String type, @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 answerPapers = answerPaperService.getAnswerPaperListByAnswerUserAndType(username, type); PageInfo pageInfo = new PageInfo(answerPapers); return pageInfo; } /** * 获取未批改或已批改的答卷数量, * @return */ @RequestMapping("/check") @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public DtoTask countUnCheckAnswerPaper() { DtoTask dtoTask = new DtoTask(); Integer checked = answerPaperService.countCheck("true"); Integer unChecked = answerPaperService.countCheck("false"); dtoTask.setChecked(checked); dtoTask.setUnChecked(unChecked); return dtoTask; } /** * 以分页方式获取数据 * @param pageIndex * @param pageSize * @param limit * @param offset * @return */ @RequestMapping(value = "", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public PageInfo 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 answerPapers = answerPaperService.getAnswerPaperList(); PageInfo pageInfo = new PageInfo(answerPapers); return pageInfo; } /** * 更新 * @param answerPaper * @return */ @RequestMapping(value = "", method = RequestMethod.PUT) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public ResponseEntity> putPaper(@RequestBody AnswerPaper answerPaper) { answerPaperService.updatePaper(answerPaper); return new ResponseEntity(HttpStatus.OK); } /** * 计算考试成绩 * @param id * @return */ @RequestMapping(value = "/{id}/calculate", method = RequestMethod.PUT) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "') or hasAuthority('" + Role.ROLE_STUDENT + "')") public ResponseEntity> CalculationScore(@PathVariable String id) { /** * 计算成绩 */ List questions = answerQuestionService.findByAnswerPaperId(id); if(questions != null && questions.size() > 0) { int score = 0; try { for(AnswerQuestion question : questions) { score += Integer.parseInt(question.getMarkScore()); } } catch (Exception e) { // TODO: 2017/4/1 } /** * 保存成绩 */ AnswerPaper answerPaper = new AnswerPaper(); answerPaper.setId(id); answerPaper.setScore(Integer.toString(score)); answerPaper.setChecked("true"); answerPaperService.updatePaper(answerPaper); } else { // TODO: 2017/4/1 } return new ResponseEntity (HttpStatus.OK); } @RequestMapping(value = "/analysis/paper") @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public List analysisPaper() { return answerPaperService.analysisPaper(); }}
到此,关于"Java Online Exam在线考试系统怎么实现"的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!
题目
信息
课程
试卷
答卷
考试
更新
控制
在线考试
系统
在线
科目
错题
实体
成绩
答案
学习
查询
管理
名称
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
互联网公司怎么防止删掉数据库
程序员软件开发与系统维护
西安软件开发的企业
对数据库没了解好学吗
如何用服务器上传图片
软件开发费可以免交增值税么
java上传图片到服务器流程
成都软件开发技术推广
56主席令网络安全评估
各种数据库文件格式转换
网络安全书签订
黑马的网络安全与运维资料
碑林软件开发
db2恢复数据库需要清空吗
华为软件开发云ppt
ue4软件开发
无线路由器软件开发做什么
魔兽世界怀旧70数据库
北京大学微电子软件开发
电脑网络安全模式有啥用
it算不算数据库相关工作
数据库如何禁止远程连接本地
安卓终端调用数据库
我的世界出售服务器
软件开发人员就业前景
工业软件开发库
各种数据库文件格式转换
多人编辑数据库网站
网络技术常用的网络命令
tcga数据库有随访信息吗