springboot房屋租赁管理系统的设计与实现

一、选题背景(综述本课题研究现状、选题目的及意义)

随着计算机的普及和计算机科学技术的飞速发展,人们开始越来越多的利用计算机解决实际问题。2020年3月6日,住房和城乡建设部党组书记、部长王蒙徽在《人民日报》发表《推动住房和城乡建设事业高质量发展》的署名文章。文章在强调了“长期坚持房子是用来住的、不是用来炒的定位”之后,明确指出,要着力培育和发展租赁住房,促进解决新市民等群体的住房问题。加快推动住房保障体系与住房市场体系相衔接,大力发展政策性租赁住房。进一步培育机构化、规模化租赁企业,加快建立和完善政府主导的住房租赁管理服务平台。

3月6日,住房和城乡建设部党组书记、部长王蒙徽在《人民日报》发表《推动住房和城乡建设事业高质量发展》的署名文章。文章在强调了“长期坚持房子是用来住的、不是用来炒的定位”之后,明确指出,要着力培育和发展租赁住房,促进解决新市民等群体的住房问题。加快推动住房保障体系与住房市场体系相衔接,大力发展政策性租赁住房。进一步培育机构化、规模化租赁企业,加快建立和完善政府主导的住房租赁管理服务平台。
    既然要让经济条件较差、购房能力不足的家庭租房,自然要有充裕的租赁住房了。因此,发展政策性租赁住房,就成了非常重要的方面。市场主体当然可以是国有企业,也可以是其他所有制企业,尤其是民营企业,既可以是国有资本,也可以是其他所有制资本。必要时,也可以混合所有。关键就看,能否按照政策承担相应的责任,能否真正为中低收入阶层提供租赁住房。如果租金价格超过了中低收入阶层的承受能力,同样是不可取的,是无法称之为政策性租赁住房的。
所以,在接下来的时间里,一定会有许多政策性住房租赁企业诞生,且需要严格按照相关的政策规定执行。否则,就不符合成立政策性住房租赁企业的条件。在这样的情况下,相关的制度、规章、规定、政策,特别是优惠政策、补贴政策、用地政策等,也会同步出台。
    为了解决这些问题,房屋租赁管理系统的出现是必不可少的,根据实际需求,从系统总体目标、设计原则和功能需求三个方面对本系统进行了需求分析。最后进行了详细设计和测试。该系统分别从前台系统和后台系统两个端口设计了10个系统模块,包括用户注册、用户登录、修改密码、房屋搜索、租用房屋、出租房屋、管理员登录、用户管理、房屋管理、订单管理。

二、研究目标和内容

2.1研究目标

本课题的研究目标在于研究房屋租赁管理系统设计的流程,主要有以下目标:

(1)设计基于B/S结构的房屋租赁管理系统,可以灵活的部署在Intermet网或校园网上,使本系统具有可扩展性和易用性。

(2)在架构上将采用面向对象的设计方法和MVC架构模式对房屋租赁管理系统进行设计和实现。

(3)本系统主要面向租客,出租人,管理人员三种用户,主要是为了满足租客对满意房子的租房需要,租客出租空闲房屋的需要,管理员对房屋、租客和出租人的管理的需要。

(4)对不同的角色进行权限的划分,保护了角色的封闭性,从而提高整个系统的质量和效率,帮助租客能租到满意的房子。

2.2主要研究内容

系统开发基于B/S模式,采用Spring Boot+Vue.js+MySQL进行房屋租赁管理系统的设计与实现,严格按照软件工程的要求设计。

此房屋租赁管理系统的设计,核心在于实现租客通过浏览器登录系统后,在相应搜索栏上输入自己的需求匹配相应出租房屋;出租人可完成上传房源信息、出租房屋等工作内容;管理员可完成用户管理、房屋管理、订单管理等工作。通过本系统,更加方便有效实现租客租到心满意足的房子。

springboot房屋租赁管理系统的设计与实现080

演示视频:

springboot房屋租赁管理系统的设计与实现080

 

package com.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;

import com.entity.YonghuEntity;
import com.entity.view.YonghuView;

import com.service.YonghuService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;


/**
 * 用户
 * 后端接口
 * @author 
 * @email 
 * @date 2021-05-05 14:32:35
 */
@RestController
@RequestMapping("/yonghu")
public class YonghuController {
    @Autowired
    private YonghuService yonghuService;
    
