当前位置:   article > 正文

基于SpringBoot+Vue的房屋租赁系统、租房平台_springboot+vue房产中介系统

springboot+vue房产中介系统

今天介绍一个SpringBoot+Vue的房屋租赁系统

主要功能

  • 租房网站页
  • 后台管理页面
  • 用户登录注册功能
  • 普通用户申请成为房东的功能
  • 房东用户上传个人房源功能
  • 管理员通过后台页面管理所有用户账号
  • 管理员审核申请房东身份的记录
  • 管理员审核房东上传的房源信息
  • 房源搜索、展示

部分代码展示

  1. @RestController
  2. public class HouseController {
  3. @Resource
  4. private HouseDao houseDao;
  5. @Resource
  6. private HousePicService housePicService;
  7. @Resource
  8. private OwnerRecordService ownerRecordService;
  9. @RequestMapping("/addHouseUpRecord")
  10. public String addHouseUpRecord(@RequestParam("houseUpForm") String houseUpForm) {
  11. HouseInfo houseInfo = JSONObject.parseObject(houseUpForm,HouseInfo.class);
  12. //将房屋户型数组,房屋地区代码数组,配套设施列表数组 转化为string类型
  13. String houseTypeJson = JSON.toJSONString(houseInfo.getHouseType());
  14. String houseIDJson = JSON.toJSONString(houseInfo.getHouseID());
  15. String checkListJson = JSON.toJSONString(houseInfo.getCheckList());
  16. //创建一个长度为五的数组存放图片
  17. String[] houpicStr = {"","","","",""};
  18. for (int i = 0; i < houseInfo.getHousePic().length ; i++) {
  19. houpicStr[i] = houseInfo.getHousePic()[i];
  20. }
  21. HousePic housePic = new HousePic(houpicStr[0],houpicStr[1],houpicStr[2],houpicStr[3],houpicStr[4]);
  22. //存图片数组,hpicid存在housePic对象中
  23. int addHousePic = housePicService.addHousePic(housePic);
  24. if (addHousePic < 1){
  25. return "fail";
  26. }
  27. House house = new House(houseInfo.getAccount(),houseTypeJson,houseIDJson,houseInfo.getRentType(),houseInfo.getRentArea(),houseInfo.getFloor(),houseInfo.getAddressDetail(),checkListJson,houseInfo.getMonthRent(),houseInfo.getDescription(),housePic.getHpicid());
  28. //int addhouid = houseDao.addHouseUpRecord(houseInfo.getAccount(),houseTypeJson,houseIDJson,houseInfo.getRentType(),houseInfo.getRentArea(),houseInfo.getFloor(),houseInfo.getAddressDetail(),checkListJson,houseInfo.getMonthRent(),houseInfo.getDescription(),hpicid);
  29. //存申请总记录
  30. int addHouseUpRecord = houseDao.addHouseUpRecord(house);
  31. if(addHouseUpRecord < 1){
  32. return "fail";
  33. }
  34. //更新对应房屋表中的房屋图片数组对应行记录中 houid
  35. int end = housePicService.setHouid(house.getHouid(),housePic.getHpicid());
  36. //System.out.println(housePic.getHpicid());
  37. // System.out.println(houseTypeJson);
  38. //
  39. // String[] aa = JSONObject.parseObject(houseTypeJson,String[].class);
  40. //
  41. // for (String a:aa
  42. // ) {
  43. // System.out.println(a);
  44. // }
  45. // System.out.println(houseUpForm);
  46. return end == 1? "success":"fail";
  47. }
  48. @RequestMapping("/getAllHURecords")
  49. public String getAllHURecords(HURecordsInfo huRecordsInfo){
  50. int HURecords;//返回查询到的记录数
  51. Integer pageStart;
  52. List<House> houseList;
  53. List<HouseInfo> houseInfoArrayList = new ArrayList<>();
  54. pageStart = (huRecordsInfo.getPageStart()-1)*huRecordsInfo.getPageSize();
  55. //查询记录数量
  56. HURecords = houseDao.getAllHURecordsNum("%"+huRecordsInfo.getAccount()+"%");
  57. houseList = houseDao.getAllHUList("%"+huRecordsInfo.getAccount()+"%",pageStart,huRecordsInfo.getPageSize());
  58. for (House hu:houseList
  59. ) {
  60. String[] houseType = JSONObject.parseObject(hu.getHouseType(),String[].class);
  61. String[] houseID = JSONObject.parseObject(hu.getHouseID(),String[].class);
  62. String[] checkList = JSONObject.parseObject(hu.getCheckList(),String[].class);
  63. HousePic houseP = housePicService.findHousePicByHpicid(hu.getHousePic());
  64. String[] housePic = {houseP.getPicone(),houseP.getPictwo(),houseP.getPicthree(),houseP.getPicfour(),houseP.getPicfive()};
  65. houseInfoArrayList.add(new HouseInfo(hu.getHouid(),hu.getAccount(),houseType,houseID,hu.getRentType(),hu.getRentArea(),hu.getFloor(),hu.getAddressDetail(),checkList,hu.getMonthRent(),hu.getDescription(),housePic,hu.getState(),hu.getRefuseReason()));
  66. }
  67. HashMap<String, Object> res = new HashMap<>();
  68. res.put("HURecords",HURecords);//存放查询结果用户总个数
  69. res.put("houseInfoArrayList",houseInfoArrayList);//存放用户列表
  70. String res_json = JSON.toJSONString(res);//res转化为json字符串
  71. return res_json;
  72. }
  73. //获取所有展示中的房源信息(分页查询)
  74. @RequestMapping("/getAllOnshowHURecords")
  75. public String getAllOnshowHURecords(HURecordsInfo huRecordsInfo){
  76. int HURecords;//返回查询到的记录数
  77. Integer pageStart;
  78. List<House> houseList;
  79. List<HouseInfo> houseInfoArrayList = new ArrayList<>();
  80. pageStart = (huRecordsInfo.getPageStart()-1)*huRecordsInfo.getPageSize();
  81. //查询记录数量
  82. HURecords = houseDao.getAllOnshowHURecordsNum("%"+huRecordsInfo.getAccount()+"%");
  83. houseList = houseDao.getAllOnshowHUList("%"+huRecordsInfo.getAccount()+"%",pageStart,huRecordsInfo.getPageSize());
  84. for (House hu:houseList
  85. ) {
  86. String[] houseType = JSONObject.parseObject(hu.getHouseType(),String[].class);
  87. String[] houseID = JSONObject.parseObject(hu.getHouseID(),String[].class);
  88. String[] checkList = JSONObject.parseObject(hu.getCheckList(),String[].class);
  89. HousePic houseP = housePicService.findHousePicByHpicid(hu.getHousePic());
  90. String[] housePic = {houseP.getPicone(),houseP.getPictwo(),houseP.getPicthree(),houseP.getPicfour(),houseP.getPicfive()};
  91. houseInfoArrayList.add(new HouseInfo(hu.getHouid(),hu.getAccount(),houseType,houseID,hu.getRentType(),hu.getRentArea(),hu.getFloor(),hu.getAddressDetail(),checkList,hu.getMonthRent(),hu.getDescription(),housePic,hu.getState(),hu.getRefuseReason()));
  92. }
  93. HashMap<String, Object> res = new HashMap<>();
  94. res.put("HURecords",HURecords);//存放查询结果用户总个数
  95. res.put("houseInfoArrayList",houseInfoArrayList);//存放用户列表
  96. String res_json = JSON.toJSONString(res);//res转化为json字符串
  97. return res_json;
  98. }
  99. //条件筛选房源信息
  100. @RequestMapping("/getAllOnshowHURecordsByKey")
  101. public String getAllOnshowHURecordsByKey(@RequestParam("houseKey")String houseKey,@RequestParam("rentArea")String rentArea,@RequestParam("monthRent")String monthRent,@RequestParam("houseType")String houseType0,@RequestParam("rentType")String rentType,@RequestParam("floor")String floor,@RequestParam("pageStart")Integer pageStart,@RequestParam("pageSize")Integer pageSize){
  102. int rentAreaStart = Integer.parseInt(rentArea);
  103. int monthRentStart = Integer.parseInt(monthRent);
  104. //int houseTypeNum = Integer.parseInt(houseType0);
  105. int rentTypeNo = Integer.parseInt(rentType);
  106. int floorStart = Integer.parseInt(floor);
  107. int HURecords;//返回查询到的记录数
  108. Integer pageStartTemp;
  109. List<House> houseList;
  110. List<HouseInfo> houseInfoArrayList = new ArrayList<>();
  111. pageStartTemp = (pageStart-1)*pageSize;
  112. //查询记录数量
  113. HURecords = houseDao.getAllHURecordsByKeysNum("%"+houseKey+"%",rentAreaStart,monthRentStart,rentTypeNo,floorStart);
  114. houseList = houseDao.getAllHUListByKeys("%"+houseKey+"%",rentAreaStart,monthRentStart,rentTypeNo,floorStart,pageStartTemp,pageSize);
  115. for (House hu:houseList
  116. ) {
  117. String[] houseType = JSONObject.parseObject(hu.getHouseType(),String[].class);
  118. String[] houseID = JSONObject.parseObject(hu.getHouseID(),String[].class);
  119. String[] checkList = JSONObject.parseObject(hu.getCheckList(),String[].class);
  120. HousePic houseP = housePicService.findHousePicByHpicid(hu.getHousePic());
  121. String[] housePic = {houseP.getPicone(),houseP.getPictwo(),houseP.getPicthree(),houseP.getPicfour(),houseP.getPicfive()};
  122. houseInfoArrayList.add(new HouseInfo(hu.getHouid(),hu.getAccount(),houseType,houseID,hu.getRentType(),hu.getRentArea(),hu.getFloor(),hu.getAddressDetail(),checkList,hu.getMonthRent(),hu.getDescription(),housePic,hu.getState(),hu.getRefuseReason()));
  123. }
  124. HashMap<String, Object> res = new HashMap<>();
  125. res.put("HURecords",HURecords);//存放查询结果用户总个数
  126. res.put("houseInfoArrayList",houseInfoArrayList);//存放用户列表
  127. String res_json = JSON.toJSONString(res);//res转化为json字符串
  128. return res_json;
  129. // System.out.println("rentAreaStart:"+rentAreaStart);
  130. // System.out.println("monthRentStart:"+monthRentStart);
  131. // System.out.println("houseTypeNum:"+houseTypeNum);
  132. // System.out.println("rentTypeNum:"+rentTypeNum);
  133. // System.out.println("floorStart:"+floorStart);
  134. }
  135. //获取所有未通过的房屋信息列表
  136. @RequestMapping("/gethouseUpRecord")
  137. public String getHouseUpRecords(HURecordsInfo huRecordsInfo){
  138. int HURecords;//返回查询到的记录数
  139. Integer pageStart;
  140. List<House> houseList;
  141. List<HouseInfo> houseInfoArrayList = new ArrayList<>();
  142. pageStart = (huRecordsInfo.getPageStart()-1)*huRecordsInfo.getPageSize();
  143. //查询记录数量
  144. HURecords = houseDao.getDesignatedAllHURecordsNum("%"+huRecordsInfo.getAccount()+"%");
  145. houseList = houseDao.getDesignatedAllHUList("%"+huRecordsInfo.getAccount()+"%",pageStart,huRecordsInfo.getPageSize());
  146. for (House hu:houseList
  147. ) {
  148. String[] houseType = JSONObject.parseObject(hu.getHouseType(),String[].class);
  149. String[] houseID = JSONObject.parseObject(hu.getHouseID(),String[].class);
  150. String[] checkList = JSONObject.parseObject(hu.getCheckList(),String[].class);
  151. HousePic houseP = housePicService.findHousePicByHpicid(hu.getHousePic());
  152. String[] housePic = {houseP.getPicone(),houseP.getPictwo(),houseP.getPicthree(),houseP.getPicfour(),houseP.getPicfive()};
  153. houseInfoArrayList.add(new HouseInfo(hu.getHouid(),hu.getAccount(),houseType,houseID,hu.getRentType(),hu.getRentArea(),hu.getFloor(),hu.getAddressDetail(),checkList,hu.getMonthRent(),hu.getDescription(),housePic,hu.getState()));
  154. }
  155. HashMap<String, Object> res = new HashMap<>();
  156. res.put("HURecords",HURecords);//存放查询结果用户总个数
  157. res.put("houseInfoArrayList",houseInfoArrayList);//存放用户列表
  158. String res_json = JSON.toJSONString(res);//res转化为json字符串
  159. return res_json;
  160. }
  161. //删除某条申请记录
  162. @RequestMapping("/deleteOneHouseUpRecord")
  163. public String deleteOneHouseUpRecord(@RequestParam("houid") Integer houid){
  164. int hpicid = houseDao.findHousepicByHouid(houid);
  165. int deleteHpicidFlag = housePicService.deleteHousepicByhpicid(hpicid);
  166. if (deleteHpicidFlag < 1){
  167. return "fail";
  168. }
  169. int deleteHouidFlag = houseDao.deleteOneHouseUpRecord(houid);
  170. return deleteHouidFlag == 1 ? "success":"fail";
  171. }
  172. //通过申请,房屋记录state值设置为2通过(也是上架方法)
  173. @RequestMapping("/submitHouseUpRecord")
  174. public String submitHouseUpRecord(@RequestParam("houid")Integer houid){
  175. int submit = houseDao.submitHouseUpRecord(houid);
  176. return submit == 1 ? "success":"fail";
  177. }
  178. //下架房屋,房屋记录state值设置为1
  179. @RequestMapping("/offHouse")
  180. public String offHouseUpRecord(@RequestParam("houid")Integer houid){
  181. int off = houseDao.offHouseUpRecord(houid);
  182. return off == 1 ? "success":"fail";
  183. }
  184. //拒绝申请
  185. @RequestMapping("/refuseHouseUpRecord")
  186. public String refuseHouseUpRecord(@RequestParam("houid")Integer houid,@RequestParam("refusereason")Integer refusereason){
  187. int refuse = houseDao.refuseHouseUpRecord(houid,refusereason);
  188. return refuse > 0 ? "success":"fail";
  189. }
  190. //房东用户关键字搜索房源信息接口
  191. @RequestMapping("/getAccBykeyHURecords")
  192. public String getAccBykeyHURecords(FindbykeyInfo findbykeyInfo){
  193. int HURecords;//返回查询到的记录数
  194. Integer pageStart;
  195. List<House> houseList;
  196. List<HouseInfo> houseInfoArrayList = new ArrayList<>();
  197. pageStart = (findbykeyInfo.getPageStart()-1)*findbykeyInfo.getPageSize();
  198. //查询记录数量
  199. HURecords = houseDao.getKeyAllHURecordsNum(findbykeyInfo.getAccount(),"%"+findbykeyInfo.getKey()+"%");
  200. houseList = houseDao.getKeyAllHUList(findbykeyInfo.getAccount(),"%"+findbykeyInfo.getKey()+"%",pageStart,findbykeyInfo.getPageSize());
  201. for (House hu:houseList
  202. ) {
  203. String[] houseType = JSONObject.parseObject(hu.getHouseType(),String[].class);
  204. String[] houseID = JSONObject.parseObject(hu.getHouseID(),String[].class);
  205. String[] checkList = JSONObject.parseObject(hu.getCheckList(),String[].class);
  206. HousePic houseP = housePicService.findHousePicByHpicid(hu.getHousePic());
  207. String[] housePic = {houseP.getPicone(),houseP.getPictwo(),houseP.getPicthree(),houseP.getPicfour(),houseP.getPicfive()};
  208. houseInfoArrayList.add(new HouseInfo(hu.getHouid(),hu.getAccount(),houseType,houseID,hu.getRentType(),hu.getRentArea(),hu.getFloor(),hu.getAddressDetail(),checkList,hu.getMonthRent(),hu.getDescription(),housePic,hu.getState()));
  209. }
  210. HashMap<String, Object> res = new HashMap<>();
  211. res.put("HURecords",HURecords);//存放查询结果用户总个数
  212. res.put("houseInfoArrayList",houseInfoArrayList);//存放用户列表
  213. String res_json = JSON.toJSONString(res);//res转化为json字符串
  214. return res_json;
  215. }
  216. //查询指定houid的
  217. @RequestMapping("/getHouseDetailByhouid")
  218. public String getHouseDetailByhouid(@RequestParam("houid")Integer houid){
  219. House house = houseDao.getHouseDetailByhouid(houid);
  220. HousePic houseP = housePicService.findHousePicByHpicid(house.getHousePic());
  221. String[] housePic = {houseP.getPicone(),houseP.getPictwo(),houseP.getPicthree(),houseP.getPicfour(),houseP.getPicfive()};
  222. HouseInfo houseInfo = new HouseInfo(house.getHouid(),house.getAccount(),JSONObject.parseObject(house.getHouseType(),String[].class),JSONObject.parseObject(house.getHouseID(),String[].class),house.getRentType(),house.getRentArea(),house.getFloor(),house.getAddressDetail(),JSONObject.parseObject(house.getCheckList(),String[].class),house.getMonthRent(),house.getDescription(),housePic,house.getState(),house.getRefuseReason());
  223. System.out.println(houid);
  224. String account = houseDao.getAccountByHouid(houid);
  225. OwnerApply ownerApply = ownerRecordService.findApplyRecordByAccount(account);
  226. HashMap<String, Object> res = new HashMap<>();
  227. res.put("house",houseInfo);
  228. res.put("owner",ownerApply);
  229. String house_json = JSON.toJSONString(res);
  230. return house_json;
  231. }
  232. }

演示视频

基于springboot和vue的租房平台设计

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/276526
推荐阅读
相关标签
  

闽ICP备14008679号