基于javaweb的SpringBoot校园维修管理系统(java+springboot+jsp+bootstrap+maven+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

070923561103

080923561103

090923561103

100923561103

110923561103

120923561103

基于javaweb的SpringBoot校园维修管理系统(java+springboot+jsp+bootstrap+maven+mysql)

项目介绍

本项目为后台管理系统,包括管理员与学生两种角色; 学生包含以下功能: 学生提交报修,添加维修,催单,水电缴费,登录页面等功能。

管理员包含以下功能: 查看所有报修单,催单,维修安排,学生管理,添加学生,维修人员管理等功能。

环境需要

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

技术栈

  1. 后端:SpringBoot 2. 前端:JSP+CSS+JavaScript+jquery+bootstrap

使用说明
运行项目,输入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

List<StudentResult> studentResults = new ArrayList<StudentResult>();

for (Student student : students) {
studentResults.add(new StudentResult(
student.getId(), student.getName(), student.getPassword(),
student.getSexual(), student.getSexual() == 0 ? "男" : "女",
student.getEmail(), student.getPhone(), student.getDoor())
);
}
model.addAttribute("students", studentResults);

return "admin/student";
}

@RequestMapping(value = "/addstudent", method = RequestMethod.GET)
public String addStudent(Model model) {
return "/admin/addStudent";
}

@RequestMapping(value = "/addstudent", method = RequestMethod.POST)
public String addStudent(@RequestParam("name") String name, @RequestParam("email") String email,
@RequestParam("password") String password, @RequestParam("sexual") String sexual,
@RequestParam("phone") String phone,@RequestParam("door") String door, Model model, HttpServletRequest httpServletRequest) {

int sex = sexual.equals("男") ? 0 : 1;

studentService.addStudent(System.currentTimeMillis()+"", name, password, sex, email, phone, door);
Door door2 = doorDao.queryByName(door);
if (door2==null) {
Door doorObject = new Door();
doorObject.setDate(new Date(System.currentTimeMillis()));
doorObject.setId(System.currentTimeMillis()+"");
doorObject.setName(door);
doorObject.setPower("100");
doorObject.setWater("100");
doorDao.add(doorObject);
}

return "redirect:/admin/student";
}

