项目描述
临近学期结束,还是毕业设计,你还在做java程序网络编程,期末作业,老师的作业要求觉得大了吗?不知道毕业设计该怎么办?网页功能的数量是否太多?没有合适的类型或系统?等等。今天给大家介绍一篇基于SpringBoot的教师宿舍管理系统设计与实现。
功能需求
本教师宿舍管理系统通过分析和确定系统的角色和功能划分,按照业务合理区分为不同的菜单功能模块。从宿舍管理业务以及学校管理人员的角度出发,对每个功能的需求实现点进行人性化详细的构思。本系统未做完善的用户体系,只是简单的分为了三个用户分别为:
- 系统管理员:登录、教师管理、楼栋管理、宿舍管理、入住管理、宿管管理、管理员管理。
- 教师用户:教师管理、宿舍管理。
- 宿管用户:教师管理、宿舍管理、入住管理。
具体功能可以根据角色权限配置菜单按钮。
部分效果图
部分代码
/*** 宿管存储服务*/@Autowiredprivate DormitoryManagerRepository dormitoryManagerRepository;@RequestMapping(method = RequestMethod.POST, path = "/login", produces = "application/json", consumes = "application/json")@ResponseBodypublic ResponseEntity<LoginResponse> login(@RequestBody LoginRequest loginRequest, HttpServletRequest request) {try {LoginResponse loginResponse = doLogin(loginRequest, request);return new ResponseEntity(loginResponse, HttpStatus.OK);} catch (Exception e) {return new ResponseEntity(null, HttpStatus.INTERNAL_SERVER_ERROR);}}@RequestMapping(method = RequestMethod.POST, path = "/logout", produces = "application/json", consumes = "application/json")@ResponseBodypublic ResponseEntity<LogoutResponse> logout(@RequestBody LogoutRequest logoutRequest, HttpServletRequest request) {try {LogoutResponse logoutResponse = doLogout(logoutRequest, request);return new ResponseEntity(logoutResponse, HttpStatus.OK);} catch (Exception e) {return new ResponseEntity(null, HttpStatus.INTERNAL_SERVER_ERROR);}}public LogoutResponse doLogout(LogoutRequest logoutRequest, HttpServletRequest request) {LogoutResponse logoutResponse = new LogoutResponse();logoutResponse.setOperator(logoutRequest.getOperator());logoutResponse.setRequestId(logoutRequest.getRequestId());request.getSession().setAttribute("user", null);request.getSession().setAttribute("userType", null);logoutResponse.setResponseCode(ResponseCodeEnum.SUCCESS);logoutResponse.setTimestamp(System.currentTimeMillis());return logoutResponse;}private LoginResponse doLogin(LoginRequest loginRequest, HttpServletRequest request) {//登录返回信息LoginResponse loginResponse = new LoginResponse();loginResponse.setOperator(loginRequest.getOperator());loginResponse.setRequestId(loginRequest.getRequestId());//验证码校验Object cpacha = request.getSession().getAttribute("cpacha");//校验session数据是否失效if (null == cpacha || !StringUtils.hasLength(String.valueOf(cpacha))) {//验证码已失效loginResponse.setResponseCode(ResponseCodeEnum.CPACHA_INVALID);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;} else {String[] cpachaCode = cpacha.toString().split("_");long time = Long.parseLong(cpachaCode[1]);long now = System.currentTimeMillis();if (now - time > cpachaTimeout) {//验证码已过期loginResponse.setResponseCode(ResponseCodeEnum.CPACHA_INVALID);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;}// 设置不区分大小写if (!loginRequest.getCaptcha().toUpperCase().equals(cpachaCode[0].toUpperCase())) {//验证码输入错误loginResponse.setResponseCode(ResponseCodeEnum.CPACHA_INVALID);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;}}//登录信息校验if ("1".equals(loginRequest.getType())) {// 超级管理员用户AdminEntity admingEntity = adminRepository.findByName(loginRequest.getAccount());if (null == admingEntity) {//账户不存在loginResponse.setResponseCode(ResponseCodeEnum.ACCOUNT_NOT_EXIST);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;} else {if (!loginRequest.getPassword().equals(admingEntity.getPassword())) {//密码错误loginResponse.setResponseCode(ResponseCodeEnum.PASSWORD_ERROR);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;} else {request.getSession().setAttribute("user", loginRequest.getAccount());request.getSession().setAttribute("userType", loginRequest.getType());loginResponse.setResponseCode(ResponseCodeEnum.SUCCESS);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;}}} else if ("3".equals(loginRequest.getType())) {// 教师登录TeacherEntity studentEntity = studentRepository.findBySn(loginRequest.getAccount());if (null == studentEntity) {List<TeacherEntity> studentEntityList = studentRepository.findByName(loginRequest.getAccount());if (studentEntityList.size() > 1) {loginResponse.setResponseCode(ResponseCodeEnum.SAME_NAME);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;} else if (studentEntityList.size() == 1) {studentEntity = studentEntityList.get(0);} else {loginResponse.setResponseCode(ResponseCodeEnum.ACCOUNT_NOT_EXIST);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;}}if (!loginRequest.getPassword().equals(studentEntity.getPassword())) {//密码错误loginResponse.setResponseCode(ResponseCodeEnum.PASSWORD_ERROR);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;} else {request.getSession().setAttribute("user", loginRequest.getAccount());request.getSession().setAttribute("userType", loginRequest.getType());loginResponse.setResponseCode(ResponseCodeEnum.SUCCESS);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;}} else if ("2".equals(loginRequest.getType())) {// 宿管登录DormitoryManagerEntity dormitoryManagerEntity = dormitoryManagerRepository.findBySn(loginRequest.getAccount());if (null == dormitoryManagerEntity) {List<DormitoryManagerEntity> dormitoryManagerEntityList = dormitoryManagerRepository.findByName(loginRequest.getAccount());if (dormitoryManagerEntityList.size() > 1) {loginResponse.setResponseCode(ResponseCodeEnum.SAME_NAME);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;} else if (dormitoryManagerEntityList.size() == 1) {dormitoryManagerEntity = dormitoryManagerEntityList.get(0);} else {loginResponse.setResponseCode(ResponseCodeEnum.ACCOUNT_NOT_EXIST);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;}}if (!loginRequest.getPassword().equals(dormitoryManagerEntity.getPassword())) {//密码错误loginResponse.setResponseCode(ResponseCodeEnum.PASSWORD_ERROR);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;} else {request.getSession().setAttribute("user", loginRequest.getAccount());request.getSession().setAttribute("userType", loginRequest.getType());loginResponse.setResponseCode(ResponseCodeEnum.SUCCESS);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;}} else {//不支持其他登录方式loginResponse.setResponseCode(ResponseCodeEnum.PARAM_ERROR);loginResponse.setTimestamp(System.currentTimeMillis());return loginResponse;}
安装部署需求
idea运行启动
系统部署
系统开发后,在生产环境配置项目运行环境,具体步骤如下:
安装linux或者windows10操作系统;
安装JDK1.8并配置环境变量;
安装MySQL5.7版本以上版本数据库,创建数据库并执行脚本创建表;
在idea中运行打包;
本项目用到的技术和框架
1.开发语言:Java
2.开发模式:B/S
3.数据库:MySQL5.7
4.框架:SpringBoot+bootstrap
本项目中的关键点
此系统的开发采用java语言开发,基于B/S结构,这些开发环境使系统更加完善。使用到的工具和技术都是开源免费的。
环境工具
开发工具 IDEA
语言 JDK1.8 、SpringBoot、bootstrap
硬件:笔记本电脑;
软件:Tomcat8.0 Web服务器、Navicat数据库客户端、MySQL;
操作系统:Windows 10;
其它软件:截图工具、常用浏览器;
以上是本系统的部分功能展示,如果你的选题正好相符,那么可以做毕业设计或课程设计使用。