当前位置:网站首页>Development and implementation of campus epidemic prevention and control management system based on SSM
Development and implementation of campus epidemic prevention and control management system based on SSM
2022-07-26 15:56:00 【Programming compass】
Author URI : Programming compass
Author's brief introduction :Java Quality creators in the field 、CSDN Blogger 、 Nuggets guest author 、 Years of architect design experience 、 Tencent classroom resident lecturer
primary coverage :Java project 、 Graduation project 、 The resume template 、 Learning materials 、 Interview question bank 、 Technical assistance
Get the source code at the end of the article
Item number :BS-XX-122
One , Project brief introduction
This project is based on java development language , use SSM frame +MYSQL The campus epidemic management system developed by database , The system contains super administrators , System administrator 、 Student role , Function as follows :
Super administrator : Administrator management ; Student management ; Risk area management ; Itinerary management ; Health management ; Leave management 、 Epidemic notification ; Personal information modification 、 Change Password ;
System administrator : The function is basically the same as that of super administrator , Only one administrator is missing ;
Student : Home page chart statistics ( Histogram 、 The pie chart ); Travel Report ( You can upload travel code and health code ); Health Report ( Upload accounting test report ); Leave management ; Epidemic notification ; Personal information modification 、 Change Password ;
The system interface is beautiful , It's very versatile , Used ssm、jquery、ajax、layui、echart Etc. technology stack , Suitable for graduation design 、 curriculum design .
Two , Introduction to the environment
Language environment :Java: jdk1.8
database :Mysql: mysql5.7
application server :Tomcat: tomcat8.5.31
development tool :IDEA or eclipse
Background development technology :SSM frame +SpringTask Timing task
Front end development technology :Layui+Jquery+AjAX+Echart
3、 ... and , System display
Login interface

Administrator login operation :

Student management

Risk area management :

Itinerary management :

Health information management :

Leave management :

Epidemic notification management

Message alert :

Student login system : It mainly refers to the reporting of personal travel and health information, as well as leave and other related functions used by students

