Java项目:业主+物业相结合小区物业管理系统(java+SSM+jsp+mysql+maven)

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

一、项目简述

功能包括: 分为管理员及普通业主角色,业主信息,社区房屋,维护 管理,社区车辆,社区投诉,社区缴费,社区业务信息维 护等等功能。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + maven等等。

Java项目:业主+物业相结合小区物业管理系统(java+SSM+jsp+mysql+maven)_第1张图片

Java项目:业主+物业相结合小区物业管理系统(java+SSM+jsp+mysql+maven)_第2张图片

Java项目:业主+物业相结合小区物业管理系统(java+SSM+jsp+mysql+maven)_第3张图片

Java项目:业主+物业相结合小区物业管理系统(java+SSM+jsp+mysql+maven)_第4张图片

业主控制层:

@Controller
public class OwnerController {

	@Autowired
	OwnerService ownerService;
	@Autowired
	private MessageService messService;
	@Autowired
	CarportService carportService;
	@Autowired
	SessionContentService sessionContentService;
	private BillService billService;

	// 登录控制器
	@RequestMapping("/login")
	public String login() {
		return "login";
	}

	// 登录判断控制器
	@RequestMapping("/loginjudge")
	public String loginjudge(@RequestParam("otel") String otel, @RequestParam("opass") String opass, Model model,
			HttpServletRequest request, String captcha) {
		String session1 = request.getSession().getAttribute("simpleCaptcha").toString();
		if (captcha.equals(session1)) {
			Owner owner = ownerService.findOwnerTel(otel, opass);
			HttpSession session = request.getSession();
			if (owner != null && owner.getOtel() != "" && owner.getOtel().equals(otel)
					&& owner.getOpass().equals(opass)) {
				if (otel.equals("vue10010")) {
					System.out.println("vue10010");
					session.setAttribute("tel", owner.getOtel());
					return "customermain";
				} else if(otel.equals("admin")) {
				
					return "main";
				}else {
					session = request.getSession();
					session.setAttribute("currentOwnerr", owner);
					List list = messService.selectByOid(owner.getOid());
					int messnumber = 0;
					for (int i = 0; i < list.size(); i++) {
						if (list.get(i).getStatus().equals("未阅读")) {
							++messnumber;
						}
					}
					model.addAttribute("messnumber", messnumber);
					// 传送owneruid到用户界面
					session.setAttribute("owneruid", owner.getOid());
					session.setAttribute("tel", owner.getOtel());
					// 将如错误信息发送到作用域,重定向在登录页面
					request.setAttribute("msss", "用户名或者密码错误");
					return "ownermain";
				}

			} else {
				// 将如错误信息发送到作用域,重定向在登录页面
				request.setAttribute("msss", "用户名或者密码错误");
				return "redirect:login.action";
			}
		} else {
			return "login";
		}
	}

	/**
	 * 添加住户信息
	 */

	@RequestMapping("/signin")
	public String signin() {
		return "regist";
	}
	/**
	 * @author Leett
	 */
	@RequestMapping("/ownermain")
	public String ownermain() {
		return "ownermain";
	}
	@RequestMapping("/savepingfen")
	public boolean savepingfen(String ff) {
		boolean f =  sessionContentService.gorgeous(ff);
		return f;
	}
	/**
	 * 添加住户信息
	 */

	@RequestMapping("/ownerbuycar")
	public String ownerbuycar(Model model) {
		Carport carport = new Carport();
		List list = carportService.findCarByState("未使用");
		for (Carport carport2 : list) {
			carport.setDuration(carport2.getDuration());
		}
		int count = list.size();
		List list1 = new ArrayList();
		list1 = carportService.findCarByArea("A");
		model.addAttribute("A", list1);
		list1 = carportService.findCarByArea("B");
		model.addAttribute("B", list1);
		list1 = carportService.findCarByArea("C");
		model.addAttribute("C", list1);
		list1 = carportService.findCarByArea("D");
		model.addAttribute("D", list1);
		model.addAttribute("count", count);
		model.addAttribute("duration", carport.getDuration());
		return "ownerbuycar";
	}

