物业管理系统,可运行

文章目录

  • 项目介绍
    • 一、技术栈
    • 二、项目功能介绍
    • 三、业主功能部分页面展示
    • 四、管理员功能部分页面展示
    • 五、部分代码展示
    • 六、获取源码

项目介绍

基于javaweb+mysql的小区物业管理系统(java+JSP+bootstrap+JavaScript+servlet+Mysql)

物业管理系统,可运行_第1张图片

一、技术栈

java+JSP+bootstrap+JavaScript+servlet+Mysql

后端:Servlet

前端:JSP+CSS+JavaScript+jquery+bootstrap

二、项目功能介绍

本项目为后台管理系统,分为管理员与业主两种角色;

管理员主要功能包括:

1、首页,2、公告查询,3、修改密码,4、报修管理,5、业主信息,6、房产信息等;7、管理员可对业主、房产等信息进行增删改查,业主仅可查看;

业主主要功能包括:

1、首页,2、公告查询,3、修改密码,4、报修管理,5、业主信息,6、房产信息等;

物业管理系统,可运行_第2张图片
物业管理系统,可运行_第3张图片

三、业主功能部分页面展示

物业管理系统,可运行_第4张图片

物业管理系统,可运行_第5张图片

四、管理员功能部分页面展示

物业管理系统,可运行_第6张图片

物业管理系统,可运行_第7张图片

物业管理系统,可运行_第8张图片

五、部分代码展示

package com.cissst.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cissst.entity.Admin;
import com.cissst.service.IAdminService;
import com.cissst.service.impl.AdminServiceImpl;
import com.cissst.util.MD5Util;

public class AdminServlet extends HttpServlet{
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=UTF-8;");
		String action = request.getParameter("action");
		IAdminService adminService = new AdminServiceImpl();
		if("adminList".equals(action)){
			List<Admin> list =  adminService.findAlladmins();
			request.setAttribute("admins", list);
			RequestDispatcher rd = request.getRequestDispatcher("admin/admin-list.jsp");
			rd.forward(request, response);
		
		}else if("adminAdd".equals(action)){
			
			String name = request.getParameter("name");
			String password = MD5Util.encode(request.getParameter("password"));
			String sex = request.getParameter("sex");
			String age = request.getParameter("age");
			String tel = request.getParameter("tel");
			String phone = request.getParameter("phone");
			String addr = request.getParameter("addr");
			String memo = request.getParameter("memo");
			
			System.out.println(name+password+tel+phone+addr+memo);
			
			Number ag = Integer.parseInt(age);

			Admin a = new Admin();
			a.setName(name);
			a.setPassword(password);
			a.setSex(sex);
			a.setAge(ag);
			a.setTel(tel);
			a.setPhone(phone);
			a.setAddr(addr);
			a.setMemo(memo);
			
			adminService.save(a);
			
			response.sendRedirect("admin?action=adminList");
		}else if("findById".equals(action)){
			String id = request.getParameter("id");
			
			Admin a = adminService.findById(id);
			
			request.setAttribute("admin", a);
			
			RequestDispatcher rd = request.getRequestDispatcher("admin/admin-edit.jsp");
			rd.forward(request, response);
			
			
		}else if("adminEdit".equals(action)){
			int id = Integer.parseInt(request.getParameter("id"));
			String name = request.getParameter("name");
			String password = MD5Util.encode(request.getParameter("password"));
			String sex = request.getParameter("sex");
			String age = request.getParameter("age");
			String tel = request.getParameter("tel");
			String phone = request.getParameter("phone");
			String addr = request.getParameter("addr");
			String memo = request.getParameter("memo");

			int ag = Integer.parseInt(age);
			
			Admin a = new Admin();
			a.setId(id);
			a.setName(name);
			a.setPassword(password);
			a.setSex(sex);
			a.setAge(ag);
			a.setTel(tel);
			a.setPhone(phone);
			a.setAddr(addr);
			a.setMemo(memo);
			
			adminService.update(a);
			
			response.sendRedirect("admin?action=adminList");
		}else if("adminDelete".equals(action)){
			String id = request.getParameter("id");
			adminService.delete(id);
			response.sendRedirect("admin?action=adminList");
		}
		else if("change".equals(action)){
			String id = request.getParameter("id");
			Admin a = adminService.findById(id);
			request.setAttribute("admin", a);
			RequestDispatcher rd = request.getRequestDispatcher("admin/adminChange.jsp");
			rd.forward(request, response);
		}
	}
}

package com.cissst.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cissst.entity.Admin;
import com.cissst.entity.CustomAccount;
import com.cissst.service.ICustomAccountService;
import com.cissst.service.impl.CustomAccountServiceImpl;
import com.cissst.util.MD5Util;