No more shows
Four , Core code display
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;
/**
* Administrator controller
*/
@Controller
@RequestMapping(value = "/admin")
public class AdminController extends BaseController {
/**
* Administrator query paging
* @return
*/
@RequestMapping(value = "/list")
@ResponseBody
public PageVo findAdmin(@RequestParam Map<String,Object> map){
PageQueryDto queryDto = new PageQueryDto(map);
return adminService.page(queryDto);
}
/**
* according to ID Query Administrator
* @param id
* @return
*/
@RequestMapping(value = "/{id}")
@ResponseBody
public JSONReturn selectById(@PathVariable(value = "id")Integer id){
Admin admin = adminService.selectById(id);
return JSONReturn.success(" The query is successful !",admin);
}
/**
* Add Administrator
* @param admin
* @return
*/
@RequestMapping(value = "/add")
@ResponseBody
public JSONReturn add(@RequestBody Admin admin){
return adminService.add(admin);
}
/**
* Update administrator
* @param admin
* @return
*/
@RequestMapping(value = "/update")
@ResponseBody
public JSONReturn update(@RequestBody Admin admin){
Integer rows = adminService.update(admin);
return rows > 0 ? JSONReturn.success(" The update is successful !") : JSONReturn.fail(" operation failed !");
}
/**
* Delete Administrator
* @param admin
* @return
*/
@RequestMapping(value = "/del")
@ResponseBody
public JSONReturn del(@RequestBody Admin admin){
Integer rows = adminService.del(admin);
return rows > 0 ? JSONReturn.success(" Delete successful !") : JSONReturn.fail(" Delete failed !");
}
/**
* Get the personal information of the current administrator
* @return
*/
@RequestMapping(value = "/info")
@ResponseBody
public JSONReturn info(){
LoginSession session = (LoginSession) getSession("user");
Admin admin = adminService.selectById(session.getId());
return JSONReturn.success(" The query is successful !",admin);
}
/**
* Update personal information
* @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;
/**
*
* Risk area management controller
*/
@Controller
@RequestMapping(value = "/area")
public class AreaRiskController extends BaseController {
/**
* Region query page
* @return
*/
@RequestMapping(value = "/list")
@ResponseBody
public PageVo findArea(@RequestParam Map<String,Object> map){
PageQueryDto queryDto = new PageQueryDto(map);
return areaRiskService.page(queryDto);
}
/**
* according to ID Query log
* @param id
* @return
*/
@RequestMapping(value = "/{id}")
@ResponseBody
public JSONReturn selectById(@PathVariable(value = "id")Integer id){
AreaRisk areaRisk = areaRiskService.selectById(id);
return JSONReturn.success(" The query is successful !",areaRisk);
}
/**
* Add region
* @param areaRisk
* @return
*/
@RequestMapping(value = "/add")
@ResponseBody
public JSONReturn add(@RequestBody AreaRisk areaRisk){
Integer rows = areaRiskService.add(areaRisk);
return rows > 0 ? JSONReturn.success(" Add success !") : JSONReturn.fail(" Add failure !");
}
/**
* Update area
* @param areaRisk
* @return
*/
@RequestMapping(value = "/update")
@ResponseBody
public JSONReturn update(@RequestBody AreaRisk areaRisk){
Integer rows = areaRiskService.update(areaRisk);
return rows > 0 ? JSONReturn.success(" The update is successful !") : JSONReturn.fail(" operation failed !");
}
/**
* Delete region
* @param areaRisk
* @return
*/
@RequestMapping(value = "/del")
@ResponseBody
public JSONReturn del(@RequestBody AreaRisk areaRisk){
Integer rows = areaRiskService.del(areaRisk.getId());
return rows > 0 ? JSONReturn.success(" Delete successful !") : JSONReturn.fail(" Delete failed !");
}
/**
* Check all regions
* @return
*/
@RequestMapping(value = "/findAll")
@ResponseBody
public JSONReturn findAll(){
List<AreaRisk> users = areaRiskService.findAll();
return JSONReturn.success(" The query is successful !",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;
/**
* Health reporting controller
*/
@Controller
@RequestMapping(value = "/hr")
public class HealthReportController extends BaseController {
/**
* Health report record query page
* @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);
}
/**
* according to ID Query health report records
* @param id
* @return
*/
@RequestMapping(value = "/{id}")
@ResponseBody
public JSONReturn selectById(@PathVariable(value = "id")Integer id){
HealthReport report = healthReportService.selectById(id);
return JSONReturn.success(" The query is successful !",report);
}
/**
* Add health report record
* @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(" Add success !") : JSONReturn.fail(" Add failure !");
}
/**
* Update health report records
* @param report
* @return
*/
@RequestMapping(value = "/update")
@ResponseBody
public JSONReturn update(@RequestBody HealthReport report){
Integer rows = healthReportService.update(report);
return rows > 0 ? JSONReturn.success(" The update is successful !") : JSONReturn.fail(" operation failed !");
}
/**
* Delete the health report record
* @param report
* @return
*/
@RequestMapping(value = "/del")
@ResponseBody
public JSONReturn del(@RequestBody HealthReport report){
Integer rows = healthReportService.del(report);
return rows > 0 ? JSONReturn.success(" Delete successful !") : JSONReturn.fail(" Delete failed !");
}
/**
* Upload the physical examination report
* @param request
* @return
*/
@RequestMapping(value = "/uploadReport",method = RequestMethod.POST )
@ResponseBody
public JSONReturn uploadHealthCode(HttpServletRequest request) {
Integer id = Integer.parseInt(request.getParameter("id"));
// Get a list of files
List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("file");
// Create month month folder
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String dateDirs = sdf.format(new Date());
// The address file here is uploaded to
for (int i = 0; i < files.size(); i++) {
MultipartFile file = files.get(i);
if (file.isEmpty()) {
return JSONReturn.fail(" Upload the " + (i++) + " Files failed ");
}
String originalFilename = file.getOriginalFilename();
// New file name
String newFileName = System.currentTimeMillis() + originalFilename.substring(originalFilename.lastIndexOf("."));
// A new file
File dest = new File(PropertiesUtils.getValue("file.path") + File.separator + dateDirs + File.separator + newFileName);
// Determine whether the directory where the target file is located exists
if (!dest.getParentFile().exists()) {
// If the directory of the target file does not exist , Then create the parent directory
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(" Upload the " + (i++) + " Files failed :"+e.getMessage());
}
}
return JSONReturn.success(" File upload succeeded !");
}
@RequestMapping(value="/downloadReport")
public ResponseEntity<byte[]> download(@RequestParam Integer id)throws Exception {
// The path to download the file in the server
String filePath = PropertiesUtils.getValue("file.path");
HealthReport hr = healthReportService.selectById(id);
File file = new File(filePath + hr.getReportFilePath());
HttpHeaders headers = new HttpHeaders();
// Download the displayed file name , Solve the problem of garbled Chinese names
String downloadFielName = new String(hr.getReportFileName().getBytes("UTF-8"),"iso-8859-1");
// Notify the browser to attachment( Download mode ) Open the picture
headers.setContentDispositionFormData("attachment", downloadFielName);
//application/octet-stream : Binary stream data ( The most common file downloads ).
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
// adopt fileutils Tool input and output downloaded files
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;
/**
* Log in to the relevant interface
*/
@Controller
public class LoginController extends BaseController{
@RequestMapping("/login.html")
public String login(){
return "login";
}
@RequestMapping("/register.html")
public String register(){
return "register";
}
/**
* Desktop page , Statistics of the following data
* @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";
}
/**
* home page
* @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";
}
/**
* validate logon
* @param loginDto
* @return
*/
@RequestMapping("/login")
@ResponseBody
public JSONReturn login(@RequestBody LoginDto loginDto, HttpSession session){
return userService.login(loginDto,session);
}
/**
* The administrator changes the password
* @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(" The original password is incorrect !");
}
admin.setPassword(updtPwdDto.getNpassword());
Integer rows = adminService.update(admin);
return rows > 0 ? JSONReturn.success(" The update is successful !") : JSONReturn.fail(" operation failed !");
}else{
User user = userService.selectById(session.getId());
if(!user.getPassword().equals(updtPwdDto.getOpassword())){
return JSONReturn.fail(" The original password is incorrect !");
}
user.setPassword(updtPwdDto.getNpassword());
Integer rows = userService.update(user);
return rows > 0 ? JSONReturn.success(" The update is successful !") : JSONReturn.fail(" operation failed !");
}
}
/**
* Exit the system
* @return
*/
@RequestMapping("/logout")
public String logout(){
removeSession("user");
return "login";
}
/**
* Proportion of students
* @return
*/
@RequestMapping(value = "/statis")
@ResponseBody
public JSONReturn statis(){
return userService.statis();
}
}
5、 ... and , Project summary
边栏推荐
猜你喜欢

Reflection, enumeration, and lambda expressions

Bucher gear pump qx81-400r301

潘多拉 IOT 开发板学习(RT-Thread)—— 实验17 ESP8266 实验(学习笔记)

Pytorch installation CUDA corresponding

My brother created his own AI anti procrastination system, and he was "blinded" when playing with his mobile phone | reddit was hot

Enterprise digital transformation needs in-depth research, and it cannot be transformed for the sake of transformation

Quanzhi a40i industrial core board, 100% domestic 4-core arm cortex-a7, supports "dual screen abnormal display" [display interface capability, preferred scheme for industrial HMI]

一文搞懂│XSS攻击、SQL注入、CSRF攻击、DDOS攻击、DNS劫持

【工具分享】自动生成文件目录结构工具mddir

This article explains in detail the discovery and processing of bigkey and hotkey in redis
随机推荐
hawe螺旋插装式单向阀RK4
Credit card number recognition (openCV, code analysis)
A comprehensive review of image enhancement technology in deep learning
什么是虚拟摄像头
拒绝噪声,耳机小白的入门之旅
Sklearn clustering clustering
2022 what is your sense of security? Volvo asked in the middle of the year
bucher齿轮泵QX81-400R301
TI C6000 TMS320C6678 DSP+ Zynq-7045的ZYNQ PS + PL异构多核案例开发手册(1)
数仓:爱奇艺数仓平台建设实践
Understand │ XSS attack, SQL injection, CSRF attack, DDoS attack, DNS hijacking
理解卷积神经网络中的权值共享
PS + PL heterogeneous multicore case development manual for Ti C6000 tms320c6678 DSP + zynq-7045 (2)
SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame
“卡片笔记法”在思源的具体实践案例
OpenGL learning diary 2 - shaders
My brother created his own AI anti procrastination system, and he was "blinded" when playing with his mobile phone | reddit was hot
Qt最基本的布局,创建window界面
[5 minutes paper] Pointer network
撤回就看不到了?三步让你微信防撤回。