Java Online Exam在线考试系统怎么实现
发表于:2024-11-22 作者:千家信息网编辑
千家信息网最后更新 2024年11月22日,这篇文章主要介绍"Java Online Exam在线考试系统怎么实现",在日常操作中,相信很多人在Java Online Exam在线考试系统怎么实现问题上存在疑惑,小编查阅了各式资料,整理出简单好
千家信息网最后更新 2024年11月22日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安全错误
数据库的锁怎样保障安全
数据库sql2000安装
大专读计算机软件开发可以吗
萤石网络安全专业
幼儿网络安全教育幼儿图片
服务器系统运维费用
软件开发 需求报告书
网络安全讲座听后感300
信息网络安全介绍
数据库的更新与维护由谁负责
防火墙与网络安全
购物车数据库设计结构图
不想记录运动数据库
行业软件开发培训计划
数据库应用技术同步练习与测评
我的世界体验服务器视频
云手机服务器连接失败
软件开发动漫设计是什么技术
网络安全 人大
网络安全靠大家手抄报高二
第三届安洵杯网络安全挑战赛
网络安全法发帖软件要求
节假日是网络安全的高峰
数据库技术的发展方向有
创建工厂数据库factory
太仓哪里有管家婆软件开发
nmon检测数据库资源
上海互联网软件开发哪家实惠
fs服务器
软件开发企业收入服务费
天龙八部缥缈峰服务器荣耀版