作者主页:夜未央5788

简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

在线考试系统分为前后台,分为学生、老师、管理员三种角色;前台学生登录,后台老师、管理员登录;
前台学生登录主要功能包括:
登录、注册、考试中心参加教师分配的考试内容、查看考试历史,回顾考试试卷;

管理员主要功能包括:
首页试卷统计;
基本信息:年级管理、科目管理;
班级管理:班级管理、各班人数折线图统计;
教师管理:教师信息增删改查;
学生管理:学生信息增删改查、学生考试平均成绩柱状图统计;
试卷管理:包括查看试题、添加试题、生成试题;
试题管理:试题列表,导入试题;
考试安排管理:待考信息;
以往考试信息:考试记录;

教师登录后功能菜单与管理员相同,但会限制当前教师的权限;

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

6.数据库:MySql 5.7版本;

技术栈

1. 后端:Spring SpringMVC MyBatis

2. 前端:JSP+bootstrap+jQuery+Echarts

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;
3. 将项目中db.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
学生用户名:xiepengfei 密码:123
管理员用户名:ylrc 密码:123456

教师用户名:liyinping 密码:123456

运行截图

代码相关

考试安排控制器

@Controller
@SuppressWarnings("all")
public class ExamPlanInfoHandler {@Autowiredprivate ExamPlanInfoService examPlanInfoService;@Autowiredprivate ClassInfoService classInfoService;@Autowiredprivate CourseInfoService courseInfoService;@Autowiredprivate ExamPaperInfoService examPaperInfoService;@Autowiredprivate ExamPaperInfo examPaper;@Autowiredprivate GradeInfo grade;private Logger logger = Logger.getLogger(ExamPlanInfoHandler.class);/*** 获取所有待考记录* @return*/@RequestMapping("/examPlans")public ModelAndView getExamPlans() {ModelAndView model = new ModelAndView();model.setViewName("admin/examPlans");logger.info("获取待考考试信息");List<ExamPlanInfo> examPlans = examPlanInfoService.getExamPlans(null);model.addObject("examPlans", examPlans);return model;}/*** 预添加* @return*/@RequestMapping("/preAddep")public ModelAndView preAddep() {ModelAndView model = new ModelAndView();model.setViewName("admin/examPlanedit");//获取所有班级信息List<ClassInfo> classes = classInfoService.getClasses(null);model.addObject("classes", classes);//获取所有科目信息List<CourseInfo> courses = courseInfoService.getCourses(null);model.addObject("courses", courses);//获取所有的试卷信息 -- 纯净的List<ExamPaperInfo> examPapers = examPaperInfoService.getExamPapersClear();model.addObject("examPapers", examPapers);return model;}/*** 添加待考信息* @param examPlan 考试安排记录信息* @return*/@RequestMapping(value="examPlan", method=RequestMethod.POST)public String isAddExamPlan(ExamPlanInfo examPlan) {logger.info("添加待考记录:"+examPlan);examPlanInfoService.isAddExamPlan(examPlan);return "redirect:examPlans";}/*** 预修改* @param examPlanId 考试安排(待考)编号* @return*/@RequestMapping(value="/preUpdateep/{examPlanId}", method=RequestMethod.GET)public ModelAndView preUpdateep(@PathVariable("examPlanId") Integer examPlanId) {ModelAndView model = new ModelAndView();model.setViewName("/admin/examPlanedit");//获取所有班级信息List<ClassInfo> classes = classInfoService.getClasses(null);model.addObject("classes", classes);//获取所有科目信息List<CourseInfo> courses = courseInfoService.getCourses(null);model.addObject("courses", courses);//获取所有的试卷信息 -- 纯净的(简单的)List<ExamPaperInfo> examPapers = examPaperInfoService.getExamPapersClear();model.addObject("examPapers", examPapers);//获取当前修改对象ExamPlanInfo examPlanWithUpdate = examPlanInfoService.getExamPlanById(examPlanId);logger.info("获取要修改的待考记录:"+examPlanWithUpdate);model.addObject("examPlan", examPlanWithUpdate);return model;}/*** 修改待考信息* @param examPlan 待考记录* @return*/@RequestMapping(value="preUpdateep/examPlan", method=RequestMethod.PUT)public String isUpdateExamPlan(ExamPlanInfo examPlan) {logger.info("修改待考记录:"+examPlan);examPlanInfoService.isUpdateExamPlan(examPlan);return "redirect:../examPlans";}/*** 查询学生待考信息* @param classId 学生所在班级编号* @param gradeId 学生所在年级百年好* @param studentId 学生编号* @return*/@RequestMapping("/willexams")public ModelAndView getStudentWillExam(@RequestParam("classId") Integer classId,@RequestParam("gradeId") Integer gradeId,@RequestParam(value="studentId", required=false) Integer studentId) {logger.info("查询学生 "+studentId+"(NULL-未指定)待考信息 班级:"+classId+", 年级:"+gradeId);ModelAndView model = new ModelAndView();model.setViewName("/reception/examCenter");Map<String, Object> map = new HashMap<String, Object>();map.put("classId", classId);map.put("gradeId", gradeId);List<ExamPlanInfo> examPlans = examPlanInfoService.getStudentWillExam(map);model.addObject("examPlans", examPlans);model.addObject("gradeId", gradeId);return model;}/*** 定时刷新考试安排记录,将过期考试移除* 周一至周五 每隔15分钟刷新一次*/@Scheduled(cron="0 */15 * * * MON-FRI")public void refreshExamPlan() {List<ExamPlanInfo> examPlans = examPlanInfoService.getExamPlans(null);logger.info("刷新待考记录, SIZE "+examPlans.size());if (examPlans.size() > 0) {for (ExamPlanInfo examPlanInfo : examPlans) {String beginTime = examPlanInfo.getBeginTime();int examPaperTime = examPlanInfo.getExamPaper().getExamPaperTime();/** 验证是否可移除 */if (validateExamPaerBeOverdue(beginTime, examPaperTime)) {logger.info("待考试卷 "+examPlanInfo.getExamPaper().getExamPaperId()+" 已经过期,即将移除");//移除过期考试安排int row = examPlanInfoService.isRemoveExamPlan(examPlanInfo.getExamPlanId());} else {logger.info("待考试卷 "+examPlanInfo.getExamPaper().getExamPaperId()+" 暂未过期,无法移除");continue;}} }}/*** 验证试卷是否过期* @param beginTime 考试开始时间* @param examTime 考试时间* @return*/private boolean validateExamPaerBeOverdue(String beginTime, int examTime) {boolean flag = false;try {SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");Date beginTimeDate = sdf.parse(beginTime);Long beginTimeTime = beginTimeDate.getTime();/** 转换考试时间为毫秒单位 */int examTimeSecond = examTime * 60 * 1000;Date nowDate = new Date();Long nowDateTime = nowDate.getTime();/** 当前时间超过了 考试结束时间,即为过期记录 */if(nowDateTime > (beginTimeTime+examTimeSecond)) {flag = true;}} catch (ParseException e) {e.printStackTrace();}return flag;}/*** 教师移除考试安排记录* @param examPlanId* @return*/@RequestMapping(value="/del/{examPlanId}")public String isDelExamPlan(@PathVariable("examPlanId") Integer examPlanId) {logger.info("教师 移除考试安排 "+examPlanId);int row = examPlanInfoService.isRemoveExamPlan(examPlanId);return "redirect:../examPlans";}
}

试卷管理控制器

@Controller
@SuppressWarnings("all")
public class ExamPaperInfoHandler {@Autowiredprivate ExamPaperInfoService examPaperInfoService;@Autowiredprivate GradeInfoService gradeInfoService;@Autowiredprivate GradeInfo grade;@Autowiredprivate ExamPaperInfo examPaper;private Logger logger = Logger.getLogger(ExamPaperInfoHandler.class);/*** 获取试卷信息* @param gradeId 年级编号* @param startPage 起始页 默认第一页* @param pageShow 页容量 默认10* @return*/@RequestMapping("/examPapers")public ModelAndView getCourses(@RequestParam(value = "gradeId", required = false) Integer gradeId,@RequestParam(value="startPage", required=false, defaultValue="1") Integer startPage,@RequestParam(value="pageShow", required=false, defaultValue="10") Integer pageShow ) {logger.info("获取试卷集合  gradeId="+gradeId+", startPage="+startPage+", pageShow="+pageShow);ModelAndView model = new ModelAndView();model.setViewName("/admin/examPapers");if (gradeId != null) {grade.setGradeId(gradeId);examPaper.setGrade(grade);}Map<String, Object> map = new HashMap<String, Object>();//计算当前查询起始数据索引int startIndex = (startPage-1) * pageShow;map.put("examPaper", examPaper);map.put("startIndex", startIndex);map.put("pageShow", pageShow);List<ExamPaperInfo> examPapers = examPaperInfoService.getExamPapers(map);model.addObject("examPapers", examPapers);//获取试卷总量int examPaperTotal = examPaperInfoService.getExamPpaerTotal();//计算总页数int pageTotal = 1;if (examPaperTotal % pageShow == 0)pageTotal = examPaperTotal / pageShow;elsepageTotal = examPaperTotal / pageShow + 1;         model.addObject("pageTotal", pageTotal);model.addObject("pageNow", startPage);return model;}/*** 根据编号获取试卷信息* @param examPaperId 试卷编号* @return*/@RequestMapping("/examPaper/{examPaperId}")public ModelAndView getCourseById(@PathVariable("examPaperId") Integer examPaperId) {logger.info("获取试卷 " + examPaperId);ModelAndView model = new ModelAndView();model.setViewName("/admin/examPaperedit");ExamPaperInfo paper = examPaperInfoService.getExamPaper(examPaperId);model.addObject("examPaper", paper);List<GradeInfo> grades = gradeInfoService.getGrades();model.addObject("grades", grades);return model;}/*** 添加/修改试卷信息* @param examPaperId 待操作试卷编号* @param isUpdate 标识是否为修改操作* @param examPaperName 试卷名称* @param subjectNum 试卷试题数量* @param examPaperScore 试卷总分* @param examPaperTime 试卷规定考试时间* @param division 分科情况* @param examPaperEasy 难易程度* @param gradeId 年级编号* @return*/@RequestMapping(value = "/examPaper/examPaper", method = RequestMethod.POST)public String isUpdateOrAddCourse(@RequestParam(value = "examPaperId", required = false) Integer examPaperId,@RequestParam(value = "isupdate", required = false) Integer isUpdate,@RequestParam(value = "examPaperName", required = false) String examPaperName,@RequestParam("subjectNum") Integer subjectNum,@RequestParam("examPaperScore") Integer examPaperScore,@RequestParam("examPaperTime") Integer examPaperTime,@RequestParam("division") Integer division,@RequestParam("examPaperEasy") Integer examPaperEasy,@RequestParam("gradeId") Integer gradeId) {examPaper.setExamPaperId(examPaperId);examPaper.setExamPaperName(examPaperName);examPaper.setSubjectNum(subjectNum);examPaper.setExamPaperScore(examPaperScore);examPaper.setExamPaperTime(examPaperTime);examPaper.setDivision(division);examPaper.setExamPaperEasy(examPaperEasy);grade.setGradeId(gradeId);examPaper.setGrade(grade);if (isUpdate != null) {logger.info("修改试卷 " + examPaper + " 的信息");int row = examPaperInfoService.isUpdateExamPaper(examPaper);} else {logger.info("添加试卷 " + examPaper + " 的信息");int row = examPaperInfoService.isAddExamPaper(examPaper);}return "redirect:/examPapers";}/*** 删除试卷* @param examPaperId 待删除试卷编号* @return*/@RequestMapping(value = "/examPaper/{examPaperId}", method = RequestMethod.DELETE)public String isDelTeacher(@PathVariable("examPaperId") Integer examPaperId) {logger.info("删除试卷 " + examPaperId);int row = examPaperInfoService.isDelExamPaper(examPaperId);return "redirect:/examPapers";}/*** 预添加试卷* @return*/@RequestMapping("/preAddExamPaper")public ModelAndView preAddStudent() {logger.info("预添加试卷信息");ModelAndView model = new ModelAndView();model.setViewName("/admin/examPaperedit");List<GradeInfo> grades = gradeInfoService.getGrades();model.addObject("grades", grades);return model;}
}

试卷答案控制器

@Controller
public class ExamChooseInfoHandler {@Autowiredprivate ExamChooseInfoService examChooseInfoService;@Autowiredprivate ExamChooseInfo examChoose;private Logger logger = Logger.getLogger(ExamChooseInfoHandler.class);/*** 记录考生考试选择答案* @param studentId 考生编号* @param examPaperId 考试试卷编号* @param subjectId 当前选择试题编号* @param index 前台控制索引* @param chooseAswer 选择答案* @param response* @throws IOException*/@RequestMapping(value="/choose", method=RequestMethod.POST)public void examChooseHandler(@RequestParam("studentId") Integer studentId,@RequestParam("examPaperId") Integer examPaperId,@RequestParam("subjectId") Integer subjectId,@RequestParam(value="index", required=false) Integer index,@RequestParam("chooseAswer") String chooseAswer,HttpServletResponse response) throws IOException {logger.info("考生 "+studentId+" 在试卷 "+examPaperId+" 中试题 "+subjectId+" 选择了答案 "+chooseAswer+" 序号 "+index);//判断该考生是否已经选择过该试题Map<String, Object> map = new HashMap<String, Object>();map.put("studentId", studentId);map.put("examPaperId", examPaperId);map.put("subjectId", subjectId);examChoose = examChooseInfoService.getChooseWithIds(map);logger.info("考生是否选择过试题 "+subjectId+" "+examChoose+" (NULL-否)");if (examChoose == null) {logger.info("考生 "+studentId+" 尚未选择试题 "+subjectId+" 添加选择记录 答案 "+chooseAswer);map.put("chooseResult", chooseAswer);/** 添加选择记录 */examChooseInfoService.addChoose(map);} else if (examChoose.getChooseId() != null && examChoose != null) {logger.info("考生 "+studentId+" 已经选择试题 "+subjectId+" 修改选择记录 答案 "+examChoose.getChooseResult()+" 更新为 "+chooseAswer);/** 如果选择了和上次相同的答案,则不做修改操作* 优化 -- 前台判断选择了相同答案则不发出请求*/if(!chooseAswer.equals(examChoose.getChooseResult())) {examChoose.setChooseResult(chooseAswer);/** 当前选择答案和之前选择答案不同 修改答案记录 */examChooseInfoService.updateChooseWithIds(examChoose);} else {logger.info("考生选择了相同答案,不做修改操作");}} else {response.getWriter().print("f");return;}response.getWriter().print("t");}
}

如果也想学习本系统,下面领取。回复:198ssm

Java项目:ssm在线考试系统相关推荐