	// 客户注册控制器
	@RequestMapping("/signinjudge")
	public String signinjudge(Owner record) {

		boolean flag = ownerService.insert(record);

		if (flag == true) {

			// 使用重定向,返回登录界面
			return "redirect:findpagess.action?pageSize=5&pageNum=1&str=n";
		} else {
			return "regist";
		}
	}

			@RequestMapping("/checktel")
			public @ResponseBody String checkname(HttpServletRequest request) {
				String otel =request.getParameter("name");
				System.out.println(ownerService.findByTel(otel));
				return ownerService.findByTel(otel);
			}					
			/**
			 * 退出控制器
			 */
			@RequestMapping("/exit")
			public String exit(HttpSession session, HttpServletRequest request, Model model) {
				System.out.println("exit");
				// 获取当前的session
				HttpSession session1 = request.getSession();
				// 销毁session
				session1.invalidate();
				return "redirect:home.action";
			}
			/**
			 * 查询所有的业主信息
			 */
			@RequestMapping("/ownerlist")
			public String ownerlist(Model model) {
				List list=ownerService.selectByExample();
				model.addAttribute("list", list);
				System.out.println(list.size());
				return "customer";
			}
			
			/**
			 * 客户修改控制器
			 */ 
			@RequestMapping("/updateuser")
			public String updateuser(Model model, @RequestParam(value = "oid", defaultValue = "0") int oid) {
				Owner owner = ownerService.findById(oid);
				model.addAttribute("owner", owner);
				return "updateuser";
			}
			/**
			 * 更新保存
			 * @return
			 */
			@RequestMapping("/save")
			public String save(Owner owner, Model model) {
				ownerService.updatesave(owner);
				return "redirect:findpagess.action?pageSize=5&pageNum=1&str=n";
			}

			/**
			 * 删除一个住户
			 */
			@RequestMapping("/deleteone")
			public String deleteone(int oid) {
				ownerService.deleteByPrimaryKey(oid);
				return "redirect:findpagess.action?pageSize=5&pageNum=1&str=n";
			}
			/**
			 * 批量删除用户
			 */
			
			@RequestMapping("/deleteAll")
			public String deleteAll(int[] oids){
				boolean flag=ownerService.deleteAll(oids);
				return "redirect:findpagess.action?pageSize=5&pageNum=1&str=n";
			}
			/**
			 *  我的车位
			 */
			
			@RequestMapping("/mycarseat")
			public String mycarseat(Model model,int uid){
				List list3 = carportService.findCarByState("未使用");
				int count = list3.size();
				List list1 = new ArrayList();
				list1 = carportService.findCarByArea("A");
				model.addAttribute("A", list1);
				list1 = carportService.findCarByArea("B");
				model.addAttribute("B", list1);
				list1 = carportService.findCarByArea("C");
				model.addAttribute("C", list1);
				list1 = carportService.findCarByArea("D");
				model.addAttribute("D", list1);
				model.addAttribute("count", count);
				System.out.println("mycarseat:"+uid);
				List list = carportService.findMyCarSeat(uid);
				 model.addAttribute("carport1", list);
				 for (Carport c : list) {
					System.out.println(c.getDate());
				}
				return "mycarseat";
			}
			
			
			/**
			 * 展示用户
			 */		
			@RequestMapping("/showoerme")
			public String showownerme(Model model,HttpSession session){
				System.out.println("============");
					int oid1 = (int) session.getAttribute("owneruid");
					System.out.println(oid1);
					if(oid1!=0) {
				Owner onwer=ownerService.findById(oid1);
				model.addAttribute("onwer", onwer);
				return "showoerme";
			}else {
				return "login";
				}
			}
			/**
			 * owner页面首页
			 */		
			@RequestMapping("/mymianmessage")
			public String mymianmessage(){
				return "mymianmessage";
			}
			/**
			   *      个人信息更改
			 */
			@RequestMapping("/updateowenerss")
			public String updateowenerss(Model model, @RequestParam(value = "oid", defaultValue = "0") int oid,HttpSession session) {
				int oid1 = (int) session.getAttribute("owneruid");
				Owner owner=ownerService.findById(oid1);
				System.out.println("+++++++++++++>>>>>>>>");
				System.out.println("onwe.id:  "+owner.getOid());
				model.addAttribute("owner",owner );
				return "updateowner";
			}
			
