小言_互联网的博客

零食商城|基于springboot的零食商城

201人阅读  评论(0)

作者主页:编程指南针

作者简介:Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师

主要内容:Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助

收藏点赞不迷路  关注作者有好处

文末获取源码 

项目编号:BS-SC-020

前言:

互联网的兴起从本质上改变了整个社会的商品交易方式,国内各大企业从上个世纪90年代互联网兴起之时,就产生了通过网络进行销售经营商品的想法。但是由于在互联网上企业的信誉难以认证、网络的法规政策不健全、物流不发达等一系列的原因,限制了网上交易发展的步伐。进入21世纪以后,随着整个社会的发展、进步,制约网上交易的各个瓶颈问题逐一被击破,各企业也纷纷的加入到电子商务的洪潮之中。

根据会员企业艾瑞咨询集团的预测,2008年我国网络购物交易将同比增长125.1%,交易总量将达1263亿,形成了中国网络购物的快速增长浪潮,网络购物这一消费方式给人们生活带来的变化,除了购物场所的改变以外,更重要的是大大改变了传统的消费行为习惯,无论是否在网上购物,上网查看产品的相关信息,已经成为购物决策环节的重要组成部分,这一环节对购物行为的实际发生起到了至关重要的指导作用。

与传统销售方式相比,在线销售有很多优点:检索便捷,在线销售提供了多种检索途径,可以从分类、新品、特价等途径进行检索,快捷准确;信息量大,与传统销售方式相比,在线销售能够提供海量产品信息;成本低、风险小、无地域限制,零食购物最突出的优点是:不再限制消费者的购买时段,扩大和巩固了客户群,从而增加了企业的核心竞争力,节省实际开店时需要投入的成本和租用费用。

一,项目简介

(1)研究内容:

基于Spring boot框架搭建一个便捷的网络购物交易平台,极大方便了人们的日常生活,省时省力,只需要几分钟就可以浏览很多商品,在线下单后等待物流到家即可。因此网络购物交易平台的作用很大,研究其的目的和意义也很重要,其中研究内容包括:

  • 研究零食商铺网站的功能需求。
  • 研究零食商铺网站的建设方案。
  • 研究零食商铺网站的理论基础。
  • 研究零食商铺网站的策略和算法。
  • 研究零食商铺网站的数据库逻辑设计。

⑥研究零食商铺网站的总体设计方案和实施方案。

(2)功能要求:

系统的开发基于B/S结构,采用Spring boot技术处理后端数据和服务,采用MySQL数据库对系统数据进行储存,充分保证系统数据的安全性和稳定性。采用模块化设计。模块化设计要求将整个系统划分成基于小的模块,有利于代码的重载,简单方便的系统界面。设计简单友好的系统界面,方便用户较快的适应系统的操作。本系统主要功能有:

普通用户功能:商品信息浏览,在线下订单,在线注册,公告信息浏览,个人信息维护;

管理员用户功能:修改个人密码,商品类别管理,商品信息管理,会员管理,系统公告管理,订单管理。

通过本系统可以实现用户直接在浏览器上实现查看商品以及在线下单的功能,且操作简单,交易时安全系数高。本系统包括前端和后端功能:

I.前端功能

前端为普通用户使用的,包括下面一些功能:

  • 商品信息浏览:浏览网站中所有已经拥有的商品的基本信息。
  • 个人信息维护:用户可以对自己的用户信息进行修改,查看。
  • 在线下订单:用户可以直接在在线下单。
  • 在线注册:新用户可以直接在线注册自己的账号。
  • 公告信息浏览:用户可以直接浏览网站的公告。

II.后端功能

后端由管理员(系统管理员)进行登录,具有下面一些功能:

  • 修改个人密码:管理员可以对自己的密码进行修改。
  • 商品类别管理:管理员可以对商品的类别进行管理,商品类别是否正确合理,可以对商品的类别信息进行增删改等。
  • 商品信息管理:管理员可对商品的信息进行管理。
  • 会员管理:管理会员信息,用户名是否合法,是否存在有损平台利益的用户存在,可清除和更改等。
  • 系统公告管理:管理员可对系统公告进行修改、添加和删除,保证公告的合理正确性。

⑥订单管理:管理员对已经存在的订单进行核对,避免出错。

(3)工作要求:

① 简单方便的系统界面。设计简单友好的系统界面,方便用户较快的适应系统的操作。