	@Autowired
	private TokenService tokenService;
	
	/**
	 * 登录
	 */
	@IgnoreAuth
	@RequestMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", username));
		if(user==null || !user.getMima().equals(password)) {
			return R.error("账号或密码不正确");
		}
		
		String token = tokenService.generateToken(user.getId(), username,"yonghu",  "用户" );
		return R.ok().put("token", token);
	}
	
	/**
     * 注册
     */
	@IgnoreAuth
    @RequestMapping("/register")
    public R register(@RequestBody YonghuEntity yonghu){
    	//ValidatorUtils.validateEntity(yonghu);
    	YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao()));
		if(user!=null) {
			return R.error("注册用户已存在");
		}
		Long uId = new Date().getTime();
		yonghu.setId(uId);
        yonghuService.insert(yonghu);
        return R.ok();
    }
	
	/**
	 * 退出
	 */
	@RequestMapping("/logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        YonghuEntity user = yonghuService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
        user.setMima("123456");
        yonghuService.updateById(user);
        return R.ok("密码已重置为:123456");
    }


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,YonghuEntity yonghu,
		HttpServletRequest request){
        EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
		PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));

        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,YonghuEntity yonghu, 
		HttpServletRequest request){
        EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
		PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( YonghuEntity yonghu){
       	EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
      	ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu")); 
        return R.ok().put("data", yonghuService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(YonghuEntity yonghu){
        EntityWrapper< YonghuEntity> ew = new EntityWrapper< YonghuEntity>();
 		ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu")); 
		YonghuView yonghuView =  yonghuService.selectView(ew);
		return R.ok("查询用户成功").put("data", yonghuView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        YonghuEntity yonghu = yonghuService.selectById(id);
        return R.ok().put("data", yonghu);
    }

    /**
     * 前端详情
     */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        YonghuEntity yonghu = yonghuService.selectById(id);
        return R.ok().put("data", yonghu);
    }
    



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
    	yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(yonghu);
    	YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao()));
		if(user!=null) {
			return R.error("用户已存在");
		}
		yonghu.setId(new Date().getTime());
        yonghuService.insert(yonghu);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
    	yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(yonghu);
    	YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao()));
		if(user!=null) {
			return R.error("用户已存在");
		}
		yonghu.setId(new Date().getTime());
        yonghuService.insert(yonghu);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
        //ValidatorUtils.validateEntity(yonghu);
        yonghuService.updateById(yonghu);//全部更新
        return R.ok();
    }
    

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        yonghuService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
    
    /**
     * 提醒接口
     */
	@RequestMapping("/remind/{columnName}/{type}")
	public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 
						 @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
		map.put("column", columnName);
		map.put("type", type);
		
		if(type.equals("2")) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Calendar c = Calendar.getInstance();
			Date remindStartDate = null;
			Date remindEndDate = null;
			if(map.get("remindstart")!=null) {
				Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
				c.setTime(new Date()); 
				c.add(Calendar.DAY_OF_MONTH,remindStart);
				remindStartDate = c.getTime();
				map.put("remindstart", sdf.format(remindStartDate));
			}
			if(map.get("remindend")!=null) {
				Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
				c.setTime(new Date());
				c.add(Calendar.DAY_OF_MONTH,remindEnd);
				remindEndDate = c.getTime();
				map.put("remindend", sdf.format(remindEndDate));
			}
		}
		
		Wrapper<YonghuEntity> wrapper = new EntityWrapper<YonghuEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}


		int count = yonghuService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	


}
package com.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;

import com.entity.AnbaoquxiaoguanliEntity;
import com.entity.view.AnbaoquxiaoguanliView;

import com.service.AnbaoquxiaoguanliService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;


/**
 * 安保取消管理
 * 后端接口
 * @author 
 * @email 
 * @date 2021-05-05 14:32:36
 */