			/**
			 * 个人修改保存控制器
			 */
			@RequestMapping("/savaowners")
			public String savaowners(Model model,@RequestParam(value = "oid", defaultValue = "0") int oid,HttpSession session,Owner owner) {
				System.out.println("+++++++++++++++++>");
				System.out.println("owner: "+owner.getOpass());
				
				owner.setOid((int)session.getAttribute("owneruid"));
				boolean flag=ownerService.updateowner(owner);
				System.out.println("flag:  "+flag);
				if(flag=true) {
			
					int oid1=(int)session.getAttribute("owneruid");
					System.out.println(oid1);
					Owner owner2=ownerService.findById(oid1);
					model.addAttribute("owner",owner2);
					return "redirect:showoerme.action";
				}
				return "updateowner";
			}
			
			// 分页查询
			@RequestMapping("/findpagess")
			public String findPage(int pageSize, int pageNum, Model model, String str, HttpSession session) {
				System.out.println("进来了");
				System.out.println(pageSize);
				System.out.println(str);
				if (str.equals("z")) {
					++pageNum;
				} else if (str.equals("j")) {
					--pageNum;
				}
				session.setAttribute("pageSize", pageSize);
				PageRequest pageQuery = new PageRequest();
				pageQuery.setPageNum(pageNum);
				pageQuery.setPageSize(pageSize);
				PageResult pageResult = ownerService.findPage(pageQuery);
				model.addAttribute("pageResult", pageResult);
				return "customer";

			}
			/**
			 * 分类查询住户集合
			 */
			@RequestMapping("list2")
			public String ownerlist2(Model model,int towernum) {
				List list=ownerService.findownerlist(towernum);
				model.addAttribute("list", list);
				return "list2";
			}
			
			@RequestMapping("/findpages2")
			public String findPage1(int pageSize, Model model, HttpSession session) {
				System.out.println("进来了");
				System.out.println(pageSize);
				PageRequest pageQuery = new PageRequest();
				pageQuery.setPageNum(1);
				pageQuery.setPageSize(pageSize);
				session.setAttribute("pageSize", pageSize);
				PageResult pageResult = ownerService.findPage(pageQuery);
				model.addAttribute("pageResult", pageResult);
				return "customer";

			}

			/**
			 * 根据id  完成时间   提交时间 模糊查询
			 * @param model
			 * @param md
			 * @return
			 */
			@RequestMapping("/findMain2")
			public String findMain(Model model,String mds) {
				System.out.println("+++++++++++++");
				System.out.println(mds);
				Listlist3 = ownerService.findMain(mds);
				model.addAttribute("list", list3);
				
				return "list2";
			}
}

投诉控制层:

@Controller
public class ComplainController {
	@Autowired
	ComplainService complainService;
	ComplainExample complainExample = new ComplainExample() ;
	@RequestMapping("/main")
	public String test() {
		return "main";
	}
	
	/**
	 * 全部投诉信息
	 */
	@RequestMapping("/complain")
	public String complain(Model model) {
		List list =complainService.findAll();
		model.addAttribute("complainlist", list);
		return "complain";
	}
	/**
	 * 业主跳转添加投诉页面
	 */
	@RequestMapping("/addcomplaint")
	public String addcomplaint() {
		return "addonecomplain";
	}
	/**
	 * 添加投诉到数据库
	 */
	@RequestMapping("/savecomplain")
	public String savecomplain(Complain complain) {
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
		Date date = new Date();
		String d = format.format(date);
		complain.setStatedate(d);
		complainService.addOne(complain);
		return "addonecomplain";
	}
	/**
	 * 分类投诉信息
	 */
	@RequestMapping("/complainstate")
	public String complainstate(Model model,String state) {
		List list =complainService.findByState(state);
		model.addAttribute("complainlist", list);
		return "complain";
	}
	/**
	 * 查询投诉信息
	 */
	@RequestMapping("/mycomplaint")
	public String mycomplaint(Model model,HttpSession session) {
		System.out.println("mycomplaint:"+(int)session.getAttribute("owneruid"));
		List list = complainService.findByOid((int) session.getAttribute("owneruid"));
		model.addAttribute("mycomplaintlist", list);
		return "mycomplaint";
	}
	@RequestMapping("/test")
	public String test1() {
		return "test";
	}
}

