Java项目:小区物业管理系统(java+JDBC+Mysql+Servlet+Jsp)

Posted qq_1334611189

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java项目:小区物业管理系统(java+JDBC+Mysql+Servlet+Jsp)相关的知识,希望对你有一定的参考价值。

servlet+jdbc+jsp实现的小区物业管理系统,该系统有两个角色一个是管理员一个是业主,

管理员功能有:业主管理、房屋管理、报修管理、巡查管理、公告管理等。

业主功能有:报修管理、公告管理。

运行环境:jdk1.8、tomcat7.0、mysql5.x、idea

 

 

 

 

 

商铺控制器:



/**
 * @category 商铺控制器
 *
 */
@Controller
public class BiddingController 
	@Autowired
	BiddingService biddingService;
	@Autowired
	TenderService tenderService;

	@RequestMapping("/savestorebid")
	public String addOne(Model model, Bidding bidding, double price) 
		double price1 = bidding.getArea() * price;
		Timestamp d = new Timestamp(System.currentTimeMillis());
		bidding.setPrice(price1);
		bidding.setDate(d);
		bidding.setState("正在竞标");
		biddingService.addOne(bidding);
		return "redirect:biddinging.action";
	

	@RequestMapping("/")
	public String zhuye() 
		return "redirect:jingbiao.action";
	
	@RequestMapping("/biddingshow")
	public String biddingShow(Model model) 
		List<Bidding> list = biddingService.findAll();
		model.addAttribute("biddinglist", list);
		return "bidding";
	

	@RequestMapping("/deletebiddingone")
	public String deleteOne(int bid) 
		return null;
	

	@RequestMapping("/biddinging")
	public String biddingIng(Model model) 
		List<Tender> list = tenderService.findAll();
		model.addAttribute("adornShowList", list);
		return "audit";
	

	@RequestMapping("/mybidding")
	public String mybidding(Model model, HttpSession session) 
		String tel = (String) session.getAttribute("userTel");
		List<TenderVo> list = tenderService.findByTel(tel);
		for (TenderVo t : list) 
			System.out.println(t.getTid());
		
		model.addAttribute("mylist", list);
		return "myjingbiao";
	

	@RequestMapping("/savejingbianman")
	public String savejingbianman(int bid, Tender tender, Model model, HttpSession session) 
		biddingService.updateOne(bid);
		try 
			Thread.sleep(1000);
			tenderService.addOne(tender);
		 catch (InterruptedException e) 
			e.printStackTrace();
		
		session.setAttribute("userTel", tender.getTel());
		return "redirect:jingbiao.action";
	

	@RequestMapping("/jingbiao")
	public String jingbiao(Model model) 
		List<Bidding> list = biddingService.findAll();
		model.addAttribute("biddinglist", list);
		return "jingbiao";
	

	@RequestMapping("/deletemyjingbiao")
	public String deletemyjingbiao(int tid) 
		System.out.println("deletemyjingbiao:" + tid);
		tenderService.deleteTenderOne(tid);
		return "redirect:jingbiao.action";
	

	/**
	 * 通过audit字段查找list
	 */
	@RequestMapping("/auditingbyaudit")
	public String auditingbyaudit(Model model, String audit) 
		List<Tender> list = tenderService.findByAudit(audit);
		model.addAttribute("adornShowList", list);
		return "audit";
	

	@RequestMapping("/auditingbyliftstate")
	public String auditingbyliftstate(Model model, int liftstate) 
		List<Tender> list = tenderService.findByLiftstate(liftstate);
		model.addAttribute("adornShowList", list);
		return "audit";
	

	/**
	 * 拒绝竞标控制
	 */
	@RequestMapping("/refuse")
	public String refuse(int tid, String remaker) 
		System.out.println("refuse:" + remaker);
		tenderService.refuse(tid, remaker);
		return "redirect:biddinging.action";
	
	/**
	 * 竞标通过
	 */
	@RequestMapping("/yespass")
	public String yespass(int tid) 
		biddingService.yesPass(tid);
		return "redirect:biddinging.action";
	

	/**
	 * 搜索展示
	 */
	@RequestMapping("/searchjb")
	public String searchjb(String searchtext,Model model) 
		List<Bidding> list = new ArrayList<Bidding>();
		list = biddingService.selectLike(searchtext);
		 if(list.size()==0) 
			 String[] str = searchtext.split("");
			 for (int i = 0; i < str.length; i++) 
				 list = biddingService.selectLike(str[i]);
				 if(list.size()>0) break;
				 if(biddingService.selectLike(str[str.length-1]).size()<=0) 
					 list = biddingService.selectLike("");
					 
				 
			 
		 
		 model.addAttribute("biddinglist", list);
		return "jingbiao";
	