@RestController
@RequestMapping("/anbaoquxiaoguanli")
public class AnbaoquxiaoguanliController {
    @Autowired
    private AnbaoquxiaoguanliService anbaoquxiaoguanliService;
    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,AnbaoquxiaoguanliEntity anbaoquxiaoguanli,
		HttpServletRequest request){
		String tableName = request.getSession().getAttribute("tableName").toString();
		if(tableName.equals("wuzhu")) {
			anbaoquxiaoguanli.setWuzhuzhanghao((String)request.getSession().getAttribute("username"));
		}
        EntityWrapper<AnbaoquxiaoguanliEntity> ew = new EntityWrapper<AnbaoquxiaoguanliEntity>();
		PageUtils page = anbaoquxiaoguanliService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, anbaoquxiaoguanli), params), params));

        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,AnbaoquxiaoguanliEntity anbaoquxiaoguanli, 
		HttpServletRequest request){
        EntityWrapper<AnbaoquxiaoguanliEntity> ew = new EntityWrapper<AnbaoquxiaoguanliEntity>();
		PageUtils page = anbaoquxiaoguanliService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, anbaoquxiaoguanli), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( AnbaoquxiaoguanliEntity anbaoquxiaoguanli){
       	EntityWrapper<AnbaoquxiaoguanliEntity> ew = new EntityWrapper<AnbaoquxiaoguanliEntity>();
      	ew.allEq(MPUtil.allEQMapPre( anbaoquxiaoguanli, "anbaoquxiaoguanli")); 
        return R.ok().put("data", anbaoquxiaoguanliService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(AnbaoquxiaoguanliEntity anbaoquxiaoguanli){
        EntityWrapper< AnbaoquxiaoguanliEntity> ew = new EntityWrapper< AnbaoquxiaoguanliEntity>();
 		ew.allEq(MPUtil.allEQMapPre( anbaoquxiaoguanli, "anbaoquxiaoguanli")); 
		AnbaoquxiaoguanliView anbaoquxiaoguanliView =  anbaoquxiaoguanliService.selectView(ew);
		return R.ok("查询安保取消管理成功").put("data", anbaoquxiaoguanliView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        AnbaoquxiaoguanliEntity anbaoquxiaoguanli = anbaoquxiaoguanliService.selectById(id);
        return R.ok().put("data", anbaoquxiaoguanli);
    }

    /**
     * 前端详情
     */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        AnbaoquxiaoguanliEntity anbaoquxiaoguanli = anbaoquxiaoguanliService.selectById(id);
        return R.ok().put("data", anbaoquxiaoguanli);
    }
    



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody AnbaoquxiaoguanliEntity anbaoquxiaoguanli, HttpServletRequest request){
    	anbaoquxiaoguanli.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(anbaoquxiaoguanli);
        anbaoquxiaoguanliService.insert(anbaoquxiaoguanli);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody AnbaoquxiaoguanliEntity anbaoquxiaoguanli, HttpServletRequest request){
    	anbaoquxiaoguanli.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(anbaoquxiaoguanli);
        anbaoquxiaoguanliService.insert(anbaoquxiaoguanli);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody AnbaoquxiaoguanliEntity anbaoquxiaoguanli, HttpServletRequest request){
        //ValidatorUtils.validateEntity(anbaoquxiaoguanli);
        anbaoquxiaoguanliService.updateById(anbaoquxiaoguanli);//全部更新
        return R.ok();
    }
    

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        anbaoquxiaoguanliService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
    
    /**
     * 提醒接口
     */
	@RequestMapping("/remind/{columnName}/{type}")
	public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 
						 @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
		map.put("column", columnName);
		map.put("type", type);
		
		if(type.equals("2")) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Calendar c = Calendar.getInstance();
			Date remindStartDate = null;
			Date remindEndDate = null;
			if(map.get("remindstart")!=null) {
				Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
				c.setTime(new Date()); 
				c.add(Calendar.DAY_OF_MONTH,remindStart);
				remindStartDate = c.getTime();
				map.put("remindstart", sdf.format(remindStartDate));
			}
			if(map.get("remindend")!=null) {
				Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
				c.setTime(new Date());
				c.add(Calendar.DAY_OF_MONTH,remindEnd);
				remindEndDate = c.getTime();
				map.put("remindend", sdf.format(remindEndDate));
			}
		}
		
		Wrapper<AnbaoquxiaoguanliEntity> wrapper = new EntityWrapper<AnbaoquxiaoguanliEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}

		String tableName = request.getSession().getAttribute("tableName").toString();
		if(tableName.equals("wuzhu")) {
			wrapper.eq("wuzhuzhanghao", (String)request.getSession().getAttribute("username"));
		}

		int count = anbaoquxiaoguanliService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	


}

  • 18
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值