  1. Springboot毕设项目操作系统的在线考试系统5woc7(java+VUE+Mybatis+Maven+Mysql)

    Springboot毕设项目操作系统的在线考试系统5woc7(java+VUE+Mybatis+Maven+Mysql) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + ...

  2. Java JSP JAVAweb在线考试系统源码网上考试系统源码(ssm考试管理系统)

    Java JSP JAVAweb在线考试系统源码网上考试系统源码(ssm考试管理系统) 常见的Javaweb题材有 理财系统,就业管理系统,汽车租赁,简易网盘,疫情数据查看,在线招标房,屋租赁,教务管 ...

  3. 基于Java Web的在线考试系统的实现

    摘  要 随着互联网的发展,教育的方式逐渐步入信息化.智能化,网络教育逐渐成为教育未来发展的重要趋势,在线考试系统成为教育成果考察的主流方向.在线考试充分利用现代信息化技术的优势,使考试更方便.更高效 ...

  4. 基于JAVA四六级在线考试系统计算机毕业设计源码+数据库+lw文档+系统+部署

    基于JAVA四六级在线考试系统计算机毕业设计源码+数据库+lw文档+系统+部署 基于JAVA四六级在线考试系统计算机毕业设计源码+数据库+lw文档+系统+部署 本源码技术栈: 项目架构:B/S架构 开 ...

