Java项目:SSM的公寓房屋出租系统

作者主页:Java毕设网

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

一、项目介绍

该项目分为前后台,分为普通用户与管理员两种角色。
前台主要功能包括:
普通用户的注册、登录,房屋列表展示,租房,我的订单、用户中心等功能模块;

后台主要功能包括:
系统设置:菜单管理、角色管理、修改密码;
用户管理:用户列表;
系统日志:日志列表;
房屋管理:房屋列表;

租赁管理:租赁列表

二、环境需要

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+EasyUI+Echarts+jQuery

四、使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

3. 将项目中db.properties配置文件中的数据库配置改为自己的配置;

4. 运行项目,输入localhost:8080即可

五、运行截图

前台界面

​​

后台界面


六、相关代码

前台首页控制器

/**
 * 前台首页控制器
 * @author Administrator
 *
 */
@RequestMapping("/home")
@Controller
public class HomeController {
	
	@Autowired
	private RoomTypeService roomTypeService;
	@Autowired
	private AccountService accountService;
	
	/**
	 * 前台首页
	 * @param model
	 * @param name
	 * @return
	 * @throws UnsupportedEncodingException 
	 */
	@RequestMapping(value="/index",method=RequestMethod.GET)
	public ModelAndView list(ModelAndView model,
			@RequestParam(name="name",defaultValue="") String names,HttpServletRequest request
			) throws UnsupportedEncodingException{
		request.setCharacterEncoding("UTF-8");
		System.out.println("--前台首页--");
		System.out.println("name:"+names);
//		String name=new String(names.getBytes("ISO-8859-1"),"UTF-8");
		Map<String,Object> queryMap = new HashMap<String, Object>();
		queryMap.put("name", names);
		queryMap.put("offset", 0);
		queryMap.put("pageSize", 999);
		model.addObject("roomTypeList", roomTypeService.findList(queryMap));
		model.setViewName("home/index/index");
//		model.setViewName("home/index/home");
		model.addObject("kw", names);
		return model;
	}
	
	/**
	 * 登录页面
	 * @param model
	 * @return
	 */
	@RequestMapping(value="/login",method=RequestMethod.GET)
	public ModelAndView login(ModelAndView model
			){
		System.out.println("---login---");
		model.setViewName("home/index/login");
		return model;
	}
	
	/**
	 * 注册页面
	 * @param model
	 * @return
	 */
	@RequestMapping(value="/reg",method=RequestMethod.GET)
	public ModelAndView reg(ModelAndView model
			){
		model.setViewName("home/index/reg");
		return model;
	}
	
	/**
	 * 登录信息提交
	 * @param account
	 * @return
	 */
	@RequestMapping(value="/login",method=RequestMethod.POST)
	@ResponseBody
	public Map<String,String> loginAct(Account account,String vcode,HttpServletRequest request){
		Map<String,String> retMap = new HashMap<String, String>();
		if(account == null){
			retMap.put("type", "error");
			retMap.put("msg", "请填写正确的用户信息!");
			return retMap;
		}
		if(StringUtils.isEmpty(account.getName())){
			retMap.put("type", "error");
			retMap.put("msg", "用户名不能为空!");
			return retMap;
		}
		if(StringUtils.isEmpty(account.getPassword())){
			retMap.put("type", "error");
			retMap.put("msg", "密码不能为空!");
			return retMap;
		}
		if(StringUtils.isEmpty(vcode)){
			retMap.put("type", "error");
			retMap.put("msg", "验证码不能为空!");
			return retMap;
		}
		Object attribute = request.getSession().getAttribute("accountLoginCpacha");
		if(attribute == null){
			retMap.put("type", "error");
			retMap.put("msg", "验证码过期,请刷新!");
			return retMap;
		}
		if(!vcode.equalsIgnoreCase(attribute.toString())){
			retMap.put("type", "error");
			retMap.put("msg", "验证码错误!");
			return retMap;
		}
		Account findByName = accountService.findByName(account.getName());
		if(findByName == null){
			retMap.put("type", "error");
			retMap.put("msg", "用户名不存在!");
			return retMap;
		}
		if(!account.getPassword().equals(findByName.getPassword())){
			retMap.put("type", "error");
			retMap.put("msg", "密码错误!");
			return retMap;
		}
		if(findByName.getStatus() == -1){
			retMap.put("type", "error");
			retMap.put("msg", "该用户已被禁用,请联系管理员!");
			return retMap;
		}
		request.getSession().setAttribute("account", findByName);
		request.getSession().setAttribute("accountLoginCpacha", null);
		retMap.put("type", "success");
		retMap.put("msg", "登录成功!");
		return retMap;
	}
	
