JavaWeb项目恋家房产平台

项目描述 目的: 这个项目的目的是为了更好地将互联网和房产联系起来,在线平台方便了房产行业信息的传播和咨询,有助于两个行业的协同发展与融合, 意义: 项目实现的功能与运用到的技术都有利于在线平台的流畅运行

本文包含相关资料包-----> 点击直达获取<-------

项目描述

目的:

这个项目的目的是为了更好地将互联网和房产联系起来,在线平台方便了房产行业信息的传播和咨询,有助于两个行业的协同发展与融合。

意义:

项目实现的功能与运用到的技术都有利于在线平台的流畅运行,带给用户良好的购房、资询信息、交流的体验,有助于带动线上相关产业的发展,便利了广大用户群众。本项目不仅有着较强的功能性,而且有一定的实用价值,可以上线部署。

项目功能目标

1.2.1 基本功能

  1. 网易邮箱注册及登录
  2. 前台展示房源信息,用户可以浏览最新、最热房源,并查看详情信息。
  3. 搜索房产信息
  4. 经纪人以及经纪机构的创建和展示
  5. 房产百科
  6. 房产创建及收藏

1.2.2 扩展功能

  1. 根据用户点击量推荐最热房源
  2. 地图找房
  3. 房屋详情信息及评价打分
  4. 房源评论及展示
  5. 后台对数据增删查改,六大管理功能
  6. 统计房源热度及房价等,多种图表展示
  7. 报表统计,导入导出
  8. 实时统计系统在线人数并展示

系统创新点:

Redis 缓存数据,根据用户点击量推荐最热房源,并在后台图表展示房源热度。

实时统计系统在线人数并展示

房源全国分布图

房源评论、打分及展示

房产百科

报表导入导出

地图找房

后台六大管理

系统主要流程

项目实施

部分核心代码如下:

