项目编号: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
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
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
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
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
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
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();
-
- }
-
-
-
-
-
-
-
- }