Java项目:ssm在线考试系统
作者主页:夜未央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在线考试系统相关推荐
- Springboot毕设项目操作系统的在线考试系统5woc7(java+VUE+Mybatis+Maven+Mysql)
Springboot毕设项目操作系统的在线考试系统5woc7(java+VUE+Mybatis+Maven+Mysql) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + ...
- Java JSP JAVAweb在线考试系统源码网上考试系统源码(ssm考试管理系统)
Java JSP JAVAweb在线考试系统源码网上考试系统源码(ssm考试管理系统) 常见的Javaweb题材有 理财系统,就业管理系统,汽车租赁,简易网盘,疫情数据查看,在线招标房,屋租赁,教务管 ...
- 基于Java Web的在线考试系统的实现
摘 要 随着互联网的发展,教育的方式逐渐步入信息化.智能化,网络教育逐渐成为教育未来发展的重要趋势,在线考试系统成为教育成果考察的主流方向.在线考试充分利用现代信息化技术的优势,使考试更方便.更高效 ...
- 基于JAVA四六级在线考试系统计算机毕业设计源码+数据库+lw文档+系统+部署
基于JAVA四六级在线考试系统计算机毕业设计源码+数据库+lw文档+系统+部署 基于JAVA四六级在线考试系统计算机毕业设计源码+数据库+lw文档+系统+部署 本源码技术栈: 项目架构:B/S架构 开 ...
- java毕业生设计-在线考试系统-计算机源码+系统+mysql+调试部署+lw
java毕业生设计-在线考试系统-计算机源码+系统+mysql+调试部署+lw java毕业生设计-在线考试系统-计算机源码+系统+mysql+调试部署+lw 本源码技术栈: 项目架构:B/S架构 开 ...
- 毕业设计 - 基于java web的在线考试系统【源码+论文】
文章目录 前言 一.项目设计 1. 模块设计 2. 基本功能 2.1 登录功能 2.2 系统答题 2.3 答题得分 2.4 错题解析 3. 实现效果 二.部分源码 项目源码 前言 今天学长向大家分享一 ...
- 基于java web的在线考试系统(源码+论文)
今天介绍的一个项目是, 基于java web的在线考试系统 1 设计内容及要求 1.1 在线考试系统概述 基于Java web开发的在线考试系统不仅可以充分利用校园内各种资源,对学校的各种教学资源进行 ...
- 基于SSM在线考试系统的核心功能之一自动组卷的实现 SpringBoot版本
基于SSM在线考试系统的核心功能之一–>自动组卷的实现 大家都知道,在考试系统中有个核心的功能 就是组卷的过程 什么是组卷呢? 组卷分成 : 手动组卷 和 随机组卷 手动组卷就是操作人选择对应的 ...
- (附源码)计算机毕业设计SSM在线考试系统
项目运行 环境配置: Jdk1.8 + Tomcat7.0 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclis ...
最新文章
- TVM示例展示 README.md,Makefile,CMakeLists.txt
- 《嵌入式 Linux应用程序开发标准教程(第2版)》——第1章 Linux快速入门 1.1 嵌入式Linux基础...
- 类的初始化列表_探索未知种族之osg类生物---渲染遍历之draw函数二
- qt带小数点的数字串显示,Qt-自定义小数点和千位分隔符
- 设计模式——抽象工厂
- ICCV2021 香港理工、阿里达摩院提出RealVSR:视频超分任务中的新数据集与损失方案...
- php mysql数据库同步_实现MySQL数据库同步实例演示_MySQL
- Linux openJDK执行javac编译java文件提示command not found
- Intellij IDEA基本配置
- state.php,状态模式(State)
- Adaptive Wing Loss 论文摘要
- 如何在Excel 2007中创建数据透视表
- 华为性格测试挂的原因是什么?这局怎么破?
- 质检动真格,你的本科毕业论文该怎么做?
- (实例解析)Python 函数调用的几种方式(类里面,类之间,类外面)
- mysql中可以查询英文却查不了中文或数字
- 计算机技术与软件专业技术资格哪个好考,计算机技术与软件专业技术资格好考吗?考试时间?...
- 基于微型计算机系统的实时时钟设计,基于单片机的DS12C887时钟芯片应用研究
- 数据库身份证号用什么类型_油罐内壁防腐施工用什么类型的升降机?
- 【源码】程序员优质资源汇总
热门文章
- 南京邮电大学计算机专业录取分数线2019,南京邮电大学2020年录取分数线(附2017-2019年分数线)...
- DispatcherServlet 详解
- Mysql 唯一索引的字段值 允许多个NULL值存在吗
- Python学习笔记 - 爬虫
- 2022年智能轨道,交通与运输工程国际会议(ICSTTE 2022)
- 【干货】 ICT厂商如何做好“年度备件管理计划”?
- 阻止邮件内容“裸奔”
- Kotlin的魔能机甲——KtArmor网络调用封装(四)
- 抖音怎么发完整版5分钟长视频 开通完整版权限教程
- 笔记本选购指南 笔记本电脑选购方法