@RequestMapping(value = "/technician", method = RequestMethod.GET)
public String technician(Model model) {

List<Technician> techniciens = technicianService.getAllTechnician();

model.addAttribute("techniciens", techniciens);
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
@Controller
@RequestMapping(value = "/admin")
public class AdminController {
private Logger logger = LoggerFactory.getLogger(this.getClass());


@Resource
private RepairService repairService;

@Resource
private StudentService studentService;

@Resource
private AdminService adminService;

@Resource
private UrgentRepairService urgentRepairService;

@Resource
private MaintenanceService maintenanceService;

@Resource
private TechnicianService technicianService;

@Resource
private DoorDao doorDao;

@RequestMapping(value = "/login", method = RequestMethod.GET)
public String login(Model model) {
return "redirect:../student/login";
}

@RequestMapping(value = "/login", method = RequestMethod.POST)
@ResponseBody
public LoginResult login(int id, String password, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
logger.info("================admin login===================");
logger.info("admin id: "+id);
logger.info("admin password: "+password);
logger.info("================admin login===================");

Admin admin = adminService.getAdminById(id);

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
            if(student==null){
// stuName = spider.getStudentName(id, password);
// student = new Student(id, stuName, password);
// System.out.println(stuName);
// studentService.addStudent(id, stuName, password, 0, "", "");

loginResult = new LoginResult(true);
loginResult.setReason("invalid user");
}else{
stuName = student.getName();

// 密码正确
if (student.getPassword().equals(password)) {
loginResult = new LoginResult(true);
} else {
loginResult = new LoginResult(false);
loginResult.setReason("invalid user");
}
}
} catch (Exception e) {
e.printStackTrace();
}

if(loginResult.isSuccess()){
// 登录成功后,为该学生生成session
httpSession.setAttribute(StudentConst.STUDENT_ID, id);

httpServletResponse.addCookie(new Cookie(StudentConst.STUDENT_ID, id));
System.out.println("StudentName:"+StudentConst.STUDENT_NAME);
httpServletResponse.addCookie(new Cookie(StudentConst.STUDENT_NAME, stuName));
}

logger.info("***************************************************************************");
logger.info("登录: " + String.valueOf(loginResult.isSuccess()) + " id : " + id + " password : " + password);
logger.info("***************************************************************************");

return loginResult;
}

/**
* 退出的控制
*
* @param httpSession
* @return
*/
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout(HttpSession httpSession) {
httpSession.removeAttribute(StudentConst.STUDENT_EMAIL);
return "redirect:/student/login";
}

/**
* 提交报修单的POST方法
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
}

/**
* 获取所有待取消的报修单
*
* @param httpServletRequest
* @param model
* @return
*/
@RequestMapping(value = "/tobecanceled", method = RequestMethod.GET)
public String toBeCanceled(HttpServletRequest httpServletRequest, Model model) {
String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();

List<Repair> repairs = repairService.getAllToBeCanceledById(id);

List<RepairInfoVo> repairInfoVos = new ArrayList<>();
for(Repair repair:repairs){
repair.setPicMD5("/"+repair.getPicMD5());
RepairInfoVo repairInfoVo = new RepairInfoVo(repair);
repairInfoVo.setStatesInfo(RepairEnumCN.stateOf(repair.getStatus()).getStateInfo());
repairInfoVos.add(repairInfoVo);
}
model.addAttribute("repairInfoVos", repairInfoVos);

return "student/tobecanceled";

}

/**
* 同意取消报修单
*
* @param repairId
* @param httpServletRequest
* @return
*/
@RequestMapping(value = "/tobecanceled/{repairId}/agree", method = RequestMethod.GET)
public String agreeCanceled(@PathVariable("repairId") int repairId, HttpServletRequest httpServletRequest) {
String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();

Student student = studentService.getStudentByEmail(id);

repairService.agreeToBeCanceled(repairId);

return "redirect:/student/tobecanceled";
}

/**
* 拒绝取消报修单
*
* @param repairId
* @param httpServletRequest
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

studentService.changePassword(student.getId(), password);

return new LoginResult(true);
}


/**
* 修改其它资料
*
* @param name
* @param phone
* @param sexual
* @param httpSession
* @param httpServletResponse
* @param httpServletRequest
* @return
*/
@RequestMapping(value = "/feelist", method = RequestMethod.GET)
public String feelist( Model model, HttpSession httpSession, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest) {
String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();
Student student = studentService.getStudentById(id);
String doorName = student.getDoor();
Door door = doorDao.queryByName(doorName);
model.addAttribute("fee", door);
return "student/feelist";
}

@RequestMapping(value = "/feeupload", method = RequestMethod.GET)
public String feeupload(Model model,HttpSession httpSession, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest) {
String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();
Student student = studentService.getStudentById(id);
String doorName = student.getDoor();
Door door = doorDao.queryByName(doorName);
model.addAttribute("feeup", door);
return "student/feeupload";
}

/**
* 缴费
* @param model
* @param httpSession
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
    private UrgentRepairService urgentRepairService;

@Resource
private DoorDao doorDao;

@RequestMapping(value = "/introduce", method = RequestMethod.GET)
public String index() {
return "student/introduce";
}

/**
* 登录的GET方法
*
* @return
*/
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String login() {
return "student/login";
}

/**
* 登录的POST方法
*
* @param id
* @param password
* @param httpSession
* @return
*/
@RequestMapping(value = "/login", method = RequestMethod.POST)
public
@ResponseBody
LoginResult login(String id, String password, HttpSession httpSession, HttpServletResponse httpServletResponse) {


LoginResult loginResult=null;
String stuName = null;

Student student = studentService.getStudentById(id);

Spider spider = new Spider();
try {
//调用service将数据存入数据库中
if(student==null){
// stuName = spider.getStudentName(id, password);
// student = new Student(id, stuName, password);
// System.out.println(stuName);


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