该项目可以分为三个大模块:管理人员登录模块、学生登录模块、宿管管理模块。每个大模块后面跟随很多小模块。本系统完成了基本所需功能,界面清晰,操作简单又实用,基本满足了学校对学生宿舍信息的增添、查询、修改和删除等功能,且具有登录系统使该系统具有一定的安全性,大大减少了操作人员和用户的工作负担,提高了学生管理的工作效率和学校的信息化的水平。
1、修改个人信息
2、宿管人员管理
3、公告管理
4、学生管理
5、宿舍评分统计
1、登录
2、查看宿舍电费
3、查看宿管人员
4、查看文明宿舍
5、签到打卡
6、宿舍调换
7、宿舍报修
8、宿舍评分统计
9、查看公告
1、登录
2、修改个人信息
3、楼层管理
4、宿舍管理
5、宿舍电费缴费管理
6、文明宿舍管理
7、宿舍调换管理
8、报修管理
9、公告管理
1、用户登录页面:
相关代码:
/**
* 登录
* @param request
* @param response
*/
private void login(HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
removeAll(request,response);
String userName = request.getParameter("username");
String password = request.getParameter("pwd");
String type = request.getParameter("type");
if(type.equals("1")){
Admin admin = new Admin();
admin.setUsername(userName);
admin.setPwd(password);
Admin admin1 = service.selectAdmin(admin);
try {
if (admin1 == null){
request.setAttribute("message", "管理员用户不存在或者密码错误");
request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request, response);
}else {
request.getSession().setAttribute("admin",admin1);
request.getSession().setAttribute("flag",1);
request.getRequestDispatcher("/WEB-INF/views/main.jsp").forward(request, response);
}
} catch (Exception e) {
e.printStackTrace();
}
}else if(type.equals("2")){
Student student = new Student();
student.setStuno(userName);
student.setPwd(password);
Student student1 = service.selectstudent(student);
try {
if (student1 == null){
request.setAttribute("message", "学生不存在或者密码错误");
request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request, response);
}else {
request.getSession().setAttribute("student",student1);
request.getSession().setAttribute("flag",2);
request.getRequestDispatcher("/WEB-INF/views/main.jsp").forward(request, response);
}
} catch (Exception e) {
e.printStackTrace();
}
}else if(type.equals("3")){
Sgry sgry = service.selectSgry(userName,password);
try {
if (sgry == null){
request.setAttribute("message", "宿管人员不存在或者密码错误");
request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request, response);
}else {
request.getSession().setAttribute("sgry",sgry);
request.getSession().setAttribute("flag",3);
request.getRequestDispatcher("/WEB-INF/views/main.jsp").forward(request, response);
}
} catch (Exception e) {
e.printStackTrace();
}
}else{
request.setAttribute("message", "账号不存在或者密码错误");
try {
request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request, response);
} catch (Exception e) {
e.printStackTrace();
}
}
}
2、宿管用户登录页面
以及信息的修改、删除功能模块
相关代码:
/**
* 分页查询宿管人员
* @param request
* @param response
*/
private void sgryList(HttpServletRequest request,
HttpServletResponse response) {
String p=request.getParameter("p");//接收页码
int pageSize=4;//每页显示5条
int pageNum=1; //默认第一页
if(p!=null){
pageNum= Integer.parseInt(p);
}
//调用分页查询
List list=service.getsgryListPage(pageNum,pageSize);
//携带参数到页面
int nums=service.querysgryCount(); //查询总数
//计算总页数
int totalPage=(nums%pageSize==0)? (nums/pageSize):(nums/pageSize+1);
request.setAttribute("cp",pageNum); //当前页
request.setAttribute("tp",totalPage); //总页数
try {
request.removeAttribute("msg");
request.setAttribute("list" ,list);
request.getRequestDispatcher("/WEB-INF/views/sgry/sgryList.jsp").forward(request, response);
} catch (Exception e) {
e.printStackTrace();
}
}
相关代码:
/**
* 添加宿管人员
* @param request
* @param response
*/
private void addsgry(HttpServletRequest request,
HttpServletResponse response) {
Sgry ss = fileUpload(request);
try {
request.removeAttribute("message");
service.addsgry(ss);
response.sendRedirect(request.getContextPath()+"/SgryServlet?action=sgryList");
} catch (Exception e) {
e.printStackTrace();
}
}
以及公告的增加、修改、删除功能模块。
相关代码:
/**
* 分页查询公告
* @param request
* @param response
*/
private void boardList(HttpServletRequest request,
HttpServletResponse response) {
String p=request.getParameter("p");//接收页码
int pageSize=4;//每页显示5条
int pageNum=1; //默认第一页
if(p!=null){
pageNum= Integer.parseInt(p);
}
//调用分页查询
List list=bs.getBoardListPage(pageNum,pageSize);
//携带参数到页面
int nums=bs.queryBoardCount(); //查询总数
//计算总页数
int totalPage=(nums%pageSize==0)? (nums/pageSize):(nums/pageSize+1);
request.setAttribute("cp",pageNum); //当前页
request.setAttribute("tp",totalPage); //总页数
try {
request.removeAttribute("msg");
request.setAttribute("list" ,list);
request.getRequestDispatcher("/WEB-INF/views/board/boardList.jsp").forward(request, response);
} catch (Exception e) {
e.printStackTrace();
}
}
以及学生信息的修改和删除功能模块。
相关代码:
/**
* 分页查询学生
* @param request
* @param response
*/
private void studentList(HttpServletRequest request,
HttpServletResponse response) {
String p=request.getParameter("p");//接收页码
int pageSize=4;//每页显示5条
int pageNum=1; //默认第一页
if(p!=null){
pageNum= Integer.parseInt(p);
}
//调用分页查询
List list=service.getstudentListPage(pageNum,pageSize);
//携带参数到页面
int nums=service.querystudentCount(); //查询总数
//计算总页数
int totalPage=(nums%pageSize==0)? (nums/pageSize):(nums/pageSize+1);
request.setAttribute("cp",pageNum); //当前页
request.setAttribute("tp",totalPage); //总页数
try {
request.removeAttribute("msg");
request.setAttribute("list" ,list);
request.getRequestDispatcher("/WEB-INF/views/student/studentList.jsp").forward(request, response);
} catch (Exception e) {
e.printStackTrace();
}
}
相关代码:
/**
* 添加学生
* @param request
* @param response
*/
private void addstudent(HttpServletRequest request,
HttpServletResponse response) {
Student ss = fileUpload(request);
try {
Student s1 = service.selectStudentByNo(ss.getStuno());
if(s1 != null){
request.setAttribute("message", "学号重复!");
request.getRequestDispatcher("/WEB-INF/views/student/addStudent.jsp").forward(request,response);
}else{
request.removeAttribute("message");
service.addstudent(ss);
response.sendRedirect(request.getContextPath()+"/StudentServlet?action=studentList");
}
} catch (Exception e) {
e.printStackTrace();
}
}
基于echarts技术实现此功能。