Java项目:ssm房屋租赁管理系统

news2024/9/27 5:53:41

作者主页:源码空间站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

运行截图

相关代码 

ApplyController

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<Apply> applylist=applyService.findapplylist();
		PageInfo<Apply> p=new PageInfo<Apply>(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<Userlist> list=userlistService.getmyapply(userlist.getId());
		PageInfo<Userlist> p=new PageInfo<Userlist>(list);
		model.addAttribute("userlist", list);
		model.addAttribute("p", p);
		model.addAttribute("mainPage", "myapply.jsp");
		return "zuke/main";
	}
	
	
}

HetongController

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";
	}
}

ZulistController

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> zulist=zulistService.findzuuserlist();
		PageInfo<Zulist> p=new PageInfo<Zulist>(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<Userlist> list=userlistService.getUserzuList(userlist.getId());
		PageInfo<Userlist> p=new PageInfo<Userlist>(list);
		model.addAttribute("userlistzu", list);
		model.addAttribute("p", p);
		model.addAttribute("mainPage", "myzulist.jsp");
		
		return "zuke/main";
	}
	
}

如果也想学习本系统,下面领取。关注并回复:024ssm 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/56333.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

皓量科技入选《中国数字营销生态图2022版》4大赛道!

11月28日&#xff0c;由中国商务广告协会数字营销专业委员会、虎啸奖组委会及秒针营销科学院三方合作出版的《中国数字营销生态图2022版》正式发布&#xff08;以下简称生态图&#xff09;。皓量科技凭借多年深耕程序化广告领域的实力与经验&#xff0c;在全行业服务商的征集调…

Codeforces Round #752 (Div. 1) B. Moderate Modular Mode

翻译&#xff1a; 谁有两个偶数&#x1d465;和&#x1d466;。帮助他找到一个整数&#x1d45b;&#xff0c;使1≤&#x1d45b;≤2⋅1018&#xff0c;且&#x1d45b;mod&#x1d465;&#x1d466;mod&#x1d45b;。这里&#xff0c;&#x1d44e;mod&#x1d44f;表示&am…

夯实算法-整数转罗马数字

题目&#xff1a;LeetCodeLeetCode 罗马数字包含以下七种字符&#xff1a; I&#xff0c; V&#xff0c; X&#xff0c; L&#xff0c;C&#xff0c;D 和 M。 字符 数值 I 1 V 5 X 10 L 50 C 100 D …

Linux操作系统~匿名管道和命名管道的使用及其原理分析

目录 1.匿名管道 &#xff08;1&#xff09;.匿名管道的原理 &#xff08;2&#xff09;.pipe接口的使用 如果只写不读&#xff08;求管道的大小&#xff09; &#xff08;3&#xff09;.匿名管道五个特点 &#xff08;4&#xff09;.匿名管道的四种情况 3.命名管道 &a…

世界杯之用Java实现随机胜平负

一、本章猜测随机数首先需要用到Scanner语句&#xff0c;对用户需要几组胜平负数量进行猜测&#xff0c;说动用到几组肯定要用到for循环了&#xff0c;还有要实现随机&#xff0c;就需要用到Math方法&#xff0c;进行随机抽取。 1.Scanner 首先使用Scanner语句抓取用户…

MATLAB算法实战应用案例精讲-【工具篇】运筹优化工具OR-TOOLS(补充篇)(附实战案例及代码实现)

前言 本文为【工具篇】运筹优化工具OR-TOOLS(附实战案例及代码实现)的补充篇。 OR-Tools是一个用于优化的开源软件套件,用于解决车辆路径、流程、整数和线性规划以及约束编程等世界上最棘手的问题。同时OR-Tools提供了C++,Python,Java,.NET的接口,同时提供统一接口封装来…

为你揭秘拼购为什么是破产老板手中的最后一根稻草?

拼购&#xff0c;已经成为了电商平台自主传播的一种营销活动&#xff0c;通过拼团可以促成更多的成交量&#xff0c;但拼团也不是这样简单的放在那里就能有客户进来参与&#xff0c;其中还有很多细节上面的地方需要我们好好探究。这个拼购模式和我们之前见过的拼多多拼团、拼购…

什么蓝牙耳机适合realme手机?适合realme手机的高端蓝牙耳机推荐

根据网络调查数据显示&#xff0c;市面上的耳机需求量在不断增加&#xff0c;随着智能手机的普及&#xff0c;耳机作为炙手可热的产品&#xff0c;尤其是网易云、全民K歌&#xff0c;直播的流行&#xff0c;消费者对于耳机的需求不仅仅是听歌了&#xff0c;有线耳机也逐渐被无线…

