基于javaweb+SpringBoot的课程在线学习与测试系统(java+SSM+redis+Bootstrap+Tomcat+mysql)

基于B/S架构的课程在线学习与测试系统
启动说明
项目为maven管理,最近集成了redis,所以在运行项目是先要下载redis并启动客户端,方可正常运行项目,由于只需要下载redis,无需其他配置,这里就不做过多说明。

最近更新

集成redis来保存用户登录信息,添加过滤器重置用户登录有效期。拦截器实现统一登录和权限校验(相关重构还未完成)。

修改配置文件:com.bs.commonn.RedisPool 地址、端口号

pool = new JedisPool(config,“127.0.0.1”,6379,1000*2);

修改数据库配置文件,导入项目bs.sql文件

学生账号测试:lwj 123456

教师测试账号:lwj 123456

管理员测试账号:admin admin

项目采用前后端分离技术实现


  • 框架:SSM(Spring,SpringMVC,Mybatis)

  • 缓存:redis

  • 数据库:MySQL

  • IDE:Intellij IDEA/Eclipse

  • 其他:Maven,Git

项目亮点


  1. 前后端分离。

  2. 用户登录权限区分和控制。

  3. 防止横向越权和纵向越权。

  4. 密码MD5明文加密。

  5. 设计高复用的服务器响应对象。

  6. guava缓存。

  7. pojo,vo抽象模型。

  8. 数据绑定对象。

  9. Mybatis分页

  10. Bootstrap。

  11. artTemplate,artDialog,iframe前端模板使用。

  12. select2、toastr、sweetalert等等前端插件的使用。

  13. redis缓存。

  14. 全局异常处理,拦截器权限统一检验。请添加图片描述
    请添加图片描述
    请添加图片描述
    请添加图片描述
    请添加图片描述
    请添加图片描述
    请添加图片描述

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

		logger.info("删除教师 " + teacherId);
		int row = teacherInfoService.isDelTeacherInfo(teacherId);
		return "redirect:/teachers";
	}
}
学生管理控制层:
@Controller
@SuppressWarnings("all")
public class StudentInfoHandler {
	@Autowired
	private StudentInfoService studentInfoService;
	@Autowired
	private ClassInfoService classInfoService;
	@Autowired
	private ExamSubjectMiddleInfoService examSubjectMiddleInfoService;
	@Autowired
	private ExamHistoryPaperService examHistoryPaperService;
	@Autowired
	private ExamChooseInfoService examChooseInfoService;
			}
		}
		// 修改上一教师不为班主任状态
		if (lastTeacherId != null) {
			String returnMsg = isChangeTeacherWork(0, lastTeacherId);
			if (returnMsg != null) {
				request.setAttribute("error", "修改教师班主任状态 对应教师编号有误");
				return "../error";
			}
		}
		// 修改当前教师为班主任状态
		String returnMsg = isChangeTeacherWork(1, classInfo.getTeacher().getTeacherId());
		if (returnMsg != null) {
			request.setAttribute("error", "修改教师班主任状态 对应教师编号有误");
			return "../error";
																										 * 每页显示数据量
																										 ** 默认10*/) {
		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);
	/**
	 * 学生注册 验证当前账户是否被占用
	 * @param studentAccount 注册账户
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping("/validateAccount")
	public void validateRegisterAccount(@RequestParam("studentAccount") String studentAccount,
			HttpServletResponse response) throws IOException {
		logger.info("验证学生账户 "+studentAccount+",是否已被注册");
		
		StudentInfo student = studentInfoService.getStudentByAccountAndPwd(studentAccount);
		
		if (student == null) {
			logger.error("注册学生账户 "+studentAccount+" 可以注册");
			response.getWriter().print("t");
	 * 学生注册 验证当前账户是否被占用
	 * @param studentAccount 注册账户
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping("/validateAccount")
	public void validateRegisterAccount(@RequestParam("studentAccount") String studentAccount,
			HttpServletResponse response) throws IOException {
		logger.info("验证学生账户 "+studentAccount+",是否已被注册");
		
		StudentInfo student = studentInfoService.getStudentByAccountAndPwd(studentAccount);
		
		if (student == null) {
			logger.error("注册学生账户 "+studentAccount+" 可以注册");
			response.getWriter().print("t");
		} else {
			logger.error("注册学生账户 "+studentAccount+" 已被注册");
			response.getWriter().print("f");
		}
	}
	
	/**
	 * 学生注册
		logger.info("获取学生集合  classId="+classId+", gradeId="+gradeId+", startPage="+startPage+", pageShow="+pageShow);
		ModelAndView model = new ModelAndView();
		model.setViewName("/admin/student/students");
		//查询条件处理
		StudentInfo student = new StudentInfo();
		if (studentId != null)
			student.setStudentId(studentId);
		if (classId != null) {
			classInfo.setClassId(classId);
			student.setClassInfo(classInfo);
		}
		if (gradeId != null) {
			grade.setGradeId(gradeId);
			student.setGrade(grade);
		}
		
		Map<String, Object> map = new HashMap<String, Object>();
		//计算当前查询起始数据索引
		int startIndex = (startPage-1) * pageShow;
		map.put("student", student);
		map.put("startIndex", startIndex);
		map.put("pageShow", pageShow);
		List<StudentInfo> students = studentInfoService.getStudents(map);
		model.addObject("students", students);
		
		//获取学生总量
		int studentTotal = studentInfoService.getStudentTotal();
	}
	
	/**
	 * 学生注册 验证当前账户是否被占用
	 * @param studentAccount 注册账户
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping("/validateAccount")
	public void validateRegisterAccount(@RequestParam("studentAccount") String studentAccount,
			HttpServletResponse response) throws IOException {
		logger.info("验证学生账户 "+studentAccount+",是否已被注册");
		
		StudentInfo student = studentInfoService.getStudentByAccountAndPwd(studentAccount);
		
		if (student == null) {
			logger.error("注册学生账户 "+studentAccount+" 可以注册");
	 * @return
	 */
	@RequestMapping(value = "/class", method = RequestMethod.POST)
	public String isAddClass(ClassInfo classInfo, HttpServletRequest request) {
		//判断班级名是否存在
		ClassInfo byClassName = classInfoService.findByClassName(classInfo.getClassName());
		if(byClassName!=null){
			request.setAttribute("error", "该班级名称已存在!");
			return "error";
		}
		// 修改教师班主任状态
		String returnMsg = isChangeTeacherWork(1, classInfo.getTeacher().getTeacherId());
		if (returnMsg != null) {
			request.setAttribute("error", "修改教师班主任状态 对应教师编号有误");
			return "error";
		}
		// 添加
	 * @param classInfo
	 *            班级信息
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/class", method = RequestMethod.POST)
	public String isAddClass(ClassInfo classInfo, HttpServletRequest request) {
		//判断班级名是否存在
		ClassInfo byClassName = classInfoService.findByClassName(classInfo.getClassName());
		if(byClassName!=null){
			request.setAttribute("error", "该班级名称已存在!");
			return "error";
		}
			int row = examHistoryPaperService.isAddExamHistory(map);
			logger.info("学生 "+studentId+" 提交的试卷 "+examPaperId+" 已成功处理,并添加到历史记录中");
		}
		
		return "redirect:willexams?gradeId="+gradeId+"&classId="+classId+"&studentId="+studentId;
	}
	
	
	/**
	 * 学生回顾试卷  --  后台教师查看也调用此方法
	 * @param studentId
	 * @param examPaperId
	 * @param score
	 * @param examPaperName
	 * @param studentName  后台教师查看需传入学生姓名
	 * @return
	 * @throws UnsupportedEncodingException
	 */
	@RequestMapping("/review")
		int row = studentInfoService.isResetPwdWithStu(student);
		
		if (row > 0) {
			response.getWriter().print("t");
		} else {
			response.getWriter().print("f");			
		}
	}
}
班级管理控制层:
@Controller
@SuppressWarnings("all")
public class ClassInfoHandler {
	@Autowired

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值