基于javaweb的SpringBoot宿舍寝室维修上报管理系统(java+springboot+freemarker+mysql+maven)

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

220023062402

230023062402

250023062402

260023062402

270023062402

基于javaweb的SpringBoot宿舍寝室维修上报管理系统(java+springboot+freemarker+mysql+maven)

管理员:校园管理(楼栋管理、宿舍管理)、师生管理(学生管理、辅导员管理)、维修管理(维修工管理、维修进度管理)等。

学生:登录、修改个人信息、上报宿舍维修信息、查看维修进度、完成维修进度等。

维修工:登录、查看分配给自己的维修任务、标记自己的维修进度等。

运行环境:windows/Linux均可、jdk1.8、mysql5.7、idea/eclipse均可。

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
 * @return
*/
@RequestMapping(value="/add",method=RequestMethod.GET)
public String add(Model model){

return "admin/coach/add";
}

/**
* 辅导员添加表单提交处理
* @param coach
* @return
*/
@RequestMapping(value="/add",method=RequestMethod.POST)
@ResponseBody
public Result<Boolean> add(Coach coach){
//用统一验证实体方法验证是否合法
CodeMsg validate = ValidateEntityUtil.validate(coach);
if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
return Result.error(validate);
}

//判断辅导员名是否存在
if(coachService.isExistname(coach.getName(), 0l)){
return Result.error(CodeMsg.COACH_ADD_EXIST_ERROR);
}
//到这说明一切符合条件,进行数据库新增
if(coachService.save(coach) == null){
return Result.error(CodeMsg.COACH_ADD_ERROR);
}
operaterLogService.add("添加辅导员,辅导员名:" + coach.getName());
return Result.success(true);
}
/**
* 辅导员编辑页面
* @param model
* @return
*/
@RequestMapping(value="/edit",method=RequestMethod.GET)
public String edit(Model model,@RequestParam(name="id",required=true)Long id){
Coach coach = coachService.find(id);
model.addAttribute("coach", coachService.find(id));
return "admin/coach/edit";
}
/**
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
 * @param
* @return
*/
@RequestMapping(value = "/repairs", method = RequestMethod.POST)
@ResponseBody
public Result<Boolean> editAllot(Repairs repairs) {
/**
* 有id是修改需要判断
* 无id是增加无需判断
*/
CodeMsg validate = ValidateEntityUtil.validate(repairs);
if (validate.getCode() != CodeMsg.SUCCESS.getCode()) {
return Result.error(validate);
}
if (repairs.getStudent().getStudentNo().equals("") || repairs.getStudent().getStudentNo() == null || repairs.getStudent().getStudentName().equals("") || repairs.getStudent().getStudentName() == null) {
return Result.error(CodeMsg.DATA_ERROR);
}
Student studentNo = studentService.findByStudentNo(repairs.getStudent().getStudentNo());
if (studentNo == null) {
return Result.error(CodeMsg.ADMIN_STUDENT_STUDENTNO);
}
if (repairs.getStudent().getStudentName() == null || !studentNo.getStudentName().equals(repairs.getStudent().getStudentName())) {
return Result.error(CodeMsg.ADMIN_STUDENT_EMPTY);
}
repairs.setStudent(studentNo);
if (repairs.getId() != null) {
//用统一验证实体方法验证是否合法

//到这说明一切符合条件,进行数据库保存
Repairs byID = repairsService.findByID(repairs.getId());
//讲提交的用户信息指定字段复制到已存在的user对象中,该方法会覆盖新字段内容
System.out.println(byID + "---------------" + byID.getCreateTime());
BeanUtils.copyProperties(repairs, byID, "id", "createTime", "updateTime");
repairsService.save(byID);
Emp emailEmp = empService.find(repairs.getEmp().getId());
try {
mailService.send(emailEmp.getEmail(), "任务发配", Objects.nonNull(repairs.getRemark()) ? repairs.getRemark() : "任务接收人修改为您,请快完成");
} catch (Exception e) {
for (int i = 0; i < 100; i++) {
System.err.println("发送任务发配邮件给维修员!!!");
}
}
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 CoachService coachService;
@Autowired
private CoachDao coachDao;
@Autowired
private OperaterLogService operaterLogService;

/*
* 跳转查询页面
* */
@RequestMapping(value = "/list")
public String findlist(Model model , Coach coach, PageBean<Coach> pageBean){
model.addAttribute("title","辅导员列表");
model.addAttribute("pageBean",coachService.findlist(coach,pageBean));
return "admin/coach/list";
}

/**
* 新增辅导员跳转页面
* @param model
* @return
*/
@RequestMapping(value="/add",method=RequestMethod.GET)
public String add(Model model){

return "admin/coach/add";
}

/**
* 辅导员添加表单提交处理
* @param coach
* @return
*/
@RequestMapping(value="/add",method=RequestMethod.POST)
@ResponseBody
public Result<Boolean> add(Coach coach){
//用统一验证实体方法验证是否合法
CodeMsg validate = ValidateEntityUtil.validate(coach);
if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
return Result.error(validate);
}

//判断辅导员名是否存在
if(coachService.isExistname(coach.getName(), 0l)){
return Result.error(CodeMsg.COACH_ADD_EXIST_ERROR);
}
//到这说明一切符合条件,进行数据库新增
if(coachService.save(coach) == null){
return Result.error(CodeMsg.COACH_ADD_ERROR);
}
operaterLogService.add("添加辅导员,辅导员名:" + coach.getName());
return Result.success(true);
}
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
        mac = sb.toString();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return mac.toUpperCase();
}

