Java项目:房屋租赁系统(java+SSM+jsp+mysql+maven)

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

一、项目简述

功能: 房源信息模块:房源信息展示、房源信息更新、房源信息 增加、房源信息删除 账户管理模块:账户登录、账户绑定、账户管理 租金结算模块:每月租金信息、租金交付功能、月租金收 入总^^克计 房屋租赁合同管理模块:房屋租赁合同录入、房屋租赁合 同展示、房屋租赁价格修改、房屋租赁合同终止 报障模块:租客报账、管理员报障审核、租客报B章统计 日程模块:收租日程显示等。

二、项目运行

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

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

 

用户控制层:

@Controller

public class UserController {

	@Autowired
	private UserService userService;
	
	@RequestMapping("/login")
	public String userList() throws Exception{
		
		
		return "login";
		
	}
	@RequestMapping("/logincheck")
	public String login(User user,Model model,HttpSession httpSession) throws Exception{
		
		User user1=userService.login(user);
		
		if(user1!=null){
			httpSession.setAttribute("user", user1);
			if(user1.getType().equals("zuke")){
				return "zuke/main";
			}
			else{
				return "admin/main1";
			}
		}else{
			String error="error";
			model.addAttribute("error", error);
		return "login";
		}
	}
	@RequestMapping("/toindex")
	public String toindex(Model model) throws Exception{
		
		
		return "admin/index";
		}
	}

合同信息控制层:

@Controller
@RequestMapping("/hetong")
public class HetongController {
	@Autowired
	private HetongService hetongService;
	@Autowired
	private HouselistService houselistService;
	@Autowired
	private ApplyService applyService;
	@Autowired
	private ZulistService zulistService;
	@Autowired
	private CheckoutService checkoutService;
	
	//新增合同信息,修改房屋列表的状态,从申请列表中删除,增添到租赁列表当中
	@RequestMapping("/inserthetong")
	public String inserthetong(Model model,Hetong hetong){
		//新增合同信息
		hetongService.inserthetong(hetong);
		Hetong hetong1=hetongService.findhetong(hetong.getHouse_id());
		//修改房屋列表状态
		Houselist houselist=houselistService.findhouseid(hetong1.getHouse_id());
		houselist.setStatus("已租赁");
		houselistService.updatehousestatus(houselist);
		//添加到租赁列表当中
		Zulist zulist=new Zulist();
		Apply apply=applyService.findbyhouse_id(hetong.getHouse_id());
		zulist.setHouse_id(hetong.getHouse_id());
		zulist.setUserlist_id(apply.getUserlist_id());
		zulist.setContract_id(hetong1.getId());
		zulist.setPrice(apply.getPrice());
		zulist.setAddress(apply.getAddress());
		zulistService.insertzulist(zulist);
		//从申请列表中删除
		applyService.deletebyhouse_id(hetong1.getHouse_id());
		model.addAttribute("error", "zusuccess");
		return "redirect:/zulist/findzulist.action";
		
	}
	@RequestMapping("/seehetong")
	public String seehetong(String house_id,Model model){
		Hetong hetong=hetongService.findhetong(house_id);
		model.addAttribute("hetong", hetong);
		model.addAttribute("mainPage", "hetong.jsp");
		return "admin/main1";
	}
	@RequestMapping("/updatehetong")
	public String updatehetong(String house_id,Model model){
		Hetong hetong=hetongService.findhetong(house_id);
		model.addAttribute("hetong", hetong);
		model.addAttribute("mainPage", "updatehetong.jsp");
		return "admin/main1";
	}
	@RequestMapping("/changehetong")
	public String changehetong(Hetong hetong){
		hetongService.updatehetong(hetong);
		
		return "redirect:/zulist/findzulist.action";
	}
	//终止合同操作:删除合同,插入已退租列表,删除在租列表,删除房屋列表
	
	@RequestMapping("/deletehetong")
	public String deletehetong(String house_id,Model model){
		hetongService.deletehetong(house_id);
		Zulist zulist=zulistService.findzulist(house_id);
		Checkout checkout=new Checkout();
		checkout.setHouse_id(house_id);
		checkout.setAddress(zulist.getAddress());
		checkout.setStatus("已退租");
		checkout.setUserlist_id(zulist.getUserlist_id());
		checkoutService.insertcheckout(checkout);
		houselistService.deletehousebyhouseid(house_id);
		zulistService.deletezulist(house_id);
		
		model.addAttribute("error", "checkoutsuccess");
		return "redirect:/zulist/findzulist.action";
	}
	
	@RequestMapping("/zukeseehetong")
	public String zukeseehetong(String house_id,Model model){
		Hetong hetong=hetongService.findhetong(house_id);
		model.addAttribute("hetong", hetong);
		model.addAttribute("mainPage", "showhetong.jsp");
		return "zuke/main";
	}
}

处理的报障控制层:

