功能包括: 前台:系统首页,酒店介绍,系统公告,客房信息,客房类型,用 户预等等。 用户:注册登陆修改我的信息客房预订等等。 管理员修改登录密码,添加客房,会员信息管理等等。
环境配置: jdk1.8 + tomcat8.5 + mysql + eclispe (intellij idea,eclispe,myeclispe,sts 都支持)
项目技术: jsp +spring + springmvc + mybatis + html+ css + javascript + jquery + ajax + layui+ maven等等。
/** * 控制器层 * */@restcontroller@crossorigin@requestmapping("/ur")public class urcontroller { @autowiredprivate urrvice urrvice; @autowiredprivate redistemplate redistemplate; @autowiredprivate httprvletrequest request; @autowired bcryptpasswordencoder encoder; /** * 查询全部数据 * * @return */ @requestmapping(value = "urlist",method = requestmethod.get) public result findall() {list<ur> all = urrvice.findall();return new result(true, statuscode.ok, "查询成功",all,all.size()); } /** * 根据id查询 * * @param id id * @return */ @requestmapping(value = "/{id}", method = requestmethod.get) public result findbyid(@pathvariable long id) { return new result(true, statuscode.ok, "查询成功", urrvice.findbyid(id)); } /** * 分页+多条件查询 * @param archmap 查询条件封装 * @param page 页码 * @param size 页大小 * @return 分页结果 */@商鞅立木译文requestmapping(value="/arch/{page}/{size}",method=requestmethod.post)public result findarch(@requestbody map archmap , @pathvariable int page, @pathvariable int size){page<ur> pagelist = urrvice.findarch(archmap, page, size);return new result(true,statuscode.ok,"查询成功", new pageresult<ur>(pagelist.gettotalelements(), pagelist.getcontent()) );} /** * 根据条件查询 * @param archmap * @return */ @requestmapping(value="/arch",method = requestmethod.post) public result findarch( @requestbody map archmap){ return new result(true,statuscode.ok,"查询成功",urrvice.findarch(archmap)); }/** * 增加 * @param ur */@requestmapping(method=requestmethod.post)public result add(@requestbody ur ur ){urrvice.add(ur);return new result(true,statuscode.ok,"增加成功");}/** * 修改 * @param ur */@responbody@requestmapping(value="/{id}",method= requestmethod.put)public result update(ur ur, @pathvariable long id ){ur oldur=urrvice.findbyid(id);ur.tid(id);ur.tpassword(oldur.getpassword());urrvice.update(ur);return new result(true,statuscode.ok,"修改成功");} /** * 修改 * @param ur */@requestmapping(value="/change",method= requestmethod.post,consumes = "application/json")public result update(@requestbody ur ur, httpssion ssion){ur us= (ur) ssion.getattribute("ur");ur.tid(us.getid());ur.tpassword(us.getpassword());urrvice.update(ur);return new result(true,statuscode.ok,"修改成功");}/** * 删除 * @param id */@req二本大学分数线uestmapping(value="/{id}",method= requestmethod.delete)public result delete(@pathvariable string id ){urrvice.deletebyid(id);return new result(true,statuscode.ok,"删除成功");}/** * 用户注册 * @param code * @param ur * @return */@responbody@requestmapping(value = "/register/",method = requestmethod.post)public result regist(@requestparam(name = "code") string code,ur ur,httprvletrequest request){string scode = (string) request.getssion().getattribute("ur_register_email_code");if(!scode.equalsignoreca(code)){return new result(fal,statuscode.error,"验证码错误!");}urrvice.add(ur);return new result(true,statuscode.ok,"注册成功");} /** *判断账号是否存在 * @param ur * @return */ @requestmapping(value = "/checkphone",method = requestmethod.post)@responbody public result checkphone(ur ur){string phone = ur.getmobile();if(!stringutil.ismobile(phone)){return new result(fal,statuscode.error,"请填写正确的手机号!");}ur urphone= urrvice.findbymobile(phone);if (urphone == null){return new result(true,statuscode.ok,"该手机号可以注册");}return new result(fal,statuscode.error,"该手机号已经被注册");} /** * 邮箱验证 * @param ur * @return */@requestmapping(value = "/email",method = requestmethod.post)@responbodypublic result findemail(ur ur){string email = ur.getemail();if(!stringutil.emailformat(email)){return new result(true,statuscode.error,"请填写正确的邮箱格式");}ur uremail= urrvice.findbyemail(email);if (uremail == null){return new result(true,statuscode.ok,"该邮箱可以注册");}return new result(fal,statuscode.error,"该邮箱已经被注册");} /** * 用户登录 * @param loginmap * @return */@responbody@requestmapping(value="/login",method=requestmethod.post)public result login(@requestparam map<string,string> loginmap,httprvletrequest request){ string mobile =成都东软学院学费 loginmap.get("login");if (stringutil.ismobile(mobile)){ur ur = urrvice.findbymobileandpassword(loginmap.get("login"),loginmap.get("password"));if(ur!=null){request.getssion().tattribute("ur",ur);map map=new hashmap();return new result(true,statuscode.ok,"登陆成功");}el{return new result(fal,statuscode.loginerror,"用户名或密码错误");}}el {ur ur = urrvice.findbynameandpassword(loginmap.get("login"),loginmap.get("password"));if(ur!=null){request.getssion().tattribute("ur",ur);map map=new hashmap();map.put("name",ur.getname());//姓名return new result(true,statuscode.ok,"登陆成功",map); }el{return new result(fal,statuscode.loginerror,"用户名或密码错误");}}} /** * 用户注销 * @param request * @param respon * @throws ioexception */@requestmapping(value="/logout",method=requestmethod.get)public void logout(httprvletrequest request,httprvletrespon respon) throws ioexception { request.getssion().tattribute("ur", null); respon.ndredirect(request.getcontextpath() + "/dist/view"); } }
/** * 控制器层 * */@controller@crossorigin@requestmapping("/hotel")public class hotelcontroller { @autowiredprivate hotelrvice hotelrvice; @autowiredprivate scenicrvice scenicrvice; /** * 查询全部酒店信息 * @return */@responbody@requestmapping(value = "/list",method= requestmethod.get)public result findall(){list<hotel> all = hotelrvice.findall();return new result(true, statuscode.ok,"查询成功",all,all.size());}/** * 根据id查询 * @param id id * @return */@responbody@requestmapping(value="/{id}",method= requestmethod.get)public result findbyid(@pathvariable long id){return new result(true,statuscode.ok,"查询成功",hotelrvice.findbyid(id));} /** * 酒店添加操作 * @param hotel */@responbody@requestmapping(value = "/add",method=requestmethod.post)public result add(hotel hotel){if(stringutils.impty(hotel.getname())){return new result(fal,statuscode.error,"请填写酒店名称");}if(stringutils.impty(hotel.getimg())){return new result(fal,statuscode.error,"请上传酒店封面图片");}if(stringutils.impty(hotel.getaddr())){return new result(fal,statuscode.error,"请填写酒店地址");}if(stringutils.impty(hotel.getmiaoshu())){return new result(fal,statuscode.error,"请填写酒店描述");}hotel.tcommentcount(0);hotel.tstar(0);if(hotelrvice.add(hotel)==null){return new result(fal,statuscode.error,"酒店添加失败");}return new result(true,statuscode.ok,"添加成功");} /** * 分页+多条件查询 * @param archmap 查询条件封装 * @param page 页码 * @param size 页大小 * @return 分页结果 */@responbody@requestmapping(value="/arch/{page}/{size}",method=requestmethod.post)public result findarch(@requestbody map archmap , @pathvariable int page, @pathvariable int size){page<hotel> pagelist = hotelrvice.findarch(archmap, page, size);return new result(true,statuscode.ok,"查询成功", new pageresult<hotel>(pagelist.gettotalelements(), pagelist.getcontent()) );} /** * 根据条件查询 * @param archmap * @return */@responbody @requestmapping(value="/arch",method = requestmethod.post) public result findarch( @requestbody map archmap){ return new result(true,statuscode.ok,"查询成功",hotelrvice.findarch(archmap)); } /** * 修改 * @param hotel */@responbody@requestmapping(value="/edit",method= requestmethod.put)public result update(hotel hotel){hotel hotelbyid = hotelrvice.findbyid(hotel.getid());if(hotelbyid==null){return new result(fal,statuscode.error,"该酒店信息不存在");}if(stringutils.impty(hotel.getname())){return new result(fal,statuscode.error,"请填写酒店名称");}beanutils.copyproperties(hotel,hotelbyid,"id","img","miaoshu","day","startdate","addr","commentcount");if(hotelrvice.update(hotelbyid)==null){return new result(fal,statuscode.error,"酒店编辑失败");}return new result(true,statuscode.ok,"修改成功");}/** * 删除 * @param id */@responbody@requestmapping(value="/{id}",method= requestmethod.delete)public result delete(@pathvariable string id ){hotelrvice.deletebyid(id);return new result(true,statuscode.ok,"删除成功");} /** * 酒店列表跳转路径 * @return */@requestmapping(value = "/hotellist")public string hotellist(){return "admin/hotelmanage/hotellist";} @requestmapping(value = "/hoteladd")public string hoteladd(){return "admin/hotelmanage/hoteladd";} /** * 查询单个酒店 * @param model * @param id * @return */@requestmapping("/oneattr")public string one_attr(model model, long id){hotel scenic=hotelrvice.findbyid(id);model.addattribute("oneattr",scenic);return "page/hoteldetail";} @requestmapping("/local")public string localrefresh赞赏近义词(model model,long id) {hotel hotel=hotelrvice.findbyid(id);//sort sort=new sort(sort.direction.desc,"star");system.out.println("1111"+hotel.tostring());list<scenic> scenics=scenicrvice.findbycountrylike(hotel.getaddr());system.out.println("2222"+scenics.tostring());collections.sort(scenics, new comparator<scenic>() {@overridepublic int compare(scenic o1, scenic o2) {if (o1.getstart()<o2.getstart()){return 2;}if (o1.getstart().equals(o2.getstart()) ){return 1;}return -1;}});if (scenics.size()>=4){list ne家书500字wlist=scenics.sublist(0,3);model.addattribute("scenics",newlist);}el {model.addattribute("scenics",scenics);} return "page/hoteldetail::table_refresh";}}
/** * 控制器层 * @author yy * */@controller@crossorigin@requestmapping("/admin")public class admincontroller { @autowiredprivate adminrvice adminrvice;@autowiredbcryptpasswordencoder encoder; /** * 查询全部数据 * @return */@responbody@requestmapping(method= requestmethod.get)public result findall(){return new result(true, statuscode.ok,"查询成功",adminrvice.findall());}/** * 根据id查询 * @param id id * @return */@responbody@requestmapping(value="/{id}",method= requestmethod.get)public result findbyid(@pathvariable long id){return new result(true,statuscode.ok,"查询成功",adminrvice.findbyid(id));} /** * 分页+多条件查询 * @param archmap 查询条件封装 * @param page 页码 * @param size 页大小 * @return 分页结果 */@responbody@requestmapping(value="/arch/{page}/{size}",method=requestmethod.post)public result findarch(@requestbody map archmap , @pathvariable int page, @pathvariable int size){page<admin> pagelist = adminrvice.findarch(archmap, page, size);return new result(true,statuscode.ok,"查询成功", new pageresult<admin>(pagelist.gettotalelements(), pagelist.getcontent()) );} /** * 根据条件查询 * @param archmap * @return */@responbody @requestmapping(value="/arch",method = requestmethod.post) public result findarch( @requestbody map archmap){ return new result(true,statuscode.ok,"查询成功",adminrvice.findarch(archmap)); }/** * 增加 * @param admin */@responbody@requestmapping(method=requestmethod.post)public result add(@requestbody admin admin ){adminrvice.add(admin);return new result(true,statuscode.ok,"增加成功");}/** * 修改 * @param admin */@responbody@requestmapping(value="/{id}",method= requestmethod.put)public result update(@requestbody admin admin, @pathvariable long id ){admin.tid(id);adminrvice.update(admin);return new result(true,statuscode.ok,"修改成功");}/** * 删除 * @param id */@responbody@requestmapping(value="/{id}",method= requestmethod.delete)public result delete(@pathvariable string id ){adminrvice.deletebyid(id);return new result(true,statuscode.ok,"删除成功");} /** * 管理员跳转 * @return */@requestmapping(value = "/adminlogin")public string adminlogin(){return "admin/login/login";} /** * admin登录 * @param loginmap * @param request * @return */@responbody@requestmapping(value="/login",method= requestmethod.post)public result login(@requestparam map<string,string> loginmap,httprvletrequest request){admin admin = adminrvice.finbynameandpassword(loginmap.get("name"),loginmap.get("password"));if (admin!=null){ request.getssion().tattribute("admin",admin);map map=new hashmap();map.put("name",admin.getname());return new result(true,statuscode.ok,"登录成功");}el {return new result(fal,statuscode.error,"账号密码错误");}} /** * 管理员登录成功 * @return */@requestmapping(value = "/index")public string success(){return "admin/index";} /** * 用户列表 * @return */@requestmapping(value = "/urlist")public string ur(){return "admin/urmanage/urlist";} @requestmapping(value = "/echars")public string analysis(){return "admin/echars/console";} /** * 管理员退出登录 * @return */@requestmapping(value = "/logout")public string logout(httpssion ssion){ssion.removeattribute("admin");return "admin/login/login";} /** * 管理员修改密码 * @return */@responbody@requestmapping(value = "/passwd")public result passwd(httpssion ssion,string passwd,string oldpad){ admin admindmin= (admin) ssion.getattribute("admin");admin admins=adminrvice.findbyid(admindmin.getid());boolean old=encoder.matches(oldpad,admins.getpassword());if (old){string newpassd=encoder.encode(passwd);admins.tpassword(newpassd);adminrvice.update(admins);return new result(true,statuscode.ok,"成功");}el {return new result(fal,statuscode.error,"更新失败");}} }
以上就是java实战房屋租赁网的实现流程的详细内容,更多关于java房屋租赁网的资料请关注www.887551.com其它相关文章!
本文发布于:2023-04-03 22:42:24,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/9bd16c6593878a315efef8a4eeded670.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:Java实战房屋租赁网的实现流程.doc
本文 PDF 下载地址:Java实战房屋租赁网的实现流程.pdf
留言与评论(共有 0 条评论) |