未缴费账单控制器:

/**
 * @category 未缴费账单控制器
 *
 */
@Controller
public class BillController {

	@Autowired
	private BillService billService;
	@Autowired
	private BillitemsService bitemService;
	@Autowired
	private OwnerService oService;

	private SimpleDateFormat cx = new SimpleDateFormat("yyyy-MM-dd");

	/**
	 * @category 跳转至业主未缴费展示页面
	 * @param model
	 * @return
	 */
	@RequestMapping("/unpay")
	public String unpay(Model model) {
		// SimpleDateFormat cx = new SimpleDateFormat("yyyy-MM-dd");
		String start = "2010-01-01";
		String stop = cx.format(new Date());
		List list = billService.findByOwner();
		model.addAttribute("list", list);
		model.addAttribute("start", start);
		model.addAttribute("stop", stop);
		model.addAttribute("inputname", "请输入姓名");
		return "unpay";

	}

	/**
	 * @category 通过给定时间范围展示和业主模糊姓名联合查询缴费信息
	 * @param model
	 * @param request
	 * @return
	 * @throws ParseException
	 */
	@RequestMapping("/unpaytime")
	public String unpayByTime(Model model, HttpServletRequest request, HttpSession session) throws ParseException {
		// 获取分页参数设置每页展示的个数
		int pageSize = (int) session.getAttribute("pageSize");
		// 获取分页参数设置传进来的页码是多少
		int pageNum = (int) session.getAttribute("pageNum");
		// 将字符串转换为日期对象
		Date start = cx.parse(request.getParameter("start"));
		Date stop = cx.parse(request.getParameter("stop"));
		// System.out.println(request.getParameter("start"));
		String name = request.getParameter("username");
		// System.out.println(name);
		// 账单的时间用于和stop和start比较
		Date billdate;
		// 开始时间戳
		long startTime = start.getTime();
		// 结束时间戳
		long stopTime = stop.getTime();
		long billtime;
		// 用该list给owner对象的billlist设值
		List billlist = new ArrayList<>();
		// 查找所有
		List list1 = billService.findByOwner();
		List list = new ArrayList<>();
		// 生成要返回的list
		for (int i = 0; i < list1.size(); i++) {
			double total = 0;
			// 循环遍历得到的所有owner对象
			for (int j = 0; j < list1.get(i).getBill().size(); j++) {
				//获得owner单个订单的时间戳
				billdate = cx.parse(list1.get(i).getBill().get(j).getBilltime());
				billtime = billdate.getTime();
				//判断订单的时间戳是否在指定的范围内,并且该owner的姓名要包含指定的字符串
				try {
					if (billtime >= startTime && billtime <= stopTime && list1.get(i).getOname().contains(name)) {
						// 如果满足上述条件,则将该条订单信息添加到billlist中
						billlist.add(list1.get(i).getBill().get(j));
						// 计算总价
						total += list1.get(i).getBill().get(j).getBillitem().getBillitemmoney();
					}
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			// 如果该业主有未缴纳的账单,给该业主对象设置未缴纳账单,并将该对象放入要传给前端的list中
			if (billlist.size() > 0) {
				list1.get(i).setTotal(total);
				list1.get(i).setBill(billlist);
				list.add(list1.get(i));
			}
			// 这里不能使用clear() 用list.clear()方法清空list;用此方法,其它引用该list的值也会变成空。
			billlist = new ArrayList<>();
		}
		if (list.size() < 1) {

			model.addAttribute("nolist", "没有查到相关信息呦,请您重新输入查询条件");
		}
		// 计算查询总数
		double listnum = list.size();
		int totalnum = (int) Math.ceil(listnum / pageSize);
		List list2 = FyResult.getOwnerList(pageSize, pageNum, list, "f");
		// System.out.println(list.size());
		session.setAttribute("start", request.getParameter("start"));
		session.setAttribute("stop", request.getParameter("stop"));
		model.addAttribute("list", list2);
		model.addAttribute("name", name);
		model.addAttribute("totalnum", totalnum);
		session.setAttribute("pageSize", pageSize);
		session.setAttribute("pageNum", pageNum);
		session.setAttribute("findList", list);
		return "unpay";

	}

	/**
	 * @category 收费项目管理界面
	 * @param model
	 * @return
	 */
	@RequestMapping("/sfmanage")
	public String shoufeiguanli(Model model) {
		BillitemsExample example = new BillitemsExample();
		List list = bitemService.selectByExample(example);
		model.addAttribute("list", list);
		return "sfmanage";

	}

	/**
	 * @category 添加新的收费项目
	 * @param model
	 * @param billitem
	 * @return
	 */
	@RequestMapping("/addbillitem")
	public String addbillitem(Model model, Billitems billitem) {
		// 判断添加的收费项目是否为一次性收费
		if (billitem.getBillitemtype().equals("一次性")) {
			Date d = new Date();
			// 生成一次性收费的时间
			// SimpleDateFormat itemtime = new SimpleDateFormat("yyyy-MM-dd");
			String time = cx.format(d);
			billitem.setBillitemtime(time);
			// 添加到数据库
			bitemService.insert(billitem);
			// 从数据库查刚刚添加的收费项目
			Billitems item = bitemService.selectByNameAndTime(billitem.getBillitemname(), time);
			// 给所有的业主添加这个费用收费
			List olist = oService.selectByExample();
			int[] all = new int[olist.size()];
			// 给数组all赋值业主的id
			for (int i = 0; i < all.length; i++) {
				all[i] = olist.get(i).getOid();
			}
			Bill bill = new Bill();
			bill.setBillitemid(item.getBillitemid());
			bill.setPaystatus("未缴纳");
			bill.setBilltime(time);
			for (int i = 0; i < all.length; i++) {
				bill.setUid(all[i]);
				billService.addBill(bill);
			}
			return "redirect:sfmanage.action";
		}
		bitemService.insert(billitem);
		return "redirect:sfmanage.action";
	}

	/**
	 * @category 搜索后展示缴费
	 * @param model
	 * @param request
	 * @return
	 */
	@RequestMapping("/showbyname")
	public String showbyname(Model model, HttpServletRequest request, HttpSession session) {
		int pageSize = (int) session.getAttribute("pageSize");
		int pageNum = (int) session.getAttribute("pageNum");
		String name = request.getParameter("username");
		// System.out.println(name);
		List list1 = billService.findByOwner();
		List list2 = FyResult.getOwnerList(pageSize, pageNum, list1, "f");
		// System.out.println(list1.size());
		List list = new ArrayList<>();
		for (int i = 0; i < list2.size(); i++) {
			// System.out.println(list1.get(i).getOname());
			if (list1.get(i).getOname().contains(name)) {

				list.add(list1.get(i));
			}
		}
		double listnum = list1.size();
		int totalnum = (int) Math.ceil(listnum / pageSize);
		session.setAttribute("findList", list);
		session.setAttribute("pageSize", pageSize);
		session.setAttribute("pageNum", pageNum);
		model.addAttribute("list", list);
		model.addAttribute("inputname", name);
		model.addAttribute("totalnum", totalnum);
		return "unpay";
	}

	/**
	 * @category ajax搜索
	 * @param name
	 * @return
	 */
	@RequestMapping("/showname")
	public @ResponseBody List showname(String name) {
		System.out.println("进来了");
		List list1 = oService.selectByExample();
		List list = new ArrayList<>();
		for (int i = 0; i < list1.size(); i++) {
			if (list1.get(i).getOname().contains(name)) {

				list.add(list1.get(i));
			}
		}
		return list;
	}

	@SuppressWarnings("unchecked")
	@RequestMapping("/unpayfy")
	public String unpayfy(Model model, HttpSession session, int pageSize, int pageNum, String type,
			HttpServletRequest request) {
		System.out.println(pageNum);
		String stop;
		String start;
		// SimpleDateFormat cx = new SimpleDateFormat("yyyy-MM-dd");
		if (session.getAttribute("stop") != null) {
			stop = (String) session.getAttribute("stop");
		} else {
			stop = cx.format(new Date());
		}
		if (session.getAttribute("start") != null) {
			start = (String) session.getAttribute("start");
		} else {
			start = "2010-01-01";
		}

		List list1 = new ArrayList<>();
		if (session.getAttribute("findList") != null) {

			list1 = (List) session.getAttribute("findList");
		} else {
			list1 = billService.findByOwner();
		}
		double listnum = list1.size();
		int totalnum = (int) Math.ceil(listnum / pageSize);
		List list = FyResult.getOwnerList(pageSize, pageNum, list1, type);
		if (type.equals("z")) {

			++pageNum;
			if (pageNum > totalnum) {
				pageNum = totalnum;
			}
		}
		if (type.equals("j")) {

			--pageNum;
			if (pageNum < 1) {

				pageNum = 1;
			}
		}
		if(type.equals("f")) {
			if(pageNum<1) {
				
				pageNum=1;
			}
			if(pageNum>totalnum) {
				pageNum = totalnum;
			}
			
		}
		model.addAttribute("list", list);
		session.setAttribute("stop", stop);
		session.setAttribute("start", start);
		session.setAttribute("pageSize", pageSize);
		session.setAttribute("pageNum", pageNum);
		model.addAttribute("totalnum", totalnum);
		return "unpay";

	}

}

房间处理器:

/**
 * @category 房间处理器
 *
 */
@Controller
public class HouseController {

	@Autowired
	private HouseNumberService hService;
	
	/**
	 * @category 通过传入参数展示相应的房屋信息
	 * @param type
	 * @param model
	 * @return
	 */
	@RequestMapping("/showhouse")
	
	public String showhouse(@RequestParam ("type") String type,Model model) {
		System.out.println(type);
		HousenumberExample example=new HousenumberExample();
		List list=hService.selectByExample(example);
		List list1=new ArrayList();
		if(type.equals("a")) {
			model.addAttribute("list", list);
			model.addAttribute("can", "a");
			return  "house";
		}
		else if(type.equals("x")) {
			for (int i = 0; i < list.size(); i++) {
				if(list.get(i).getStatus().equals("闲置")) {
					list1.add(list.get(i));
				}
			}
			model.addAttribute("can", "x");
			model.addAttribute("list", list1);
			return  "house";
		}
		else if(type.equals("y")) {
			for (int i = 0; i < list.size(); i++) {
				if(list.get(i).getStatus().equals("已出售")) {
					list1.add(list.get(i));
				}
			}
			model.addAttribute("can", "y");
			model.addAttribute("list", list1);
			return  "house";
		}	
		return "mian";
	}
	
	/**
	 * @category 跳转到更新房屋信息页面
	 * @param model
	 * @param homeid
	 * @return
	 */
	@RequestMapping("/updatehouse")
	public String updatehouse(Model model,@RequestParam ("homeid") int homeid) {
		Housenumber house=hService.selectByPrimaryKey(homeid);
		model.addAttribute("house", house);
		return "updatehouse";
		
	}
	/**
	 * @category 跟新房屋信息
	 * @param model
	 * @param house
	 * @return
	 */
	@RequestMapping("/updatehouse1")
	public String updatehouse1(Model model, Housenumber house) {
		String type=house.getStatus();
		if(type.equals("闲置")) {
			type="x";
			
		}else if(type.equals("已出售")) {
			type="y";
		}
		System.out.println(house.getStatus());
		hService.updateByPrimaryKeySelective(house);
		model.addAttribute("house", house);
		return "redirect:showhouse.action?type="+type;
		
	}
	/**
	 * @category 添加新的闲置房屋
	 * @param model
	 * @param house
	 * @return
	 */
	@RequestMapping("/addhouse")
	public String addhouse(Model model,Housenumber house) {
		house.setSaleprice(0);
		hService.insert(house);
		return "redirect:showhouse.action?type=a";
		
	}
	
}

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

你可能感兴趣的:(Java毕业设计项目实战篇,java,maven,mysql,ssm,jsp)