	/**
	 * 注册信息提交
	 * @param account
	 * @return
	 */
	@RequestMapping(value="/reg",method=RequestMethod.POST)
	@ResponseBody
	public Map<String,String> regAct(Account account){
		Map<String,String> retMap = new HashMap<String, String>();
		if(account == null){
			retMap.put("type", "error");
			retMap.put("msg", "请填写正确的用户信息!");
			return retMap;
		}
		if(StringUtils.isEmpty(account.getName())){
			retMap.put("type", "error");
			retMap.put("msg", "用户名不能为空!");
			return retMap;
		}
		if(StringUtils.isEmpty(account.getPassword())){
			retMap.put("type", "error");
			retMap.put("msg", "密码不能为空!");
			return retMap;
		}
		if(StringUtils.isEmpty(account.getMobile())){
			retMap.put("type", "error");
			retMap.put("msg", "手机号不能为空!");
			return retMap;
		}
		if(isExist(account.getName())){
			retMap.put("type", "error");
			retMap.put("msg", "该用户名已经存在!");
			return retMap;
		}
		if(accountService.add(account) <= 0){
			retMap.put("type", "error");
			retMap.put("msg", "注册失败,请联系管理员!");
			return retMap;
		}
		retMap.put("type", "success");
		retMap.put("msg", "注册成功!");
		return retMap;
	}
	
	/**
	 * 退出登录
	 * @param request
	 * @return
	 */
	@RequestMapping(value="/logout",method=RequestMethod.GET)
	public String logout(HttpServletRequest request){
		request.getSession().setAttribute("account", null);
		return "redirect:login";
	}
	
	private boolean isExist(String name){
		Account account = accountService.findByName(name);
		if(account == null)return false;
		return true;
	}
}

房间类型管理控制器

/**
 * 房屋类型管理后台控制器
 * @author Administrator
 *
 */
@RequestMapping("/admin/room_type")
@Controller
public class RoomTypeController {
	
	@Autowired
	private RoomTypeService roomTypeService;
	
	
	/**
	 * 房屋类型管理列表页面
	 * @param model
	 * @return
	 */
	@RequestMapping(value="/list",method=RequestMethod.GET)
	public ModelAndView list(ModelAndView model){
		model.setViewName("room_type/list");
		return model;
	}
	
	/**
	 * 房屋类型信息添加操作
	 * @param roomType
	 * @return
	 */
	@RequestMapping(value="/add",method=RequestMethod.POST)
	@ResponseBody
	public Map<String, String> add(RoomType roomType){
		Map<String, String> ret = new HashMap<String, String>();
		if(roomType == null){
			ret.put("type", "error");
			ret.put("msg", "请填写正确的房屋类型信息!");
			return ret;
		}
		if(StringUtils.isEmpty(roomType.getName())){
			ret.put("type", "error");
			ret.put("msg", "房屋类型名称不能为空!");
			return ret;
		}
		roomType.setAvilableNum(roomType.getRoomNum());//默认房屋数等于可用房屋数
		roomType.setBookNum(0);//设置预定数0
		roomType.setLivedNum(0);//设置已入住数0
		if(roomTypeService.add(roomType) <= 0){
			ret.put("type", "error");
			ret.put("msg", "添加失败,请联系管理员!");
			return ret;
		}
		ret.put("type", "success");
		ret.put("msg", "添加成功!");
		return ret;
	}
	
	/**
	 * 房屋类型信息编辑操作
	 * @param roomType
	 * @return
	 */
	@RequestMapping(value="/edit",method=RequestMethod.POST)
	@ResponseBody
	public Map<String, String> edit(RoomType roomType){
		Map<String, String> ret = new HashMap<String, String>();
		if(roomType == null){
			ret.put("type", "error");
			ret.put("msg", "请填写正确的房屋类型信息!");
			return ret;
		}
		if(StringUtils.isEmpty(roomType.getName())){
			ret.put("type", "error");
			ret.put("msg", "房屋类型名称不能为空!");
			return ret;
		}
		RoomType existRoomType = roomTypeService.find(roomType.getId());
		if(existRoomType == null){
			ret.put("type", "error");
			ret.put("msg", "未找到该数据!");
			return ret;
		}
		int offset = roomType.getRoomNum() - existRoomType.getRoomNum();
		roomType.setAvilableNum(existRoomType.getAvilableNum() + offset);
		if(roomType.getAvilableNum() <= 0){
			roomType.setAvilableNum(0);//没有可用房屋
			roomType.setStatus(0);//房型已满
			if(roomType.getAvilableNum() + existRoomType.getLivedNum() + existRoomType.getBookNum() > roomType.getRoomNum()){
				ret.put("type", "error");
				ret.put("msg", "房屋数设置不合理!");
				return ret;
			}
		}
		if(roomTypeService.edit(roomType) <= 0){
			ret.put("type", "error");
			ret.put("msg", "修改失败,请联系管理员!");
			return ret;
		}
		ret.put("type", "success");
		ret.put("msg", "修改成功!");
		return ret;
	}
	
