current position:Home>Java project: Online house searching system (renting and purchasing) (java + springboot + redis + MySQL + Vue + springsecurity + JWT + elasticsearch + websocket)

Java project: Online house searching system (renting and purchasing) (java + springboot + redis + MySQL + Vue + springsecurity + JWT + elasticsearch + websocket)

2022-01-27 05:19:10 qq_ one billion three hundred and thirty-four million six hundr

The system has three roles , Namely : Ordinary users 、 letting agent 、 Administrators . Ordinary users The function of : Browse house information 、 Make an appointment to see the house 、 Chat with an intermediary 、 Apply to become an intermediary, etc . letting agent The function of : Release housing information 、 Chat with users 、 Reply to appointment information, etc . Administrators The function of : Manage all user information 、 Manage permission information 、 Manage all house information 、 Manage all appointment information, etc .

applied technology :SpringBoot + Redis + MySQL + Vue + SpringSecurity + JWT + ElasticSearch + WebSocket + FreeMarker + MyBatis-Plus wait

Running environment :Eclipse/IntelliJ IDEA + MySQL5.7 + Maven3.6.3( Built in project package ) + JDK1.8 + Redis5.0.5( Built in project package )+ ElasticSearch6.8.0

 

 

 

 

 

User controller :

/**
 *  User controller 
 * 
 * @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;

	/**
	 *  Sign in 
	 */
	@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", " The account and password entered cannot be blank !");
			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", " The account and password entered are incorrect !");
						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", " The account and password entered are incorrect !");
					return "login";
				}
			}
		} catch (NullPointerException e) {
			request.setAttribute("erorr", " Choose login method !");
			e.printStackTrace();
			return "login";
		}

		return "login";
	}

	/**
	 *  register 
	 */
	@RequestMapping("/register")
	public String register(String usercall, String userpwd, String userphone, HttpServletRequest request) {
		if (usercall.equals("") || userpwd.equals("") || userphone.equals("")) {
			request.setAttribute("erorr", " The account and password entered cannot be blank !");
			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";
	}

	/**
	 *  Get mobile phone verification code 
	 **/
	@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();
		}

	}

	/**
	 *  Log in after judging the verification code 
	 **/
	@RequestMapping("/phonecod")
	public String phonecod(String userphone, String code, HttpServletRequest request) {
		HttpSession session = request.getSession();
		if (userphone.equals("") || code.equals("")) {
			request.setAttribute("erorr", " The mobile phone number or verification code is empty !");
			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", " The phone number is not registered !");
				return "login";
			}
		} else {
			request.setAttribute("erorr", " Verification code error !");
			return "login";
		}
		return "login";
	}

	/**
	 *  Change Password 
	 */
	@RequestMapping("/updatepwd")
	public String updatepwd(String code, String userphone, String userpwd, HttpServletRequest request) {
		if (code.equals("") || userphone.equals("") || userpwd.equals("")) {
			request.setAttribute("erorr", " cell-phone number , Verification Code , The new password cannot be empty !");
			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;
	}

	/**
	 *  Cancellation 
	 */
	@RequestMapping("/cancellation")
	public String cancellation(HttpServletRequest request) {
		HttpSession session = request.getSession();
		session.removeAttribute("user");
		System.out.println(" Logout successful ");
		return "official";
	}

	/**
	 *  Apply to see the house 
	 */
	@RequestMapping("/apply")
	@ResponseBody
	public ModelAndView apply(HttpSession session, HttpServletRequest request, String housemoney, String housecall,
			String houseaddress,String housesize) {
		ModelAndView mav = new ModelAndView("official");
		// Token validation 
		if(!new Koken().kokenid(request, session)) {
			return mav;	
		}
		mav.addObject("news", "official");
		if ((String) session.getAttribute("user") == null) {
			mav.addObject("apply", " Please log in first !");
			return mav;
		}
		//  Query all the data 
		userlist user = userlistService.selectUserCall((String) session.getAttribute("user"));
		if (user.getUsername() == null) {//  Determine whether the real name is empty 
			mav.addObject("apply", " Please bind your real name before renting the house !");
			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(" House viewing application in progress ");
			String temp=checkoutapplicationService.insertApply(coa);
			mav.addObject("apply", temp);
		}
		return mav;
	}

}

 