c++ package com.ljq.house.web.controller; import java.util.List; import com.ljq.house.common.utils.FileUtil; import org.apache.poi.hssf.usermodel.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.ljq.house.biz.service.AgencyService; import com.ljq.house.biz.service.CityService; import com.ljq.house.biz.service.CommentService; import com.ljq.house.biz.service.HouseService; import com.ljq.house.biz.service.RecommendService; import com.ljq.house.common.constants.CommonConstants; import com.ljq.house.common.constants.HouseUserType; import com.ljq.house.common.model.Comment; import com.ljq.house.common.model.House; import com.ljq.house.common.model.HouseUser; import com.ljq.house.common.model.User; import com.ljq.house.common.model.UserMsg; import com.ljq.house.common.page.PageData; import com.ljq.house.common.page.PageParams; import com.ljq.house.common.result.ResultMsg; import com.ljq.house.web.interceptor.UserContext; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @Controller public class HouseController { @Autowired private HouseService houseService; @Autowired private CityService cityService; @Autowired private AgencyService agencyService; @Autowired private RecommendService recommendService; @Autowired private CommentService commentService; /**- * 1.实现分页 - * 2.支持小区搜索、类型搜索 - * 3.支持排序 - * 4.支持展示图片、价格、标题、地址等信息

c++ * * @return */ @RequestMapping("/house/list") public String houseList(Integer pageSize, Integer pageNum, House query, ModelMap modelMap) { PageData<House> ps = houseService.queryHouse(query, PageParams.build(pageSize, pageNum)); List<House> hotHouses = recommendService.getHotHouse(CommonConstants.RECOM_SIZE); modelMap.put("recomHouses", hotHouses); modelMap.put("ps", ps); modelMap.put("vo", query); return "house/listing"; } @RequestMapping("/house/toAdd") public String toAdd(ModelMap modelMap) { modelMap.put("citys", cityService.getAllCitys()); modelMap.put("communitys", houseService.getAllCommunitys()); return "/house/add"; } @RequestMapping("/house/add") public String doAdd(House house) { User user = UserContext.getUser(); house.setState(CommonConstants.HOUSE_STATE_UP); houseService.addHouse(house, user); return "redirect:/house/ownlist"; } @RequestMapping("house/ownlist") public String ownlist(House house, Integer pageNum, Integer pageSize, ModelMap modelMap) { User user = UserContext.getUser(); house.setUserId(user.getId()); house.setBookmarked(false); modelMap.put("ps", houseService.queryHouse(house, PageParams.build(pageSize, pageNum))); modelMap.put("pageType", "own"); return "/house/ownlist"; } /** * 查询房屋详情 * 查询关联经纪人

c++ * * @param id * @return */ @RequestMapping("house/detail") public String houseDetail(Long id, ModelMap modelMap) { House house = houseService.queryOneHouse(id); HouseUser houseUser = houseService.getHouseUser(id); recommendService.increase(id); List<Comment> comments = commentService.getHouseComments(id, 8); if (houseUser.getUserId() != null && !houseUser.getUserId().equals(0)) { modelMap.put("agent", agencyService.getAgentDetail(houseUser.getUserId())); } List<House> rcHouses = recommendService.getHotHouse(CommonConstants.RECOM_SIZE); modelMap.put("recomHouses", rcHouses); modelMap.put("house", house); modelMap.put("commentList", comments); return "/house/detail"; } @RequestMapping("house/leaveMsg") public String houseMsg(UserMsg userMsg) { houseService.addUserMsg(userMsg); return "redirect:/house/detail?id=" + userMsg.getHouseId() + ResultMsg.successMsg("留言成功").asUrlParams(); } //1.评分 @ResponseBody @RequestMapping("house/rating") public ResultMsg houseRate(Double rating, Long id) { houseService.updateRating(id, rating); return ResultMsg.successMsg("ok"); } //2.收藏 @ResponseBody @RequestMapping("house/bookmark") public ResultMsg bookmark(Long id) { User user = UserContext.getUser(); houseService.bindUser2House(id, user.getId(), true); return ResultMsg.successMsg("ok"); } //3.删除收藏 @ResponseBody @RequestMapping("house/unbookmark") public ResultMsg unbookmark(Long id) { User user = UserContext.getUser(); houseService.unbindUser2House(id, user.getId(), HouseUserType.BOOKMARK); return ResultMsg.successMsg("ok"); } @RequestMapping(value = "house/del") public String delsale(Long id, String pageType) { User user = UserContext.getUser(); houseService.unbindUser2House(id, user.getId(), pageType.equals("own") ? HouseUserType.SALE : HouseUserType .BOOKMARK); return "redirect:/house/ownlist"; } //4.收藏列表 @RequestMapping("house/bookmarked") public String bookmarked(House house, Integer pageNum, Integer pageSize, ModelMap modelMap) { User user = UserContext.getUser(); house.setBookmarked(true); house.setUserId(user.getId()); modelMap.put("ps", houseService.queryHouse(house, PageParams.build(pageSize, pageNum))); modelMap.put("pageType", "book"); return "/house/ownlist"; } @RequestMapping("/exportHouseinfo") public void exportHouse(HttpServletRequest request, HttpServletResponse response) { List<House> houseList = houseService.getHouses(); // 创建工作簿 HSSFWorkbook workbook = new HSSFWorkbook(); // 创建表 HSSFSheet sheet = workbook.createSheet("房产信息导出excel"); // 创建行 HSSFRow row = sheet.createRow(0); // 创建单元格样式 HSSFCellStyle cellStyle = workbook.createCellStyle(); // 表头 String[] head = {"id", "名称", "类型", "价格", "图片地址", "面积", "卧室数量", "卫生间数量", "评分", "房产描述", "属性", "户型图", "标签", "创建时间", "城市id", "社区id", "房产地址", "状态" }; HSSFCell cell; // 设置表头 for (int iHead = 0; iHead < head.length; iHead++) { cell = row.createCell(iHead); cell.setCellValue(head[iHead]); cell.setCellStyle(cellStyle); } // 设置表格内容 for (int iBody = 0; iBody < houseList.size(); iBody++) { row = sheet.createRow(iBody + 1); House hs = houseList.get(iBody); String[] userArray = new String[18]; userArray[0] = hs.getId() + ""; userArray[1] = hs.getName(); userArray[2] = hs.getType() == 1 ? "For Sale" : "For Rent"; userArray[3] = hs.getPrice() + "万"; userArray[4] = hs.getImages(); userArray[5] = hs.getArea() + ""; userArray[6] = hs.getBeds() + ""; userArray[7] = hs.getBaths() + ""; userArray[8] = hs.getRating() + ""; userArray[9] = hs.getRemarks(); userArray[10] = hs.getProperties(); userArray[11] = hs.getFloorPlan(); userArray[12] = hs.getTags(); userArray[13] = hs.getCreateTime() + ""; userArray[14] = hs.getCityId() + ""; userArray[15] = hs.getCommunityId() + ""; userArray[16] = hs.getAddress(); userArray[17] = hs.getState() == 1 ? "上架" : "下架"; for (int iArray = 0; iArray < userArray.length; iArray++) { row.createCell(iArray).setCellValue(userArray[iArray]); } } // 生成Excel文件 FileUtil.createFile(response, workbook, "房产信息数据导出"); } @PostMapping("/importHouseinfo") public boolean addHouseinfo(@RequestParam("file") MultipartFile file) { boolean a = false; String fileName = file.getOriginalFilename(); try { = houseService.batchImport(fileName, file); } catch (Exception e) { printStackTrace(); } return a; } } package com.ljq.house.web.controller; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.ljq.house.common.utils.FileUtil; import org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.usermodel.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import com.ljq.house.biz.service.AgencyService; import com.ljq.house.biz.service.UserService; import com.ljq.house.common.constants.CommonConstants; import com.ljq.house.common.model.User; import com.ljq.house.common.result.ResultMsg; import com.ljq.house.common.utils.HashUtils; @Controller public class UserController { @Autowired private UserService userService; @Autowired private AgencyService agencyService; /** 注册提交:1.注册验证 2 发送邮件 3 验证失败重定向到注册页面 注册页获取:根据 account 对象为依据判断是否注册页获取请求

c++ * * @param account * @param modelMap * @return */ @RequestMapping("accounts/register") public String accountsRegister(User account, ModelMap modelMap) { if (account == null || account.getName() == null) { modelMap.put("agencyList", agencyService.getAllAgency()); return "/user/accounts/register"; } // 用户验证 ResultMsg resultMsg = com.ljq.house.web.controller.UserHelper.validate(account); if (resultMsg.isSuccess() && userService.addAccount(account)) { modelMap.put("email", account.getEmail()); return "/user/accounts/registerSubmit"; } else { return "redirect:/accounts/register?" + resultMsg.asUrlParams(); } } @RequestMapping("accounts/verify") public String verify(String key) { boolean result = userService.enable(key); if (result) { return "redirect:/index?" + ResultMsg.successMsg("激活成功").asUrlParams(); } else { return "redirect:/accounts/register?" + ResultMsg.errorMsg("激活失败,请确认链接是否过期"); } } //登录流程 /**登录接口

c++ */ @RequestMapping("/accounts/signin") public String signin(HttpServletRequest req) { String username = req.getParameter("username"); String password = req.getParameter("password"); String target = req.getParameter("target"); if (username == null || password == null) { req.setAttribute("target", target); return "/user/accounts/signin"; } User user = userService.auth(username, password); if (user == null) { return "redirect:/accounts/signin?" + "target=" + target + "&username=" + username + "&" + ResultMsg.errorMsg("用户名或密码错误").asUrlParams(); } else { HttpSession session = req.getSession(true); session.setAttribute(CommonConstants.USER_ATTRIBUTE, user); // session.setAttribute(CommonConstants.PLAIN_USER_ATTRIBUTE, user); return StringUtils.isNoneBlank(target) ? "redirect:" + target : "redirect:/index"; } } /**登出操作

c++ * * @param request * @return */ @RequestMapping("accounts/logout") public String logout(HttpServletRequest request) { HttpSession session = request.getSession(false);//防止创建Session if (session != null) { session.removeAttribute(CommonConstants.USER_ATTRIBUTE); session.invalidate(); } return "redirect:/index"; } //个人信息页 /**1.能够提供页面信息 2.更新用户信息

c++ * * @param updateUser * @param model * @return */ @RequestMapping("accounts/profile") public String profile(HttpServletRequest req, User updateUser, ModelMap model) { if (updateUser.getEmail() == null) { return "/user/accounts/profile"; } userService.updateUser(updateUser, updateUser.getEmail()); User query = new User(); query.setEmail(updateUser.getEmail()); List<User> users = userService.getUserByQuery(query); req.getSession(true).setAttribute(CommonConstants.USER_ATTRIBUTE, users.get(0)); return "redirect:/accounts/profile?" + ResultMsg.successMsg("更新成功").asUrlParams(); } /**修改密码操作

c++ * * @param email * @param password * @param newPassword * @param confirmPassword * @param mode * @return */ @RequestMapping("accounts/changePassword") public String changePassword(String email, String password, String newPassword, String confirmPassword, ModelMap mode) { User user = userService.auth(email, password); if (user == null || !confirmPassword.equals(newPassword)) { return "redirct:/accounts/profile?" + ResultMsg.errorMsg("密码错误").asUrlParams(); } User updateUser = new User(); updateUser.setPasswd(HashUtils.encryPassword(newPassword)); userService.updateUser(updateUser, email); return "redirect:/accounts/profile?" + ResultMsg.successMsg("更新成功").asUrlParams(); } /**忘记密码

c++ * * @param username * @param modelMap * @return */ @RequestMapping("accounts/remember") public String remember(String username, ModelMap modelMap) { if (StringUtils.isBlank(username)) { return "redirect:/accounts/signin?" + ResultMsg.errorMsg("邮箱不能为空").asUrlParams(); } userService.resetNotify(username); modelMap.put("email", username); return "/user/accounts/remember"; } @RequestMapping("accounts/reset") public String reset(String key, ModelMap modelMap) { String email = userService.getResetEmail(key); if (StringUtils.isBlank(email)) { return "redirect:/accounts/signin?" + ResultMsg.errorMsg("重置链接已过期").asUrlParams(); } modelMap.put("email", email); modelMap.put("success_key", key); return "/user/accounts/reset"; } @RequestMapping(value = "accounts/resetSubmit") public String resetSubmit(HttpServletRequest req, User user) { ResultMsg retMsg = com.ljq.house.web.controller.UserHelper.validateResetPassword(user.getKey(), user .getPasswd(), user.getConfirmPasswd()); if (!retMsg.isSuccess()) { String suffix = ""; if (StringUtils.isNotBlank(user.getKey())) { suffix = "email=" + userService.getResetEmail(user.getKey()) + "&key=" + user.getKey() + "&"; } return "redirect:/accounts/reset?" + suffix + retMsg.asUrlParams(); } User updatedUser = userService.reset(user.getKey(), user.getPasswd()); req.getSession(true).setAttribute(CommonConstants.USER_ATTRIBUTE, updatedUser); return "redirect:/index?" + retMsg.asUrlParams(); } @RequestMapping("/exportUserinfo") public void exportUser(HttpServletRequest request, HttpServletResponse response) { List<User> userList = userService.getUsers(); // 创建工作簿 HSSFWorkbook workbook = new HSSFWorkbook(); // 创建表 HSSFSheet sheet = workbook.createSheet("用户信息导出excel"); // 创建行 HSSFRow row = sheet.createRow(0); // 创建单元格样式 HSSFCellStyle cellStyle = workbook.createCellStyle(); // 表头 String[] head = {"id", "用户名", "电话", "邮箱", "个人介绍", "密码", "头像地址", "类型", "加入时间", "是否激活", "经纪机构id"}; HSSFCell cell; // 设置表头 for (int iHead = 0; iHead < head.length; iHead++) { cell = row.createCell(iHead); cell.setCellValue(head[iHead]); cell.setCellStyle(cellStyle); } // 设置表格内容 for (int iBody = 0; iBody < userList.size(); iBody++) { row = sheet.createRow(iBody + 1); User u = userList.get(iBody); String[] userArray = new String[11]; userArray[0] = u.getId() + ""; userArray[1] = u.getName(); userArray[2] = u.getPhone(); userArray[3] = u.getEmail(); userArray[4] = u.getAboutme(); userArray[5] = u.getPasswd(); userArray[6] = u.getAvatar(); userArray[7] = u.getType() == 1 ? "普通用户" : "经纪人"; userArray[8] = u.getCreateTime() + ""; userArray[9] = u.getEnable() == 1 ? "已激活" : "未激活"; userArray[10] = u.getAgencyId() + ""; for (int iArray = 0; iArray < userArray.length; iArray++) { row.createCell(iArray).setCellValue(userArray[iArray]); } } // 生成Excel文件 FileUtil.createFile(response, workbook, "用户信息数据导出"); } } package com.ljq.house.admin.controller; import com.ljq.house.biz.service.HouseService; import com.ljq.house.biz.service.RecommendService; import com.ljq.house.common.model.House; import com.ljq.house.common.utils.OnLineCount; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.annotation.WebListener; import javax.servlet.http.*; import java.net.URLEncoder; import java.util.List; @Controller @RequestMapping("/admin/statistics") public class AdminStatistics { @Autowired private RecommendService recommendService; @Autowired private HouseService houseService; @RequestMapping(value = "/hot") public String getHot(ModelMap modelMap) { List<House> hotHouses = recommendService.getHotHouse(8); List<Double> data = recommendService.getPercentage(8); for (int i = 0; i < hotHouses.size(); i++) hotHouses.get(i).setHot(data.get(i)); modelMap.put("hotHouses", hotHouses); return "/admin/charts-hot"; } @RequestMapping(value = "/price") public String getPrice(ModelMap modelMap) { List<House> hs = houseService.getHouses(); modelMap.put("house", hs); return "/admin/charts-price"; } @RequestMapping(value = "/rating") public String getRating(ModelMap modelMap) { List<House> hs = houseService.getHouses(); modelMap.put("house", hs); return "/admin/charts-rating"; } @RequestMapping(value = "/export") public String getExport(ModelMap modelMap) { return "/admin/export"; } @RequestMapping(value = "/NationalMap") public String getNationalMap(ModelMap modelMap) { List<String> nation = houseService.selectNationCount(); modelMap.put("nation", nation); return "/admin/charts-NationalMap"; } @RequestMapping(value = "/TreeMap") public String getTreeMap(ModelMap modelMap) { return "/admin/charts-treemap"; } @RequestMapping(value = "/realtime") public String getRealtimepeople(ModelMap modelMap) { return "/admin/realtime"; } @RequestMapping("/realtime/onlinecount") @ResponseBody public int number(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { try { //把sessionId记录在浏览器 Cookie c = new Cookie("JSESSIONID", URLEncoder.encode(httpServletRequest.getSession().getId(), "utf-8")); setPath("/"); //先设置cookie有效期为2天 setMaxAge(24 * 60 * 60); httpServletResponse.addCookie(c); } catch (Exception e) { printStackTrace(); } /* HttpSession session = httpServletRequest.getSession(false); Object count = session.getServletContext().getAttribute("count");*/ return OnLineCount.count; } }

课程设计总结

这次课设我做得还算轻松,很早就弄完了,但这次的收获依然是满满的。这次我主要是用框架去做的,以前就用过框架做过 javaweb 项目,这次做完我感觉自己的理解更加深刻了,运用得也更加灵活自如。对 SpringBoot 和 MyBatis 的理解更深入了。而且项目的前后台交互也锻炼了我的很多技能,处理错误、调试代码的能力进一步提高了。各种图表的动态展示也为我后面的数据可视化项目打下了坚实的基础。所以这次课设对我来说非常重要,自己的能力进一步提高了,也学到了很多的知识和操作实践。

参考文献

  • 一个房产交易系统的设计与实现(吉林大学·于冰)
  • 基于J2EE的房屋租赁管理信息系统设计与实现(河北科技大学·赵迎芳)
  • 基于SSH架构的个人空间交友网站的设计与实现(北京邮电大学·隋昕航)
  • 房地产企业销售管理系统的设计与实现(吉林大学·李孔泽)
  • 基于J2EE房地产客户管理系统的设计与实现(电子科技大学·张轶婧)
  • 基于B/S模式售楼管理系统的设计与实现(电子科技大学·沈南开)
  • 基于ASP.NET的房产信息网的设计与实现(辽宁科技大学·谷慧明)
  • 基于J2EE的房屋租赁管理信息系统设计与实现(河北科技大学·赵迎芳)
  • 房屋租售信息平台的设计与实现(电子科技大学·李尔家)
  • 房产信息管理系统设计与实现(大连理工大学·郇正杰)
  • 基于J2EE的房屋租赁管理信息系统设计与实现(河北科技大学·赵迎芳)
  • 房地产企业销售管理系统的设计与实现(吉林大学·李孔泽)
  • 基于互联网+的房屋租赁管理系统的设计与实现(江西财经大学·胡世民)
  • 基于J2EE的房产中介信息系统设计与实现(大连理工大学·韩世斌)
  • 基于J2EE的房屋租赁管理信息系统设计与实现(河北科技大学·赵迎芳)

本文内容包括但不限于文字、数据、图表及超链接等)均来源于该信息及资料的相关主题。发布者:代码项目助手 ,原文地址:https://m.bishedaima.com/yuanma/35857.html

相关推荐

发表回复

登录后才能评论