前端使用的是vue+elementui,这款系统只适合学习巩固springboot+vue,后面还要在这上面加校园公告、校园零食等功能,后期代码我也会持续更新上去。系统分为管理员和学生、学生是管理员后台添加的两种角色。
运行环境:
后端 jdk1.8、maven3.5/3.6 mysql5.7 idea/eclip
前端 idea vue-cli node.js 搭建vue环境 webpack3.6.0指定版本
@controller@requestmapping(value = "admin")public class admincontroller { p红枫的诗句rivate final urrvice urrvice; private final goodrvice goodrvice; private final typervice typervice; private final orderrvice orderrvice; @autowired public admincontroller(urrvice urrvice, goodrvice goodrvice, typervice typervice, orderrvice orderrvice) { this.urrvice = urrvice; this.goodrvice = goodrvice; this.typervice = typervice; this.orderrvice = orderrvice; } @requestmapping(value = "/adminlogin", method = requestmethod.get) public string getadminlogin(){ return "admin/adminlogin"; } @requestmapping(value = "/adminlogin", method = requestmethod.post) public string postadminlogin(modelmap model, @requestparam(value = "email", required = fal) string email, @requestparam(value = "password", required = fal) string password, httpssion ssion) { ur admin = urrvice.geturbyemail(email); string message; if (admin != null){ string mdspass = digestutils.md5digestashex((password + admin.getcode()).getbytes());// if (!mdspass .equals(admin.getpassword())){// message = "用户密码错误!";// } if (!password .equals(admin.getpassword())){ message = "用户密码错误!"; } el if (admin.getroleid() != 101){ message = "用户没有权限访问!"; } el { ssion.tattribute("admin",admin); return "redirect:/admin/adminpage"; } } el { message = "用户不存在!"; } model.addattribute("message", message); return "admin/adminlogin"; } @requestmapping(value = "/adminlogout", method = requestmethod.get) public string adminlogout(@requestparam(required = fal, defaultvalue = "fal" )string adminlogout, httpssion ssion){ if (adminlogout.equals("true")){ ssion.removeattribute("admin"); }// adminlogout = "fal"; return "redirect:/"; } @requestmapping(value = "/adminpage", method = requestmethod.get) public string getadminpage(modelmap model, httpssion ssion){ ur admin = (ur) ssion.getattribute("admin"); if (admin == null){ return "redirect:/admin/adminlogin"; } list<good> goodlist = goodrvice.getallgoodlist(); for (good good : goodlist) { good.tgoodur(urrvice.geturbyid(good.geturid())); good.tgoodcondtype(typervice.getcondtypebyid(good.getcondtypeid())); } list<ur> urlist = urrvice.getallur(); list<firsttype> firsttypelist = typervice.getallfirsttype(); list<order> orderlist = orderrvice.getorderlist(); model.addattribute("goodlist", goodlist); model.addattribute("urlist", urlist); model.addattribute("firsttypelist", firsttypelist); model.addattribute("orderlist", orderlist); return "admin/adminpage"; } @requestmapping(value = "/ur/update/status/{statusid}&{urid}", method = requestmethod.get) public responentity updateurstatus(@pathvariable integer statusid, @pathvariable integer urid){ boolean success = urrvice.updateurstatus(statusid, urid); if (success){ list<ur> urlist = urrvice.getallur(); return responentity.ok(urlist); } return responentity.ok(success); } @requestmapping(value = "/ur/delete/{urid}", method = requestmethod.get) public responentity deleteur(@pathvariable integer urid){ boolean success = urrvice.deleteur(urid); if (success){ list<ur> urlist = urrvice.getallur(); return responentity.ok(urlist); } return responentity.ok(success); } }
@controller@requestmapping(value = "ur")public class urcontroller {private final goodrvice goodrvice;private final orderrvice orderrvice;private final reviewrvice reviewrvice;private final urrvice urrvice;private final collectrvice collectrvice; @autowiredpublic urcontroller(goodrvice goodrvice, orderrvice orderrvice,reviewrvice reviewrvice, urrvice urrvice,collectrvice collectrvice) {this.goodrvice = goodrvice;this.orderrvice = orderrvice;this.reviewrvice = reviewrvice;this.urrvice = urrvice;this.collectrvice = collectrvice;} @requestmapping(value = "urprofile", method = requestmethod.get)public string getmyprofile(modelmap model, httpssion ssion) {ur ur = (ur) ssion.getattribute("ur");if (ur == null) {return "redirect:/";}list<collect> collects = collectrvice.getcollectbyurid(ur.getid());for (collect collect : collects) {collect.tgood(goodrvice.getgoodbyid(collect.getgoodid()));}list<good> goods = goodrvice.getgoodbyurid(ur.getid());list<order> orders = orderrvice.getorderbycustomerid(ur.getid());list<review> reviews = reviewrvice.gerreviewbytourid(ur.getid());list<reply> replies = reviewrvice.gerreplybytourid(ur.getid());list<order> llgoods = order治疗失眠中成药rvice.getorderbyllerid(ur.getid());model.addattribute("collects", collects);model.addattribute("goods", goods);model.addattribute("orders", orders);model.addattribute("reviews", reviews);model.addattribute("replies", replies);model.addattribute("llgoods", llgoods);return "ur/urprofile";} @requestmapping(value = "/review", method = requestmethod.get)public string getreviewinfo(@requestparam(required = fal) integer goodid,@requestparam(required = fal) integer reviewid) {system.out.println("reviewid" + reviewid);if (reviewid != null) {system.out.println("reviewid" + reviewid);if (reviewrvice.updatereviewstatus(1, reviewid) == 1) {return "redirect:/goods/goodinfo?goodid=" + goodid;}}return "redirect:/ur/urprofile";} @requestmapping(value = "/reply", method = requestmethod.get)public string getreplyinfo(@requestparam(required = fal) integer reviewid,@requestparam(required = fal) integer replyid) {if (replyid != null) {if (reviewrvice.updatereplystatus(1, replyid) == 1) {integer goodid = reviewrvice.getgoodidbyreviewid(reviewid);return "redirect:/goods/goodinfo?goodid=" + goodid;}}return "redirect:/ur/urprofile";} @requestmapping(value = "/uredit", method = requestmethod.get)public string geturedit(modelmap model,@requestparam(value = "urid", required = fal) integer urid,httpssion ssion) {ur ssionur = (ur) ssion.getattribute("ur");if (ssionur == null) {return "redirect:/";}ur ur = urrvice.geturbyid(urid);list<order> llgoods = orderrvice.getorderbyllerid(ur.getid());list<review> reviews = reviewrvice.gerreviewbytourid(ur.getid());list<reply> replies = reviewrvice.gerreplybytourid(ur.getid());model.addattribute("ur", ur);model.addattribute("llgoods", llgoods);model.addattribute("reviews", reviews);model.addattribute("replies", replies);return "ur/uredit";} @requestmapping(value = "/uredit", method = requestmethod.post)public string posturedit(modelmap model, @valid ur ur,httpssion ssion,@requestparam(value = "photo", required = fal) multipartfile photo)throws ioexception {string status;boolean inrtsuccess;ur ssionur = (ur) ssion.getattribute("ur");ur.tid(ssionur.getid());infocheck infocheck = new infocheck();if 经典幽默(!infocheck.ismobile(ur.getmobile())) {status = "请输入正确的手机号!";} el if (!infocheck.imail(ur.getemail())) {status = "请输入正确的邮箱!";} el if (urrvice.geturbymobile(ur.getmobile()).getid() != ur.getid()) {system.out.println(urrvice.geturbymobile(ur.getmobile()).getid() + " " + ur.getid());status = "此手机号码已使用!";} el if (urrvice.geturbyemail(ur.getemail()).getid() != ur.getid()) {status = "此邮箱已使用!";} el {if (!photo.impty()) {randomstring randomstring = new randomstring();filecheck filecheck = new filecheck();string filepath = "/statics/image/photos/" + ur.getid();string pathroot = filecheck.checkgoodfolderexist(filepath);string filename = ur.getid()+ randomstring.getrandomstring(10);string contenttype = photo.getcontenttype();string imagename = contenttype.substring(contenttype.indexof("/") + 1);string name = filename + "." + imagename;photo.transferto(new file(pat丰收节是几月几日hroot + name));string photourl = filepath + "/" + name;ur.tphotourl(photourl);} el {string photourl = urrvice.geturbyid(ur.getid()).getphotourl();ur.tphotourl(photourl);}inrtsuccess = urrvice.updateur(ur);if (inrtsuccess) {ssion.removeattribute("ur");ssion.tattribute("ur", ur);return "redirect:/ur/urprofile";} el {status = "修改失败!";model.addattribute("ur", ur);model.addattribute("status", status);return "ur/uredit";}}system.out.println(ur.getmobile());system.out.println(status);model.addattribute("ur", ur);model.addattribute("status", status);return "ur/uredit";} @requestmapping(value = "/password/edit", method = requestmethod.post)public responentity editpassword(@requestbody password password) {ur ur = urrvice.geturbyid(password.geturid());string oldpass = digestutils.md5digestashex((password.getoldpassword() + ur.getcode()).getbytes());if (oldpass.equals(ur.getpassword())) {randomstring randomstring = new randomstring();string code = (randomstring.getrandomstring(5));string md5pass = digestutils.md5digestashex((password.getnewpassword() + code).getbytes());boolean success = urrvice.updatepassword(md5pass, code,password.geturid());if (success) {return responentity.ok(true);} el {return responentity.ok("密码修改失败!");}} el {return responentity.ok("原密码输入不正确!");}} }
@controller@requestmapping("type")public class typecontroller {private final typervice typervice;private final goodrvice goodrvice; @autowiredpublic typecontroller(typervice typervice, goodrvice goodrvice) {this.typervice = typervice;this.goodrvice = goodrvice;} @requestmapping(value = "/condtype/{firsttypeid}", method = requestmethod.get)public responentity getcondtypeid(@pathvariable integer firsttypeid) {list<condtype> condtypes = typervice.getcondtypebyfirsttypeid(firsttypeid);if (condtypes == null) {return responentity.ok("isnull");}return responentity.ok(condtypes);} @requestmapping(value = "/condtype/delete/{condtypeid}", method = requestmethod.get)public responentity deletecondtype(@pathvariable integer condtypeid) {boolean success = goodrvice.getgoodsadminbytype(condtypeid).impty();system.out.println(goodrvice.getgoodsadminbytype(condtypeid));if (success) {integer thisfirsttypeid = typervice.getcondtypebyid(condtypeid).getfirsttypeid();success = typervice.deletecondtype(condtypeid);if (success) {list<condtype> condtypelist = typervice.getcondtypebyfirsttypeid(thisfirsttypeid);if (condtypelist == null) {return responentity.ok("isnull");}return responentity.ok(condtypelist);}}return responentity.ok(success);} @requestmapping(value = "/firsttype/delete/{firsttypeid}", method = requestmethod.get)public responentity deletefirsttype(@pathvariable integer firsttypeid) {boolean success = typervice.getcondtypebyfirsttypeid(firsttypeid).impty();if (success) {success = typervice.deletefirsttype(firsttypeid);if (success) {list<firsttype> firsttypelist = typervice.getallfirsttype();if (firsttypelist == null) {return responentity.ok("isnull");}return responentity.ok(firsttypelist);}}return respone形容人很多ntity.ok(success);} @requestmapping(value = "/condtype/create", method = requestmethod.post)public responentity createcondtype(@requestbody condtype condtype) {integer thisfirsttypeid = condtype.getfirsttypeid();boolean success = typervice.createcondtype(condtype);if (success) {list<condtype> condtypelist = typervice.getcondtypebyfirsttypeid(thisfirsttypeid);return responentity.ok(condtypelist);}return responentity.ok(success);} @requestmapping(value = "/firsttype/create", method = requestmethod.post)public responentity createcondtype(@requestbody firsttype firsttype) {boolean success = typervice.createfirsttype(firsttype);if (success) {list<firsttype> firsttypelist = typervice.getallfirsttype();return responentity.ok(firsttypelist);}return responentity.ok(success);}}
到此这篇关于java实战项目之校园跑腿管理系统的实现的文章就介绍到这了,更多相关java 校园跑腿管理系统内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章希望大家以后多多支持www.887551.com!
本文发布于:2023-04-04 16:06:49,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/242b6b124101b6c3228e6b65de1a0066.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:Java实战项目之校园跑腿管理系统的实现.doc
本文 PDF 下载地址:Java实战项目之校园跑腿管理系统的实现.pdf
留言与评论(共有 0 条评论) |