Administrator control layer :

@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;

	/**
	 *  Cancellation 
	 */
	@RequestMapping("/admincancel")
	public String cancellation(HttpServletRequest request) {
		HttpSession session = request.getSession();
		session.removeAttribute("admin");
		System.out.println(" Logout successful ");
		return "official";
	}

	@RequestMapping("/details")
	public ModelAndView listCategory(@RequestParam int pn) {
		ModelAndView mav = new ModelAndView("rentingdel");
		//  Set paging transfer 
		PageHelper.startPage(pn, 10);
		//  Query all the data 
		List<rentwithdrawn> list = rentwithdrawnService.selectRwState(" Rent withdrawn ");
		//  Use PageInFo Encapsulate query results 
		PageInfo<rentwithdrawn> pageInfo = new PageInfo<rentwithdrawn>(list, 5);
		//  Put forward parameters 
		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");
		//  Set paging transfer 
		PageHelper.startPage(pn, 10);
		//  Query all the data 
		List<leaseinformation> list = leaseinformationService.selecthousteaseWith(" Renting ");
		//  Use PageInFo Encapsulate query results 
		PageInfo<leaseinformation> pageInfo = new PageInfo<leaseinformation>(list, 5);
		//  Put forward parameters 
		mav.addObject("cs", pageInfo);
		return mav;
	}

	@RequestMapping("/delectcontract")
	public ModelAndView delectcontract(@RequestParam int id) {
		ModelAndView mav = new ModelAndView("rentinglist");
		leaseinformationService.updacontract(id);
		return mav;
	}

	/**
	 *  House viewing application list 
	 */
	@RequestMapping("/houseapply")
	public ModelAndView kanfansqing(@RequestParam int pn) {
		ModelAndView mav = new ModelAndView("houseapply");
		//  Set paging transfer 
		PageHelper.startPage(pn, 10);
		//  Query all the data 
		List<checkoutapplication> list = checkoutapplicationService.selectCoaState();
		//  Use PageInFo Encapsulate query results 
		PageInfo<checkoutapplication> pageInfo = new PageInfo<checkoutapplication>(list, 5);
		//  Put forward parameters 
		mav.addObject("cs", pageInfo);
		return mav;
	}

	/**
	 *  Application for booking a house 
	 */
	@RequestMapping("/tonyizp")
	public ModelAndView tonyizp(@RequestParam int id, String housecall, String name) throws ParseException {
		ModelAndView mav = new ModelAndView("houseapply");
		checkoutapplicationService.xgaiCoaState(" Have agreed to ", id);
		leaseinformation house = leaseinformationService.selectHouseCall(housecall).get(0);
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//  Set the date format 
		Calendar c = Calendar.getInstance();
		c.add(Calendar.DATE, 30);//  Calculation 30 Days later 
		String t1 = df.format(new Date());
		String t2 = df.format(c.getTime());
		//  format conversion date Format 
		Date date1 = df.parse(t1);
		Date date2 = df.parse(t2);
		house.setHousestartingdate(date1);
		house.setHouseclosingdate(date2);
		house.setHousestate(" Renting ");
		house.setUsername(name);
		leaseinformationService.updateByPrimaryKey(house);
		return mav;
	}

	@RequestMapping("/jujzp")
	public ModelAndView jujzp(@RequestParam int id) {
		ModelAndView mav = new ModelAndView("houseapply");
		checkoutapplicationService.xgaiCoaState(" Rejected ", id);
		return mav;
	}

	/**
	 *	 Check out application 
	 */
	@RequestMapping("/tzshenqing")
	public ModelAndView tzshenqing(@RequestParam int pn) {
		ModelAndView mav = new ModelAndView("housedel");
		//  Set paging transfer 
		PageHelper.startPage(pn, 10);
		//  Query all the data 
		List<checkoutapplication> list = checkoutapplicationService.selectCoaState1();
		//  Use PageInFo Encapsulate query results 
		PageInfo<checkoutapplication> pageInfo = new PageInfo<checkoutapplication>(list, 5);
		//  Put forward parameters 
		mav.addObject("cs", pageInfo);
		return mav;
	}

	/**
	 *  Delete check-out record 
	 */
	@RequestMapping("/delecttzsq")
	public ModelAndView delecttzsq(@RequestParam int id) {
		ModelAndView mav = new ModelAndView("housedel");
		checkoutapplicationService.deleteByPrimaryKey(id);
		return mav;
	}

	/**
	 *  Agree to check out 
	 */
	@RequestMapping("/checkoutmvc")
	public ModelAndView checkoutmvc(@RequestParam int id,String housecall) {
		ModelAndView mav = new ModelAndView("housedel");
		String news=checkoutapplicationService.updateState(" Have agreed to ", id);
		if(news.equals(" Agree to cancel the lease successfully !")) {
			System.out.println(news);
			System.out.println(leaseinformationService.updateCancelForeignKey(housecall));
		}
		return mav;
	}
	
	/**
	 *  Refuse to check out 
	 */
	@RequestMapping("/refusemvc")
	public ModelAndView refusemvc(@RequestParam int id) {
		ModelAndView mav = new ModelAndView("housedel");
		System.out.println(checkoutapplicationService.updateState(" Rejected ", id));
		return mav;
	}
	
	/**
	 *  Paging to find all users 
	 */
	@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";
	}

	/**
	 *  Delete user information 
	 */
	@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";
	}

	/**
	 *  Add housing 
	 * 
	 * @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", " The input housing information cannot be missing any item !");
			return "housingadd";
		}
		List<leaseinformation> list = leaseinformationService.queryAll();
		for (leaseinformation leaseinformation : list) {
			if (housecall.equals(leaseinformation.getHousecall())) {
				request.setAttribute("erro", " This listing number already exists ");
				return "housingadd";
			}
		}
		String path = "";
		String imgname = "";
		if (!file.isEmpty()) {
			//  Generate uuid As the file name 
			String uuid = UUID.randomUUID().toString().replaceAll("-", "");
			//  Get file type ( You can judge if it's not a picture , No upload )
			String contentType = file.getContentType();
			//  Get the file suffix name 
			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);
		// Get the current time and the time after one month 
		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(" Not set ");
		leaseinformationService.addHouse(house);
		request.setAttribute("sessce", " Add success ");
		return "housingadd";
	}

	/**
	 *  Display listing information in different pages 
	 */
	@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";
	}

	/**
	 *  Get and modify the listing information 
	 */
	@RequestMapping("/getupdatehouse")
	public String getupdatehouse(int houseid, HttpServletRequest request) {
		List<leaseinformation> house = leaseinformationService.queryID(houseid);
		request.setAttribute("uphouse", house);
		return "houseupdate";
	}

	/**
	 *  Modify listing information 
	 */
	@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", " Modification successful ");
		request.setAttribute("newhouse", house);
		return "houseupdate";
	}

	/**
	 *  Delete listing information 
	 */
	@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";
	}

	/*
	 *  List of recommended houses 
	 */
	@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";
	}

	/**
	 *  Modify recommendation information 
	 */
	@RequestMapping("/updaterecommend")
	public String updatehouse(Integer houseid) {
		leaseinformation house = leaseinformationService.queryID(houseid).get(0);
		if (house.getHouserecommend().equals(" Not recommended ")) {
			house.setHouserecommend(" Recommended ");
		} else {
			house.setHouserecommend(" Not recommended ");
		}
		leaseinformationService.updateByPrimaryKey(house);
		return "redirect:recommendlist.do?";
	}

	/**
	 *  Paging query schedule information 
	 */
	@RequestMapping("/schedulelist")
	public String mydailylifelist(@RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) {
		//  quote PageHelper Paging plug-ins 
		PageHelper.startPage(pn, 10);
		List<mydailylife> mydailylifes = mydailylifeService.selectAll();
		PageInfo<mydailylife> page = new PageInfo<mydailylife>(mydailylifes, 3);
		model.addAttribute("p", page);
		return "schedulelist";
	}

	/**
	 *  Add schedule 
	 */
	@RequestMapping("/addmydailylife")
	public String mydailylifeadd(mydailylife mydailylife) {
		mydailylifeService.insert(mydailylife);
		return "redirect:/admin/schedulelist.do";
	}

	/**
	 *  Modify the schedule 
	 */
	@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";
	}

	/**
	 *  Delete schedule 
	 */
	@RequestMapping("/delmydailylife")
	public String mydailylifedel(Integer id) {
		mydailylifeService.deleteByPrimaryKey(id);
		return "redirect:/admin/schedulelist.do";
	}

	//  Report the trouble 
	/**
	 *  Query the pending alarm 
	 */
	@RequestMapping("/Adminselectrepairwait")
	public String selectrepairwait(String state, @RequestParam(value = "pn", defaultValue = "1") Integer pn,
			Model model) {
		state = " Untreated ";
		//  quote PageHelper Paging plug-ins 
		PageHelper.startPage(pn, 10);
		List<fault> faultlist = faultService.AdminSelectStateAll(state);
		PageInfo<fault> page = new PageInfo<fault>(faultlist, 3);
		model.addAttribute("p", page);
		return "repairwait";
	}

	/**
	 *  All obstacle reporting has been completed 
	 */
	@RequestMapping("/Adminselectrepairdone")
	public String selectrepairdone(String state, @RequestParam(value = "pn", defaultValue = "1") Integer pn,
			Model model) {
		state = " Disposed of ";
		//  quote PageHelper Paging plug-ins 
		PageHelper.startPage(pn, 10);
		List<fault> faultdone = faultService.AdminSelectStateAll(state);
		PageInfo<fault> page = new PageInfo<fault>(faultdone, 3);
		model.addAttribute("p", page);
		return "repairdone";
	}

	/**
	 *  Failure reporting status modification 
	 */
	@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 = " Disposed of ";
		fault f = new fault(fhouseid, fhouseaddress, fprice, fdate, fcontent, fusername, fuserid, fuserphone, fstate,
				id);
		faultService.updateByPrimaryKey(f);
		return "redirect:/admin/Adminselectrepairwait.do";
	}

	/**
	 *  Barrier deletion 
	 */
	@RequestMapping("/adminrepairdone")
	public String delrepair(Integer id) {
		faultService.deleteByPrimaryKey(id);
		return "redirect:/admin/Adminselectrepairdone.do";
	}

	/**
	 *  Search for a barrier 
	 */
	@RequestMapping("/repairselect")
	public String repairselect(QueryVo vo, @RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) {
		//  quote PageHelper Paging plug-ins 
		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";
	}

	/**
	 *  I want to collect the rent 
	 */
	@RequestMapping("/adminrentshou")
	public String rentshou(@RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) {
		//  quote PageHelper Paging plug-ins 
		PageHelper.startPage(pn, 10);
		List<userlist> userlists = userlistService.rentSelectAll();
		PageInfo<userlist> page = new PageInfo<userlist>(userlists, 3);
		model.addAttribute("rent", page);
		return "rentshou";
	}

	/**
	 *  Get rent collection information 
	 */
	@RequestMapping("/adminrentselect")
	public String rentadd(String housecall, Model model) {
		userlist userlist = userlistService.selectUserCallWith(housecall);
		model.addAttribute("addrent", userlist);
		return "rentadd";
	}

	/**
	 *  Add paid rent 
	 */
	@RequestMapping("/adminrentadd")
	public String rentaddwait(rentcollection rentcollection) {
		rentcollectionService.insert(rentcollection);
		return "redirect:/admin/adminrentshou.do";
	}

	/**
	 *  Pay rent on behalf of 
	 */
	@RequestMapping("/adminrentwait")
	public String rentwait(String rcstate, @RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) {
		rcstate = " Unpaid ";
		//  quote PageHelper Paging plug-ins 
		PageHelper.startPage(pn, 10);
		List<rentcollection> rentlists = rentcollectionService.selectPaidStateAll(rcstate);
		PageInfo<rentcollection> page = new PageInfo<rentcollection>(rentlists, 3);
		model.addAttribute("rent", page);
		return "rentwait";
	}

	/**
	 *  Delete rent payment record 
	 */
	@RequestMapping("/admindelrent")
	public String delrent(Integer id) {
		rentcollectionService.deleteByPrimaryKey(id);
		return "redirect:/admin/adminselectPaidAll.do";
	}

	/**
	 *  Search for 
	 */
	@RequestMapping("/adminselectPaidAll")
	public String adminselectPaidAll(QueryVo vo, @RequestParam(value = "pn", defaultValue = "1") Integer pn,
			Model model) {
		//  quote PageHelper Paging plug-ins 
		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";
	}

	/**
	 *  Check the contract 
	 */
	@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();
		//  Put forward parameters 
		mav.addObject("pdftemp", pdf);

		return mav;
	}
}

