<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
該系統有三個角色,分別是:普通使用者、房屋中介、管理員。普通使用者的功能:瀏覽房屋資訊、預約看房、和中介聊天、申請成為中介等等。房屋中介的功能:釋出房屋資訊、和使用者聊天、回覆預約資訊等等。管理員的功能:管理所有使用者資訊、管理許可權資訊、管理所有房屋資訊、管理所有預約資訊等等。
應用技術:SpringBoot + Redis + MySQL + Vue + SpringSecurity + JWT + ElasticSearch + WebSocket + FreeMarker + MyBatis-Plus等等
執行環境:Eclipse/IntelliJ IDEA + MySQL5.7 + Maven3.6.3(專案壓縮包中自帶) + JDK1.8 + Redis5.0.5(專案壓縮包中自帶)+ ElasticSearch6.8.0
/** * 使用者控制器 * * @author yy * */ @Controller @RequestMapping("/userlistmvc") public class UserListController { private static final long serialVersionUID = -884689940866074733L; @Resource private UserlistService userlistService; @Resource private AdminListService adminListService; @Resource private HeadPortraitImgService headPortraitImgService; @Resource private CheckoutapplicationService checkoutapplicationService; /** * 登入 */ @RequestMapping("/userpwd") public String userpwd(String username, String pwd, String[] identity, HttpServletRequest request) { HttpSession session = request.getSession(); if (username.equals("") || pwd.equals("")) { request.setAttribute("erorr", "輸入賬號密碼不能為空!"); return "login"; } String tempstr = null; try { if (identity[0].equals("user")) { userlist temp = new userlist(); temp.setUsercall(username); temp.setUserpwd(pwd); userlist userlist = userlistService.queryAllUserPwd(temp); try { tempstr = userlist.getUsercall(); if (tempstr != null) { session.setAttribute("user", tempstr); headportraitimg headportraitimg = headPortraitImgService.selectheadportrait(tempstr); if (headportraitimg.getHeadportraitimgaddress() != null) { session.setAttribute("headportraitimg", headportraitimg.getHeadportraitimgaddress()); } return "official"; } } catch (NullPointerException e) { if (tempstr == null) { request.setAttribute("erorr", "輸入賬號密碼有誤!"); return "login"; } else { return "official"; } } } if (identity[0].equals("admin")) { adminlist temp = new adminlist(); temp.setAdminname(username); temp.setAdminpwd(pwd); adminlist adminlist = adminListService.findAllAdminPwd(temp); try { tempstr = adminlist.getAdminname(); if (tempstr != null) { session.setAttribute("admin", tempstr); return "BackgroundHome"; } } catch (NullPointerException e) { request.setAttribute("erorr", "輸入賬號密碼有誤!"); return "login"; } } } catch (NullPointerException e) { request.setAttribute("erorr", "選擇登入方式!"); e.printStackTrace(); return "login"; } return "login"; } /** * 註冊 */ @RequestMapping("/register") public String register(String usercall, String userpwd, String userphone, HttpServletRequest request) { if (usercall.equals("") || userpwd.equals("") || userphone.equals("")) { request.setAttribute("erorr", "輸入賬號密碼不能為空!"); return "register"; } userlist user = new userlist(); user.setUsercall(usercall); user.setUserphone(userphone); user.setUserpwd(userpwd); userlistService.insert(user); headportraitimg userimg = new headportraitimg(); userimg.setHeadportraitimgusername(usercall); headPortraitImgService.insertuserimg(userimg); return "login"; } /** * 獲取手機驗證碼 **/ @RequestMapping("/getcode") public void getcode(String userphone, HttpServletResponse response, HttpServletRequest request) { response.setCharacterEncoding("UTF-8"); try { HttpSession session = request.getSession(); String code = "123456"; // String code = Code.getNum(userphone); System.out.println(code); session.setAttribute("code", code); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * 判斷驗證碼輸入後登陸 **/ @RequestMapping("/phonecod") public String phonecod(String userphone, String code, HttpServletRequest request) { HttpSession session = request.getSession(); if (userphone.equals("") || code.equals("")) { request.setAttribute("erorr", "手機號或者驗證碼為空!"); return "login"; } System.out.println(code); if (code.equals(session.getAttribute("code"))) { userlist user = userlistService.selectUserPhone(userphone); if (user != null) { String tempstr = null; userlist userlist = userlistService.selectUserPhone(userphone); tempstr = userlist.getUsercall(); if (tempstr != null) { session.setAttribute("user", tempstr); headportraitimg headportraitimg = headPortraitImgService.selectheadportrait(tempstr); if (headportraitimg.getHeadportraitimgaddress() != null) { session.setAttribute("headportraitimg", headportraitimg.getHeadportraitimgaddress()); } return "official"; } } else { request.setAttribute("erorr", "該手機號未註冊!"); return "login"; } } else { request.setAttribute("erorr", "驗證碼錯誤!"); return "login"; } return "login"; } /** * 修改密碼 */ @RequestMapping("/updatepwd") public String updatepwd(String code, String userphone, String userpwd, HttpServletRequest request) { if (code.equals("") || userphone.equals("") || userpwd.equals("")) { request.setAttribute("erorr", "手機號,驗證碼,新密碼不能為空!"); return "updatepwd"; } HttpSession session = request.getSession(); if (code.equals(session.getAttribute("code"))) { userlist userlist = userlistService.selectUserPhone(userphone); userlist.setUserpwd(userpwd); userlistService.updatepwd(userlist); return "login"; } return userpwd; } /** * 登出 */ @RequestMapping("/cancellation") public String cancellation(HttpServletRequest request) { HttpSession session = request.getSession(); session.removeAttribute("user"); System.out.println("登出成功"); return "official"; } /** * 申請看房 */ @RequestMapping("/apply") @ResponseBody public ModelAndView apply(HttpSession session, HttpServletRequest request, String housemoney, String housecall, String houseaddress,String housesize) { ModelAndView mav = new ModelAndView("official"); //令牌驗證 if(!new Koken().kokenid(request, session)) { return mav; } mav.addObject("news", "official"); if ((String) session.getAttribute("user") == null) { mav.addObject("apply", "請先登入!"); return mav; } // 查詢所有資料 userlist user = userlistService.selectUserCall((String) session.getAttribute("user")); if (user.getUsername() == null) {// 判斷真實姓名是否為空 mav.addObject("apply", "請繫結真實姓名後再租賃房屋!"); return mav; } else { checkoutapplication coa = new checkoutapplication(); coa.setCoausername(user.getUsername()); coa.setCoauserid(user.getUserid()); coa.setCoauserphone(user.getUserphone()); coa.setCoahouseid(housecall); coa.setCoahouseaddress(houseaddress); coa.setCoahouseprice(Double.parseDouble(housemoney)); coa.setCoahousesize(Double.parseDouble(housesize)); coa.setCoastate("看房申請中"); String temp=checkoutapplicationService.insertApply(coa); mav.addObject("apply", temp); } return mav; } }
@Controller @RequestMapping("/admin") public class Adminfunctioncontroller { @Resource private RentwithdrawnService rentwithdrawnService; @Resource private LeaseinformationService leaseinformationService; @Resource private CheckoutapplicationService checkoutapplicationService; @Resource private MydailylifeService mydailylifeService; @Resource private RentcollectionService rentcollectionService; @Resource private FaultService faultService; @Resource private UserlistService userlistService; @Resource private LeaseimgService leaseimgService; @Resource private HeadPortraitImgService headPortraitImgService; /** * 登出 */ @RequestMapping("/admincancel") public String cancellation(HttpServletRequest request) { HttpSession session = request.getSession(); session.removeAttribute("admin"); System.out.println("登出成功"); return "official"; } @RequestMapping("/details") public ModelAndView listCategory(@RequestParam int pn) { ModelAndView mav = new ModelAndView("rentingdel"); // 設定分頁傳輸 PageHelper.startPage(pn, 10); // 查詢所有資料 List<rentwithdrawn> list = rentwithdrawnService.selectRwState("已退租"); // 使用PageInFo封裝查詢結果 PageInfo<rentwithdrawn> pageInfo = new PageInfo<rentwithdrawn>(list, 5); // 放入轉發引數 mav.addObject("cs", pageInfo); return mav; } @RequestMapping("/delect") public ModelAndView delect(@RequestParam int id) { ModelAndView mav = new ModelAndView("rentingdel"); rentwithdrawnService.deleteByPrimaryKey(id); return mav; } @RequestMapping("/rentinglist") public ModelAndView listHouseState(@RequestParam int pn) { ModelAndView mav = new ModelAndView("rentinglist"); // 設定分頁傳輸 PageHelper.startPage(pn, 10); // 查詢所有資料 List<leaseinformation> list = leaseinformationService.selecthousteaseWith("出租中"); // 使用PageInFo封裝查詢結果 PageInfo<leaseinformation> pageInfo = new PageInfo<leaseinformation>(list, 5); // 放入轉發引數 mav.addObject("cs", pageInfo); return mav; } @RequestMapping("/delectcontract") public ModelAndView delectcontract(@RequestParam int id) { ModelAndView mav = new ModelAndView("rentinglist"); leaseinformationService.updacontract(id); return mav; } /** * 看房申請列表 */ @RequestMapping("/houseapply") public ModelAndView kanfansqing(@RequestParam int pn) { ModelAndView mav = new ModelAndView("houseapply"); // 設定分頁傳輸 PageHelper.startPage(pn, 10); // 查詢所有資料 List<checkoutapplication> list = checkoutapplicationService.selectCoaState(); // 使用PageInFo封裝查詢結果 PageInfo<checkoutapplication> pageInfo = new PageInfo<checkoutapplication>(list, 5); // 放入轉發引數 mav.addObject("cs", pageInfo); return mav; } /** * 預約看房申請 */ @RequestMapping("/tonyizp") public ModelAndView tonyizp(@RequestParam int id, String housecall, String name) throws ParseException { ModelAndView mav = new ModelAndView("houseapply"); checkoutapplicationService.xgaiCoaState("已同意", id); leaseinformation house = leaseinformationService.selectHouseCall(housecall).get(0); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");// 設定日期格式 Calendar c = Calendar.getInstance(); c.add(Calendar.DATE, 30);// 計算30天后的時間 String t1 = df.format(new Date()); String t2 = df.format(c.getTime()); // 格式轉換date格式 Date date1 = df.parse(t1); Date date2 = df.parse(t2); house.setHousestartingdate(date1); house.setHouseclosingdate(date2); house.setHousestate("出租中"); house.setUsername(name); leaseinformationService.updateByPrimaryKey(house); return mav; } @RequestMapping("/jujzp") public ModelAndView jujzp(@RequestParam int id) { ModelAndView mav = new ModelAndView("houseapply"); checkoutapplicationService.xgaiCoaState("已拒絕", id); return mav; } /** * 退房申請 */ @RequestMapping("/tzshenqing") public ModelAndView tzshenqing(@RequestParam int pn) { ModelAndView mav = new ModelAndView("housedel"); // 設定分頁傳輸 PageHelper.startPage(pn, 10); // 查詢所有資料 List<checkoutapplication> list = checkoutapplicationService.selectCoaState1(); // 使用PageInFo封裝查詢結果 PageInfo<checkoutapplication> pageInfo = new PageInfo<checkoutapplication>(list, 5); // 放入轉發引數 mav.addObject("cs", pageInfo); return mav; } /** * 刪除退房記錄 */ @RequestMapping("/delecttzsq") public ModelAndView delecttzsq(@RequestParam int id) { ModelAndView mav = new ModelAndView("housedel"); checkoutapplicationService.deleteByPrimaryKey(id); return mav; } /** * 同意退房 */ @RequestMapping("/checkoutmvc") public ModelAndView checkoutmvc(@RequestParam int id,String housecall) { ModelAndView mav = new ModelAndView("housedel"); String news=checkoutapplicationService.updateState("已同意", id); if(news.equals("同意退租成功!")) { System.out.println(news); System.out.println(leaseinformationService.updateCancelForeignKey(housecall)); } return mav; } /** * 拒絕退房 */ @RequestMapping("/refusemvc") public ModelAndView refusemvc(@RequestParam int id) { ModelAndView mav = new ModelAndView("housedel"); System.out.println(checkoutapplicationService.updateState("已拒絕", id)); return mav; } /** * 分頁查詢所有使用者 */ @RequestMapping("/pagingselectuser") public String pagingselectuser(Model model, @RequestParam(value = "pn", defaultValue = "1") Integer pn, @RequestParam(required = false, defaultValue = "6") Integer pageSize) { PageHelper.startPage(pn, 10); List<userlist> userlist = userlistService.selectAll(); PageInfo<userlist> p = new PageInfo<userlist>(userlist, 3); model.addAttribute("p", p); return "account"; } /** * 刪除使用者資訊 */ @RequestMapping("/deletuser") public String deletuser(int id,String username,HttpServletRequest request) { userlistService.updateJointTabledelete(username); headPortraitImgService.deletuserimg(userlistService.selectUserId(id).getUsercall()); userlistService.deleteByPrimaryKey(id); return "redirect:pagingselectuser.do"; } /** * 新增房源 * * @throws IOException * @throws IllegalStateException */ @RequestMapping("/addhouse") public String addhouse(String housecall, String address, String area, String rent, String housetype, String[] state, @RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request) throws IllegalStateException, IOException { if (housecall.equals("") || address.equals("") || area.equals("") || rent.equals("") || state.equals("") || housetype.equals("")) { request.setAttribute("erro", "輸入房源資訊不能缺少任意一項!"); return "housingadd"; } List<leaseinformation> list = leaseinformationService.queryAll(); for (leaseinformation leaseinformation : list) { if (housecall.equals(leaseinformation.getHousecall())) { request.setAttribute("erro", "該房源編號已存在"); return "housingadd"; } } String path = ""; String imgname = ""; if (!file.isEmpty()) { // 生成uuid作為檔名稱 String uuid = UUID.randomUUID().toString().replaceAll("-", ""); // 獲得檔案型別(可以判斷如果不是圖片,禁止上傳) String contentType = file.getContentType(); // 獲得檔案字尾名稱 String imageName = contentType.substring(contentType.indexOf("/") + 1); path = "C://Users/Rain/Desktop/ssm_leaseOfHouses/WebContent/leaseimg/" + uuid + "." + imageName; file.transferTo(new File(path)); imgname = uuid + "." + imageName; } leaseimg img = new leaseimg(); img.setImgname(address); img.setImgroute(imgname); leaseimgService.insert(img); int id = leaseimgService.selectAll().get(leaseimgService.selectAll().size() - 1).getId(); leaseinformation house = new leaseinformation(); house.setHouseaddress(address); house.setHousesize(Double.valueOf(area)); house.setHousemoney(rent); house.setHousestate(state[0]); house.setHousecall(housecall); //獲取當前時間和一個月後的時間 Date date = new Date(); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); String HouseStartingDate=sdf.format(date); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, 30); String HouseClosingDate=sdf.format(cal.getTime()); house.setHousestartingdate(date); house.setHouseclosingdate(cal.getTime()); house.setHousestartingdatetemp(HouseStartingDate); house.setHouseclosingdatetemp(HouseClosingDate); house.setId(id); house.setHousetype(housetype); house.setHouserecommend("未設定"); leaseinformationService.addHouse(house); request.setAttribute("sessce", "新增成功"); return "housingadd"; } /** * 分頁展示房源資訊 */ @RequestMapping("/pagingselecthouse") public String pagingselecthouse(Model model, @RequestParam(value = "pn", defaultValue = "1") Integer pn, @RequestParam(required = false, defaultValue = "6") Integer pageSize) { PageHelper.startPage(pn, 10); List<leaseinformation> leaseinformation = leaseinformationService.queryAll(); PageInfo<leaseinformation> p = new PageInfo<leaseinformation>(leaseinformation, 3); model.addAttribute("p", p); return "housinglist"; } /** * 獲取修改房源資訊 */ @RequestMapping("/getupdatehouse") public String getupdatehouse(int houseid, HttpServletRequest request) { List<leaseinformation> house = leaseinformationService.queryID(houseid); request.setAttribute("uphouse", house); return "houseupdate"; } /** * 修改房源資訊 */ @RequestMapping("/updatehouse") public String updatehouse(Integer houseid, String housetype, String address, String area, String rent, String state, HttpServletRequest request) { leaseinformation house = leaseinformationService.queryID(houseid).get(0); request.removeAttribute("uphouse"); house.setHouseaddress(address); house.setHousemoney(rent); house.setHousetype(housetype); house.setHousesize(Double.valueOf(area)); house.setHousestate(state); house.setHouseid(houseid); leaseinformationService.updateByPrimaryKey(house); request.setAttribute("sessce", "修改成功"); request.setAttribute("newhouse", house); return "houseupdate"; } /** * 刪除房源資訊 */ @RequestMapping("/delethouse") public String delethouse(int houseid, HttpServletRequest request) { if (houseid >= 0) { int id = leaseinformationService.queryID(houseid).get(0).getId(); leaseinformationService.deleteByPrimaryKey(houseid); leaseimgService.deleteByPrimaryKey(id); } return "redirect:pagingselecthouse.do"; } /* * 推薦房屋列表 */ @RequestMapping("/recommendlist") public String recommendlist(Model model, @RequestParam(value = "pn", defaultValue = "1") Integer pn, @RequestParam(required = false, defaultValue = "6") Integer pageSize) { PageHelper.startPage(pn, 10); List<leaseinformation> leaseinformation = leaseinformationService.selectAllLeasable(); PageInfo<leaseinformation> p = new PageInfo<leaseinformation>(leaseinformation, 3); model.addAttribute("p", p); return "recommendhouse"; } /** * 修改推薦資訊 */ @RequestMapping("/updaterecommend") public String updatehouse(Integer houseid) { leaseinformation house = leaseinformationService.queryID(houseid).get(0); if (house.getHouserecommend().equals("未推薦")) { house.setHouserecommend("已推薦"); } else { house.setHouserecommend("未推薦"); } leaseinformationService.updateByPrimaryKey(house); return "redirect:recommendlist.do?"; } /** * 分頁查詢日程資訊 */ @RequestMapping("/schedulelist") public String mydailylifelist(@RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) { // 參照PageHelper分頁外掛 PageHelper.startPage(pn, 10); List<mydailylife> mydailylifes = mydailylifeService.selectAll(); PageInfo<mydailylife> page = new PageInfo<mydailylife>(mydailylifes, 3); model.addAttribute("p", page); return "schedulelist"; } /** * 新增日程 */ @RequestMapping("/addmydailylife") public String mydailylifeadd(mydailylife mydailylife) { mydailylifeService.insert(mydailylife); return "redirect:/admin/schedulelist.do"; } /** * 修改日程 */ @RequestMapping("/updatemydailylife") public String mydailylifeupdate1(Integer id, HttpServletRequest request) { mydailylife mydailylife = mydailylifeService.selectByPrimaryKey(id); request.setAttribute("mydailylife", mydailylife); return "scheduleupdate"; } @RequestMapping("/toupdate") public String mydailylifeupdate2(mydailylife mydailylife) { mydailylifeService.updateByPrimaryKey(mydailylife); return "redirect:/admin/schedulelist.do"; } /** * 刪除日程 */ @RequestMapping("/delmydailylife") public String mydailylifedel(Integer id) { mydailylifeService.deleteByPrimaryKey(id); return "redirect:/admin/schedulelist.do"; } // 報障 /** * 查詢待處理報障 */ @RequestMapping("/Adminselectrepairwait") public String selectrepairwait(String state, @RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) { state = "未處理"; // 參照PageHelper分頁外掛 PageHelper.startPage(pn, 10); List<fault> faultlist = faultService.AdminSelectStateAll(state); PageInfo<fault> page = new PageInfo<fault>(faultlist, 3); model.addAttribute("p", page); return "repairwait"; } /** * 已完成全部報障 */ @RequestMapping("/Adminselectrepairdone") public String selectrepairdone(String state, @RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) { state = "已處理"; // 參照PageHelper分頁外掛 PageHelper.startPage(pn, 10); List<fault> faultdone = faultService.AdminSelectStateAll(state); PageInfo<fault> page = new PageInfo<fault>(faultdone, 3); model.addAttribute("p", page); return "repairdone"; } /** * 報障狀態修改 */ @RequestMapping("/adminrepairwait") public String updaterepairwait(Integer id) { fault fault = faultService.selectByPrimaryKey(id); String fhouseid = fault.getFhouseid(); String fhouseaddress = fault.getFhouseaddress(); Double fprice = fault.getFprice(); Date fdate = fault.getFdate(); String fcontent = fault.getFcontent(); String fusername = fault.getFusername(); String fuserid = fault.getFuserid(); String fuserphone = fault.getFuserphone(); String fstate = "已處理"; fault f = new fault(fhouseid, fhouseaddress, fprice, fdate, fcontent, fusername, fuserid, fuserphone, fstate, id); faultService.updateByPrimaryKey(f); return "redirect:/admin/Adminselectrepairwait.do"; } /** * 報障刪除 */ @RequestMapping("/adminrepairdone") public String delrepair(Integer id) { faultService.deleteByPrimaryKey(id); return "redirect:/admin/Adminselectrepairdone.do"; } /** * 搜尋報障 */ @RequestMapping("/repairselect") public String repairselect(QueryVo vo, @RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) { // 參照PageHelper分頁外掛 PageHelper.startPage(pn, 10); List<fault> faultdone = faultService.repairselect(vo); for (fault temp : faultdone) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String date = sdf.format(temp.getFdate()); temp.setFdatetemp(date); } PageInfo<fault> page = new PageInfo<fault>(faultdone, 3); model.addAttribute("p", page); model.addAttribute("vo", vo); return "repairdone"; } /** * 我要收租 */ @RequestMapping("/adminrentshou") public String rentshou(@RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) { // 參照PageHelper分頁外掛 PageHelper.startPage(pn, 10); List<userlist> userlists = userlistService.rentSelectAll(); PageInfo<userlist> page = new PageInfo<userlist>(userlists, 3); model.addAttribute("rent", page); return "rentshou"; } /** * 獲取收租資訊 */ @RequestMapping("/adminrentselect") public String rentadd(String housecall, Model model) { userlist userlist = userlistService.selectUserCallWith(housecall); model.addAttribute("addrent", userlist); return "rentadd"; } /** * 新增代繳租金 */ @RequestMapping("/adminrentadd") public String rentaddwait(rentcollection rentcollection) { rentcollectionService.insert(rentcollection); return "redirect:/admin/adminrentshou.do"; } /** * 代繳租金 */ @RequestMapping("/adminrentwait") public String rentwait(String rcstate, @RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) { rcstate = "未繳納"; // 參照PageHelper分頁外掛 PageHelper.startPage(pn, 10); List<rentcollection> rentlists = rentcollectionService.selectPaidStateAll(rcstate); PageInfo<rentcollection> page = new PageInfo<rentcollection>(rentlists, 3); model.addAttribute("rent", page); return "rentwait"; } /** * 刪除租金繳納記錄 */ @RequestMapping("/admindelrent") public String delrent(Integer id) { rentcollectionService.deleteByPrimaryKey(id); return "redirect:/admin/adminselectPaidAll.do"; } /** * 搜尋查詢 */ @RequestMapping("/adminselectPaidAll") public String adminselectPaidAll(QueryVo vo, @RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) { // 參照PageHelper分頁外掛 PageHelper.startPage(pn, 10); List<rentcollection> rentlists = rentcollectionService.selectPaidAll(vo); for (rentcollection temp : rentlists) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String date = sdf.format(temp.getRcdate()); temp.setRcdatetemp(date); if(temp.getRcpaiddate()!=null) { String Rcpaiddate = sdf.format(temp.getRcpaiddate()); temp.setRcpaiddatetemp(Rcpaiddate); } } PageInfo<rentcollection> page = new PageInfo<rentcollection>(rentlists, 3); model.addAttribute("rent", page); model.addAttribute("vo", vo); return "rentdone"; } /** * 檢視合同 */ @RequestMapping("/viewcontractadmin") public ModelAndView viewcontractadmin(String username, String userid, String houseaddress, String housestartingdatetemp, String houseclosingdatetemp, String housemoney, String userphone, String houseid, HttpServletRequest request, HttpSession session) { ModelAndView mav = new ModelAndView("rentinglist"); String arraytemp[] = { username, userid, houseaddress, housestartingdatetemp, houseclosingdatetemp, housemoney, userphone, houseid }; System.out.println(Arrays.toString(arraytemp)); String temp = arraytemp[7] + "pdf.pdf"; File filetemp = new File("C://Users/Rain/Desktop/ssm_leaseOfHouses/WebContent/contract/pdf/" + temp); if (!filetemp.exists()) { System.out.println(new DocumentConversion().DocumentGeneration(arraytemp)); new DocumentConversion().PdfGeneration(arraytemp[7]); filetemp = new File("C://Users/Rain/Desktop/ssm_leaseOfHouses/WebContent/contract/pdf/" + temp); } String pdf = filetemp.getName(); // 放入轉發引數 mav.addObject("pdftemp", pdf); return mav; } }
/** * 個人中心控制器 * * @author yy * */ @Controller @RequestMapping("/personacentermvc") public class PersonacenterController { @Resource private RentwithdrawnService rentwithdrawnService; @Resource private UserlistService userlistService; @Resource private LeaseinformationService leaseinformationService; @Resource private CheckoutapplicationService checkoutapplicationService; @Resource private RentcollectionService rentcollectionService; @Resource private FaultService faultService; @Resource private HeadPortraitImgService headPortraitImgService; /** * 個人資訊切換頁面 */ @RequestMapping("/personal_switch") public void temp(String txt, HttpServletResponse response) throws IOException { response.setCharacterEncoding("UTF-8"); switch (txt) { case "租賃資訊": response.getWriter().print("/jsp/personalInformation/information.jsp"); break; case "我的申請": response.getWriter().print("/jsp/personalInformation/myapplication.jsp"); break; case "代繳租金": response.getWriter().print("/jsp/personalInformation/rentpayment.jsp"); break; case "報障模組": response.getWriter().print("/jsp/personalInformation/faultreportingmodule.jsp"); break; case "其他操作": response.getWriter().print("/jsp/personalInformation/otheroperations.jsp"); break; } } /** * 我的租賃分頁查詢 */ @RequestMapping("/myRentalList") @ResponseBody public Msg myRentalList(@RequestParam(value = "pn") Integer pn, HttpSession session) { // 查詢所有資料 userlist user = userlistService.selectUserCall((String) session.getAttribute("user")); // 設定分頁傳輸 PageHelper.startPage(pn, 8); List<userlist> leaseuser = userlistService.selectUserNameWith(user.getUsername()); // 使用PageInFo封裝查詢結果 PageInfo<userlist> pageInfo = new PageInfo<userlist>(leaseuser, 3); return Msg.success().add("pageInfo", pageInfo); } /** * 已退租賃記錄分頁查詢 */ @RequestMapping("/refundedLeaseList") @ResponseBody public Msg refundedLeaseList(@RequestParam(value = "pn") Integer pn, HttpSession session) { // 查詢所有資料 userlist user = userlistService.selectUserCall((String) session.getAttribute("user")); // 設定分頁傳輸 PageHelper.startPage(pn, 8); List<rentwithdrawn> list = rentwithdrawnService.queryAllStateName("已退租", "", user.getUsername()); // 使用PageInFo封裝查詢結果 PageInfo<rentwithdrawn> pageInfo = new PageInfo<rentwithdrawn>(list, 3); return Msg.success().add("pageInfo", pageInfo); } /** * 申請狀態記錄分頁查詢 */ @RequestMapping("/applicationAtatusList") @ResponseBody public Msg applicationAtatusList(@RequestParam(value = "pn") Integer pn, boolean flag, HttpSession session) { List<checkoutapplication> list = null; userlist user = userlistService.selectUserCall((String) session.getAttribute("user")); // 設定分頁傳輸 PageHelper.startPage(pn, 8); // 查詢所有資料 if (flag) { list = checkoutapplicationService.selectStateAll("看房申請中", "退房申請中", "", user.getUsername()); } else { list = checkoutapplicationService.selectStateAll("已拒絕", "已同意", "已取消", user.getUsername()); } // 使用PageInFo封裝查詢結果 PageInfo<checkoutapplication> pageInfo = new PageInfo<checkoutapplication>(list, 3); return Msg.success().add("pageInfo", pageInfo); } /** * 代繳租金分頁查詢 */ @RequestMapping("/rentpaymentList") @ResponseBody public Msg rentpaymentList(@RequestParam(value = "pn") Integer pn, String state, HttpSession session) { userlist user = userlistService.selectUserCall((String) session.getAttribute("user")); // 設定分頁傳輸 PageHelper.startPage(pn, 8); List<rentcollection> list = rentcollectionService.queryPaidStateAll(state, user.getUsername()); // 使用PageInFo封裝查詢結果 PageInfo<rentcollection> pageInfo = new PageInfo<rentcollection>(list, 3); return Msg.success().add("pageInfo", pageInfo); } /** * 繳納租金 */ @RequestMapping("/payrentmvc") public ModelAndView payrentmvc(String rchousemoney,Integer rcid,String token,HttpServletRequest request,HttpSession session) { ModelAndView mav = new ModelAndView("personacenter"); //令牌驗證 if(!new Koken().kokenid(request, session)) { return mav; } Warning news = rentcollectionService.updateState(rcid); System.out.println(news.getWarningContent()); // 放入轉發引數 mav.addObject("news", news); return mav; } /** * 已繳納租金刪除記錄 */ @RequestMapping("/paidrent") public ModelAndView paidrent(Integer rcid,HttpServletRequest request,HttpSession session) { ModelAndView mav = new ModelAndView("personacenter"); //令牌驗證 if(!new Koken().kokenid(request, session)) { return mav; } Warning news = rentcollectionService.deleteByPrimaryKey(rcid); System.out.println(news.getWarningContent()); // 放入轉發引數 mav.addObject("news", news); return mav; } /** * 共繳費費用 */ @RequestMapping("/copaymentfee") @ResponseBody public Msg copaymentfee(String state, HttpSession session) { userlist user = userlistService.selectUserCall((String) session.getAttribute("user")); List<rentcollection> list = rentcollectionService.queryPaidStateAll(state, user.getUsername()); int num = 0; for (rentcollection temp : list) { num += Float.parseFloat(temp.getRchousemoney()); } return Msg.success().add("num", num); } /** * 報障分頁查詢 */ @RequestMapping("/repairList") @ResponseBody public Msg repairList(@RequestParam(value = "pn") Integer pn, String str, HttpSession session) { // 使用PageInFo封裝查詢結果 userlist user = userlistService.selectUserCall((String) session.getAttribute("user")); // 設定分頁傳輸 PageHelper.startPage(pn, 8); if (str.equals("我要報障")) { List<userlist> leaseuser = userlistService.selectUserNameWith(user.getUsername()); PageInfo<userlist> pageInfo = new PageInfo<userlist>(leaseuser, 3); return Msg.success().add("pageInfo", pageInfo); } List<fault> list = faultService.queryAllState(str, user.getUsername()); PageInfo<fault> pageInfo = new PageInfo<fault>(list, 3); return Msg.success().add("pageInfo", pageInfo); } /** * 報障提交內容 * * @throws ParseException */ @RequestMapping("/contentofthereport") public ModelAndView contentofthereport(String date, String housecall, String contentofthe,String token,HttpServletRequest request,HttpSession session) throws ParseException { ModelAndView mav = new ModelAndView("personacenter"); //令牌驗證 if(!new Koken().kokenid(request, session)) { return mav; } userlist user = userlistService.selectUserCallWith(housecall); fault fault = new fault(); fault.setFhouseid(housecall); fault.setFhouseaddress(user.getLeaseinformation().getHouseaddress()); fault.setFprice(Double.parseDouble(user.getLeaseinformation().getHousemoney())); SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); Date t1 = sdf.parse(date); fault.setFdate(t1); fault.setFdatetemp(date); fault.setFcontent(contentofthe); fault.setFusername(user.getUsername()); fault.setFuserid(user.getUserid()); fault.setFuserphone(user.getUserphone()); fault.setFstate("未處理"); Warning news = faultService.insert(fault); System.out.println(news.getWarningContent()); // 放入轉發引數 mav.addObject("news", news); return mav; } /** * 報障刪除記錄 */ @RequestMapping("/deleterepair") public ModelAndView deleterepair(Integer fid,String token,HttpServletRequest request,HttpSession session) { ModelAndView mav = new ModelAndView("personacenter"); //令牌驗證 if(!new Koken().kokenid(request, session)) { return mav; } Warning news = faultService.deleteByPrimaryKey(fid); System.out.println(news.getWarningContent()); // 放入轉發引數 mav.addObject("news", news); return mav; } /** * 頭像上傳 使用者真實姓名,身份證號,手機號上傳 * * @throws FileNotFoundException */ @RequestMapping("/file") public ModelAndView file(String username,String userid,String userphone,HttpServletRequest request,HttpSession session,@RequestParam MultipartFile file) throws Exception { System.out.println(username); ModelAndView mav = new ModelAndView("personacenter"); userlist usere=userlistService.selectUserName(username); if (usere==null) { session.setAttribute("modifyerro",null); System.out.println("可修改"); }else { Warning news=new Warning(2, "修改失敗!該姓名使用者已註冊"); mav.addObject("news", news); return mav; } //令牌驗證 if(!new Koken().kokenid(request, session)) { return mav; } // 獲取檔案的名稱 String fName = file.getOriginalFilename(); System.out.println(fName); if (!fName.equals("")) { // 儲存圖片的目錄 String path = "C://Users/Rain/Desktop/ssm_leaseOfHouses/WebContent/headPortraitImg"; File filepath = new File(path); // 如果目錄不存在,建立 if (!filepath.exists()) { filepath.mkdir(); } File f = new File(path, fName); // 更改使用者頭像 headportraitimg headportraitimg = new headportraitimg(); String user = (String) session.getAttribute("user"); headportraitimg.setHeadportraitimgusername(user); headportraitimg.setHeadportraitimgaddress(fName); // 圖片路徑上傳到資料庫 headPortraitImgService.updatauserimg(headportraitimg); // 更換頭像 session.setAttribute("headportraitimg", headportraitimg.getHeadportraitimgaddress()); // 上傳檔案 file.transferTo(f); } userlist user = userlistService.selectUserCall((String) session.getAttribute("user")); //暫時儲存需要修改的真實姓名 String rcusernametemp=user.getUsername(); //判斷,如有真實姓名聯表修改,則新增 if(user.getUsername()==null||"".equals(user.getUsername())) { // 上傳真實姓名,身份證,手機號 userlist userlist = new userlist(); userlist.setUsercall((String) session.getAttribute("user")); userlist.setUsername(username); userlist.setUserid(userid); userlist.setUserphone(userphone); Warning news = userlistService.updateByPrimaryCall(userlist); System.out.println(news.getWarningContent()); // 放入轉發引數 mav.addObject("news", news); }else { // 修改真實姓名,身份證,手機號 userlist userlist = new userlist(); userlist.setUsername(username); userlist.setUserid(userid); userlist.setUserphone(userphone); userlist.setUsernametemp(user.getUsername()); Warning news = userlistService.updateJointTableName(userlist); //修改租金真實姓名 System.out.println(rentcollectionService.updateUserName(username,rcusernametemp)); System.out.println(news.getWarningContent()); // 放入轉發引數 mav.addObject("news", news); } return mav; } /** * 刪除已退租記錄 */ @RequestMapping("/deleterentrefund") public ModelAndView deleterentrefund(Integer rwid,String token,HttpServletRequest request,HttpSession session) { ModelAndView mav = new ModelAndView("personacenter"); //令牌驗證 if(!new Koken().kokenid(request, session)) { return mav; } Warning news = rentwithdrawnService.deleteByPrimaryKey(rwid); System.out.println(news.getWarningContent()); // 放入轉發引數 mav.addObject("news", news); return mav; } /** * 檢視合同 */ @RequestMapping("/viewcontract") public ModelAndView viewcontract(String username, String userid, String houseaddress, String housestartingdatetemp, String houseclosingdatetemp, String housemoney, String userphone, String houseid,HttpServletRequest request,HttpSession session) { ModelAndView mav = new ModelAndView("personacenter"); String arraytemp[] = { username, userid, houseaddress, housestartingdatetemp, houseclosingdatetemp, housemoney, userphone, houseid }; String temp = (arraytemp[0]+arraytemp[7]) + "pdf.pdf"; File filetemp = new File("C://Users/Rain/Desktop/ssm_leaseOfHouses/WebContent/contract/pdf/" + temp); if (!filetemp.exists()) { // System.out.println(new DocumentConversion().DocumentGeneration(arraytemp)); new DocumentConversion().PdfGeneration((arraytemp[0]+arraytemp[7])); filetemp = new File("C://Users/Rain/Desktop/ssm_leaseOfHouses/WebContent/contract/pdf/" + temp); } String pdf = filetemp.getName(); // 放入轉發引數 mav.addObject("pdftemp", pdf); return mav; } /** * 終止合同 */ @RequestMapping("/termination") public ModelAndView termination(String call,String token,HttpServletRequest request,HttpSession session) { ModelAndView mav = new ModelAndView("personacenter"); //令牌驗證 if(!new Koken().kokenid(request, session)) { return mav; } userlist leaseuser = userlistService.selectUserCallWith(call); Warning news = checkoutapplicationService.insert(leaseuser); // 放入轉發引數 mav.addObject("news", news); return mav; } /** * 終止申請 */ @RequestMapping("/stopapplying") public ModelAndView stopapplying(String call,String token,HttpServletRequest request,HttpSession session) { ModelAndView mav = new ModelAndView("personacenter"); //令牌驗證 if(!new Koken().kokenid(request, session)) { return mav; } Warning news = checkoutapplicationService.updateCallState("已取消", call); System.out.println(news.getWarningContent()); // 放入轉發引數 mav.addObject("news", news); return mav; } /** * 刪除申請記錄 */ @RequestMapping("/deleterecord") public ModelAndView deleterecord(Integer coaid,String token,HttpServletRequest request,HttpSession session) { ModelAndView mav = new ModelAndView("personacenter"); //令牌驗證 if(!new Koken().kokenid(request, session)) { return mav; } Warning news = checkoutapplicationService.deleteByPrimaryKey(coaid); System.out.println(news.getWarningContent()); // 放入轉發引數 mav.addObject("news", news); return mav; } }
以上就是Java實戰之線上租房系統的實現的詳細內容,更多關於Java租房系統的的資料請關注it145.com其它相關文章!
相關文章
<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
综合看Anker超能充系列的性价比很高,并且与不仅和iPhone12/苹果<em>Mac</em>Book很配,而且适合多设备充电需求的日常使用或差旅场景,不管是安卓还是Switch同样也能用得上它,希望这次分享能给准备购入充电器的小伙伴们有所
2021-06-01 09:31:42
除了L4WUDU与吴亦凡已经多次共事,成为了明面上的厂牌成员,吴亦凡还曾带领20XXCLUB全队参加2020年的一场音乐节,这也是20XXCLUB首次全员合照,王嗣尧Turbo、陈彦希Regi、<em>Mac</em> Ova Seas、林渝植等人全部出场。然而让
2021-06-01 09:31:34
目前应用IPFS的机构:1 谷歌<em>浏览器</em>支持IPFS分布式协议 2 万维网 (历史档案博物馆)数据库 3 火狐<em>浏览器</em>支持 IPFS分布式协议 4 EOS 等数字货币数据存储 5 美国国会图书馆,历史资料永久保存在 IPFS 6 加
2021-06-01 09:31:24
开拓者的车机是兼容苹果和<em>安卓</em>,虽然我不怎么用,但确实兼顾了我家人的很多需求:副驾的门板还配有解锁开关,有的时候老婆开车,下车的时候偶尔会忘记解锁,我在副驾驶可以自己开门:第二排设计很好,不仅配置了一个很大的
2021-06-01 09:30:48
不仅是<em>安卓</em>手机,苹果手机的降价力度也是前所未有了,iPhone12也“跳水价”了,发布价是6799元,如今已经跌至5308元,降价幅度超过1400元,最新定价确认了。iPhone12是苹果首款5G手机,同时也是全球首款5nm芯片的智能机,它
2021-06-01 09:30:45