【Matplotlib绘制图像大全】(五):饼图

前言 大家好,我是阿光。 本专栏整理了《Matplotlib绘制图像大全》,内包含了各种常见的绘图方法,以及Matplotlib各种内置函数的使用方法,帮助我们快速便捷的绘制出数据图像。 正在更新中~ ✨ 🚨 我的项目环境: 平台:Windows10语言环境:python3.7编译器:PyCharmMatp…

风靡互联网关键词 Web3.0 | 区块链 | 比特币 | 元宇宙……

&#x1f497;wei_shuo的个人主页 &#x1f4ab;wei_shuo的学习社区 &#x1f310;Hello World &#xff01; Web web是互联网的总称&#xff0c;全称为World Wide Web&#xff0c;缩写WWW &#xff0c;即全球广域网&#xff0c;也称为万维网&#xff0c;它是一种基于超文本和H…

007.复原 IP 地址

1.题目链接&#xff1a; 93. 复原 IP 地址 2.解题思路&#xff1a; 2.1.题目要求&#xff1a; 给定一串只包含数字的字符串s&#xff0c;返回所有让 s 构成 有效IP地址 的数字组合。 有IP地址&#xff1a; 4个 [0,255] 范围内的数字 组成&#xff0c;并且整数之间用 " …

绿源:“老大哥”冲刺IPO,新的故事如何讲?

又一家老牌电动两轮车企业“开”向了资本市场。 11月22日&#xff0c;绿源集团控股&#xff08;开曼&#xff09;有限公司&#xff08;以下简称“绿源集团”&#xff09;正式向港交所递交招股说明书&#xff0c;拟主板挂牌上市&#xff0c;中信建设国际担任独家保荐人&#xf…

ctfshow node.js专题

文章目录web334web335web336web337web338web339web340web341web342、web343web334 给了附件&#xff0c;然后进入后发现是一个登录框。 在附件中知道了账号密码&#xff0c;但是却无法登录。 先看user从哪里获取&#xff1a; var user findUser(req.body.username, req.bod…

虹科案例 | 订单自动分拣效率居然这么高?

Background 背景 过去&#xff0c;一家自动仓储和检索系统&#xff08;AS/RS&#xff09;梭子解决方案的制造商依靠车轮编码器来指示梭子沿轨道的位置。虽然这种解决方案已经使用了多年&#xff0c;也将继续使用&#xff0c;但它可能容易出现定位错误&#xff0c;这通常是由车…

[附源码]Python计算机毕业设计SSM考勤管理系统(程序+LW)

项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM mybatis Maven Vue 等等组成&#xff0c;B/S模式 M…

Kotlin高仿微信-第35篇-支付-二维码收款(二维码)

Kotlin高仿微信-项目实践58篇详细讲解了各个功能点&#xff0c;包括&#xff1a;注册、登录、主页、单聊(文本、表情、语音、图片、小视频、视频通话、语音通话、红包、转账)、群聊、个人信息、朋友圈、支付服务、扫一扫、搜索好友、添加好友、开通VIP等众多功能。 Kotlin高仿…

【python可视化】python编码规范、标准库与扩展库对象的导入与使用

&#x1f64b;‍ 哈喽大家好&#xff0c;本次是python数据分析、挖掘与可视化专栏第一期 ⭐本期内容&#xff1a;python编码规范、标准库与扩展库对象的导入与使用 &#x1f3c6;系列专栏&#xff1a;Python数据分析、挖掘与可视化 &#x1f44d;欢迎大佬指正&#xff0c;一起学…

嵌入式分享合集115

一、数字万用表电压、电流、电阻、电容、频率、电池、二极管等测量方法 数字万用表可用来测量直流和交流电压、直流和交流电流、电阻、电容、频率、电池、二极管等等。整机电路设计以大规模集成电路双积分A/D转换器为核心&#xff0c;并配以全过程过载保护电路&#xff0c;使之…

动态改变列数做分页

【问题】 My question is: How can I prepare template which will receive various number of columns in such way, that if they won’t fit to page, next columns would be printed on a second page. For example If I have 10 columns, but only 6 fit to the page 1,…

[附源码]计算机毕业设计springboot万佳商城管理系统

项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM mybatis Maven Vue 等等组成&#xff0c;B/S模式 M…