项目编号:BS-XX-119
一,项目简介
本项目主要基于Springboot+Vue实现前后端分离的公租房管理系统,主要使用用户包括系统管理员和租户。申请入驻公租房的客户在线下走申请流程,申请成功后管理员将租房信息添加到系统中,用户登陆系统查看可租的公租房信息后,由管理员添加房租出租信息,并设置租金交纳记录。租户可以在系统中添加维修申请,并可以查看系统发布的新闻公告。
二,环境介绍
语言环境:Java: jdk1.8
数据库:Mysql: mysql5.7
应用服务器:Tomcat: tomcat8.5.31
开发工具:IDEA或eclipse
后台开发技术:Springboot+Mybatis
前端开发技术:Vue+Element
三,系统展示
管理员用户功能展示
用户登陆
后台管理界面
房屋出租信息管理
房屋租金信息管理
房屋故障维修管理
新闻公告管理
用户管理
租户相关功能模块
查看公租房信息
查看租金缴纳情况
故障申报
新闻信息公告
个人信息查看
修改密码
四,核心代码展示
package com.house.controller; import com.house.common.Result; import com.house.common.StatusCode; import com.house.dto.HouseExecution; import com.house.pojo.HouseList; import com.house.service.HouseListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @CrossOrigin @RequestMapping(value="/house") public class HouseController { @Autowired private HouseListService houseListService; @RequestMapping(value = "/getallhouselist",method = RequestMethod.GET) public Result getAllHouseList(){ List<HouseList> houseList = houseListService.findHouseListByCondition(null,null,null); return new Result(true, StatusCode.SUCCESS,"查找房屋信息列表成功",houseList); } @RequestMapping(value = "/gethouselistbycondition",method = RequestMethod.POST) public Result getHouseListByCondition(@RequestBody HouseList houseList){ return new Result(true, StatusCode.SUCCESS,"按条件查找房屋信息列表成功",houseListService.findHouseListByCondition(houseList.getStatus(),houseList.getAddress(),houseList.getUserlist_Id())); } @RequestMapping(value="/addhouse",method = RequestMethod.POST) public Result addHouse(@RequestBody HouseList houseList){ HouseExecution he; try{ he = houseListService.addHouse(houseList); if(he.isFlag()){ return new Result(true,StatusCode.SUCCESS,"添加房屋信息成功"); }else { return new Result(false,StatusCode.ERROR,"添加房屋信息失败:" + he.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"添加房屋信息失败:" + e.toString()); } } @RequestMapping(value="/updatehouse",method = RequestMethod.POST) public Result updateHouse(@RequestBody HouseList houseList){ HouseExecution he; try{ he = houseListService.updateHouse(houseList); if(he.isFlag()){ return new Result(true,StatusCode.SUCCESS,"修改房屋信息成功"); }else { return new Result(false,StatusCode.ERROR,"修改房屋信息失败:" + he.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"修改房屋信息失败:" + e.toString()); } } @RequestMapping(value="/deletehouse",method = RequestMethod.DELETE) public Result deleteHouse(@RequestParam("houseId")Integer houseId){ HouseExecution he; try{ he = houseListService.deleteHouse(houseId); if(he.isFlag()){ return new Result(true,StatusCode.SUCCESS,"删除房屋信息成功"); }else { return new Result(false,StatusCode.ERROR,"删除房屋信息失败:" + he.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"删除房屋信息失败:" + e.toString()); } } }
package com.house.controller; import com.house.common.Result; import com.house.common.StatusCode; import com.house.dto.PaidExecution; import com.house.pojo.Paid; import com.house.service.PaidService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @RestController @CrossOrigin @RequestMapping(value="/paid") public class PaidController { @Autowired private PaidService paidService; @RequestMapping(value = "/getallpaidlist",method = RequestMethod.GET) public Result getAllPaidList(){ return new Result(true, StatusCode.SUCCESS,"查找租金信息列表成功",paidService.findPaidListByCondition(null,null,null,null)); } @RequestMapping(value = "/getpaidlistbycondition",method = RequestMethod.POST) public Result getPaidListByCondition(@RequestBody Paid paid){ return new Result(true, StatusCode.SUCCESS,"按条件查找租金信息列表成功",paidService.findPaidListByCondition(paid.getStatus(),paid.getName(),paid.getAddress(),paid.getUserlist_id())); } @RequestMapping(value="/addpaid",method = RequestMethod.POST) public Result addPaid(@RequestBody Paid paid){ PaidExecution pe; try{ pe = paidService.addPaid(paid); if(pe.isFlag()){ return new Result(true,StatusCode.SUCCESS,"添加租金信息成功"); }else { return new Result(false,StatusCode.ERROR,"添加租金信息失败:" + pe.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"添加租金信息失败:" + e.toString()); } } @RequestMapping(value="/updatepaid",method = RequestMethod.POST) public Result updatePaid(@RequestBody Paid paid){ PaidExecution pe; try{ pe = paidService.updatePaid(paid); if(pe.isFlag()){ return new Result(true,StatusCode.SUCCESS,"修改租金信息成功"); }else { return new Result(false,StatusCode.ERROR,"修改租金信息失败:" + pe.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"修改租金信息失败:" + e.toString()); } } @RequestMapping(value="/deletepaid",method = RequestMethod.DELETE) public Result deletePaid(@RequestParam("paidId")Integer paidId){ PaidExecution pe; try{ pe = paidService.deletePaid(paidId); if(pe.isFlag()){ return new Result(true,StatusCode.SUCCESS,"删除租金信息成功"); }else { return new Result(false,StatusCode.ERROR,"删除租金信息失败:" + pe.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"删除租金信息失败:" + e.toString()); } } }
package com.house.controller; import com.house.common.Result; import com.house.common.StatusCode; import com.house.dto.ScheduleExecution; import com.house.pojo.Schedule; import com.house.service.ScheduleService; import com.house.utils.DateUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Date; @RestController @CrossOrigin @RequestMapping(value="/schedule") public class ScheduleController { @Autowired private ScheduleService scheduleService; @RequestMapping(value = "/getallschedulelist",method = RequestMethod.GET) public Result getAllScheduleList(){ return new Result(true, StatusCode.SUCCESS,"查找公告信息列表成功",scheduleService.findByCondition()); } @RequestMapping(value = "/getscheduleinsevendays",method = RequestMethod.GET) public Result getScheduleInsevenDays(){ return new Result(true, StatusCode.SUCCESS,"查找公告信息列表成功",scheduleService.findScheduleInSevenDays(DateUtil.dateFormat1(new Date()))); } @RequestMapping(value = "/getschedulelistbycondition",method = RequestMethod.POST) public Result getScheduleListByCondition(@RequestBody Schedule schedule){ return new Result(true, StatusCode.SUCCESS,"按条件查找公告信息列表成功",scheduleService.findByCondition()); } @RequestMapping(value="/addschedule",method = RequestMethod.POST) public Result addSchedule(@RequestBody Schedule schedule){ ScheduleExecution se; try{ se = scheduleService.addSchedule(schedule); if(se.isFlag()){ return new Result(true,StatusCode.SUCCESS,"添加公告信息成功"); }else { return new Result(false,StatusCode.ERROR,"添加公告信息失败:" + se.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"添加公告信息失败:" + e.toString()); } } @RequestMapping(value="/updateschedule",method = RequestMethod.POST) public Result updateSchedule(@RequestBody Schedule schedule){ ScheduleExecution se; try{ se = scheduleService.updateSchedule(schedule); if(se.isFlag()){ return new Result(true,StatusCode.SUCCESS,"修改公告信息成功"); }else { return new Result(false,StatusCode.ERROR,"修改公告信息失败:" + se.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"修改公告信息失败:" + e.toString()); } } @RequestMapping(value="/deleteschedule",method = RequestMethod.DELETE) public Result deleteSchedule(@RequestParam("scheduleId")Integer scheduleId){ ScheduleExecution se; try{ se = scheduleService.deleteSchedule(scheduleId); if(se.isFlag()){ return new Result(true,StatusCode.SUCCESS,"删除公告信息成功"); }else { return new Result(false,StatusCode.ERROR,"删除公告信息失败:" + se.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"删除公告信息失败:" + e.toString()); } } }
package com.house.controller; import com.house.common.Result; import com.house.common.StatusCode; import com.house.dto.SolveExecution; import com.house.pojo.Solve; import com.house.service.SolveService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @RestController @CrossOrigin @RequestMapping(value="/solve") public class SolveController { @Autowired private SolveService solveService; @RequestMapping(value = "/getallsolvelist",method = RequestMethod.GET) public Result getAllSolveList(){ return new Result(true, StatusCode.SUCCESS,"查找故障信息列表成功",solveService.findSolveListByCondition(null,null,null,null)); } @RequestMapping(value = "/getsolvelistbycondition",method = RequestMethod.POST) public Result getSolveListByCondition(@RequestBody Solve solve){ return new Result(true, StatusCode.SUCCESS,"按条件查找故障信息列表成功",solveService.findSolveListByCondition(solve.getStatus(),solve.getName(),solve.getAddress(),solve.getUserlist_id())); } @RequestMapping(value="/addsolve",method = RequestMethod.POST) public Result addSolve(@RequestBody Solve solve){ SolveExecution se; try{ se = solveService.addSolve(solve); if(se.isFlag()){ return new Result(true,StatusCode.SUCCESS,"添加故障信息成功"); }else { return new Result(false,StatusCode.ERROR,"添加故障信息失败:" + se.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"添加故障信息失败:" + e.toString()); } } @RequestMapping(value="/updatesolve",method = RequestMethod.POST) public Result updateSolve(@RequestBody Solve solve){ SolveExecution se; try{ se = solveService.updateSolve(solve); if(se.isFlag()){ return new Result(true,StatusCode.SUCCESS,"修改故障信息成功"); }else { return new Result(false,StatusCode.ERROR,"修改故障信息失败:" + se.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"修改故障信息失败:" + e.toString()); } } @RequestMapping(value="/deletesolve",method = RequestMethod.DELETE) public Result deleteSolve(@RequestParam("solveId")Integer solveId){ SolveExecution se; try{ se = solveService.deleteSolve(solveId); if(se.isFlag()){ return new Result(true,StatusCode.SUCCESS,"删除故障信息成功"); }else { return new Result(false,StatusCode.ERROR,"删除故障信息失败:" + se.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"删除故障信息失败:" + e.toString()); } } }
package com.house.controller; import java.util.HashMap; import java.util.Map; import com.house.dto.LoginUser; import com.house.common.Result; import com.house.common.StatusCode; import com.house.dto.UserExecution; import com.house.pojo.User; import com.house.pojo.UserList; import com.house.service.UserService; import com.house.utils.JwtUtil; import com.house.vo.PasswordVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @RestController @CrossOrigin @RequestMapping(value="/user") public class UserController { @Autowired private UserService userService; @RequestMapping(value = "/login",method = RequestMethod.POST) public Map<String,Object> login(@RequestBody LoginUser loginUser) { Map<String,Object> map = new HashMap<>(); User user = userService.login(loginUser.getAccount(),loginUser.getPassword()); if(user == null){ map.put("flag",false); return map; } UserList userList = userService.findUserInfoByCondition(null,user.getId(),null); //生成令牌 JwtUtil jwtUtil = new JwtUtil(); String token = null; if(userList.getType() == 1){ map.put("systemRole","admin"); token = jwtUtil.createJWT(String.valueOf(userList.getId()),user.getUsername(),"admin"); }else { map.put("systemRole","user"); token = jwtUtil.createJWT(String.valueOf(userList.getId()),user.getUsername(),"user"); } map.put("userInfo",userList); map.put("token",token); map.put("flag",true); return map; } @RequestMapping(value = "/getalluserlist",method = RequestMethod.GET) public Result getAllUserList(){ return new Result(true, StatusCode.SUCCESS,"查找用户列表成功",userService.findUserListByCondition(null,null)); } @RequestMapping(value = "/getuserlistbycondition",method = RequestMethod.POST) public Result getuUerListByCondition(@RequestBody UserList userList){ return new Result(true, StatusCode.SUCCESS,"按条件查找用户列表成功",userService.findUserListByCondition(userList.getName(),userList.getId())); } @RequestMapping(value = "/getuserinfobycondition",method = RequestMethod.POST) public Result getUserInfoByCondition(@RequestBody UserList userList){ return new Result(true, StatusCode.SUCCESS,"按条件查找用户列表成功",userService.findUserInfoByCondition(userList.getName(),userList.getUserId(),userList.getId())); } @RequestMapping(value="/adduser",method = RequestMethod.POST) public Result addUser(@RequestBody UserList userList){ UserExecution ue; try{ ue = userService.addUserListAndUserAccount(userList); if(ue.isFlag()){ return new Result(true,StatusCode.SUCCESS,"添加用户成功"); }else { return new Result(false,StatusCode.ERROR,"添加用户失败:" + ue.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"添加用户失败:" + e.toString()); } } @RequestMapping(value="/updateuser",method = RequestMethod.POST) public Result updateUser(@RequestBody UserList userList){ UserExecution ue; try{ ue = userService.updateUserList(userList); if(ue.isFlag()){ return new Result(true,StatusCode.SUCCESS,"更新用户成功"); }else { return new Result(false,StatusCode.ERROR,"更新用户失败:" + ue.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"更新用户失败:" + e.toString()); } } @RequestMapping(value="/deleteuser",method = RequestMethod.DELETE) public Result deleteUser(@RequestParam("userListid")Integer userListid){ UserExecution ue; try{ ue = userService.deleteUser(userListid); if(ue.isFlag()){ return new Result(true,StatusCode.SUCCESS,"删除用户成功"); }else { return new Result(false,StatusCode.ERROR,"删除用户失败:" + ue.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"删除用户失败:" + e.toString()); } } @RequestMapping(value="/editpassword",method = RequestMethod.POST) public Result updateUser(@RequestBody PasswordVO passwordVO){ UserExecution ue; try{ ue = userService.updatePassword(passwordVO); if(ue.isFlag()){ return new Result(true,StatusCode.SUCCESS,"修改密码成功"); }else { return new Result(false,StatusCode.ERROR,ue.getReason()); } }catch (Exception e){ return new Result(false,StatusCode.ERROR,"修改密码失败:" + e.toString()); } } }
五,项目总结
本项目基于前后端分离的开发方式来进行开发实现,符合现在开发的主流趋势,项目结构清晰明了,层次分明,采用MVC设计模式和三层架构来进行整体设计。界面布局简洁大方,操作符合用户使用习惯,人机交互处理的比较人性化,适合做毕业设计使用,也可以做课程设计或期未作业使用。
后台项目结构
前台项目结构