基于SpringBoot的校园疫情管理系统
摘要
2019年12月19号中国武汉发生第一例新冠病毒的到来,大家都在听从政府的号召在居家隔离,不管是在城市还是在乡镇、农村,这引起我的注目,设计一套校园疫情防控系统,疫情防控需要大家共同努力、团结对学校学生进行了新型冠状病毒肺炎防控知识普及和宣传教育,通过学校广播、教室发宣传单、老师给学生谱及防疫知识,社会也可以通过微信群、短信等多种形式,从个人防护知识、居家防护知识、外出公共场所防护知识、新型冠状病毒肺炎医学知识、就医流程五个方面,有针对性地向学校学生普及了防疫知识。充分做到疫情防控人人知晓、人人参与认识病毒的可怕,最好方式就是建立学校的平台信息,并对其进行管理。
我通过对新冠病毒的到来懵生了开发一套关于校园疫情防控系统,本系统采用了Java技术,将所有业务模块采用以浏览器交互的模式,选择MySQL数据库,springboot作为系统的后台框架,开发工具选择My eclipse来进行系统的设计。基本实现了校园疫情防控系统应有的主要功能模块,本系统有管理员、学生。管理员:首页、个人中心、核酸检测管理、体温状态管理、学生管理、学生状态管理、休假申请管理、出入登记管理、疫情知识管理、论坛管理、系统管理。学生权限;首页、个人中心、学生状态管理、休假申请管理、出入登记管理;前台首页:首页、出入登记、疫情知识、论坛信息、疫情公告、个人中心、后台管理、客服等操作。
对系统进行测试,是为了改善了程序逻辑和代码。同时确保系统中所有的程序都能正常运行,所有的功能都能操作,并且该系统有很好的操作体验,实现了对于校园疫情防控系统和护工管理、学校学生管理、政府部门双赢。
**关键词:**校园疫情防控系统;springboot框架 ;Mysql数据库;Java语言
系统流程分析
1、系统登录流程图
2、添加信息流程图
3、删除信息流程图
系统设计
1、系统结构图
2、开发流程设计
系统流程的分析是通过调查系统所涉及问题的识别、可行性、可操作性、系统分析处理能力等具体环节来调节、整理系统的设计方案以确保系统能达到理想的状态。这些操作都要从注册、登录处着眼进行一系列的流程测试保证数据库的完整,从而把控系统所涉及信息管理的安全、保证信息输入、输出正常转换。然后,通过实际操作完成流程图的绘制工作。
3、数据库设计原则
学习编程,我们都知道数据库设计是基于需要设计的系统功能,我们需要建立一个数据库关系模型,用于存储数据信息,这样当我们在程序中时,就没有必要为程序页面添加数据,从而提高系统的效率。数据库存储了很多信息,可以说是信息管理系统的核心和基础,数据库还为系统提供了添加、删除、修改和检查等操作模块,使系统能够快速找到自己想要的信息,而不是在程序代码中找到。
功能截图
1、校园疫情防控系统,在管理员登录系统的首页可以通过填写账号/密码、选择角色进行登录操作等信息
2、管理员首页,管理员进入校园疫情防控系统查看个人中心、核酸检测管理、体温状态管理、学生管理、学生状态管理、休假申请管理、出入登记管理、疫情知识管理、论坛管理、系统管理操作
3、核酸检测管理,通过核酸检测管理内容列表可以获取核酸检测、核酸状态等信息可进行详情、修改、删除或查看操作
4、学生管理,通过学生管理内容列表获取景区学号、密码、学生姓名、性别、头像、专业、班级、住址省份、市级、县级、手机、邮箱等信息可进行详情、修改、删除或查看操作。
5、休假申请管理,通过休假申请管理内容列表可以获取申请编号、申请标题、休假天数、行程城市、途径城市、申请日期等信息可进行详情、修改、删除或查看操作
6、出入登记管理,通过出入登记管理内容列表可以获取登记标题、登陆类型、登记时间、备注、学号、学生姓名、性别、头像、实时体温、手机、班级、专业、审核回复、审核状态、审核等信息可进行详情、修改、删除或查看等操作
相关代码
数据库配置
# Tomcatserver: tomcat: uri-encoding: UTF-8 port: 8080 servlet: context-path: /springboot81644spring: datasource: driverClassName: com.mysql.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/springboot81644?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC username: root password: 123456 servlet: multipart: max-file-size: 10MB max-request-size: 10MB resources: static-locations: classpath:static/,file:static/#mybatismybatis-plus: mapper-locations: classpath*:mapper/*.xml #实体扫描,多个package用逗号或者分号分隔 typeAliasesPackage: com.entity global-config: #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; id-type: 1 #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断" field-strategy: 2 #驼峰下划线转换 db-column-underline: true #刷新mapper 调试神器 refresh-mapper: true #逻辑删除配置 logic-delete-value: -1 logic-not-delete-value: 0 #自定义SQL注入器 sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector configuration: map-underscore-to-camel-case: true cache-enabled: false call-setters-on-nulls: true #springboot 项目mybatis plus 设置 jdbcTypeForNull (oracle数据库需配置JdbcType.NULL, 默认是Other) jdbc-type-for-null: 'null'
控制层(Controller)
package com.controller;import java.util.Arrays;import java.util.Calendar;import java.util.Date;import java.util.Map;import javax.servlet.http.HttpServletRequest;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.PathVariable;import org.springframework.web.bind.annotation.PostMapping;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.ResponseBody;import org.springframework.web.bind.annotation.RestController;import com.annotation.IgnoreAuth;import com.baomidou.mybatisplus.mapper.EntityWrapper;import com.entity.TokenEntity;import com.entity.UserEntity;import com.service.TokenService;import com.service.UserService;import com.utils.CommonUtil;import com.utils.MPUtil;import com.utils.PageUtils;import com.utils.R;import com.utils.ValidatorUtils;/** * 登录相关 */@RequestMapping("users")@RestControllerpublic class UserController{@Autowiredprivate UserService userService;@Autowiredprivate TokenService tokenService;/** * 登录 */@IgnoreAuth@PostMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));if(user==null || !user.getPassword().equals(password)) {return R.error("账号或密码不正确");}String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());return R.ok().put("token", token);}/** * 注册 */@IgnoreAuth@PostMapping(value = "/register")public R register(@RequestBody UserEntity user){// ValidatorUtils.validateEntity(user); if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) { return R.error("用户已存在"); } userService.insert(user); return R.ok(); }/** * 退出 */@GetMapping(value = "logout")public R logout(HttpServletRequest request) {request.getSession().invalidate();return R.ok("退出成功");}/** * 密码重置 */ @IgnoreAuth@RequestMapping(value = "/resetPass") public R resetPass(String username, HttpServletRequest request){ UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username)); if(user==null) { return R.error("账号不存在"); } user.setPassword("123456"); userService.update(user,null); return R.ok("密码已重置为:123456"); }/** * 列表 */ @RequestMapping("/page") public R page(@RequestParam Map<String, Object> params,UserEntity user){ EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>(); PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params)); return R.ok().put("data", page); }/** * 列表 */ @RequestMapping("/list") public R list( UserEntity user){EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>(); ew.allEq(MPUtil.allEQMapPre( user, "user")); return R.ok().put("data", userService.selectListView(ew)); } /** * 信息 */ @RequestMapping("/info/{id}") public R info(@PathVariable("id") String id){ UserEntity user = userService.selectById(id); return R.ok().put("data", user); } /** * 获取用户的session用户信息 */ @RequestMapping("/session") public R getCurrUser(HttpServletRequest request){ Long id = (Long)request.getSession().getAttribute("userId"); UserEntity user = userService.selectById(id); return R.ok().put("data", user); } /** * 保存 */ @PostMapping("/save") public R save(@RequestBody UserEntity user){// ValidatorUtils.validateEntity(user); if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) { return R.error("用户已存在"); } userService.insert(user); return R.ok(); } /** * 修改 */ @RequestMapping("/update") public R update(@RequestBody UserEntity user){// ValidatorUtils.validateEntity(user); userService.updateById(user);//全部更新 return R.ok(); } /** * 删除 */ @RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ userService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); }}
业务层(Service)
package com.service;import java.util.List;import java.util.Map;import org.apache.ibatis.annotations.Param;import com.baomidou.mybatisplus.mapper.Wrapper;import com.baomidou.mybatisplus.service.IService;import com.entity.UserEntity;import com.utils.PageUtils;/** * 系统用户 * @author yangliyuan * @date 2019年10月10日 上午9:18:20 */public interface UserService extends IService<UserEntity> { PageUtils queryPage(Map<String, Object> params);List<UserEntity> selectListView(Wrapper<UserEntity> wrapper); PageUtils queryPage(Map<String, Object> params,Wrapper<UserEntity> wrapper); }
数据访问层(Dao)
package com.dao;import java.util.List;import org.apache.ibatis.annotations.Param;import com.baomidou.mybatisplus.mapper.BaseMapper;import com.baomidou.mybatisplus.mapper.Wrapper;import com.baomidou.mybatisplus.plugins.pagination.Pagination;import com.entity.UserEntity;/** * 用户 */public interface UserDao extends BaseMapper<UserEntity> {List<UserEntity> selectListView(@Param("ew") Wrapper<UserEntity> wrapper);List<UserEntity> selectListView(Pagination page,@Param("ew") Wrapper<UserEntity> wrapper);}