维修内容:

@Controller
public class CleanController 

	@Autowired
	CleanService cleanService;
	/**
	 * 查询所有维修内容
	 */
	@RequestMapping("/cleanact1")
	public String clist(Model model) 
		List<Clean>list=cleanService.selectByExample();
		model.addAttribute("clist", list);
		System.out.println(list.size());
		return "showclean";
	
	/**
	 * 分类查询维修信息
	 */
	@RequestMapping("/cleanact2")
	public String clist2(Model model,String claccomplish) 
		List<Clean> list=cleanService.findClieanList(claccomplish);
		model.addAttribute("clist", list);
		return "showclean2";
	
	/**
	 * 保存
	 * 
	 * @return
	 */
	@RequestMapping("/saveclean3")
	public String save(Clean clean, Model model) 
		System.out.println("+++++++++++++jinlai");
		cleanService.updatesave3(clean);
		return "redirect:cleanact1.action";
	
	/**
	 * 根据id查询所有的维修信息
	 */
	@RequestMapping("/findCleanById")
	public String findCleanById(Model model, @RequestParam(value = "clid", defaultValue = "0") int clid) 
		Clean clean = cleanService.findCleanById(clid);
		model.addAttribute("clist", clean);
		return "showclean";
	
	/**
	 * 点击更改完成状态
	 */
	@RequestMapping("/pushupdate")
	public String pushupdate(Clean clean) 
		cleanService.updaclaccomplish(clean);
		return "redirect:cleanact1.action";
	
	
	/**
	 * 用户登记维修信息
	 */
	@RequestMapping("/addcleanq")
	public String signin() 
		return "regist";
	

	// 客户注册控制器
	@RequestMapping("/signin2")
	public String signinjudge(Clean clean) 
	
		boolean flag = cleanService.insert(clean);
		
		if (flag == true) 

			// 使用重定向,返回登录界面
			return "css";
		 else 
			return "css";
		
	
	/**
	   * 保洁部门自己登记
	 * @param maintain
	 * @return
	 */
	@RequestMapping("/addclean")
	public String addmm(Clean clean) 
	
		boolean flag = cleanService.insert(clean);	
		if (flag == true) 
			// 使用重定向,返回登录界面
			return "redirect:cleanact1.action";
		 else 
			return "css";
		
	
	/**
	 * 根据结束时间日期查询
	 */
	@RequestMapping("/findCleanBymdate")
	public String findCleanBymdate(Model model,String cltime) 
		List<Clean>list2 = cleanService.findCleanBymdate(cltime);
		model.addAttribute("clist", list2);
		return "showclean";
	
	/**
	 * 删除一个住户
	 */
	@RequestMapping("/deleteclen")
	public String deleteone(int clid) 
		cleanService.deleteByPrimaryKey(clid);
		return "redirect:cleanact1.action";
	

	/**
	 * 根据id  完成时间   提交时间 模糊查询
	 * @param model
	 * @param md
	 * @return
	 */
	@RequestMapping("/findclean1")
	public String findclean(Model model,String cleanname) 
		System.out.println("+++++++++++++");
		System.out.println(cleanname);
		List<Clean>list3 = cleanService.findMainClean(cleanname);
		model.addAttribute("clist", list3);
		
		return "showclean";
	

业主登录控制器:

@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<Message> 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<Carport> list = carportService.findCarByState("未使用");
		for (Carport carport2 : list) 
			carport.setDuration(carport2.getDuration());
		
		int count = list.size();
		List<Carport> list1 = new ArrayList<Carport>();
		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<Owner> 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<Carport> list3 = carportService.findCarByState("未使用");
				int count = list3.size();
				List<Carport> list1 = new ArrayList<Carport>();
				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<Carport> 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<Owner> 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);
				List<Owner>list3 = ownerService.findMain(mds);
				model.addAttribute("list", list3);
				
				return "list2";
			

以上是关于Java项目:小区物业管理系统(java+JDBC+Mysql+Servlet+Jsp)的主要内容,如果未能解决你的问题,请参考以下文章

基于Javaweb实现小区物业管理系统

Java智慧社区商业级别项目源码,拿来学习真不错

Java智慧社区商业级别项目源码,拿来学习真不错

Java智慧社区商业级别项目源码,拿来学习真不错

Java项目:小区物业管理系统(java+Springboot+ssm+mysql+maven+jsp)

Java项目:小区物业管理系统(java+Springboot+ssm+mysql+maven+jsp)