  5. java毕业生设计-在线考试系统-计算机源码+系统+mysql+调试部署+lw

    java毕业生设计-在线考试系统-计算机源码+系统+mysql+调试部署+lw java毕业生设计-在线考试系统-计算机源码+系统+mysql+调试部署+lw 本源码技术栈: 项目架构:B/S架构 开 ...

  6. 毕业设计 - 基于java web的在线考试系统【源码+论文】

    文章目录 前言 一.项目设计 1. 模块设计 2. 基本功能 2.1 登录功能 2.2 系统答题 2.3 答题得分 2.4 错题解析 3. 实现效果 二.部分源码 项目源码 前言 今天学长向大家分享一 ...

  7. 基于java web的在线考试系统(源码+论文)

    今天介绍的一个项目是, 基于java web的在线考试系统 1 设计内容及要求 1.1 在线考试系统概述 基于Java web开发的在线考试系统不仅可以充分利用校园内各种资源,对学校的各种教学资源进行 ...

  8. 基于SSM在线考试系统的核心功能之一自动组卷的实现 SpringBoot版本

    基于SSM在线考试系统的核心功能之一–>自动组卷的实现 大家都知道,在考试系统中有个核心的功能 就是组卷的过程 什么是组卷呢? 组卷分成 : 手动组卷 和 随机组卷 手动组卷就是操作人选择对应的 ...

