当前位置:网站首页>基于SSM开发实现校园疫情防控管理系统
基于SSM开发实现校园疫情防控管理系统
2022-07-26 15:34:00 【编程指南针】
作者主页:编程指南针
作者简介:Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师
主要内容:Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助
文末获取源码
项目编号:BS-XX-122
一,项目简介
本项目基于java开发语言,采用SSM框架+MYSQL数据库开发的校园疫情管理系统,系统包含超级管理员,系统管理员、学生角色,功能如下:
超级管理员:管理员管理;学生管理;风险地区管理;行程管理;健康管理;请假管理、疫情通告;个人信息修改、修改密码;
系统管理员:功能和超级管理员基本一致,只是少了一个管理员管理;
学生:首页图表统计(柱状图、饼状图);行程上报(可上传行程码和健康码);健康上报(上传核算检测报告);请假管理;疫情通告;个人信息修改、修改密码;
系统界面美观大方,功能及其丰富,使用了ssm、jquery、ajax、layui、echart等技术栈,适合作为毕业设计、课程设计。
二,环境介绍
语言环境:Java: jdk1.8
数据库:Mysql: mysql5.7
应用服务器:Tomcat: tomcat8.5.31
开发工具:IDEA或eclipse
后台开发技术:SSM框架+SpringTask定时任务
前端开发技术:Layui+Jquery+AjAX+Echart
三,系统展示
登陆界面

管理员登陆操作:

学生管理

风险地区管理:

行程管理:

健康信息管理:

请假管理:

疫情通告管理

消息提醒:

学生登陆系统:主要是个人的行程和健康信息的上报以及请假等学生用相关功能

