作者主页:源码空间站2022
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
本项目分为管理员与租户2种角色:
管理员主要功能包括:
登录、查看房源信息、添加房源、查看租赁情况、合同查看、看房申请、退租申请、报障、租金管理、日程管理、账户管理
租户主要功能包括:
登录、查看房源信息、我的租赁、看房申请、退租申请、租金管理、报障
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
6.是否Maven项目: 否;
1. 后端:spring+springmvc+mybatis
2. 前端:JSP+css+javascript+jQuery+bootstrap
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中db.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入http://localhost:8080/text2 登录
管理员账号密码:admin/123456
租户账号密码:admin/123456
- package controller;
-
- import java.util.List;
-
- import javax.servlet.http.HttpSession;
-
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
-
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
-
- import Pojo.Apply;
- import Pojo.Houselist;
- import Pojo.User;
- import Pojo.Userlist;
- import Pojo.Zulist;
- import service.ApplyService;
- import service.HouselistService;
- import service.UserlistService;
-
- @Controller
- public class ApplyController {
- @Autowired
- private UserlistService userlistService;
- @Autowired
- private HouselistService houselistService;
- @Autowired
- private ApplyService applyService;
- //申请看房
- @RequestMapping("/applycheckuserlist")
- public String applycheckuserlist(HttpSession httpSession,Model model,Integer id){
- User user1= (User) httpSession.getAttribute("user");
- Integer user_id=user1.getId();
- Userlist list=userlistService.findhasuserlist(user_id);
- if(list==null){
- model.addAttribute("error", "applycheck");
- return "redirect:houselist.action";
- }else{
- Houselist houselist=houselistService.findid(id);
- houselist.setStatus("已被申请");
- houselistService.updatehousestatus(houselist);
- Integer userlist_id=list.getId();
- Apply apply=new Apply();
- apply.setHouse_id(houselist.getHouseid());
- apply.setAddress(houselist.getAddress());
- apply.setPrice(houselist.getPrice());
- apply.setArea(houselist.getArea());
- apply.setStatus("申请中");
- apply.setUserlist_id(userlist_id);
- applyService.insertapply(apply);
- model.addAttribute("error", "applysuccess");
- return "redirect:houselist.action";
-
-
- }
-
- }
- //管理员查看申请看房列表
- @RequestMapping("/findapplylist")
- public String findapplylist(Model model,@RequestParam(required=false,defaultValue="1") Integer page,
- @RequestParam(required=false,defaultValue="2") Integer pageSize) throws Exception{
- PageHelper.startPage(page, pageSize);
- List
applylist=applyService.findapplylist(); - PageInfo
p=new PageInfo(applylist); - model.addAttribute("applylist",applylist);
- model.addAttribute("p", p);
- model.addAttribute("mainPage","applylist.jsp");
- return "admin/main1";
- }
-
- @RequestMapping("/applychangehousestatus")
- public String applychangehousestatus(HttpSession httpSession,Model model,String house_id)throws Exception{
- User user1= (User) httpSession.getAttribute("user");
- Integer user_id=user1.getId();
- Userlist userlist=userlistService.findhasuserlist(user_id);
- Houselist houselist=houselistService.findhouseid(house_id);
- houselist.setStatus("已租赁");
- houselistService.updatehousestatus(houselist);
- Zulist zulist=new Zulist();
- zulist.setHouse_id(house_id);
- zulist.setPrice(houselist.getPrice());
- zulist.setAddress(houselist.getAddress());
-
- return "";
- }
- //管理员拒绝看房申请
- @RequestMapping("/refuseapply")
- public String refuseapply(String house_id,Model model){
- Houselist houselist=new Houselist();
- houselist.setHouseid(house_id);
- houselist.setStatus("未租赁");
- applyService.refuseapply(houselist);
-
- return "redirect:findapplylist.action";
- }
-
- //租客查看自己的 看房申请
- @RequestMapping("/getmyapply")
- public String getmyapply(Model model,HttpSession httpSession,@RequestParam(required=false,defaultValue="1") Integer page,
- @RequestParam(required=false,defaultValue="2") Integer pageSize){
- User user1= (User) httpSession.getAttribute("user");
- Userlist userlist=userlistService.findhasuserlist(user1.getId());
- PageHelper.startPage(page, pageSize);
- List
list=userlistService.getmyapply(userlist.getId()); - PageInfo
p=new PageInfo(list); - model.addAttribute("userlist", list);
- model.addAttribute("p", p);
- model.addAttribute("mainPage", "myapply.jsp");
- return "zuke/main";
- }
-
-
- }
- package controller;
-
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.RequestMapping;
-
- import Pojo.Apply;
- import Pojo.Checkout;
- import Pojo.Hetong;
- import Pojo.Houselist;
- import Pojo.Zulist;
- import service.ApplyService;
- import service.CheckoutService;
- import service.HetongService;
- import service.HouselistService;
- import service.ZulistService;
- @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";
- }
- }
- package controller;
-
- import java.util.List;
-
- import javax.servlet.http.HttpSession;
-
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
-
- import com.fasterxml.jackson.databind.util.JSONPObject;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
-
- import Pojo.Apply;
- import Pojo.Hetong;
- import Pojo.User;
- import Pojo.Userlist;
- import Pojo.Zulist;
- import service.UserlistService;
- import service.ZulistService;
-
- @Controller
- @RequestMapping("/zulist")
- public class ZulistController {
- @Autowired
- private ZulistService zulistService;
- @Autowired
- private UserlistService userlistService;
- //跳到增添合同的页面
- @RequestMapping("/toaddhetong")
- public String toaddhetong(Model model,String house_id){
- Hetong hetong=new Hetong();
- hetong.setHouse_id(house_id);
- model.addAttribute("hetong", hetong);
- model.addAttribute("mainPage", "addhetong.jsp");
-
- return "admin/main1";
- }
- //管理员查看所有在租列表
- @RequestMapping("/findzulist")
- public String findzulist(Model model,@RequestParam(required=false,defaultValue="1") Integer page,
- @RequestParam(required=false,defaultValue="2") Integer pageSize) throws Exception{
- PageHelper.startPage(page, pageSize);
- List
zulist=zulistService.findzuuserlist(); - PageInfo
p=new PageInfo(zulist); - model.addAttribute("p", p);
- model.addAttribute("zulist", zulist);
- model.addAttribute("mainPage", "zulist.jsp");
- return "admin/main1";
- }
-
- //查看我的在租列表
- @RequestMapping("/myzulist")
- public String myzulist(Model model,HttpSession httpSession,@RequestParam(required=false,defaultValue="1") Integer page,
- @RequestParam(required=false,defaultValue="2") Integer pageSize) throws Exception{
-
- User user1= (User) httpSession.getAttribute("user");
- Userlist userlist=userlistService.findhasuserlist(user1.getId());
- PageHelper.startPage(page, pageSize);
- List
list=userlistService.getUserzuList(userlist.getId()); - PageInfo
p=new PageInfo(list); - model.addAttribute("userlistzu", list);
- model.addAttribute("p", p);
- model.addAttribute("mainPage", "myzulist.jsp");
-
- return "zuke/main";
- }
-
- }
如果也想学习本系统,下面领取。关注并回复:024ssm