基于javaweb+mysql的springboot物业管理系统(java+springboot+maven+ssm+jsp+jquery+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot物业管理系统(java+springboot+maven+ssm+jsp+jquery+mysql)
项目介绍
基于SpringBoot的物业管理系统
角色:管理员、业主
管理员和业主
业主功能: 缴费信息,报修,投诉,注册,公告,修改密码等
管理员功能:用户管理,楼栋信息,房间信息,房屋绑定,车位绑定,缴费信息,报修信息,投诉信息,修改密码,公告信息等
环境需要
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)
前端: JSP、css、JavaScript、JQuery、Ajax
使用说明
项目运行: 1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,控制台提示运行成功后再去运行前端项目; 5. 管理员用户名密码:admin/admin 普通用户名密码:user/123456
文档介绍(课题背景与意义、系统实现功能、课题研究现状、系统相关技术、java技术、B/S架构、Mysql介绍、Mysql环境配置、Springboot框架、系统需求分析、系统功能、可行性研究、经济可行性、技术可行性、运行可行性、事件可行性、系统业务过程分析、系统业务过程分析、系统用例图、系统设计、数据库设计、系统整体设计、系统设计思想、系统流程图、系统详情设计、系统功能模块、系统功能模块、管理员功能模块):
小区物业报修:
我的账单展示页:
小区物业系统登录页:
小区物业系统统计展示页面:
投诉管理展示页面:
用户管理展示页面:
缴费管理展示页面:
}
@GetMapping("/api/getAllRepairsByUser")
public ResBody getAllRepairsByUser(@RequestParam int page,
@RequestParam int limit, HttpSession session, HttpServletResponse response) throws IOException {
ResBody resBody = new ResBody();
User user = (User) session.getAttribute("user");
if(user == null){
session.setAttribute("timeout","登录已过期,请重新登录");
response.sendRedirect("/login");
}
List<Repair> list= service.getAllRepairsByUser(page, limit,user.getId());
int count = 0;
if (list != null){
count = list.size();
}
resBody.setCount(count);
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
@PostMapping("/api/addRepair")
public ResBody addRepair(@RequestBody Repair repair,HttpSession session,HttpServletResponse response) throws IOException {
ResBody resBody = new ResBody();
User user = (User) session.getAttribute("user");
if (user!=null){
repair.setUser_id(user.getId());
}else {
session.setAttribute("timeout","登录已过期,请重新登录");
response.sendRedirect("/login");
}
int i = service.addRepair(repair);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("添加成功");
}else{
resBody.setCode(500);
resBody.setMsg("添加失败");
}
return resBody;
}
@PostMapping("/api/updateRepair")
public ResBody updateRepair(@RequestBody Repair repair) {
ResBody resBody = new ResBody();
// 状态为未处理时,清除处理结果信息
if (repair.getStatus() == 0){
repair.setResult("");
ResBody resBody = new ResBody();
int i = service.delPayment(id);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("删除成功");
}else{
resBody.setCode(500);
resBody.setMsg("删除失败");
}
return resBody;
}
}
@RestController
public class TousuController {
@Autowired
TousuService service;
@GetMapping("/api/getAllTousus")
public ResBody getAllTousus(@RequestParam int page,
@RequestParam int limit) {
ResBody resBody = new ResBody();
int count = service.getCount();
List<Tousu> list= service.getAllTousus(page, limit);
resBody.setCount(count);
resBody.setData(list);
resBody.setCode(0);
return resBody;
resBody.setCode(200);
resBody.setMsg("添加成功");
}else{
resBody.setCode(500);
resBody.setMsg("添加失败");
}
return resBody;
}
@PostMapping("/api/updatePayment")
public ResBody updatePayment(@RequestBody Payment payment) {
ResBody resBody = new ResBody();
int i = service.updatePayment(payment);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("修改成功");
}else{
resBody.setCode(500);
resBody.setMsg("修改失败");
}
return resBody;
}
@GetMapping("/api/delPayment")
public ResBody delPayment(@RequestParam int id) {
ResBody resBody = new ResBody();
int i = service.delPayment(id);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("删除成功");
}else{
resBody.setCode(500);
resBody.setMsg("删除失败");
}
return resBody;
}
@GetMapping("/api/findPayment")
public ResBody findPayment(@RequestParam int page,
@RequestParam int limit,
@RequestParam String name) {
ResBody resBody = new ResBody();
int count = service.getCount(name);
List<Payment> list= service.findPayment(page, limit,name);
resBody.setCount(count);
resBody.setData(list);
resBody.setCode(0);
return template.update("update repair set `status` = ?,`result` = ? where id = ?",
repair.getStatus(),repair.getResult(),repair.getId());
}
public int delRepair(int id) {
return template.update("DELETE from repair where id=?",id);
}
public int getCount(String name) {
int count = template.queryForObject("select count(*) from repair where content like '%"+name+"%' ", Integer.class);
return count;
}
public int getCount(int uid,int status) {
int count = template.queryForObject("select count(*) from repair where user_id = "+uid+" and status = "+status, Integer.class);
return count;
}
public List<Repair> findRepair(int page, int limit, String name) {
List<Repair> list = template.query("select * from repair where status = "+name+" limit ?,?" ,new Object[]{(page-1)*limit,limit},
new BeanPropertyRowMapper(Repair.class));
if (list!=null){
for (Repair repair:list){
List<User> users = template.query("select * from user where id = ?" ,
new Object[]{repair.getUser_id()}, new BeanPropertyRowMapper(User.class));
repair.setUser(users.get(0));
}
return list;
}else{
return null;
}
}
public List<Repair> searchMyRepairsByStatus(int page, int limit,int uid,int status) {
List<Repair> list = template.query("select * from repair where user_id = "+uid+" and status = "+status+" limit ?,?" ,new Object[]{(page-1)*limit,limit},
new BeanPropertyRowMapper(Repair.class));
if (list.size() > 0){
for (Repair repair:list){
List<User> users = template.query("select * from user where id = ?" ,
new Object[]{repair.getUser_id()}, new BeanPropertyRowMapper(User.class));
repair.setUser(users.get(0));
}
return list;
}else{
return null;
}
}
public int getCountByUserId(Integer id) {
int count = template.queryForObject("select count(*) from repair where user_id = "+id, Integer.class);
return count;
}
@GetMapping("/index")
public String index(Model model,HttpSession session) {
if(session.getAttribute("admin") == null){
session.setAttribute("timeout","登录已过期,请重新登录");
return "redirect:/login";
}else {
return "index";
}
}
@GetMapping("/console")
public String console(Model model) {
int gonggaoCount = gonggaoService.getCount();
int repairCount = repairService.getCount();
int tousuCount = tousuService.getCount();
int userCount = userService.getCount();
int roomCount = roomService.getCount();
int roomFreeCount = roomService.getFreeCount();
int carCount = carService.getCount();
int carFreeCount = carService.getFreeCount();
int paymentCount = user_paymentService.getCount();
int paymentFreeCount = user_paymentService.getFreeCount();
model.addAttribute("gonggaoCount",gonggaoCount);
model.addAttribute("repairCount",repairCount);
model.addAttribute("tousuCount",tousuCount);
model.addAttribute("userCount",userCount);
model.addAttribute("roomCount",roomCount);
model.addAttribute("roomFreeCount",roomFreeCount);
model.addAttribute("carCount",carCount);
model.addAttribute("carFreeCount",carFreeCount);
model.addAttribute("paymentCount",paymentCount);
model.addAttribute("paymentFreeCount",paymentFreeCount);
return "page/console/console";
}
@GetMapping("/tpl-theme")
public String tpl(){
return "page/tpl/tpl-theme";
}
@GetMapping("/tpl-password")
public String password(){
return "page/tpl/tpl-password";
}
@RestController
public class TousuController {
@Autowired
TousuService service;
@GetMapping("/api/getAllTousus")
public ResBody getAllTousus(@RequestParam int page,
@RequestParam int limit) {
ResBody resBody = new ResBody();
int count = service.getCount();
List<Tousu> list= service.getAllTousus(page, limit);
resBody.setCount(count);
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
@GetMapping("/api/getAllToususByUser")
public ResBody getAllToususByUser(@RequestParam int page,
@RequestParam int limit, HttpSession session, HttpServletResponse response) throws IOException {
ResBody resBody = new ResBody();
User user = (User) session.getAttribute("user");
if( user == null){
session.setAttribute("timeout","登录已过期,请重新登录");
response.sendRedirect("/login");
}
List<Tousu> list= service.getAllToususByUser(page, limit,user.getId());
int count = 0;
if (list != null){
count = list.size();
}
resBody.setCount(count);
resBody.setData(list);
return resBody;
}
@GetMapping("/api/delPayment")
public ResBody delPayment(@RequestParam int id) {
ResBody resBody = new ResBody();
int i = service.delPayment(id);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("删除成功");
}else{
resBody.setCode(500);
resBody.setMsg("删除失败");
}
return resBody;
}
@GetMapping("/api/findPayment")
public ResBody findPayment(@RequestParam int page,
@RequestParam int limit,
@RequestParam String name) {
ResBody resBody = new ResBody();
int count = service.getCount(name);
List<Payment> list= service.findPayment(page, limit,name);
resBody.setCount(count);
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
@GetMapping("/ajax/getAllPayments")
public ResBody getAllPayments() {
ResBody resBody = new ResBody();
List<Payment> list= service.getAllPayments();
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
}
@RestController
public class UserController {
@Autowired
UserService service;
@Autowired
AdminService adminService;
@Autowired
User_RoomService user_roomService;
@Autowired
RoomService roomService;
@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, HttpSession session, HttpServletResponse response) throws IOException {
ResBody resBody = new ResBody();
int i = service.updateUser(user);
if (i == 1){
session.setAttribute("user",user);
resBody.setCode(200);
resBody.setMsg("修改成功");
}else{
resBody.setCode(500);
resBody.setMsg("修改失败");
}
return resBody;
int i = service.remind(id);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("催缴成功");
}else {
resBody.setCode(500);
resBody.setMsg("催缴失败");
}
return resBody;
}
@GetMapping("/api/delUserPayment")
public ResBody delUserPayment(@RequestParam int id) {
ResBody resBody = new ResBody();
int i = service.delPayment(id);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("删除成功");
}else{
resBody.setCode(500);
resBody.setMsg("删除失败");
}
return resBody;
}
}
@RestController
@RequestParam int limit,
@RequestParam String name) {
ResBody resBody = new ResBody();
int count = 0;
List<Tousu> list= new ArrayList<>();
if (name.isEmpty()){
count = service.getCount();
list= service.getAllTousus(page, limit);
}else {
count = service.getCount(name);
list= service.findTousu(page, limit,name);
}
resBody.setCount(count);
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
@GetMapping("/api/searchMyCompByStatus")
public ResBody searchMyCompByStatus(@RequestParam int page,
@RequestParam int limit,
@RequestParam int status,HttpSession session,HttpServletResponse response) throws IOException {
ResBody resBody = new ResBody();
User user = (User) session.getAttribute("user");
if( user == null){
session.setAttribute("timeout","登录已过期,请重新登录");
response.sendRedirect("/login");
}
List<Tousu> list = new ArrayList<>();
int count;
int user_id = user.getId();
if(status==2){
count = service.getCount(user_id);
list= service.getAllToususByUser(page, limit,user_id);
}else {
list= service.searchMyCompByStatus(page,limit,user.getId(),status);
count = list.size();
}
resBody.setCount(count);
resBody.setData(list);
resBody.setCode(0);
resBody.setMsg("成功");
}else {
resBody.setCode(500);
resBody.setMsg("失败");
}
return resBody;
}
@GetMapping("/api/remind")
public ResBody remind(@RequestParam int id) {
ResBody resBody = new ResBody();
int i = service.remind(id);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("催缴成功");
}else {
resBody.setCode(500);
resBody.setMsg("催缴失败");
}
return resBody;
}
@GetMapping("/api/delUserPayment")
public ResBody delUserPayment(@RequestParam int id) {
ResBody resBody = new ResBody();
int i = service.delPayment(id);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("删除成功");
}else{
resBody.setCode(500);
resBody.setMsg("删除失败");
}
return resBody;
}
}
return count;
}
public List<Repair> getAllRepairsByUser(int page, int limit, Integer id) {
List<Repair> list = template.query("select * from repair where user_id = ? limit ?,?" ,new Object[]{id,(page-1)*limit,limit},
new BeanPropertyRowMapper(Repair.class));
if (!list.isEmpty()){
return list;
}else{
return null;
}
}
}
@Repository
public class TousuDao {
@Autowired
JdbcTemplate template;
public int getCount() {
int count = template.queryForObject("select count(*) from tousu", Integer.class);
return count;
}
public List<Tousu> getAllTousus(int page, int limit) {
List<Tousu> list = template.query("select * from tousu limit ?,?" ,new Object[]{(page-1)*limit,limit},
new BeanPropertyRowMapper(Tousu.class));
if (list!=null){
for (Tousu tousu:list){
List<User> users = template.query("select * from user where id = ?" ,
new Object[]{tousu.getUser_id()}, new BeanPropertyRowMapper(User.class));
tousu.setUser(users.get(0));
}
return list;
}else{
return null;
}
}
HttpSession session) {
ResBody resBody = new ResBody();
int identity = Integer.parseInt(params.get("identity").toString());
String phone = params.get("phone").toString();
String password = params.get("password").toString();
if(identity==1){
Admin admin = adminService.findAdmin(phone,password);
if (admin == null){
resBody.setCode(500);
resBody.setMsg("账号或密码错误,请重新登录");
}else {
session.setAttribute("admin",admin);
resBody.setCode(200);
resBody.setIdentity(1);
resBody.setMsg("登录成功");
}
}else {
User user = service.loginByPassword(phone,password);
if (user == null){
resBody.setCode(500);
resBody.setMsg("账号或密码错误,请重新登录");
}else {
if (user.getStatus() != 0){
session.setAttribute("user",user);
resBody.setCode(200);
resBody.setIdentity(2);
resBody.setMsg("登录成功");
}else {
resBody.setCode(202);
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();
String newPsw2 = params.get("newPsw2").toString();
String oldPsw = params.get("oldPsw").toString();
System.out.println(newPsw);
System.out.println(newPsw2);
ResBody resBody = new ResBody();
int i = service.delBuilding(id);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("删除成功");
}else{
resBody.setCode(500);
resBody.setMsg("删除失败");
}
return resBody;
}
@GetMapping("/api/findBuilding")
public ResBody findBuilding(@RequestParam int page,
@RequestParam int limit,
@RequestParam String name) {
ResBody resBody = new ResBody();
int count = service.getCount(name);
List<Building> list= service.findBuilding(page, limit,name);
resBody.setCount(count);
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
@GetMapping("/ajax/getAllBuildings")
public ResBody getAllDanyuans() {
ResBody resBody = new ResBody();
List<Building> list= service.getAllBuildings();
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
}
@RestController
public class PaymentController {
@Autowired
PaymentService service;
@GetMapping("/api/getAllPayments")
public ResBody getAllPayments(@RequestParam int page,
@RequestParam int limit) {
resBody.setMsg("修改成功");
}else{
resBody.setCode(500);
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){
}
@GetMapping("/api/delUser")
public ResBody delete(@RequestParam int id) {
ResBody resBody = new ResBody();
user_roomService.outAllRoom(id);
int i = service.delete(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();
int identity = Integer.parseInt(params.get("identity").toString());
String phone = params.get("phone").toString();
String password = params.get("password").toString();
if(identity==1){
Admin admin = adminService.findAdmin(phone,password);
if (admin == null){
resBody.setCode(500);
resBody.setMsg("账号或密码错误,请重新登录");
}else {
session.setAttribute("admin",admin);
resBody.setCode(200);
resBody.setIdentity(1);
resBody.setMsg("登录成功");
}
}else {
User user = service.loginByPassword(phone,password);
if (user == null){
resBody.setCode(500);
resBody.setMsg("账号或密码错误,请重新登录");
}else {
ResBody resBody = new ResBody();
List<Room> list = service.getAllFreeRooms(danyuan_id);
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
}
@RestController
public class DanyuanController {
@Autowired
DanyuanService service;
@GetMapping("/api/getAllDanyuans")
public ResBody getAllDanyuans(@RequestParam int page,
@RequestParam int limit) {
ResBody resBody = new ResBody();
int count = service.getCount();
List<Danyuan> list= service.getAllDanyuans(page, limit);
resBody.setCount(count);
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
@PostMapping("/api/addDanyuan")
public ResBody addDanyuan(@RequestBody Danyuan danyuan) {
ResBody resBody = new ResBody();
int i = service.addDanyuan(danyuan);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("添加成功");
}else{
resBody.setCode(500);
resBody.setMsg("添加失败");
}
return resBody;
}
@PostMapping("/api/updateCar")
public ResBody updateCar(@RequestBody Car car) {
ResBody resBody = new ResBody();
int i = service.updateCar(car);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("修改成功");
}else{
resBody.setCode(500);
resBody.setMsg("修改失败");
}
return resBody;
}
@GetMapping("/api/delCar")
public ResBody delCar(@RequestParam int id) {
ResBody resBody = new ResBody();
int i = service.delCar(id);
if (i == 1){
resBody.setCode(200);
resBody.setMsg("删除成功");
}else{
resBody.setCode(500);
resBody.setMsg("删除失败");
}
return resBody;
}
@GetMapping("/api/findCar")
public ResBody findCar(@RequestParam int page,
@RequestParam int limit,
@RequestParam String name) {
ResBody resBody = new ResBody();
int count = service.getCount(name);
List<Car> list= service.findCar(page, limit,name);
resBody.setCount(count);
resBody.setData(list);
resBody.setCode(0);
return resBody;
}
@GetMapping("/ajax/getAllFreeCars")