	/**
	 * 分页查询房屋类型信息
	 * @param name
	 * @param page
	 * @return
	 */
	@RequestMapping(value="/list",method=RequestMethod.POST)
	@ResponseBody
	public Map<String,Object> list(
			@RequestParam(name="name",defaultValue="") String name,
			@RequestParam(name="status",required=false) Integer status,
			Page page
			){
		Map<String,Object> ret = new HashMap<String, Object>();
		Map<String,Object> queryMap = new HashMap<String, Object>();
		queryMap.put("name", name);
		queryMap.put("status", status);
		queryMap.put("offset", page.getOffset());
		queryMap.put("pageSize", page.getRows());
		ret.put("rows", roomTypeService.findList(queryMap));
		ret.put("total", roomTypeService.getTotal(queryMap));
		return ret;
	}
	
	/**
	 * 房屋类型信息删除操作
	 * @param id
	 * @return
	 */
	@RequestMapping(value="/delete",method=RequestMethod.POST)
	@ResponseBody
	public Map<String, String> delete(Long id){
		Map<String, String> ret = new HashMap<String, String>();
		if(id == null){
			ret.put("type", "error");
			ret.put("msg", "请选择要删除的信息!");
			return ret;
		}
		try {
			if(roomTypeService.delete(id) <= 0){
				ret.put("type", "error");
				ret.put("msg", "删除失败,请联系管理员!");
				return ret;
			}
		} catch (Exception e) {
			// TODO: handle exception
			ret.put("type", "error");
			ret.put("msg", "该房屋类型下存在房屋信息,请先删除该房屋类型下的所有房屋信息!");
			return ret;
		}
		ret.put("type", "success");
		ret.put("msg", "删除成功!");
		return ret;
	}
}

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

  • 19
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
"SSM服装出租服装店租赁服装管理系统" 是一个基于Java项目。该系统旨在帮助服装店有效管理其库存、租赁流程和顾客信息,以提升运营效率。 该系统的主要功能包括库存管理,租赁管理和顾客管理。首先,库存管理模块允许店主添加、删除和更新服装的详细信息,包括服装名称、类型、尺码和价格等。店主可以通过该模块随时了解实时库存情况,并及时补充库存。其次,租赁管理模块允许店主记录租赁订单,包括租赁日期、租赁时长和顾客信息等。系统可以自动计算租赁费用并生成相应的发票。最后,顾客管理模块允许店主维护顾客的基本信息,并记录顾客的租赁历史以及积累的租赁次数和会员等级。 为了提高系统的稳定性和安全性,该项目采用SSM(Spring+Spring MVC+MyBatis)框架进行开发Spring作为业务层框架,负责处理系统的业务逻辑;Spring MVC作为视图层框架,负责接收用户请求和展示数据;MyBatis作为持久层框架,负责与数据库进行交互。此外,项目还使用MySQL作为数据库,保证数据的可靠存储和快速检索。 该项目的优势在于提高了服装店的管理效率。通过系统化的库存管理和租赁管理,店主可以实时掌握库存情况和租赁订单,避免了重复和遗漏,提高了工作效率。而顾客管理模块的引入,使店主能够更好地了解顾客的需求和偏好,从而提供个性化的服务,增加顾客的满意度和忠诚度。 综上所述,SSM服装出租服装店租赁服装管理系统是一个基于Java开发项目,旨在提高服装店的库存管理、租赁管理和顾客管理效率。该系统通过SSM框架和MySQL数据库的应用,保证了系统的稳定性和安全性。它的优势在于提高了店主的工作效率和顾客满意度,帮助服装店实现更好的运营表现。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值