——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于javaweb的SSM在线考试系统(java+ssm+mysql+jsp)
运行环境:jdk1.8、Mysql5.7、Tomcat8.5、IDEA/Eclipse
功能简介:在线考试、历史回顾、个人成绩查询等。
管理员和教师功能有:学院管理、班级管理、课程管理、教师、学生管理、统计分析、试卷试题管理、考试安排管理、历史考试管理等
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| * </p> * <p> * Description: 科目 * </p> */
@Controller @SuppressWarnings("all") public class CourseInfoHandler { @Autowired private CourseInfoService courseInfoService; @Autowired private GradeInfoService gradeInfoService;
private Logger logger = Logger.getLogger(CourseInfoHandler.class);
/** * 获取科目信息 * * @param gradeId * 系部编号 * @param division * 分科情况 * @return */ @RequestMapping("/courses") public ModelAndView getCourses(@RequestParam(value = "gradeId", required = false) Integer gradeId, @RequestParam(value = "division", required = false) Integer division) { ModelAndView model = new ModelAndView(); model.setViewName("/admin/course/courses");
CourseInfo course = new CourseInfo(); if (gradeId != null) course.getGrade().setGradeId(gradeId); if (division != null) course.setDivision(division); List<CourseInfo> courses = courseInfoService.getCourses(course); model.addObject("courses", courses);
return model; }
/** * 根据科目编号获取学科信息 * * @param courseId * 科目编号 * @return */ @RequestMapping("/course/{courseId}") public ModelAndView getCourseById(@PathVariable("courseId") Integer courseId) { ModelAndView model = new ModelAndView();
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| int examPaperTotal = examPaperInfoService.getExamPpaerTotal(); int pageTotal = 1; if (examPaperTotal % pageShow == 0) pageTotal = examPaperTotal / pageShow; else pageTotal = examPaperTotal / pageShow + 1; model.addObject("pageTotal", pageTotal); model.addObject("pageNow", startPage);
return model; }
@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; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| examPaperInfoService.isUpdateExamPaperSubjects(scoreWithNum); }
private void deleteUploadFile(String filePath) { File file = new File(filePath);
if (file.exists()) { logger.info("上传文件已被删除 " + filePath); } }
@RequestMapping("/preAddSubject") public ModelAndView preAddStudent() { logger.info("预添加试卷信息"); ModelAndView model = new ModelAndView(); model.setViewName("/admin/subject-test"); List<GradeInfo> grades = gradeInfoService.getGrades(); model.addObject("grades", grades); model.addObject("courses", courseInfoService.getCourses(null)); return model; }
private String trimChar(String str) { if (str != null) { return str.replaceAll("^,*|,*$", ""); } return str; }
} package com.yuanlrc.online.exam.controller;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| * 获取学生历史考试记录 * @param studentId 学生编号 * @return */ @RequestMapping("/history/{studentId}") public ModelAndView getExamHistoryInfo(@PathVariable("studentId") Integer studentId) { ModelAndView model = new ModelAndView(); if (studentId == null) { logger.error("学生编号 为空"); model.setViewName("error"); return model; } logger.info("学生 "+studentId+" 获取考试历史记录"); List<ExamHistoryPaper> ehps = examHistoryPaperService.getExamHistoryToStudent(studentId); model.addObject("ehps", ehps); model.setViewName("/reception/examHistory"); return model; }
@RequestMapping(value="/submit", method={RequestMethod.POST, RequestMethod.GET}) public String examSubmit( @RequestParam("studentId") Integer studentId, @RequestParam("examPaperId") Integer examPaperId, @RequestParam("classId") Integer classId, @RequestParam("gradeId") Integer gradeId) { logger.info("学生 "+studentId+" 提交了试卷 "+examPaperId); Map<String, Object> map = new HashMap<String, Object>(); map.put("studentId", studentId);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| public ModelAndView getTeachers( @RequestParam(value = "startPage", required = false, defaultValue = "1") Integer startPage, // 当前页码,默认第一页 @RequestParam(value = "pageShow", required = false, defaultValue = "10") Integer pageShow
) { logger.info("查询教师集合");
ModelAndView model = new ModelAndView(); model.setViewName("admin/teacher/teachers");
List<TeacherInfo> teachers;
Map<String, Object> map = new HashMap<String, Object>(); int startIndex = (startPage - 1) * pageShow; map.put("startIndex", startIndex); map.put("pageShow", pageShow); map.put("teacher", null); teachers = teacherInfoService.getTeachers(map); model.addObject("teachers", teachers);
int teacherTotal = teacherInfoService.getTeacherTotal(); int pageTotal = 1; if (teacherTotal % pageShow == 0) pageTotal = teacherTotal / pageShow; else pageTotal = teacherTotal / pageShow + 1; model.addObject("pageTotal", pageTotal); model.addObject("pageNow", startPage);
return model; }
@RequestMapping(value = "/teacher/{teacherId}", method = RequestMethod.GET) public ModelAndView preUpdateTeacher(@PathVariable("teacherId") Integer teacherId) { logger.info("预修改教师处理");
ModelAndView model = new ModelAndView();
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| if (classId != null) classInfo.setClassId(classId); if (className != null) { if (className.trim() != "") classInfo.setClassName(className); }
List<ClassInfo> classes = classInfoService.getClasses(classInfo); model.setViewName("admin/clazz/classes"); model.addObject("classes", classes);
return model; }
@RequestMapping("/preAddClass") public ModelAndView preAddClass(@RequestParam(name = "gid",required = false,defaultValue = "")Integer gid) {
ModelAndView model = new ModelAndView(); List<GradeInfo> grades = gradeInfoService.getGrades(); model.setViewName("admin/clazz/classedit"); model.addObject("grades", grades); teacher.setIsWork(0); Map<String, Object> map = new HashMap<String, Object>(); map.put("startIndex", null); map.put("pageShow", null); map.put("teacher", teacher); List<TeacherInfo> teachers = teacherInfoService.getTeachers(map); model.addObject("teachers", teachers); model.addObject("editClass", new ClassInfo()); model.addObject("gid",gid); return model; }
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=091422282105200cj
https://javayms.pages.dev?id=091422282105200cj