Java项目:物业管理系统(java+SpringBoot+HTML+Thymeleaf+Layui+Mysql)

源码获取:俺的博客首页 "资源" 里下载!

项目介绍

主要功能包括:

前台:登录,房屋购买,车位购买,公告通知,出入登记,投诉服务,报修服务,关于我们

后台:楼宇管理,住房管理,车位管理,物业管理,抄表管理,纳税记录管理,住户管理,住户投诉,住户报修,系统管理,公告管理,出入记录,评价管理等


环境需要

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(Spring+SpringMVC+Mybatis)

前端:HTML,jquery,Thymeleaf,Layui


使用说明

项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,控制台提示运行成功后再去运行前端项目;
5. 管理员用户名密码:admin/admin
普通用户名密码:user/123456

首页展示页面: 

服务管理展示: 

 公告通知管理:

 

 售楼情况:

后台管理住户保修:

 

 抄表管理展示:

 车位管理展示:

住户投诉管理:

 

 住房管理列表:

用户管理控制层:

@RestController
public class UserController {
    @Autowired
    UserService service;

    @GetMapping("/api/getUsers")
    public ResBody getUsers(@RequestParam int page,
                                   @RequestParam int limit) {
        ResBody resBody = new ResBody();
        int count = service.getCount();
        List<User> list= service.getUsers(page, limit);
        resBody.setCount(count);
        resBody.setData(list);
        resBody.setCode(0);
        return resBody;
    }

    @PostMapping("/api/addUser")
    public ResBody addUser(@RequestBody User user) {
        ResBody resBody = new ResBody();
        int i = service.addUser(user);
        if (i == 1){
            resBody.setCode(200);
            resBody.setMsg("添加成功");
        }else{
            resBody.setCode(500);
            resBody.setMsg("添加失败");
        }
        return resBody;
    }

    @PostMapping("/api/updateUser")
    public ResBody updateUser(@RequestBody User user) {
        ResBody resBody = new ResBody();
        int i = service.updateUser(user);
        if (i == 1){
            resBody.setCode(200);
            resBody.setMsg("修改成功");
        }else{
            resBody.setCode(500);
            resBody.setMsg("修改失败");
        }
        return resBody;
    }

    @GetMapping("/api/stopUser")
    public ResBody delBuilding(@RequestParam int id) {
        ResBody resBody = new ResBody();
        int i = service.stopUser(id);
        if (i == 1){
            resBody.setCode(200);
            resBody.setMsg("停用成功");
        }else{
            resBody.setCode(500);
            resBody.setMsg("停用失败");
        }
        return resBody;
    }

    @GetMapping("/api/findUser")
    public ResBody findBuilding(@RequestParam int page,
                                @RequestParam int limit,
                                @RequestParam String name) {
        ResBody resBody = new ResBody();
        int count = service.getCount(name);
        List<User> list= service.findUser(page, limit,name);
        resBody.setCount(count);
        resBody.setData(list);
        resBody.setCode(0);
        return resBody;
    }

    @PostMapping("/api/loginByPassword")
    public ResBody loginByPassword(@RequestBody Map<String, Object> params,
                                   HttpSession session) {
        ResBody resBody = new ResBody();
        String phone = params.get("phone").toString();
        String password = params.get("password").toString();
        User user = service.loginByPassword(phone,password);
        if (user == null){
            resBody.setCode(500);
            resBody.setMsg("登录失败,请重新登录");
        }else {
            session.setAttribute("user",user);
            resBody.setCode(200);
            resBody.setMsg("登录成功");
        }
        return resBody;
    }

    @PostMapping("/api/updatePass")
    public ResBody updatePass(@RequestBody Map<String, Object> params,
                              HttpSession session) {
        ResBody resBody = new ResBody();
        String newPsw = params.get("newPsw").toString();
        User user = (User) session.getAttribute("user");
        user.setPassword(newPsw);
        int i = service.updatePass(user.getId(),newPsw);
        if (i != 1){
            resBody.setCode(500);
            resBody.setMsg("修改失败,后台出错");
        }else {
            session.setAttribute("user",user);
            resBody.setCode(200);
            resBody.setMsg("修改成功");
        }
        return resBody;
    }
}

房屋信息管理控制层:

@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;
    }
}

源码获取:俺的博客首页 "资源" 里下载!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

beyondwild

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值