Personal center controller :

/**
 *  Personal center controller 
 * 
 * @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;

	/**
	 *  Personal information switching page 
	 */
	@RequestMapping("/personal_switch")
	public void temp(String txt, HttpServletResponse response) throws IOException {
		response.setCharacterEncoding("UTF-8");
		switch (txt) {
		case " Rental information ":
			response.getWriter().print("/jsp/personalInformation/information.jsp");
			break;
		case " My application ":
			response.getWriter().print("/jsp/personalInformation/myapplication.jsp");
			break;
		case " Pay rent on behalf of ":
			response.getWriter().print("/jsp/personalInformation/rentpayment.jsp");
			break;
		case " Alarm module ":
			response.getWriter().print("/jsp/personalInformation/faultreportingmodule.jsp");
			break;
		case " Other operating ":
			response.getWriter().print("/jsp/personalInformation/otheroperations.jsp");
			break;
		}
	}

	/**
	 *  My lease page query 
	 */
	@RequestMapping("/myRentalList")
	@ResponseBody
	public Msg myRentalList(@RequestParam(value = "pn") Integer pn, HttpSession session) {
		//  Query all the data 
		userlist user = userlistService.selectUserCall((String) session.getAttribute("user"));
		//  Set paging transfer 
		PageHelper.startPage(pn, 8);
		List<userlist> leaseuser = userlistService.selectUserNameWith(user.getUsername());
		//  Use PageInFo Encapsulate query results 
		PageInfo<userlist> pageInfo = new PageInfo<userlist>(leaseuser, 3);

		return Msg.success().add("pageInfo", pageInfo);
	}

	/**
	 *  Paging query of returned lease records 
	 */
	@RequestMapping("/refundedLeaseList")
	@ResponseBody
	public Msg refundedLeaseList(@RequestParam(value = "pn") Integer pn, HttpSession session) {
		//  Query all the data 
		userlist user = userlistService.selectUserCall((String) session.getAttribute("user"));
		//  Set paging transfer 
		PageHelper.startPage(pn, 8);
		List<rentwithdrawn> list = rentwithdrawnService.queryAllStateName(" Rent withdrawn ", "", user.getUsername());

		//  Use PageInFo Encapsulate query results 
		PageInfo<rentwithdrawn> pageInfo = new PageInfo<rentwithdrawn>(list, 3);

		return Msg.success().add("pageInfo", pageInfo);
	}

	/**
	 *  Paging query of application status records 
	 */
	@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"));
		//  Set paging transfer 
		PageHelper.startPage(pn, 8);
		//  Query all the data 
		if (flag) {
			list = checkoutapplicationService.selectStateAll(" House viewing application in progress ", " Check out application in progress ", "", user.getUsername());
		} else {
			list = checkoutapplicationService.selectStateAll(" Rejected ", " Have agreed to ", " Cancelled ", user.getUsername());
		}

		//  Use PageInFo Encapsulate query results 
		PageInfo<checkoutapplication> pageInfo = new PageInfo<checkoutapplication>(list, 3);

		return Msg.success().add("pageInfo", pageInfo);
	}

	/**
	 *  Paging query of paid rent 
	 */
	@RequestMapping("/rentpaymentList")
	@ResponseBody
	public Msg rentpaymentList(@RequestParam(value = "pn") Integer pn, String state, HttpSession session) {
		userlist user = userlistService.selectUserCall((String) session.getAttribute("user"));
		//  Set paging transfer 
		PageHelper.startPage(pn, 8);
		List<rentcollection> list = rentcollectionService.queryPaidStateAll(state, user.getUsername());
		//  Use PageInFo Encapsulate query results 
		PageInfo<rentcollection> pageInfo = new PageInfo<rentcollection>(list, 3);

		return Msg.success().add("pageInfo", pageInfo);
	}

	/**
	 *  Pay rent 
	 */
	@RequestMapping("/payrentmvc")
	public ModelAndView payrentmvc(String rchousemoney,Integer rcid,String token,HttpServletRequest request,HttpSession session) {
		ModelAndView mav = new ModelAndView("personacenter");
		// Token validation 
		if(!new Koken().kokenid(request, session)) {
			return mav;	
		}
		Warning news = rentcollectionService.updateState(rcid);
		System.out.println(news.getWarningContent());
		//  Put forward parameters 
		mav.addObject("news", news);
		return mav;
	}
	
	/**
	 *  Rent paid delete record 
	 */
	@RequestMapping("/paidrent")
	public ModelAndView paidrent(Integer rcid,HttpServletRequest request,HttpSession session) {
		ModelAndView mav = new ModelAndView("personacenter");
		// Token validation 
		if(!new Koken().kokenid(request, session)) {
			return mav;	
		}
		Warning news = rentcollectionService.deleteByPrimaryKey(rcid);
		System.out.println(news.getWarningContent());
		//  Put forward parameters 
		mav.addObject("news", news);
		return mav;
	}

	/**
	 *  Total payment fee 
	 */
	@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);
	}

	/**
	 *  Alarm paging query 
	 */
	@RequestMapping("/repairList")
	@ResponseBody
	public Msg repairList(@RequestParam(value = "pn") Integer pn, String str, HttpSession session) {
		//  Use PageInFo Encapsulate query results 
		userlist user = userlistService.selectUserCall((String) session.getAttribute("user"));
		//  Set paging transfer 
		PageHelper.startPage(pn, 8);
		if (str.equals(" I want to report ")) {
			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);
	}

	/**
	 *  The content of the barrier submission 
	 * 
	 * @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");
		// Token validation 
		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 year MM month dd Japan ");
		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(" Untreated ");
		Warning news = faultService.insert(fault);
		System.out.println(news.getWarningContent());
		//  Put forward parameters 
		mav.addObject("news", news);
		return mav;
	}

	/**
	 *  Report an obstacle and delete a record 
	 */
	@RequestMapping("/deleterepair")
	public ModelAndView deleterepair(Integer fid,String token,HttpServletRequest request,HttpSession session) {
		ModelAndView mav = new ModelAndView("personacenter");
		// Token validation 
		if(!new Koken().kokenid(request, session)) {
			return mav;	
		}
		Warning news = faultService.deleteByPrimaryKey(fid);
		System.out.println(news.getWarningContent());
		//  Put forward parameters 
		mav.addObject("news", news);
		return mav;
	}

	/**
	 *  Upload your avatar   User's real name , ID number , Mobile phone number upload 
	 * 
	 * @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(" Modifiable ");
		}else {
			Warning news=new Warning(2, " Modification failed ! The user with this name is already registered ");
			mav.addObject("news", news);
			return mav;
		}
		
		// Token validation 
		if(!new Koken().kokenid(request, session)) {
			return mav;	
		}
		//  Get the name of the file 
		String fName = file.getOriginalFilename();
		System.out.println(fName);
		if (!fName.equals("")) {
			//  The directory where the pictures are saved 
			String path = "C://Users/Rain/Desktop/ssm_leaseOfHouses/WebContent/headPortraitImg";
			File filepath = new File(path);
			//  If the directory does not exist , establish 
			if (!filepath.exists()) {
				filepath.mkdir();
			}

			File f = new File(path, fName);

			//  Change user avatar 
			headportraitimg headportraitimg = new headportraitimg();
			String user = (String) session.getAttribute("user");
			headportraitimg.setHeadportraitimgusername(user);
			headportraitimg.setHeadportraitimgaddress(fName);
			//  Upload the image path to the database 
			headPortraitImgService.updatauserimg(headportraitimg);
			//  change the avatar 
			session.setAttribute("headportraitimg", headportraitimg.getHeadportraitimgaddress());
			//  Upload files 
			file.transferTo(f);
		}

		userlist user = userlistService.selectUserCall((String) session.getAttribute("user"));
		// Temporarily save the real name to be modified 
		String rcusernametemp=user.getUsername();
		// Judge , If there is any modification to the real name sheet , Then add 
		if(user.getUsername()==null||"".equals(user.getUsername())) {
			//  Upload your real name , Id card , cell-phone number 
			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());
			//  Put forward parameters 
			mav.addObject("news", news);
		}else {
			//  Change your real name , Id card , cell-phone number 
			userlist userlist = new userlist();
			userlist.setUsername(username);
			userlist.setUserid(userid);
			userlist.setUserphone(userphone);
			userlist.setUsernametemp(user.getUsername());
			Warning news = userlistService.updateJointTableName(userlist);
			// Modify the real name of the rent 
			System.out.println(rentcollectionService.updateUserName(username,rcusernametemp));
			System.out.println(news.getWarningContent());
			//  Put forward parameters 
			mav.addObject("news", news);
		}

		return mav;
	}

	/**
	 *  Delete the lease retired record 
	 */
	@RequestMapping("/deleterentrefund")
	public ModelAndView deleterentrefund(Integer rwid,String token,HttpServletRequest request,HttpSession session) {
		ModelAndView mav = new ModelAndView("personacenter");
		// Token validation 
		if(!new Koken().kokenid(request, session)) {
			return mav;	
		}
		Warning news = rentwithdrawnService.deleteByPrimaryKey(rwid);
		System.out.println(news.getWarningContent());
		//  Put forward parameters 
		mav.addObject("news", news);
		return mav;
	}

	/**
	 *  Check the contract 
	 */
	@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();
		//  Put forward parameters 
		mav.addObject("pdftemp", pdf);

		return mav;
	}

	/**
	 *  Terminate the contract 
	 */
	@RequestMapping("/termination")
	public ModelAndView termination(String call,String token,HttpServletRequest request,HttpSession session) {
		ModelAndView mav = new ModelAndView("personacenter");
		// Token validation 
		if(!new Koken().kokenid(request, session)) {
			return mav;	
		}
		userlist leaseuser = userlistService.selectUserCallWith(call);
		Warning news = checkoutapplicationService.insert(leaseuser);
		//  Put forward parameters 
		mav.addObject("news", news);
		return mav;
	}

	/**
	 *  Termination application 
	 */
	@RequestMapping("/stopapplying")
	public ModelAndView stopapplying(String call,String token,HttpServletRequest request,HttpSession session) {
		ModelAndView mav = new ModelAndView("personacenter");
		// Token validation 
		if(!new Koken().kokenid(request, session)) {
			return mav;	
		}
		Warning news = checkoutapplicationService.updateCallState(" Cancelled ", call);
		System.out.println(news.getWarningContent());
		//  Put forward parameters 
		mav.addObject("news", news);
		return mav;
	}

	/**
	 *  Delete application record 
	 */
	@RequestMapping("/deleterecord")
	public ModelAndView deleterecord(Integer coaid,String token,HttpServletRequest request,HttpSession session) {
		ModelAndView mav = new ModelAndView("personacenter");
		// Token validation 
		if(!new Koken().kokenid(request, session)) {
			return mav;	
		}
		Warning news = checkoutapplicationService.deleteByPrimaryKey(coaid);
		System.out.println(news.getWarningContent());
		//  Put forward parameters 
		mav.addObject("news", news);
		return mav;
	}
}

copyright notice
author[qq_ one billion three hundred and thirty-four million six hundr],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201270519055059.html

Random recommended