public class CustomAccountServlet extends HttpServlet{
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String action = request.getParameter("action");
		ICustomAccountService ca = new CustomAccountServiceImpl();
		if("customAccountList".equals(action)){
			List<CustomAccount> list =  ca.findAllcustomAccount();
			request.setAttribute("customAccounts", list);
			RequestDispatcher rd = request.getRequestDispatcher("customAccount/custom-list.jsp");
			rd.forward(request,response);
		
		}else if("customAccountAdd".equals(action)){
			String username = request.getParameter("username");
			String password = MD5Util.encode(request.getParameter("password"));
			String ownerid = request.getParameter("ownerid");
			String carid = request.getParameter("carid");

			CustomAccount c = new CustomAccount();
			c.setUsername(username);
			c.setPassword(password);
			c.setOwnerid(ownerid);
			c.setCarid(carid);
			
			ca.save(c);
			
			response.sendRedirect("custom?action=customAccountList");
		}else if("findById".equals(action)){
			String accountid = request.getParameter("accountid");
			CustomAccount c = ca.findById(accountid);
			request.setAttribute("customAccount", c);
			
			RequestDispatcher rd = request.getRequestDispatcher("customAccount/custom-edit.jsp");
			rd.forward(request, response);
			
		}else if("findById2".equals(action)){
			String accountid = request.getParameter("accountid");
			CustomAccount c = ca.findById(accountid);
			request.setAttribute("customAccount", c);
			RequestDispatcher rd = request.getRequestDispatcher("customAccount/user-custom-list.jsp");
			rd.forward(request, response);
			
		}else if("customAccountEdit".equals(action)){
			int accountid = Integer.parseInt(request.getParameter("accountid"));
			String username = request.getParameter("username");
			String password = MD5Util.encode(request.getParameter("password"));
			String ownerid = request.getParameter("ownerid");
			String carid = request.getParameter("carid");

            CustomAccount c = new CustomAccount();
    		
            c.setAccountid(accountid);
			c.setUsername(username);
			c.setPassword(password);
			c.setOwnerid(ownerid);
			c.setCarid(carid);
	
			ca.update(c);
			response.sendRedirect("custom?action=customAccountList");
		}else if("customAccountDelete".equals(action)){
			String accountid = request.getParameter("accountid");
			ca.delete(accountid);
			response.sendRedirect("custom?action=customAccountList");
		}
		else if("change".equals(action)){
			String accountid = request.getParameter("accountid");
			CustomAccount c = ca.findById(accountid);
			request.setAttribute("customAccount", c);
			RequestDispatcher rd = request.getRequestDispatcher("customAccount/user-change-passwd.jsp");
			rd.forward(request, response);
		}else if("customAccountUserEdit".equals(action)){
			int accountid = Integer.parseInt(request.getParameter("accountid"));
			String username = request.getParameter("username");
			String password = MD5Util.encode(request.getParameter("password"));
			String ownerid = request.getParameter("ownerid");
			String carid = request.getParameter("carid");

            CustomAccount c = new CustomAccount();
    		
            c.setAccountid(accountid);
			c.setUsername(username);
			c.setPassword(password);
			c.setOwnerid(ownerid);
			c.setCarid(carid);
	
			ca.update(c);
			response.sendRedirect("custom?action=findById2&accountid="+accountid);
		}
	}
}

package com.cissst.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cissst.entity.House;
import com.cissst.service.IHouseService;
import com.cissst.service.impl.HouseServiceImpl;

public class HouseServlet extends HttpServlet{
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String action = request.getParameter("action");
		IHouseService ihs = new HouseServiceImpl();
		if("houseList".equals(action)){
			List<House> list =  ihs.findAllHouse();
			request.setAttribute("houses", list);
			RequestDispatcher rd = request.getRequestDispatcher("house/house-list.jsp");
			rd.forward(request, response);
		
		}else if("houseAdd".equals(action)){
			
//			int id = Integer.parseInt(request.getParameter("id"));
			String num = request.getParameter("num");
			String dep = request.getParameter("dep");
			String type = request.getParameter("type");
			String area = request.getParameter("area");
			String sell = request.getParameter("sell");
			String unit = request.getParameter("unit");
			String floor = request.getParameter("floor");
			String direction = request.getParameter("direction");
			String memo = request.getParameter("memo");
			String ownerid = request.getParameter("ownerid");

			House h = new House();
//			h.setId(id);
			h.setNum(num);
			h.setDep(dep);
			h.setType(type);
			h.setArea(area);
			h.setSell(sell);
			h.setUnit(unit);
			h.setFloor(floor);
			h.setDirection(direction);
			h.setMemo(memo);
			h.setOwnerid(ownerid);
			
			ihs.add(h);
			
			response.sendRedirect("house?action=houseList");
		}else if("findByOwnerid".equals(action)){
			String ownerid = request.getParameter("ownerid");
			
			List<House>  list = ihs.findByOwnerid(ownerid);
			
			request.setAttribute("houses", list);
			
			RequestDispatcher rd = request.getRequestDispatcher("house/user-house-list.jsp");
			rd.forward(request, response);
			
			
		}else if("houseEdit".equals(action)){
			int id = Integer.parseInt(request.getParameter("id"));
			String num = request.getParameter("num");
			String dep = request.getParameter("dep");
			String type = request.getParameter("type");
			String area = request.getParameter("area");
			String sell = request.getParameter("sell");
			String unit = request.getParameter("unit");
			String floor = request.getParameter("floor");
			String direction = request.getParameter("direction");
			String memo = request.getParameter("memo");
			String ownerid = request.getParameter("ownerid");
			House h = new House();
			
			h.setId(id);
			h.setNum(num);
			h.setDep(dep);
			h.setType(type);
			h.setArea(area);
			h.setSell(sell);
			h.setUnit(unit);
			h.setFloor(floor);
			h.setDirection(direction);
			h.setMemo(memo);
			h.setOwnerid(ownerid);

			ihs.update(h);
			
			response.sendRedirect("house?action=houseList");
		}else if("houseDelete".equals(action)){
			String id = request.getParameter("id");
			ihs.delete(id);
			response.sendRedirect("house?action=houseList");
		}else if("findById".equals(action)){
			String id = request.getParameter("id");
			
			House h = ihs.findById(id);
			
			request.setAttribute("house",h);
			
			RequestDispatcher rd = request.getRequestDispatcher("house/house-edit.jsp");
			rd.forward(request, response);
			
		}
	}
	
}

六、获取源码

你可能感兴趣的:(项目,servlet,java,物业管理系统,jsp)