不再一一展示
四,核心代码展示
package com.xiaoniucr.controller;
import com.xiaoniucr.dto.PageQueryDto;
import com.xiaoniucr.entity.Admin;
import com.xiaoniucr.vo.JSONReturn;
import com.xiaoniucr.vo.LoginSession;
import com.xiaoniucr.vo.PageVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 管理员控制器
*/
@Controller
@RequestMapping(value = "/admin")
public class AdminController extends BaseController {
/**
* 管理员查询分页
* @return
*/
@RequestMapping(value = "/list")
@ResponseBody
public PageVo findAdmin(@RequestParam Map<String,Object> map){
PageQueryDto queryDto = new PageQueryDto(map);
return adminService.page(queryDto);
}
/**
* 根据ID查询管理员
* @param id
* @return
*/
@RequestMapping(value = "/{id}")
@ResponseBody
public JSONReturn selectById(@PathVariable(value = "id")Integer id){
Admin admin = adminService.selectById(id);
return JSONReturn.success("查询成功!",admin);
}
/**
* 添加管理员
* @param admin
* @return
*/
@RequestMapping(value = "/add")
@ResponseBody
public JSONReturn add(@RequestBody Admin admin){
return adminService.add(admin);
}
/**
* 更新管理员
* @param admin
* @return
*/
@RequestMapping(value = "/update")
@ResponseBody
public JSONReturn update(@RequestBody Admin admin){
Integer rows = adminService.update(admin);
return rows > 0 ? JSONReturn.success("更新成功!") : JSONReturn.fail("操作失败!");
}
/**
* 删除管理员
* @param admin
* @return
*/
@RequestMapping(value = "/del")
@ResponseBody
public JSONReturn del(@RequestBody Admin admin){
Integer rows = adminService.del(admin);
return rows > 0 ? JSONReturn.success("删除成功!") : JSONReturn.fail("删除失败!");
}
/**
* 获取当前管理员个人信息
* @return
*/
@RequestMapping(value = "/info")
@ResponseBody
public JSONReturn info(){
LoginSession session = (LoginSession) getSession("user");
Admin admin = adminService.selectById(session.getId());
return JSONReturn.success("查询成功!",admin);
}
/**
* 更新个人信息
* @param admin
* @return
*/
@RequestMapping(value = "/updateInfo")
@ResponseBody
public JSONReturn updateInfo(@RequestBody Admin admin){
return adminService.updateInfo(admin);
}
}
package com.xiaoniucr.controller;
import com.xiaoniucr.dto.PageQueryDto;
import com.xiaoniucr.entity.AreaRisk;
import com.xiaoniucr.vo.JSONReturn;
import com.xiaoniucr.vo.PageVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
*
* 风险地区管理控制器
*/
@Controller
@RequestMapping(value = "/area")
public class AreaRiskController extends BaseController {
/**
* 地区查询分页
* @return
*/
@RequestMapping(value = "/list")
@ResponseBody
public PageVo findArea(@RequestParam Map<String,Object> map){
PageQueryDto queryDto = new PageQueryDto(map);
return areaRiskService.page(queryDto);
}
/**
* 根据ID查询记录
* @param id
* @return
*/
@RequestMapping(value = "/{id}")
@ResponseBody
public JSONReturn selectById(@PathVariable(value = "id")Integer id){
AreaRisk areaRisk = areaRiskService.selectById(id);
return JSONReturn.success("查询成功!",areaRisk);
}
/**
* 添加地区
* @param areaRisk
* @return
*/
@RequestMapping(value = "/add")
@ResponseBody
public JSONReturn add(@RequestBody AreaRisk areaRisk){
Integer rows = areaRiskService.add(areaRisk);
return rows > 0 ? JSONReturn.success("添加成功!") : JSONReturn.fail("添加失败!");
}
/**
* 更新地区
* @param areaRisk
* @return
*/
@RequestMapping(value = "/update")
@ResponseBody
public JSONReturn update(@RequestBody AreaRisk areaRisk){
Integer rows = areaRiskService.update(areaRisk);
return rows > 0 ? JSONReturn.success("更新成功!") : JSONReturn.fail("操作失败!");
}
/**
* 删除地区
* @param areaRisk
* @return
*/
@RequestMapping(value = "/del")
@ResponseBody
public JSONReturn del(@RequestBody AreaRisk areaRisk){
Integer rows = areaRiskService.del(areaRisk.getId());
return rows > 0 ? JSONReturn.success("删除成功!") : JSONReturn.fail("删除失败!");
}
/**
* 查询所有地区
* @return
*/
@RequestMapping(value = "/findAll")
@ResponseBody
public JSONReturn findAll(){
List<AreaRisk> users = areaRiskService.findAll();
return JSONReturn.success("查询成功!",users);
}
}
package com.xiaoniucr.controller;
import com.xiaoniucr.dto.PageQueryDto;
import com.xiaoniucr.entity.HealthReport;
import com.xiaoniucr.util.PropertiesUtils;
import com.xiaoniucr.vo.JSONReturn;
import com.xiaoniucr.vo.LoginSession;
import com.xiaoniucr.vo.PageVo;
import org.apache.commons.io.FileUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import sun.rmi.runtime.Log;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 健康上报控制器
*/
@Controller
@RequestMapping(value = "/hr")
public class HealthReportController extends BaseController {
/**
* 健康上报记录查询分页
* @return
*/
@RequestMapping(value = "/list")
@ResponseBody
public PageVo findHealthReport(@RequestParam Map<String,Object> map){
LoginSession loginSession = (LoginSession) getSession("user");
PageQueryDto queryDto = new PageQueryDto(map);
if(loginSession.getRole() == 2){
queryDto.put("userId",loginSession.getId());
}
return healthReportService.page(queryDto);
}
/**
* 根据ID查询健康上报记录
* @param id
* @return
*/
@RequestMapping(value = "/{id}")
@ResponseBody
public JSONReturn selectById(@PathVariable(value = "id")Integer id){
HealthReport report = healthReportService.selectById(id);
return JSONReturn.success("查询成功!",report);
}
/**
* 添加健康上报记录
* @param report
* @return
*/
@RequestMapping(value = "/add")
@ResponseBody
public JSONReturn add(@RequestBody HealthReport report){
LoginSession session = (LoginSession) getSession("user");
report.setUserId(session.getId());
Integer rows = healthReportService.add(report);
return rows > 0 ? JSONReturn.success("添加成功!") : JSONReturn.fail("添加失败!");
}
/**
* 更新健康上报记录
* @param report
* @return
*/
@RequestMapping(value = "/update")
@ResponseBody
public JSONReturn update(@RequestBody HealthReport report){
Integer rows = healthReportService.update(report);
return rows > 0 ? JSONReturn.success("更新成功!") : JSONReturn.fail("操作失败!");
}
/**
* 删除健康上报记录
* @param report
* @return
*/
@RequestMapping(value = "/del")
@ResponseBody
public JSONReturn del(@RequestBody HealthReport report){
Integer rows = healthReportService.del(report);
return rows > 0 ? JSONReturn.success("删除成功!") : JSONReturn.fail("删除失败!");
}
/**
* 上传体检报告
* @param request
* @return
*/
@RequestMapping(value = "/uploadReport",method = RequestMethod.POST )
@ResponseBody
public JSONReturn uploadHealthCode(HttpServletRequest request) {
Integer id = Integer.parseInt(request.getParameter("id"));
//得到文件的列表
List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("file");
// 创建年月文件夹
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String dateDirs = sdf.format(new Date());
//这里的地址文件上传到的地方
for (int i = 0; i < files.size(); i++) {
MultipartFile file = files.get(i);
if (file.isEmpty()) {
return JSONReturn.fail("上传第" + (i++) + "个文件失败");
}
String originalFilename = file.getOriginalFilename();
// 新的文件名称
String newFileName = System.currentTimeMillis() + originalFilename.substring(originalFilename.lastIndexOf("."));
// 新文件
File dest = new File(PropertiesUtils.getValue("file.path") + File.separator + dateDirs + File.separator + newFileName);
// 判断目标文件所在的目录是否存在
if (!dest.getParentFile().exists()) {
// 如果目标文件所在的目录不存在,则创建父目录
dest.getParentFile().mkdirs();
}
try {
HealthReport healthReport = healthReportService.selectById(id);
healthReport.setReportFileName(originalFilename);
healthReport.setReportFilePath("/"+dateDirs+"/"+newFileName);
healthReportService.update(healthReport);
file.transferTo(dest);
} catch (IOException e) {
return JSONReturn.fail("上传第" + (i++) + "个文件失败:"+e.getMessage());
}
}
return JSONReturn.success("文件上传成功!");
}
@RequestMapping(value="/downloadReport")
public ResponseEntity<byte[]> download(@RequestParam Integer id)throws Exception {
//服务器中下载文件的路径
String filePath = PropertiesUtils.getValue("file.path");
HealthReport hr = healthReportService.selectById(id);
File file = new File(filePath + hr.getReportFilePath());
HttpHeaders headers = new HttpHeaders();
//下载显示的文件名,解决中文名称乱码问题
String downloadFielName = new String(hr.getReportFileName().getBytes("UTF-8"),"iso-8859-1");
//通知浏览器以attachment(下载方式)打开图片
headers.setContentDispositionFormData("attachment", downloadFielName);
//application/octet-stream : 二进制流数据(最常见的文件下载)。
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
//通过fileutils的工具输入输出下载的文件
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),
headers, HttpStatus.CREATED);
}
}
package com.xiaoniucr.controller;
import com.xiaoniucr.dto.LoginDto;
import com.xiaoniucr.dto.UpdtPwdDto;
import com.xiaoniucr.entity.Admin;
import com.xiaoniucr.entity.Message;
import com.xiaoniucr.entity.User;
import com.xiaoniucr.vo.JSONReturn;
import com.xiaoniucr.vo.LoginSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.util.List;
/**
* 登录相关接口
*/
@Controller
public class LoginController extends BaseController{
@RequestMapping("/login.html")
public String login(){
return "login";
}
@RequestMapping("/register.html")
public String register(){
return "register";
}
/**
* 桌面页,统计以下数据信息
* @param map
* @return
*/
@RequestMapping("/welcome.html")
public String welcome(ModelMap map){
Integer totalNum = userService.countTotal();
Integer isolateNum = userService.countByHealth(1);
Integer definiteNum = userService.countByHealth(2);
map.put("totalNum",totalNum);
map.put("isolateNum",isolateNum);
map.put("definiteNum",definiteNum);
return "admin/welcome";
}
/**
* 首页
* @return
*/
@RequestMapping("/index.html")
public String index(ModelMap map){
LoginSession loginSession = (LoginSession) getSession("user");
if(loginSession == null){
return "login";
}
Integer latestNum = messageService.countLatestNum(loginSession.getId());
List<Message> messageList = messageService.selectLatestTopList(loginSession.getId(),4);
map.put("latestNum",latestNum);
map.put("messageList",messageList);
return "index";
}
/**
* 登录验证
* @param loginDto
* @return
*/
@RequestMapping("/login")
@ResponseBody
public JSONReturn login(@RequestBody LoginDto loginDto, HttpSession session){
return userService.login(loginDto,session);
}
/**
* 管理员修改密码
* @param updtPwdDto
* @return
*/
@RequestMapping(value = "/updtpwd")
@ResponseBody
public JSONReturn updtpwd(@RequestBody UpdtPwdDto updtPwdDto) {
LoginSession session = (LoginSession) getSession("user");
Integer role = session.getRole();
if(role == 0 || role == 1){
Admin admin = adminService.selectById(session.getId());
if (!admin.getPassword().equals(updtPwdDto.getOpassword())) {
return JSONReturn.fail("原始密码错误!");
}
admin.setPassword(updtPwdDto.getNpassword());
Integer rows = adminService.update(admin);
return rows > 0 ? JSONReturn.success("更新成功!") : JSONReturn.fail("操作失败!");
}else{
User user = userService.selectById(session.getId());
if(!user.getPassword().equals(updtPwdDto.getOpassword())){
return JSONReturn.fail("原始密码错误!");
}
user.setPassword(updtPwdDto.getNpassword());
Integer rows = userService.update(user);
return rows > 0 ? JSONReturn.success("更新成功!") : JSONReturn.fail("操作失败!");
}
}
/**
* 退出系统
* @return
*/
@RequestMapping("/logout")
public String logout(){
removeSession("user");
return "login";
}
/**
* 学生比例
* @return
*/
@RequestMapping(value = "/statis")
@ResponseBody
public JSONReturn statis(){
return userService.statis();
}
}
五,项目总结
边栏推荐
- Enterprise digital transformation needs in-depth research, and it cannot be transformed for the sake of transformation
- 777. Exchange adjacent characters in LR string
- # 工欲善其事必先利其器-C语言拓展--嵌入式C语言(十一)
- If you want to be good at work, you must first use its tools -c language expansion -- embedded C language (11)
- Glyphs V3 Font Icon query
- 北京的大学排名
- [expdp export data] expdp exports a table with 23 rows of records and no lob field. It takes 48 minutes. Please help us have a look
- 2022你的安全感是什么?沃尔沃年中问道
- Desktop application layout
- QT is the most basic layout, creating a window interface
猜你喜欢

