基于SSM的“基于Apriori算法的网络书城”的设计与实现(源码+数据库+文档)
-
开发语言:Java
-
数据库:MySQL
-
技术:SSM
-
工具:IDEA/Ecilpse、Navicat、Maven
系统展示
网站功能展示图
首页
商品分类
热销
新品
我的订单
个人中心
搜索
9.购物车
订单管理
客户管理
商品管理
类目管理
摘要
网络技术的发展市场的销售模式发生了巨大的改变,现在销售网站引用电子商务网站网站设计的基本流程,引用网站网站的开发生命周期法和结构化方法,使用JSP语言来设计并实现了书籍网上销售网站。本书籍销售网站分为前台、后台两个模块。前台接受从用户端来的的请求,前台主要具有用来登录注册页面、网站第一个页面、商品进行仔细搜索、产品的特别展示、新书籍的分类,购物车等功能。后台由管理员来管理,管理员可以实现网站管理、商品管理、订单管理、用户管理等功能。
网站用的是MySQL数据库。利用其提供的各种组件,在很短时间里面内更新数据库表里面的信息,对数据库要分析,不断更新并且改进,直到该网站模块基本成功运行位置。
题目背景
书籍销售网站是现在最火的电子商务之一。我的这个网站大大的节约了客户的时间成本;对企业也会提高他们的业务的效率。从而让买家跟卖家的交易成本会减小好多。随着现在科技的发展,使用网络的人数越来越多。也变得越来越的小龄化。所现在网购=是一件特别普及并特别火的一件事情。他们不用耗费好多时间来逛街买,只要有一部联网的设备都可以实现现网上购物的这个想法。网上开店也是特别方便。不用交房租,不用装修,有人不用去可以的留常客。也不用去跑办一些开店的手续。只通过网络来展示自己的商品卖出去而获得利润。利用电脑做电子商务的好处有好多。
随着现的社会发展,并我们的小康社会,人们的经济收入有所提高。随着他们收入的提高,并他们忙碌的生活,给他们新的购买商品的选择。那就是网购:电子商务。也就是说现在的网点,销售网站,就跟我要实现的书籍销售网站等类似的网点有了新的发展趋势。
题目研究意义
科技在进步人类在发展,我们的计算机技术也随之不断前进发展,现在网店等电子商务信息量的增长对计算机技术的要求也越来越高。对网店的每一位注册者,购买者,并他们的浏览记录等信息一定要给他们存储的空间。也对这些客户进行后台的管理,也得实现他们对商品的需求,得不时的更改商品的,并分析他们的需求,提供他们更好的选择。因此我们需要研究我们诉说的电子商务。
电子商务就是在网上进行的,客户通过商家上上传的商品信息筛选自己心意的商品而解决双方需求的一个贸易活动。电子商务可以完成购买者短时间里购买商品的需求,短时间里,可以购买并浏览不同类的各种商品。并节省很多时间,商家也可以不用掏房租等很多必要资金,通过网络就可以实现自己买卖想法。所以我才选择了这个快捷,简单的这个网站设,希望通过这次的网站设计,我要充分得了解电子商务的各种利与弊,也要学会网站设计。用自己以前学会的专业理论知识来实现这次的毕业设计。
部分源码
@Controller
public class BookController {@Autowiredpublic BookService bookService;@Autowiredpublic BookTypeService bookTypeService;@RequestMapping("/recommend_books")public String showRecommendBook(int rtype, int pageNumber, HttpServletRequest request){if(pageNumber<=0)pageNumber=1;Page p= bookService.queryBookByRecommendType(rtype,pageNumber);if(p.getTotalPage()==0){p.setTotalPage(1);p.setPageNumber(1);}else {if(pageNumber>=p.getTotalPage()+1){p = bookService.queryBookByRecommendType(rtype,p.getTotalPage());}}request.setAttribute("p", p);request.setAttribute("t", rtype);return "recommend_list";}@RequestMapping("/booktypes_list")public String showBooksByBookTypeID(int pageNumber, int btid,HttpServletRequest request){String btname="";if(btid!=0){btname=bookTypeService.queryBookTypeNameByBookTypeID(btid);}request.setAttribute("t",btname);//List<Goods> list=gService.selectGoodsByTypeID(id,1,8);//request.setAttribute("goodsList",list);if(pageNumber<=0)pageNumber=1;Page p=bookTypeService.queryBookByBookTypeID(btid,pageNumber);if(p.getTotalPage()==0){p.setTotalPage(1);p.setPageNumber(1);}else {if(pageNumber>=p.getTotalPage()+1){p=bookTypeService.queryBookByBookTypeID(btid,p.getTotalPage());}}request.setAttribute("p",p);request.setAttribute("btid",btid);return "booktypes_list";}@RequestMapping("/book_detail")public String showBookByID(int bid,HttpServletRequest request){Book book= bookService.queryBookByID(bid);List<Book> books=bookService.queryBookByRecommendType(3,1,8);List<Comments> comments=bookService.queryComments(bid);request.setAttribute("newList",books);request.setAttribute("comments",comments);request.setAttribute("book",book);return "book_detail";}@RequestMapping("/search_books")public String SearchBooksByKeyword(int pageNumber,String keyword,HttpServletRequest request) throws UnsupportedEncodingException {if(pageNumber<=0){pageNumber=1;}Page p =bookService.searchBooksByKeyword(keyword,pageNumber);if(p.getTotalPage()==0){p.setTotalPage(1);p.setPageNumber(1);}else {if(pageNumber>=p.getTotalPage()+1){p =bookService.searchBooksByKeyword(keyword,p.getTotalPage());}}request.setAttribute("p", p);request.setAttribute("keyword", URLEncoder.encode(keyword,"utf-8"));return "book_search";}@RequestMapping("/admin/type_list")public String ShowBookTypes(HttpServletRequest request){request.setAttribute("list",bookTypeService.queryBookTypes());return "admin/type_list";}@RequestMapping("/admin/type_add")public String CreateBookType(String btname,HttpServletRequest request){boolean result= bookTypeService.addBookType(btname);UpdateBookType(request);return "redirect:type_list.action";}@RequestMapping("/admin/type_delete")public String RemoveBookType(int btid,HttpServletRequest request){boolean result= bookTypeService.removeBookType(btid);UpdateBookType(request);return "redirect:type_list.action";}@RequestMapping("/admin/type_update")public String ModifyBookType(int btid,String btname,HttpServletRequest request){boolean result= bookTypeService.modifyBookType(btid,btname);UpdateBookType(request);return "redirect:type_list.action";}public void UpdateBookType(HttpServletRequest request){if(request.getServletContext().getAttribute("bookTypes")==null){request.getServletContext().setAttribute("bookTypes",bookTypeService.queryBookTypes());}else{request.getServletContext().removeAttribute("bookTypes");request.getServletContext().setAttribute("bookTypes",bookTypeService.queryBookTypes());}}@RequestMapping("/admin/book_list")public String ShowBookByRecommend(int pageNumber,int rtype,HttpServletRequest request){if(pageNumber<=0)pageNumber=1;Page p = bookService.queryBookByRecommendType(rtype, pageNumber);if(p.getTotalPage()==0){p.setTotalPage(1);p.setPageNumber(1);}else {if(pageNumber>=p.getTotalPage()+1){p = bookService.queryBookByRecommendType(rtype, p.getTotalPage());}}request.setAttribute("p", p);request.setAttribute("rtype", rtype);return "/admin/book_list";}@RequestMapping("/admin/book_change")public String ChangeBookRecommend(int bid,int rtype,String method,int page){boolean result=false;if(method.equals("add")) {result=bookService.addRecommend(bid,rtype);}else {result=bookService.remoteRecommend(bid,rtype);}return "redirect:book_list.action?pageNumber=1&rtype="+page;}@RequestMapping("/admin/book_delete")public String DeleteBook(int bid,int rtype){boolean result=bookService.removeBookByBid(bid);//return "redirect:book_list.action?pageNumber=1&rtype="+rtype;}@RequestMapping("/admin/book_add")public String uploadimg(HttpServletRequest request) throws Exception{DiskFileItemFactory factory=new DiskFileItemFactory();ServletFileUpload upload = new ServletFileUpload(factory);try {List<FileItem> list = upload.parseRequest(request);Book b = new Book();for(FileItem item:list) {if(item.isFormField()) {switch(item.getFieldName()) {case "bname":b.setBname(item.getString("utf-8"));break;case "bprice":b.setBprice(Double.parseDouble(item.getString("utf-8")));break;case "bmark":b.setBmark(item.getString("utf-8"));break;case "bstock":b.setBstock(Integer.parseInt(item.getString("utf-8")));break;case "btid":b.setBtid(Integer.parseInt(item.getString("utf-8")));break;case "bisbn":b.setBisbn(item.getString("utf-8"));break;case "bauthor":b.setBauthor(item.getString("utf-8"));break;case "bpublisher":b.setBpublisher(item.getString("utf-8"));break;}}else {if(item.getInputStream().available()<=0)continue;String fileName = item.getName();fileName = fileName.substring(fileName.lastIndexOf("."));fileName = "/"+new Date().getTime()+fileName;String path = request.getServletContext().getRealPath("/images")+fileName;InputStream in = item.getInputStream();FileOutputStream out = new FileOutputStream(path);byte[] buffer = new byte[1024];int len=0;while( (len=in.read(buffer))>0 ) {out.write(buffer);}in.close();out.close();item.delete();switch(item.getFieldName()) {case "bcover":b.setBcover("images"+fileName);break;case "bimage1":b.setBimage1("images"+fileName);break;case "bimage2":b.setBimage2("images"+fileName);break;}}}bookService.addBook(b);} catch (FileUploadException e) {System.out.println(e.getMessage());}return "redirect:book_list.action?pageNumber=1&rtype=0";}@RequestMapping("/admin/book_edit_show")public String ShowBookByBid(int bid,HttpServletRequest request){Book b = bookService.queryBookByID(bid);request.setAttribute("g", b);return "admin/book_edit";}@RequestMapping("/admin/book_update")public String ModifyBook(HttpServletRequest request) throws Exception {DiskFileItemFactory factory=new DiskFileItemFactory();ServletFileUpload upload = new ServletFileUpload(factory);try {List<FileItem> list = upload.parseRequest(request);Book b=new Book();for(FileItem item:list) {if(item.isFormField()) {switch(item.getFieldName()) {case "bid":b.setBid(Integer.parseInt(item.getString("utf-8")));break;case "bname":b.setBname(item.getString("utf-8"));break;case "bprice":b.setBprice(Double.parseDouble(item.getString("utf-8")));break;case "bmark":b.setBmark(item.getString("utf-8"));break;case "bstock":b.setBstock(Integer.parseInt(item.getString("utf-8")));break;case "btid":b.setBtid(Integer.parseInt(item.getString("utf-8")));break;case "bisbn":b.setBisbn(item.getString("utf-8"));break;case "bauthor":b.setBauthor(item.getString("utf-8"));break;case "bpublisher":b.setBpublisher(item.getString("utf-8"));break;case "bcover":b.setBcover(item.getString("utf-8"));break;case "bimage1":b.setBimage1(item.getString("utf-8"));break;case "bimage2":b.setBimage2(item.getString("utf-8"));break;}}else {if(item.getInputStream().available()<=0)continue;String fileName = item.getName();fileName = fileName.substring(fileName.lastIndexOf("."));fileName = "/"+new Date().getTime()+fileName;String path = request.getServletContext().getRealPath("/images")+fileName;InputStream in = item.getInputStream();FileOutputStream out = new FileOutputStream(path);byte[] buffer = new byte[1024];int len=0;while( (len=in.read(buffer))>0 ) {out.write(buffer);}in.close();out.close();item.delete();switch(item.getFieldName()) {case "bcover":b.setBcover("images"+fileName);break;case "bimage1":b.setBimage1("images"+fileName);break;case "bimage2":b.setBimage2("images"+fileName);break;}}}bookService.modifyBook(b);//Service.update(g);//request.getRequestDispatcher("/admin/goods_list?pageNumber="+pageNumber+"&type="+type).forward(request, response);} catch (FileUploadException e) {System.out.println(e.getMessage());}return "redirect:book_list.action?pageNumber=1&rtype=0";}@RequestMapping("/book_vote")public void updateBookVote(int bid){bookService.updateBookVote(bid);}@RequestMapping("/comment_add")public String commentAdd(int bid,String content, HttpServletRequest request){User user= (User)request.getSession().getAttribute("user");String userName = user.getUrealname();Comments b=new Comments();int uid = user.getUid();if(!user.getUid().equals("")){b.setBid(bid);b.setUid(uid);b.setCcontent(content);b.setUrealname(userName);bookService.addComment(b);}return "redirect:book_detail.action?bid="+bid;}
}
结论
该毕业设计是我们使用四年里学到的理论知识并实际操作来独立实现一个项目的机会。我在接触这个毕业设计的最开始不知道从哪儿开始,选题是该选什么样的题目,自己所喜欢的东西怎么给展现出来。选完题目之后的该使用那个语言来编写,用那个数据库。编写过程当中的困难,还有模块设计不出来。设计出来的东西跟想的不一样等很多困难,但是通过自己的学习,并同学们的帮助,老师们的指导下一个个去解决困难而做出了此网站。
在制作过程学会了很多新的知识点,把自己对JSP开发语言的浅薄的认识改变成自己能独立完成一个网页设计的进步。在连接数据库并创建数据表等的时候也遇到了好多问题。但是还是不停地去努力下这些都被我克制了。