当前位置:网站首页>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
边栏推荐
- HTB-Apocalyst
- Is it safe for CICC fortune to speculate in stocks? The securities company with the cheapest handling fee
- Credit card number recognition (openCV, code analysis)
- 什么是虚拟摄像头
- 提问征集丨快来向NLLB作者提问啦!(智源Live第24期)
- 03 common set security classes under JUC
- Detailed explanation of nat/napt address translation (internal and external network communication) technology [Huawei ENSP]
- OSPF综合实验
- Complete MySQL commands
- Qt最基本的布局,创建window界面
猜你喜欢

我们被一个 kong 的性能 bug 折腾了一个通宵

Reflection, enumeration, and lambda expressions

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

Research and application of the whole configuration of large humanoid robot

PS + PL heterogeneous multicore case development manual for Ti C6000 tms320c6678 DSP + zynq-7045 (3)

单例模式
![Detailed explanation of nat/napt address translation (internal and external network communication) technology [Huawei ENSP]](/img/84/3f5092bc2da6dfe657d7c27c6492cc.png)
Detailed explanation of nat/napt address translation (internal and external network communication) technology [Huawei ENSP]

QCF for deep packet inspection paper summary

【C】 Flexible array

2022 what is your sense of security? Volvo asked in the middle of the year
随机推荐
parker泵PV140R1K1T1PMMC
Pytorch installation CUDA corresponding
Daily1:SVM
Kalibr calibration realsensed435i -- multi camera calibration
超简单!只需简单几步即可为TA定制天气小助理!!
Musk was exposed to be the founder of Google: he broke up his best friend's second marriage and knelt down to beg for forgiveness
ES6高级-查询商品案例
My brother created his own AI anti procrastination system, and he was "blinded" when playing with his mobile phone | reddit was hot
TI C6000 TMS320C6678 DSP+ Zynq-7045的PS + PL异构多核案例开发手册(3)
【5分钟Paper】Pointer Network指针网络
全志A40i工业核心板,100%国产4核ARM Cortex-A7,支持“双屏异显”【显示接口能力,工业HMI首选方案】
[leetcode daily question] - 121. The best time to buy and sell stocks
Summary of QT plug-in development -- add plug-in menu in the main interface
Glyphicons V3 字体图标查询
tensorboard多个events文件显示紊乱的解决办法
数仓:爱奇艺数仓平台建设实践
VS2019Debug模式太卡进不去断点
TI C6000 TMS320C6678 DSP+ Zynq-7045的PS + PL异构多核案例开发手册(4)
04 callable and common auxiliary classes
拒绝噪声,耳机小白的入门之旅