Reflection, enumeration, and lambda expressions

sklearn clustering聚类

OSPF综合实验

Summary of QT plug-in development -- add plug-in menu in the main interface

教程篇(7.0) 05. 通过FortiClient EMS发放FortiClient * FortiClient EMS * Fortinet 网络安全专家 NSE 5

什么是传输层协议TCP/UDP???

Practical task scheduling platform (scheduled task)

信用卡数字识别(opencv,代码分析)

Strengthen the defense line of ecological security, and carry out emergency drills for environmental emergencies in Guangzhou
FTP协议
随机推荐
Glyphicons V3 字体图标查询
PS + PL heterogeneous multicore case development manual for Ti C6000 tms320c6678 DSP + zynq-7045 (3)
USB转串口参数配置功能
机器人手眼标定Ax=xB(eye to hand和eye in hand)及平面九点法标定
Tool skill learning (II): pre skills shell
pytorch---进阶篇(函数使用技巧/注意事项)
Data warehouse: Data Modeling and log system in data warehouse construction
The R language uses the histogram function in the lattice package to visualize the histogram (histogram plot), the col parameter to customize the fill color, and the type parameter to customize the hi
Data preprocessing of data mining
Tutorial (7.0) 05. Issue forticlient * forticlient EMS * Fortinet network security expert NSE 5 through forticlient EMS
R language wilcox The test function compares whether there is a significant difference in the central position of the population of two nonparametric samples (if the two sample data are paired data, s
【五分钟Paper】基于参数化动作空间的强化学习
Interview with data center and Bi business (IV) -- look at the essence of ten questions
Promise, async await and the solution of cross domain problems -- the principle of proxy server
[static code quality analysis tool] Shanghai daoning brings you sonarource/sonarqube download, trial and tutorial
北京的大学排名
我们被一个 kong 的性能 bug 折腾了一个通宵
理解卷积神经网络中的权值共享
FOC电机控制基础
Using information entropy to construct decision tree