基于javaweb的SSM自习室图书馆座位预约管理系统(java+ssm+jsp+easyui+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

210023562402

220023562402

230023562402

240023562402

250023562402

260023562402

基于javaweb的SSM自习室图书馆座位预约管理系统(java+ssm+jsp+easyui+mysql)

项目介绍

一款由jsp+ssm+mysql实现的图书馆预约占座管理系统,前端采用的是当下最流行的easyui框架,后台用的ssm(spring、springMVC、mybaits)框架.添加学生和教师时会自动在用户表中注册,定时任务会定时生成座位信息,阅览室分类中可设置信用等级,学生被扣分后信用等级低于相应的值后不能预约相应的阅览室座位.本项目分为管理员、教师、学生三种角色。

管理员角色包含以下功能: 管理员登陆,用户管理,师生信息管理,阅览室管理,信用积分管理,交流管理,信息统计,图书推荐等功能。

教师角色包含以下功能: 教师角色登陆,个人信息管理,管理学生的信用积分等功能。

学生角色包含以下功能: 学生账号登陆,阅览室信息查看,信息积分查看,选座位,选座管理,通知信息管理,信息交流,图书推荐等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;  5.数据库:MySql 5.7版本; 6.是否Maven项目:否;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+easyUI

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中config.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
@Autowired
private UserService<User> userService;

@RequestMapping("teacherIndex")
public String index(){
return "info/teacher";
}


@RequestMapping("teacherList")
public void teacherList(HttpServletRequest request,HttpServletResponse response){
try {
page = Integer.parseInt(request.getParameter("page")); //获取当前页
rows = Integer.parseInt(request.getParameter("rows")); //每页记录条数

// 构造查询条件
teacher = new Teacher();
teacher.setPage((page-1)*rows);
teacher.setRows(rows);
teacher.setName(request.getParameter("name"));
teacher.setNo(request.getParameter("no"));

User currentUser = (User)request.getSession().getAttribute("currentUser");


if(currentUser.getRoleId()==2){ //教师
teacher.setNo(currentUser.getUserName());
}

// 调用service层的查询方法查出记录和数量
List<Teacher> list = teacherService.findTeacher(teacher);
int total = teacherService.countTeacher(teacher);

JSONObject jsonObj = new JSONObject();//new一个JSON
jsonObj.put("total",total );//total代表一共有多少数据
jsonObj.put("rows", list);//row是代表显示的页的数据
WriterUtil.write(response,jsonObj.toString()); //将上述Json输出,前台ajax接收
} catch (Exception e) {
e.printStackTrace();
}
}



@RequestMapping("reserveTeacher")
public void reserve(HttpServletRequest request,HttpServletResponse response,Teacher teacher) {
JSONObject result = new JSONObject(); // new一个json对象
result.put("success", true);
String id = request.getParameter("id");
try {
if(StringUtil.isNotEmpty(id)){ //不为空,说明是修改操作
teacher.setId(Integer.parseInt(id));
teacherService.updateTeacher(teacher); //调用service的修改方法
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23





@Controller
@RequestMapping("seat")
public class SeatController {

private int page;
private int rows;
@Autowired
private SeatService<Seat> seatService;
private Seat seat;
@Autowired
private RoomService<Room> roomService;
@Autowired
private ChoiceService<Choice> choiceService;
private Choice choice;
@Autowired
private ScoreService<Score> scoreService;
private Score score;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
				if (sonNum == 1) {  
// 只有一个孩子,删除该孩子,且把父亲状态置为open
menu = new Menu();
menu.setMenuId(Integer.parseInt(parentId));
menu.setState("open");
menuService.updateMenu(menu);

menuService.deleteMenu(Integer.parseInt(menuId));
} else {
//不只一个孩子,直接删除
menuService.deleteMenu(Integer.parseInt(menuId));
}
result.put("success", true);
}

} catch (Exception e) {
e.printStackTrace();
result.put("errorMsg", "对不起,删除失败!");
}
WriterUtil.write(response, result.toString());
}



}
package dingzhen.controller;






/**
* 日志管理控制器
*/
@Controller
@RequestMapping("log")
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
	public static Date getNextDay(Date date,int day) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, day);
date = calendar.getTime();
return date;
}




}
package dingzhen.util;

// 两个定时器



@Component
@Controller
public class SeatUtil {
@Autowired
private SeatService<Seat> seatService;
@Autowired
private RoomService<Room> roomService;
@Autowired
private ChoiceService<Choice> choiceService;

//每天晚上11点生成后天的所有座位信息

@Scheduled(cron = "0 0 23 * * ?") //每天晚上23点运行一次 生成所有新的座位
@RequestMapping("addSeat")//http://localhost:8080/addSeat.htm
public void generateNextDay(){
System.out.println("生成座位1");
addNewSeat(1);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}



@RequestMapping("friendList")
public void list(HttpServletRequest request,HttpServletResponse response){
try {
User currentUser = (User)request.getSession().getAttribute("currentUser");
String currentStudentno = currentUser.getUserName(); //当前学号
choice = new Choice();
choice.setStudentno(currentStudentno);
List<Choice> currentList = choiceService.findChoice(choice);
String currentKeyword = "";
if(currentList != null && currentList.size() >0){

// 设置筛选推荐朋友的匹配条件
currentKeyword = currentList.get(0).getSeatkeyword();
currentKeyword = currentKeyword.substring(11, 20); // 获得08点-12点-1这样的字符串,表示在8-12这个时间段在id=1的阅览室
Choice c = new Choice();
c.setSeatkeyword(currentKeyword); //相同的时间段和自习室
c.setStudentno(currentStudentno); //排除自己
Date today = new Date();
Date lastDay = getNextDay(today, -20); //20天之内
c.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(lastDay));
c.setPipeishu(3); //至少有3次相同时间段相同教室
List<Choice> friendList = choiceService.findFriend(c); //查询匹配的朋友
List<Student> friendStudent = new ArrayList<Student>();
if(friendList == null || friendList.size()==0){
//没有匹配到一个相同的朋友
} else if (friendList.size() > 10) {
// 超过10取前10位
for(int i=0;i<10;i++){
Choice friendChoice = friendList.get(i);
String friendStudentno = friendChoice.getStudentno(); //得到学号
student = studentService.findOneStudentByno(friendStudentno); //通过学号查询学生
friendStudent.add(student);
}
} else {
// 不超过10条全部取出来
for(int i=0;i<friendList.size();i++){
Choice friendChoice = friendList.get(i);
String friendStudentno = friendChoice.getStudentno();


项目链接:
https://javayms.github.io?id=151122582008200va
https://javayms.pages.dev?id=151122582008200va