public static boolean authOrder(String orderSn, String phone) {
Map<String, String> headerParaMap = new HashMap<String, String>();
String mac = getMac();
String paramToken = DESUtil.encrypt(orderSn, mac + "#" + orderSn + "#" + phone);
headerParaMap.put("paramToken", paramToken);
String timeToken = DESUtil.encrypt("muyi_ylrc", System.currentTimeMillis() + "");
headerParaMap.put("timeToken", timeToken);
String sendPost = HttpUtil.sendPost("http://120.25.120.129:8081/order_auth/verify", headerParaMap, "orderSn=" + orderSn + "&phone=" + phone + "&mac=" + mac);
JSONObject parseObject = JSONObject.parseObject(sendPost);
if (parseObject.getIntValue("code") != CodeMsg.SUCCESS.getCode()) {
return false;
}
return true;
}

public static String readFileToString(File file) {
String string = "";
if (file != null) {
try {
BufferedReader br = new BufferedReader(new FileReader(file));
String line = null;
while ((line = br.readLine()) != null) {
string += line;
string += line;
}
br.close();
} catch (Exception e) {
// TODO: handle exception
}
}
return string;
}
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
public String index(Model model) {
model.addAttribute("operatorLogs", operaterLogService.findLastestLog(10));
model.addAttribute("userTotal", userService.total());
model.addAttribute("operatorLogTotal", operaterLogService.total());
model.addAttribute("databaseBackupTotal", 0);
model.addAttribute("onlineUserTotal", SessionListener.onlineUserCount);
model.addAttribute("showTipsText", showTipsText);
model.addAttribute("showTipsUrlText", showTipsUrlText);
model.addAttribute("showTipsUtl", showTipsUtl);
model.addAttribute("showTipsBtnText", showTipsBtnText);
return "admin/system/index";
}

/**
* 注销登录
*
* @return
*/
@RequestMapping(value = "/logout")
public String logout() {
User loginedUser = SessionUtil.getLoginedUser();
if (loginedUser != null) {
SessionUtil.set(SessionConstant.SESSION_USER_LOGIN_KEY, null);
}
return "redirect:login";
}

/**
* 无权限提示页面
*
* @return
*/
@RequestMapping(value = "/no_right")
public String noRight() {
return "admin/system/no_right";
}

/**
* 修改用户个人信息
*
* @return
*/
@RequestMapping(value = "/update_userinfo", method = RequestMethod.GET)
public String updateUserInfo() {
return "admin/system/update_userinfo";
}

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
    return "admin/system/index";
}

/**
* 注销登录
*
* @return
*/
@RequestMapping(value = "/logout")
public String logout() {
User loginedUser = SessionUtil.getLoginedUser();
if (loginedUser != null) {
SessionUtil.set(SessionConstant.SESSION_USER_LOGIN_KEY, null);
}
return "redirect:login";
}

/**
* 无权限提示页面
*
* @return
*/
@RequestMapping(value = "/no_right")
public String noRight() {
return "admin/system/no_right";
}

/**
* 修改用户个人信息
*
* @return
*/
@RequestMapping(value = "/update_userinfo", method = RequestMethod.GET)
public String updateUserInfo() {
return "admin/system/update_userinfo";
}

/**
* 修改个人信息保存
*
* @param user
* @return
*/
@RequestMapping(value = "/update_userinfo", method = RequestMethod.POST)
public String updateUserInfo(User user) {
User loginedUser = SessionUtil.getLoginedUser();
Role role = loginedUser.getRole();

if (role.getRoleType() == RoleType.ELECTRICIAN) {
Emp emp = empService.find(loginedUser.getId());


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