② 根据功能设计合理的菜单,分别完成各项子功能。

③ 设计合理的输出界面,比如商品详细信息要简洁明了。

④ 功能完善和改进:做最后的修缮和调整,使得功能全面、运行流畅、贴近实际运行环境。

⑤ 撰写设计报告:整理资料完成设计报告。设计报告的形成要求以研究和设计结果为依据,设计报告的结构合理具有科学性,内容论述清楚,最终能够具有相关领域的参考价值。

⑥ 提交可执行程序及其相关代码、相关文档,进行答辩。

二,环境介绍

语言环境:Java:  jdk1.8

数据库:Mysql: mysql5.7

应用服务器:Tomcat:  tomcat8.5.31

开发工具:IDEA或eclipse

后台开发技术:Springboot+Mybatis

前台开发技术:Bootstrap+ajax+html+css

三,系统展示

前台首页

全文搜索

商品购买

 收货地址管理

我的订单

后台管理

品牌管理

 商品管理

 订单管理

销售统计

四,核心代码展示


  
  1. package com.yw.eshop.controller.admin;
  2. import com.yw.eshop.domain.Product;
  3. import com.yw.eshop.domain.TongjiVo;
  4. import com.yw.eshop.mapper.ProductMapper;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import org.springframework.web.bind.annotation.ResponseBody;
  9. import java.util.ArrayList;
  10. import java.util.List;
  11. @Controller
  12. @RequestMapping("/echart")
  13. public class AdminTongjiController {
  14. @Autowired
  15. private ProductMapper productMapper;
  16. /*得到所有已被销售商品的销售情况*/
  17. @RequestMapping(value = "/adminEachartzhu")
  18. @ResponseBody
  19. public List<TongjiVo> getAllXiaoshou (){
  20. System.out.println( "柱状图数据统计请求");
  21. return productMapper.tongjiBing();
  22. }
  23. /*管理员权限查询近日订单金额*/
  24. @RequestMapping(value = "/getAllOrdersComeInByDate")
  25. @ResponseBody
  26. public List<TongjiVo> getAllOrdersComeInByDate (){
  27. System.out.println( "管理员权限查询近日订单金额");
  28. return productMapper.tongjiZhu();
  29. }
  30. /*跳转到销售柱状图页面*/
  31. @RequestMapping(value = "/toadminEachartzhu")
  32. public String toAdminEchart (){
  33. return "/admin/echart/xiaoshouZhu";
  34. }
  35. /*跳转到销售饼状图页面*/
  36. @RequestMapping(value = "/toadminEachartBin")
  37. public String toadminEachartzhu2 (){
  38. return "/admin/echart/xiaoshouBin";
  39. }
  40. }


  
  1. package com.yw.eshop.controller.admin;
  2. import com.yw.eshop.domain.Brand;
  3. import com.yw.eshop.domain.ProductType;
  4. import com.yw.eshop.service.BrandService;
  5. import com.yw.eshop.service.ProductTypeService;
  6. import com.yw.eshop.utils.PageModel;
  7. import com.yw.eshop.service.BrandService;
  8. import com.yw.eshop.service.ProductTypeService;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.stereotype.Controller;
  11. import org.springframework.ui.Model;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RequestParam;
  14. import org.springframework.web.bind.annotation.ResponseBody;
  15. import java.util.List;
  16. @Controller
  17. @RequestMapping("/admin/brand")
  18. public class BrandController {
  19. @Autowired
  20. private BrandService brandService;
  21. @Autowired
  22. private ProductTypeService productTypeService;
  23. @RequestMapping("/list")
  24. public String list ( @RequestParam(defaultValue = "1") Integer pageNo,
  25. @RequestParam(defaultValue = "5")Integer pageSize,
  26. Model model){
  27. try {
  28. PageModel<Brand> brandPages = brandService.queryBrandPages(pageNo, pageSize);
  29. model.addAttribute( "brandPages", brandPages);
  30. } catch (Exception e) {
  31. e.printStackTrace();
  32. model.addAttribute( "errMessage", "查询失败:"+e.getMessage());
  33. return "500";
  34. }
  35. return "admin/brand/list";
  36. }
  37. @RequestMapping("addPage")
  38. public String addPage (Model model){
  39. List<ProductType> productTypes= productTypeService.queryProductTypeAll();
  40. model.addAttribute( "productTypes",productTypes);
  41. return "admin/brand/add";
  42. }
  43. @RequestMapping("/add")
  44. private String addBrand (Brand brand,Model model){
  45. try {
  46. int i = brandService.addBrand(brand);
  47. if (i== 0){
  48. model.addAttribute( "errMessage", "服务器繁忙操作失败");
  49. return "500";
  50. }
  51. } catch (Exception e){
  52. model.addAttribute( "errMessage",e.getMessage());
  53. return "500";
  54. }
  55. model.addAttribute( "url", "admin/brand/list");
  56. return "success";
  57. }
  58. @RequestMapping("updatePage")
  59. public String updatePage (String id,Model model){
  60. Brand brand= brandService.queryBrandById(id);
  61. List<ProductType> productTypes= productTypeService.queryProductTypeAll();
  62. model.addAttribute( "productTypes",productTypes);
  63. model.addAttribute( "brand",brand);
  64. return "admin/brand/update";
  65. }
  66. @RequestMapping("/update")
  67. private String update (Brand brand,Model model){
  68. try {
  69. int i = brandService.updateBrand(brand);
  70. if (i== 0){
  71. model.addAttribute( "errMessage", "服务器繁忙操作失败");
  72. return "500";
  73. }
  74. } catch (Exception e){
  75. model.addAttribute( "errMessage",e.getMessage());
  76. return "500";
  77. }
  78. model.addAttribute( "url", "admin/brand/list");
  79. return "success";
  80. }
  81. @RequestMapping("deletePage")
  82. public String deletePage (String id,Model model){
  83. model.addAttribute( "id",id);
  84. return "admin/carousel/delete";
  85. }
  86. @RequestMapping("/delete")
  87. public String delete (String id, Model model){
  88. try {
  89. int i = brandService.delete(id);
  90. if (i== 0){
  91. model.addAttribute( "errMessage", "服务器繁忙操作失败");
  92. return "500";
  93. }
  94. } catch (Exception e){
  95. model.addAttribute( "errMessage",e.getMessage());
  96. return "500";
  97. }
  98. model.addAttribute( "url", "admin/brand/list");
  99. return "success";
  100. }
  101. @RequestMapping("batchDel")
  102. @ResponseBody
  103. public String batchDel (String[] ids) {
  104. System.out.println( "进来了");
  105. brandService.batchProductTypeDel(ids);
  106. return "/admin/brand/list";
  107. }
  108. }

  
  1. package com.yw.eshop.controller.admin;
  2. import com.yw.eshop.domain.User;
  3. import com.yw.eshop.service.UserService;
  4. import com.yw.eshop.utils.PageModel;
  5. import com.yw.eshop.service.UserService;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Controller;
  8. import org.springframework.ui.Model;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RequestParam;
  11. @Controller
  12. @RequestMapping("/admin")
  13. public class UserController {
  14. @Autowired
  15. private UserService userService;
  16. @RequestMapping("/user/list")
  17. public String list (@RequestParam(defaultValue = "1")Integer pageNo,
  18. @RequestParam(defaultValue = "10") Integer pageSize, Model model){
  19. PageModel<User> userPages = userService.queryUserList(pageNo, pageSize);
  20. model.addAttribute( "userPages",userPages);
  21. return "admin/user/list";
  22. }
  23. @RequestMapping("/user/addPage")
  24. public String addPage (){
  25. return "admin/user/add";
  26. }
  27. @RequestMapping("/user/add")
  28. public String addUser (User user,Model model){
  29. try {
  30. user.setType( 0);
  31. int i = userService.addUser(user);
  32. if (i== 0){
  33. model.addAttribute( "errMessage", "服务器繁忙添加失败");
  34. return "500";
  35. }
  36. } catch (Exception e){
  37. model.addAttribute( "errMessage",e.getMessage());
  38. return "500";
  39. }
  40. model.addAttribute( "url", "admin/user/list");
  41. return "success";
  42. }
  43. @RequestMapping("user/updatePage")
  44. public String updatePage (String id,Model model){
  45. User user = userService.queryUserById(id);
  46. model.addAttribute( "user",user);
  47. return "admin/user/update";
  48. }
  49. @RequestMapping("/user/update")
  50. public String updateUser (User user,Model model){
  51. try {
  52. int i = userService.updateUser(user);
  53. if (i== 0){
  54. model.addAttribute( "errMessage", "服务器繁忙修改失败");
  55. return "500";
  56. }
  57. } catch (Exception e){
  58. model.addAttribute( "errMessage",e.getMessage());
  59. return "500";
  60. }
  61. model.addAttribute( "url", "admin/user/list");
  62. return "success";
  63. }
  64. @RequestMapping("user/deletePage")
  65. public String deletePage (String id,Model model){
  66. model.addAttribute( "id",id);
  67. return "admin/user/delete";
  68. }
  69. @RequestMapping("user/delete")
  70. public String deleteUser (String id,Model model){
  71. try {
  72. int i = userService.deleteUser(id);
  73. if (i== 0){
  74. model.addAttribute( "errMessage", "服务器繁忙修改失败");
  75. return "500";
  76. }
  77. } catch (Exception e){
  78. model.addAttribute( "errMessage",e.getMessage());
  79. return "500";
  80. }
  81. model.addAttribute( "url", "admin/user/list");
  82. return "success";
  83. }
  84. }


  
  1. package com.yw.eshop.controller.front;
  2. import com.yw.eshop.domain.Carousel;
  3. import com.yw.eshop.domain.Product;
  4. import com.yw.eshop.domain.ProductType;
  5. import com.yw.eshop.domain.SearchHistory;
  6. import com.yw.eshop.service.CarouselService;
  7. import com.yw.eshop.service.ProductService;
  8. import com.yw.eshop.service.ProductTypeService;
  9. import com.yw.eshop.service.SearchHistoryService;
  10. import com.yw.eshop.service.CarouselService;
  11. import com.yw.eshop.service.ProductService;
  12. import com.yw.eshop.service.ProductTypeService;
  13. import com.yw.eshop.service.SearchHistoryService;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.stereotype.Controller;
  16. import org.springframework.ui.Model;
  17. import org.springframework.web.bind.annotation.RequestMapping;
  18. import java.util.List;
  19. @Controller
  20. @RequestMapping("/front")
  21. public class FrontIndexController {
  22. @Autowired //轮播图
  23. private CarouselService carouselService ;
  24. @Autowired //商品类型
  25. private ProductTypeService productTypeService ;
  26. @Autowired //商品
  27. private ProductService productService ;
  28. @Autowired
  29. private SearchHistoryService searchHistoryService;
  30. @RequestMapping("/index")
  31. public String index (Model model){
  32. //轮播图
  33. List<Carousel> carousels = carouselService.queryCarouselAll();
  34. model.addAttribute( "allcarouselFigures",carousels);
  35. //分类
  36. List<ProductType> productTypes = productTypeService.queryProductTypeAll();
  37. model.addAttribute( "allProductTypes",productTypes);
  38. //新品
  39. List<Product> newProducts = productService.queryNewProduct( 6);
  40. model.addAttribute( "newProducts", newProducts);
  41. //查询热搜词
  42. List<SearchHistory> searchHistorys = searchHistoryService.querySearchHistoryPages( 10);
  43. model.addAttribute( "searchHistorys",searchHistorys);
  44. //排行榜
  45. List<Product> rankings = productService.queryProductRankings();
  46. model.addAttribute( "rankings", rankings);
  47. //饼干
  48. ProductType productType = new ProductType();
  49. productType.setProductTypeName( "饼干");
  50. Product product = new Product();
  51. product.setProductType(productType);
  52. List<Product> list = productService.queryProductsByType(product, 5);
  53. model.addAttribute( "list", list);
  54. //肉铺
  55. productType.setProductTypeName( "肉铺");
  56. product.setProductType(productType);
  57. List<Product> list2 = productService.queryProductsByType(product, 12);
  58. model.addAttribute( "list2", list2);
  59. //坚果
  60. productType.setProductTypeName( "坚果");
  61. product.setProductType(productType);
  62. List<Product> list3 = productService.queryProductsByType(product, 5);
  63. model.addAttribute( "list3", list3);
  64. //果干
  65. productType.setProductTypeName( "果干");
  66. product.setProductType(productType);
  67. List<Product> list4 = productService.queryProductsByType(product, 12);
  68. model.addAttribute( "list4", list4);
  69. return "front/index/index";
  70. }
  71. }

五,项目总结

本项目功能完整,美观大方,数据完善,人机交互符合要求,是一个不错的毕业设计作品。


转载:https://blog.csdn.net/whirlwind526/article/details/128777281
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场