源码获取:俺的博客首页 "资源" 里下载!
项目介绍
基于Springboot Vue的小区物业管理系统
角色:管理员、用户、员工三种角色;
普通用户:用户系统,用户登录后可以查看首页、个人中心、业主信息管理、费用信息管理、楼房信息管理、报修信息管理、车位信息管理等内容
员工:员工登录后可以查看首页、个人中心、楼房信息管理、报修信息管理、投诉编号管理、公告信息管理、部门信息管理等内容
管理员:管理员登录进入小区物业管理系统平台可以查看首页、个人中心、用户管理、员工管理、业主信息管理、费用信息管理、楼房信息管理、报修信息管理、车位信息管理等内容
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;
技术栈
后端:SpringBoot+Mybaits
前端:Vue
使用说明
项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
在浏览器中输入地址:http://localhost:8080/springboot003ds/admin/dist/index.html#/login
管理员:admin/admin
员工:员工2/123456
普通用户:用户1/123456
架构图展示:
员工管理展示:
停车信息管理展示:
保修信息展示:![](https://i-blog.csdnimg.cn/blog_migrate/a7f0ca3a7a6918c5c83d4434071c81a6.jpeg)
个人中心管理展示:
投诉编号管理:
停车信息管理:![](https://i-blog.csdnimg.cn/blog_migrate/57b0dae014002189f1b167fc9b546704.jpeg)
保修信息管理:![](https://i-blog.csdnimg.cn/blog_migrate/468adda157e56c44798880ca47cb23bb.jpeg)
个人中心展示:
用户管理控制层:
@Controller
public class UserController {
@Autowired
@Qualifier("pmsService")
private PmsService pmsService;
@RequestMapping(value="/login")
public String login(@ModelAttribute("user") User user1, String userId,String password,Model model,HttpSession session) {
User user =pmsService.login(userId, password);
if(user!=null) {
session.setAttribute("user",user);
if(user.getRoleType()==0) {
return "manager/userMg";
}
else return "user/user_login";
}
else {
model.addAttribute("errorMessage", "登录失败,请重新登录");
return "user/user_login";
}
}
@RequestMapping(value="/change")
public String change(@RequestParam("password")String password,@RequestParam("phone")String phone,Model model,HttpSession session) {
User user=(User)(session.getAttribute("user"));
String userId=user.getUserId();
System.out.println(userId);
System.out.println(password);
System.out.println(phone);
pmsService.change(password,phone,userId);
model.addAttribute("errorMessage", "修改成功,请重新登录");
user=null;
session.setAttribute("user", user);
return "user/user_login";
}
@RequestMapping(value= {"/","/index"})
public String fist(Model model) {
return "user/user_login";
}
@RequestMapping(value="/signout")
public String logout(HttpSession session,Model model) {
User user=null;
session.setAttribute("user", user);
return "user/user_login";
}
@RequestMapping(value="/user/user-list")
public void selectUser(
HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
request.setCharacterEncoding("UTF-8");
String key = request.getParameter("key");
String pageNoStr = request.getParameter("pageNo");
String rowMaxStr = request.getParameter("rowMax");
String roleTypeStr = request.getParameter("roleType");
int pageNo = Integer.valueOf(pageNoStr);
int rowMax = Integer.valueOf(rowMaxStr);
int roleType = Integer.valueOf(roleTypeStr);
User user = new User();
user.setUserName(key);
user.setRoleType(roleType);
PageVO<User> page = pmsService.listUser(user, pageNo, rowMax);
response.reset();
response.setContentType("text/plain;charset=UTF-8");
response.getWriter().print(JSON.toJSONString(page));
response.flushBuffer();
}
@RequestMapping(value="/user/addUser")
public void addUser(@ModelAttribute("user") User user){
if(user.getSexId() == 0) {
user.setSex("男");
}
else {
user.setSex("女");
}
user.setRoleType(user.getTypeId());
pmsService.addUser(user);
System.out.println("add user :"+ user.getUserId());
user = null;
}
@RequestMapping(value="/user/updateUser")
public void updateUser(@ModelAttribute("user") User user){
//User user = new User();
if(user.getSexId() == 0) {
user.setSex("男");
}
else {
user.setSex("女");
}
user.setRoleType(user.getTypeId());
pmsService.modifyUser(user);
System.out.println("modify user :"+ user.getUserName());
System.out.println("modify user :"+ user.getUserId());
System.out.println("modify user :"+ user.getPassword());
}
@RequestMapping(value="/user/deleteUser")
public void deleteUser(@RequestBody User user, HttpServletResponse response){
String userId = user.getUserId();
pmsService.removeUserById(userId);
System.out.println("delete user :"+ userId);
}
@RequestMapping(value="/user/loadEditUser")
@ResponseBody
public Object loadEditUser(@RequestParam(value="name",required=false) String name){
User user = new User();
user = pmsService.findUserById(name);
System.out.println("load user :"+ user.getUserName());
return user;
}
@RequestMapping(value= {"/userMg"})
public String userMg(@ModelAttribute("user") User user) {
return "manager/userMg";
}
//关于我们
@RequestMapping(value="/info")
public String about() {
return "user/about";
}
}
报修控制管理层:
@Controller
public class RepairController {
@Autowired
@Qualifier("pmsService")
private PmsService pmsService;
@RequestMapping(value= {"/repairMg"})
public String repairMg(@ModelAttribute("repair") Repair repair) {
return "manager/repairMg";
}
@RequestMapping(value="/manager/repair-list")
public void selectRepair(
HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
request.setCharacterEncoding("UTF-8");
String key = request.getParameter("key");
String pageNoStr = request.getParameter("pageNo");
String rowMaxStr = request.getParameter("rowMax");
String repairState1 = request.getParameter("repairState");
int pageNo = Integer.valueOf(pageNoStr);
int rowMax = Integer.valueOf(rowMaxStr);
int repairState = Integer.valueOf(repairState1);
Repair repair = new Repair();
repair.setUserId(key);
repair.setRepairState(repairState);
PageVO<Repair> page = pmsService.listRepair(repair, pageNo, rowMax);
response.reset();
response.setContentType("text/plain;charset=UTF-8");
response.getWriter().print(JSON.toJSONString(page));
response.flushBuffer();
}
@RequestMapping(value="/manager/updateRepair")
public void updateRepair(@ModelAttribute("repair") Repair repair){
repair.setRepairState(repair.getTypeId());
pmsService.modifyRepair(repair);
System.out.println("modify Repair :"+ repair.getRepairId());
}
@RequestMapping(value="/manager/deleteRepair")
public void deleteRepair(@RequestBody Repair repair, HttpServletResponse response){
int repairId = repair.getRepairId();
pmsService.removeRepair(repairId);
System.out.println("delete Repair :"+ repairId);
}
@RequestMapping(value="/manager/loadEditRepair")
@ResponseBody
public Object loadEditRepair(@RequestParam(value="repairId",required=false) String repairId){
int repairId1 = Integer.valueOf(repairId);
Repair repair = new Repair();
repair = pmsService.findRepair(repairId1);
System.out.println("load Repair :"+ repairId);
return repair;
}
@RequestMapping(value="repair")
public String repair(Model model) {
return "user/repair";
}
@RequestMapping(value="user/repair-list")
public void selectAdvice(HttpServletRequest request, HttpServletResponse response, HttpSession session)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
User user = (User) session.getAttribute("user");
String pageNoStr = request.getParameter("pageNo");
String rowMaxStr = request.getParameter("rowMax");
String repairState = request.getParameter("repairState");
String beginDate = request.getParameter("beginDate");
String endDate = request.getParameter("endDate");
System.out.println(beginDate);
System.out.println(endDate);
int pageNo = Integer.valueOf(pageNoStr);
int rowMax = Integer.valueOf(rowMaxStr);
int reState = Integer.valueOf(repairState);
Repair repair =new Repair();
repair.setUserId(user.getUserId());
repair.setRepairState(reState);
PageVO<Repair> page = pmsService.listRepair(repair, pageNo, rowMax);
response.reset();
response.setContentType("text/plain;charset=UTF-8");
response.getWriter().print(JSON.toJSONString(page));
response.flushBuffer();
}
@RequestMapping(value="/user/addRepair")
public void addRepair(HttpServletRequest request, HttpServletResponse response, HttpSession session,
@ModelAttribute("repair") Repair repair) throws ServletException, IOException{
request.setCharacterEncoding("UTF-8");
String buildingNum = request.getParameter("buildingNum");
String roomNum = request.getParameter("roomNum");
Date date = (Date) new Timestamp(System.currentTimeMillis());
User user = (User) session.getAttribute("user");
String userId = user.getUserId();
int bdNum = Integer.valueOf(buildingNum);
int rmNum = Integer.valueOf(roomNum);
repair.setUserId(userId);
repair.setRepairDate(date);
repair.setBuildingNum(bdNum);
repair.setRoomNum(rmNum);
repair.setRepairState(0);
pmsService.addRepair(repair);
}
@RequestMapping(value="/user/loadRepair")
@ResponseBody
public Object loadAdvice(@RequestParam(value="repairId",required=false) String repairId){
int id = Integer.valueOf(repairId);
Repair repair = new Repair();
repair = pmsService.selectRepairByIdUser(id);
return repair;
}
}
房屋信息管理控制层:
@RestController
public class RoomController {
@Autowired
RoomService service;
@GetMapping("/api/getAllRooms")
public ResBody getAllRooms(@RequestParam int page,
@RequestParam int limit) {
ResBody resBody = new ResBody();
int count = service.getCount();
List<Room> list= service.getAllRooms(page, limit);
resBody.setCount(count);
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
@PostMapping("/api/addRoom")
public ResBody addRoom(@RequestBody Room room) {
ResBody resBody = new ResBody();
int i = service.addRoom(room);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("添加成功");
}else{
resBody.setCode(500);
resBody.setMsg("添加失败");
}
return resBody;
}
@PostMapping("/api/updateRoom")
public ResBody updateDanyuan(@RequestBody Room room) {
ResBody resBody = new ResBody();
int i = service.updateRoom(room);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("修改成功");
}else{
resBody.setCode(500);
resBody.setMsg("修改失败");
}
return resBody;
}
@GetMapping("/api/delRoom")
public ResBody delRoom(@RequestParam int id) {
ResBody resBody = new ResBody();
int i = service.delRoom(id);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("删除成功");
}else{
resBody.setCode(500);
resBody.setMsg("删除失败");
}
return resBody;
}
@GetMapping("/api/findRoom")
public ResBody findBuilding(@RequestParam int page,
@RequestParam int limit,
@RequestParam String name) {
int count = 0;
List<Room> list= new ArrayList<>();
ResBody resBody = new ResBody();
if (name.isEmpty()){
count = service.getCount();
list= service.getAllRooms(page, limit);
}else {
count = service.getCount(name);
list= service.findRoom(page, limit,name);
}
resBody.setCount(count);
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
@GetMapping("/ajax/getAllFreeRooms")
public ResBody getAllFreeRooms(@RequestParam int danyuan_id) {
ResBody resBody = new ResBody();
List<Room> list = service.getAllFreeRooms(danyuan_id);
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
}
后台管理员控制层:
@RestController
public class AdminController {
@Autowired
AdminService service;
private static final Logger LOG = LoggerFactory.getLogger(AdminController.class);
@PostMapping("/admin/loginByPassword")
public ResBody loginByPassword(@RequestBody Map<String, Object> params,
HttpSession session) {
ResBody resBody = new ResBody();
String email = params.get("email").toString();
String password = params.get("password").toString();
Admin admin = service.findAdmin(email,password);
if (admin == null){
resBody.setCode(500);
resBody.setMsg("登录失败,请重新登录");
}else {
session.setAttribute("admin",admin);
LOG.info(admin.toString());
resBody.setCode(200);
resBody.setMsg("登录成功");
}
return resBody;
}
@PostMapping("/admin/updatePass")
public ResBody updatePass(@RequestBody Map<String, Object> params,
HttpSession session) {
ResBody resBody = new ResBody();
String newPsw = params.get("newPsw").toString();
Admin admin = (Admin) session.getAttribute("admin");
admin.setPassword(newPsw);
int i = service.updatePass(admin.getId(),newPsw);
if (i != 1){
resBody.setCode(500);
resBody.setMsg("修改失败,后台出错");
}else {
session.setAttribute("admin",admin);
LOG.info(admin.toString());
resBody.setCode(200);
resBody.setMsg("修改成功");
}
return resBody;
}
}
源码获取:俺的博客首页 "资源" 里下载!