本系统功能包括:
商品的分类展示,用户的注册登录,购物车,订单结算,购物车加减,后台商品管理,分类管理,订单管理等等功能。
环境配置:
jdk1.8 + tomcat8.5 + mysql + hbuilderx(webstorm也行)+ eclispe(intellij idea,eclispe,myeclispe,sts都支持)。
项目技术:
springboot + maven + mybatis+ vue 等等组成,b/s模式 + maven管理等等。
用户管理控制层:
/** * 用户 **/@restcontroller@requestmapping("ur")public class urcontroller { @autowired urrvice urrvice; @autowired urdao dao; @requestmapping("/test") r test() { r r = new r(); return r国际商务礼仪.tcode(4000).tmsg(constant.img_path).tdata(dao.findall()); } @requestmapping("/queryinfobyaccount") r queryinfobyaccount(@requestparam("account") string account) { r r = new r(); if (stringutil.impty(account)){ return r.tcode(4000).tmsg(httpmsg.invalid_param); } ur loginur = urrvice.queryinfo(account); if (loginur == null){ return r.tcode(4000).tmsg(httpmsg.invalid_ur); } return r.tcode(2000).tdata(loginur); } @requestmapping("/find") r find(@requestparam("page") int page, @requestparam("archkey") string archkey) { r r = new r(); map<string, object> map = new hashmap<>(); list<ur> urs = urrvice.find(archkey); if (urs == null) { return r.tcode(2000); } list<ur> items = urs.size() >= page * constant.page_size ? urs.sublist((page - 1) * constant.page_size, page * constant.page_size) : urs.sublist((page - 1) * constant.page_size, urs.size()); int len = urs.size() % constant.page_size == 0 ? urs.size() / constant.page_size : (urs.size() / constant.page_size + 1); map.put("items", items); map.put("len", len); return r.tcode(2000).tdata(map); } @requestmapping("/create") r create(@requestbody ur ur) { r r = new r(); int ans = urrvice.add(ur); if (ans == 1) { return r.tcode(2000).tmsg(httpmsg.add_ur_ok); } return r.tcode(4000).tmsg(httpmsg.add_ur_failed); } @requestmapping("/update") r update(@requestbody ur ur) { r r = new r(); int ans = urrvice.update(ur); if (ans >= 0) { return r.tcode(2000).tmsg(httpmsg.update_ur_ok); } return r.tcode(4000).tmsg(httpmsg.update_ur_failed); } @deletemapping("/delete") r delete(@requestparam("id") int id) { r r = new r(); int ans = urrvice.delete(id); if (ans == 1) { return r.tcode(2000).tmsg(httpmsg.delete_ur_ok); } return r.tcode(4000).tmsg(httpmsg.delete_ur_failed); }}
订单管理控制层:
/** * 用户 **/@restcontroller@requestmapping("order")public class ordercontroller { @autowired orderrvice orderrvice; @autowired urdao urdao; @autowired orderdao orderdao; @autowired flowersdao flowersdao; @requestmapping("/test") r test() { r r = new r(); return r.tcode(4000).tmsg(constant.img_path).tdata(orderdao.findall(null)); } @requestmapping("/querybyaccount") r querybyaccount(@requestparam("account") string account) { r r = new r(); if (stringutil.impty(account)) { return r.tcode(4000).tmsg(httpmsg.invalid_param); } list<order> orders = orderrvice.querybyaccount(account); return r.tcode(2000).tdata(orders); } @requestmapping("/find") r find(@requestparam("page") int page, @requestparam("archkey") string archkey, @requestparam("account") string account) { r r = new r(); map<string, object> map = new hashmap<>(); list<order> orders = orderrvice.find(archkey, account); if (orders == null) { return r.tcode(2000); } map.put("items", orders); map.put("len", orders.size()); return r.tcode(2000).tdata(map); } @requestmapping("/findall") r findall(@requestparam("page") int page, @requestparam("archkey") string archkey) { r r = new r(); map<string, object> map = new hashmap<>(); list<order> orders = orderrvice.findall(archkey); if (orders == null) { return r.tcode(2000); } list<order> items = orders.size() >= page * constant.page_size ? orders.sublist((page - 1) * constant.page_size, page * constant.page_size) : orders.sublist((page - 1) * constant.page_size, orders.size()); int len = orders.size() % constant.page_size == 0 ? orders.si期中教学检查总结ze() / constant.page_size : (orders.size() / constant.page_size + 1); list<ordervo> vos = new arraylist<>(); for (order item : items) { ur ur = urdao.querybyid(item.getuid()); ordervo vo = new ordervo(); vo.taddress(ur.getaddress()).tphone(ur.getphone()).turname(ur.getname()) .tamount(item.getamount()).tflower(item.getflower()).tid(item.getid()) .tuid(item.getuid()).torder_guid(item.getorder_guid()).tprice(it新民主主义时期em.getprice()) .tstate(item.getstate()); vos.add(vo); } map.put("items", vos); map.put("len", len); return r.tcode(2000).tdata(map); } @requestmapping("/update") r update(@requestbody order order) { r r = new r(); int ans = orderrvice.update(order); if (ans >= 0) { return r.tcode(2000).tmsg(httpmsg.update_ur_ok); } return r.tcode(4000).tmsg(httpmsg.update_ur_failed); } @requestmapping("/changestate") r changestate(@requestbody order order) { orderdao.changestate(order); return new r().tcode(2000).tmsg(httpmsg.update_order_ok); } @deletemapping("/delete") r delete(@requestparam("id") int id) { r r = new r(); int ans = orderrvice.delete(id); if (ans == 1) { return r.tcode(2000).tmsg(httpmsg.delete_ur_ok); } return r.tcode(4000).tmsg(httpmsg.delete_ur_failed); }}
购物车控制层:
/** * 用户 **/@restcontroller@requestmapping("cart")public class cartcontroller { @autowired cartrvice cartrvice; @autowired orderrvice orderrvice; @autowired cartdao dao; @autowired flowersdao flowersdao; @requestmapping("/test") r test() { r r = new r(); return r.tcode(4000).tmsg(constant.img_path).tdata(dao.findall()); } @requestmapping("/querybyaccount") r querybyaccount(@requestparam("account") string account) { r r = new r(); if (stringutil.impty(account)) { return r.tcode(4000).tmsg(httpmsg.invalid_param); } list<cart> carts = cartrvice.querybyaccount(account); for (cart cart : carts) { float price = flowersdao.queryprice(cart.getfid()); cart.tprice(cart.getamount() * price); } return r.tcode(20理综卷00).tdata(carts); } @requestmapping("/find") r find(@requestparam("page") int page, @requestparam("archkey") string archkey, @requestparam("ac台风命名怎么来的count") string account) { r r = new r(); map<string, object> map = new hashmap<>(); list<cart> carts = cartrvice.find(archkey, account); if (carts == null) { return r.tcode(2000); } list<cart> items = carts.size() >= page * constant.page_size ? carts.sublist((page - 1) * constant.page_size, page * constant.page_size) : carts.sublist((page - 1) * constant.page_size, carts.size()); int len = carts.size() % constant.page_size == 0 ? carts.size() / constant.page_size : (carts.size() / constant.page_size + 1); map.put("items", items); map.put("len", len); return r.tcode(2000).tdata(map); } @requestmapping("/buy") r buy(@requestparam("account") string account) { r r = new r(); // 查该用户的购物车 list<cart> carts = (list<cart>) querybyaccount(account).getdata(); for (cart cart : carts) { // 增加订单数据 orderrvice.add(cart); // 删除购物车数据 cartrvice.delete(cart.getid()); } return r.tcode(2000).tmsg(httpmsg.buy_ok); } @requestmapping("/create") r create(@requestbody cart cart) { r r = new r(); int ans = cartrvice.add(cart); if (ans == 1) { return r.tcode(2000).tmsg(httpmsg.add_cart_ok); } return r.tcode(4000).tmsg(httpmsg.add_cart_failed); } @requestmapping("/update") r update(@requestbody cart cart) { r r = new r(); int ans = cartrvice.update(cart); if (ans >= 0) { return r.tcode(2000).tmsg(httpmsg.update_ur_ok); } return r.tcode(4000).tmsg(httpmsg.update_ur_failed); } @deletemapping("/delete") r delete(@requestparam("id") int id) { r r = new r(); int ans = cartrvice.delete(id); if (ans == 1) { return r.tcode(2000).tmsg(httpmsg.delete_ur_ok); } return r.tcode(4000).tmsg(httpmsg.delete_ur_failed); }}
到此这篇关于java实战花店商城系统的实现流程的文章就介绍到这了,更多相关java 花店商城系统内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章希望大家以后多多支持www.887551.com!
本文发布于:2023-04-04 09:33:45,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/95746cf1b96a311aebfc239127f7fdf0.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:Java实战花店商城系统的实现流程.doc
本文 PDF 下载地址:Java实战花店商城系统的实现流程.pdf
留言与评论(共有 0 条评论) |