  9. (附源码)计算机毕业设计SSM在线考试系统

    项目运行 环境配置: Jdk1.8 + Tomcat7.0 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclis ...

最新文章

  1. AtCoder Petrozavodsk Contest 001
  2. 换工作必须避开的五个坑
  3. shell监控MySQL服务是否正常
  4. 浅谈ThreadPool 线程池(引用)
  5. rapidjson的read和write的sample
  6. 为什么手机升级系统反应慢了_手机卡顿反应慢怎么解决?久用不卡顿的手机盘点...
  7. 思科和华为/H3C命令对比表
  8. 冒泡排序、选择排序、插入排序
  9. 阿里云API网关(6)用户指南(开放 API )
  10. linux系统官方版下载 百度云,百度网盘linux版
  11. H5点餐系统,微信公众号H5
  12. 丹尼带你入坑无人机3 - 四轴飞行原理
  13. 科学家做一个实验,我就得胖三斤?
  14. 磁珠 符号_贴片磁珠规格
  15. 如何实现图片的上传-(上传到本地)
  16. Java在线预览(word转html)--强势推荐
  17. 诡异!意识何以意识到意识自身?道翰天琼认知智能机器人API接口平台为您揭秘。
  18. 题目内容: 你的程序要读入一个整数,范围是[-100000,100000]。然后,用汉语拼音将这个整数的每一位输出出来。 如输入1234,则输出: yi er san si 注意,每个字的拼音
  19. sheet_name
  20. pandas选取数据方法

热门文章

  1. 提高逻辑思维能力从说话开始
  2. Excel导入数据,未在本地计算机上注册“Microsoft.Jet.OLEDB.4.0”提供程序
  3. Dart基础系统学习
  4. Node.js安装教程(图文版)
  5. 微信小程序跳转其他小程序
  6. 微信小程序跳转h5页面的方式
  7. Tensorrt踩坑日志—YOLOv5使用python的Tensorrt依赖包直接加速
  8. 本学期C#学习个人总结
  9. mac securecrt程序无响应_IT人员必备工具SecureCRT介绍及一些实用小技巧
  10. pca 累积方差贡献率公式_初识PCA数据降维