@Controller
@RequestMapping("/wrong")
public class WrongController {
  @Autowired
  private SolveService solveService;
  @Autowired
  private UserlistService userlistService;
  @Autowired
  private PaidService paidService;
  @Autowired
  private ZulistService zulistService;
  //管理员查找所有已处理的报障
  @RequestMapping("/selectall")
  public String selectall(Model model,QueryVo vo,@RequestParam(required=false,defaultValue="1") Integer page,
          @RequestParam(required=false,defaultValue="6") Integer pageSize){
		PageHelper.startPage(page, pageSize);
		List<Solve> list=solveService.selectall(vo);
		PageInfo<Solve> p=new PageInfo<Solve>(list);
		Integer count=solveService.selectcount(vo);
		model.addAttribute("solve", list);
		model.addAttribute("count", count);
		model.addAttribute("p", p);
		model.addAttribute("mainPage", "solve.jsp");
		model.addAttribute("vo", vo);
		return "admin/main1";
	}
//租客查找自己已处理的报障
		@RequestMapping("/findmysolve")
		public String findmysolve(HttpSession httpSession,Model model,QueryVo vo,@RequestParam(required=false,defaultValue="1") Integer page,
	            @RequestParam(required=false,defaultValue="6") Integer pageSize){
			User user1= (User) httpSession.getAttribute("user");
			Userlist userlist=userlistService.findhasuserlist(user1.getId());
			
			vo.setUserlist_id(userlist.getId());
			PageHelper.startPage(page, pageSize);
			List<Solve> list=solveService.selectall(vo);
			PageInfo<Solve> p=new PageInfo<Solve>(list);
			Integer count=solveService.selectcount(vo);
			model.addAttribute("solve", list);
			model.addAttribute("count", count);
			model.addAttribute("p", p);
			model.addAttribute("mainPage", "mysolve.jsp");
			model.addAttribute("vo", vo);
			return "zuke/main";
		}
		//管理员删除已处理报障记录
		@RequestMapping("/deletesolve")
		public String deletesolve(Integer id){
			solveService.deletesolve(id);
			return "redirect:selectall.action";
		}
		//zuke删除自己的已处理报障记录
			@RequestMapping("/zukedeletesolve")
			public String zukedeletesolve(Integer id){
				solveService.deletesolve(id);
				return "redirect:findmypaid.action";
			}
			//租客跳到我要报障页面
			@RequestMapping("/showaddwrong")
			public String showaddwrong(HttpSession httpSession,Model model,@RequestParam(required=false,defaultValue="1") Integer page,
		            @RequestParam(required=false,defaultValue="6") Integer pageSize)throws Exception{
				User user1= (User) httpSession.getAttribute("user");
				Userlist userlist=userlistService.findhasuserlist(user1.getId());
				PageHelper.startPage(page, pageSize);
				List<Zulist> list=zulistService.findzulistbyuid(userlist.getId());
				PageInfo<Zulist> p=new PageInfo<Zulist>(list);
				model.addAttribute("zulist", list);
				model.addAttribute("p", p);
				model.addAttribute("mainPage", "showaddwrong.jsp");
				return "zuke/main";
			}
			//点击报障后跳转到添加报障信息页面
			@RequestMapping("/addwrong")
			public String addwrong(Integer id,Model model){
				Zulist zulist=paidService.findzukezulist(id);
				model.addAttribute("zulist", zulist);
				model.addAttribute("mainPage", "addwrong.jsp");
				return "zuke/main";
			}
			//添加报障信息到wrong表
			@RequestMapping("/insertwrong")
			public String insertwrong(Wrong wrong,Model model){
				solveService.insertwrong(wrong);
				model.addAttribute("error","insertwrong");
				
				return "redirect:showaddwrong.action";
			}
			//管理员查看所有未处理报障
			@RequestMapping("/wronglist")
			public String wronglist(Model model,@RequestParam(required=false,defaultValue="1") Integer page,
		            @RequestParam(required=false,defaultValue="6") Integer pageSize){
				QueryVo vo=new QueryVo();
				PageHelper.startPage(page, pageSize);
				List<Wrong> list=solveService.findwrong(vo);
				PageInfo<Wrong> p=new PageInfo<Wrong>(list);
				model.addAttribute("wrong", list);
				model.addAttribute("p", p);
				model.addAttribute("mainPage", "wrong.jsp");
				return "admin/main1";
			}
			//租客查看自己的未处理报障
			@RequestMapping("/mywronglist")
			public String mywronglist(Model model,HttpSession httpSession,@RequestParam(required=false,defaultValue="1") Integer page,
		            @RequestParam(required=false,defaultValue="6") Integer pageSize){
				User user1= (User) httpSession.getAttribute("user");
				Userlist userlist=userlistService.findhasuserlist(user1.getId());
				QueryVo vo=new QueryVo();
				vo.setUserlist_id(userlist.getId());
				PageHelper.startPage(page, pageSize);
				List<Wrong> list=solveService.findwrong(vo);
				PageInfo<Wrong> p=new PageInfo<Wrong>(list);
				model.addAttribute("p", p);
				model.addAttribute("wrong",list);
				model.addAttribute("mainPage", "mywrong.jsp");
				return "zuke/main";
			}
			//管理员处理报障
			@RequestMapping("/gotosolve")
			public String gotosolve(Integer id,Model model){
				
				Wrong wrong=solveService.findbyid(id);
				Solve solve=new Solve();
				solve.setHouse_id(wrong.getHouse_id());
				solve.setAddress(wrong.getAddress());
				solve.setDate(wrong.getDate());
				solve.setDetail(wrong.getDetail());
				solve.setName(wrong.getName());
				solve.setUserlist_id(wrong.getUserlist_id());
				solve.setStatus("已处理");
				solveService.gotosolve(id, solve);
				model.addAttribute("error", "duesucess");
				return "redirect:selectall.action";
			}
}

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

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

beyondwild

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

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

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

打赏作者

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

抵扣说明:

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

余额充值