酒水商城|基于Springboot实现酒水商城系统
创始人
2024-02-02 19:58:54

作者主页:编程千纸鹤

作者简介:Java、前端、Pythone开发多年,做过高程,项目经理,架构师

主要内容:Java项目开发、毕业设计开发、面试技术整理、最新技术分享

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

项目编号:BS-SC-036

一,项目简介

系统整体介绍:

本系统主要基于Springboot框架开发实现,实现了一个以茶叶为主题的商城系统。在本商城系统中,可以实现在线购买酒水,在线支付,管理个人订单,管理个人收货地址,确认收货等功能。用户浏览商城的茶叶产品后可以将茶叶商品添加到购物车中,然后下单支付购买。用户登陆后可以在个人中心中管理自己的购物车信息、订单信息、收货地址信息等。同样在商城前端页面中提供了全文搜索功能,用户可以根据酒水的相关功效或禁忌来查询符合自己要的酒水商品。

系统同样提供了强大的后台管理系统,在后台管理模块中可以实现能前台注册用户的管理操作,可以管理所有用户的订单信息,根据订单支付情况进行发货等操作。同样可以管理产品的分类,可以管理商品的信息,以图文的形式来添加商品信息。为了更好了了解商品的销售情况,在后台使用echart实现了商品销售的图形报表和订单的统计报表功能。

      系统使用了SpringSecurity框架来管理系统的用户登陆和权限认证操作,以保证系统的安全性。本系统功能完整,页面简洁大方,运行无误,适合做毕业设计使用。

      相似性推荐:根据用户的浏览商品的相似性做协同过滤运算,从而给用户进行商品的推荐。

      浏览记录查询:用户的浏览和搜索记录后台会进行记录,在用户进行搜索时会根据搜索关键词的总量进行排行,从而实现推荐的效果

 

二,环境介绍

语言环境:Java:  jdk1.8

数据库:Mysql: mysql5.7

应用服务器:Tomcat:  tomcat8.5.31

开发工具:IDEA或eclipse

后台开发技术:springboot+springmvc+mybatis+ Springsecurity

前台开发技术:jsp+jquery+ajax+bootstrap

三,系统展示

系统首页

分类展示

商品详情

全文检索:记录用户检索历史记录并可以根据历史记录来进行快速搜索

根据品牌进行搜索

相似性推荐:根据用户的浏览商品的相似性做协同过滤运算,从而给用户进行商品的推荐

用户注册

用户登陆

登陆后可以进行商品购买

下单后可个人中心可以查看我的订单,并可以取消订单

个人中心管理个人收货地址

后台管理员登陆

用户管理

轮播图管理

商品分类动态维护

商品品牌管理

商品管理

订单管理

图形统计报表

四,核心代码展示

package com.yw.eshop.controller.front;import com.yw.eshop.domain.Carousel;
import com.yw.eshop.domain.Product;
import com.yw.eshop.domain.ProductType;
import com.yw.eshop.domain.SearchHistory;
import com.yw.eshop.service.CarouselService;
import com.yw.eshop.service.ProductService;
import com.yw.eshop.service.ProductTypeService;
import com.yw.eshop.service.SearchHistoryService;
import com.yw.eshop.service.CarouselService;
import com.yw.eshop.service.ProductService;
import com.yw.eshop.service.ProductTypeService;
import com.yw.eshop.service.SearchHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;import java.util.List;/*** 前端首页控制接口*/
@Controller
@RequestMapping("/front")
public class FrontIndexController {@Autowired//轮播图private CarouselService carouselService ;@Autowired//商品类型private ProductTypeService productTypeService ;@Autowired//商品private ProductService productService ;@Autowiredprivate SearchHistoryService searchHistoryService;@RequestMapping("/index")public String index(Model model){//轮播图List carousels = carouselService.queryCarouselAll();model.addAttribute("allcarouselFigures",carousels);//分类List productTypes = productTypeService.queryProductTypeAll();model.addAttribute("allProductTypes",productTypes);//新品List newProducts = productService.queryNewProduct(6);model.addAttribute("newProducts", newProducts);//查询热搜词List searchHistorys = searchHistoryService.querySearchHistoryPages(10);model.addAttribute("searchHistorys",searchHistorys);//排行榜List rankings = productService.queryProductRankings();model.addAttribute("rankings", rankings);//白酒ProductType productType = new ProductType();productType.setProductTypeName("白酒");Product product = new Product();product.setProductType(productType);List list = productService.queryProductsByType(product, 5);model.addAttribute("list", list);//红酒productType.setProductTypeName("红酒");product.setProductType(productType);product.getProductType().setProductTypeName("红酒");List list2 = productService.queryProductsByType(product, 12);model.addAttribute("list2", list2);//洋酒productType.setProductTypeName("洋酒");product.setProductType(productType);List list3 = productService.queryProductsByType(product, 5);model.addAttribute("list3", list3);//养生酒productType.setProductTypeName("养生酒");product.setProductType(productType);List list4 = productService.queryProductsByType(product, 12);model.addAttribute("list4", list4);return "front/index/index";}
}

package com.yw.eshop.controller.front;import com.yw.eshop.domain.User;
import com.yw.eshop.service.UserService;
import com.yw.eshop.utils.EncryptionUtils;import com.yw.eshop.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;/*** 前端用户登陆退出*/
@Controller
@RequestMapping("/front/login")
public class FrontLoginController {@Autowiredprivate UserService userService;@RequestMapping("/loginPage")public String loginPage(){return "front/login";}@RequestMapping("/login")@ResponseBodypublic String login(String username, String password, String code, String autoLogin,HttpServletRequest request, HttpSession session, HttpServletResponse response){String code1 = (String) session.getAttribute("code");if(StringUtils.isEmpty(code)||!code.equalsIgnoreCase(code1)){return "验证码错误";}if(!StringUtils.isEmpty(username)){User user = userService.queryUserByName(username, 1);if(user==null){return "用户名不存在";}else {String psw1 = user.getPassword();if(psw1.equals(EncryptionUtils.encryptMD5(password))){System.out.println("登录成功");session.setAttribute("user",user);if(!StringUtils.isEmpty(autoLogin)&&autoLogin.equals("1")){Cookie username_cookie = new Cookie("username", username);username_cookie.setMaxAge(3600*24*7);username_cookie.setPath(request.getContextPath());response.addCookie(username_cookie);}else {Cookie username_cookie = new Cookie("username", username);username_cookie.setMaxAge(0);username_cookie.setPath(request.getContextPath());response.addCookie(username_cookie);}return "登录成功";}else {return "密码错误";}}}else {return "用户名为空";}}@RequestMapping("/logout")public void logout(HttpSession session,HttpServletRequest request,HttpServletResponse response) throws IOException {session.removeAttribute("user");Cookie[] cookies = request.getCookies();if(cookies!=null){for (Cookie cookie : cookies) {if ("username".equals(cookie.getName())) {cookie.setMaxAge(0);cookie.setPath(request.getContextPath());response.addCookie(cookie);}}}response.sendRedirect(request.getContextPath()+"/front/login/loginPage");}
}

package com.yw.eshop.controller.front;import com.yw.eshop.domain.Order;
import com.yw.eshop.domain.OrderProduct;
import com.yw.eshop.domain.User;
import com.yw.eshop.service.OrderProductService;
import com.yw.eshop.service.OrderService;
import com.yw.eshop.service.OrderProductService;
import com.yw.eshop.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;import javax.servlet.http.HttpSession;
import java.util.List;/*** 前台订单控制器*/
@Controller
@RequestMapping("front/order")
public class FrontOrderController {@Autowiredprivate OrderService orderService;@Autowiredprivate OrderProductService orderProductService;/*** 前台个人中心订单查询* @param session* @param model* @return*/@RequestMapping("index")private String index(HttpSession session, Model model){try {User user = (User) session.getAttribute("user");if (user == null) {return "redirect:/front/login/loginPage";} else {List list = orderService.queryAllOrder(user.getId());for (Order order : list) {List orderProducts = orderProductService.queryOrderProByOrderId(order.getId());order.setList(orderProducts);}model.addAttribute("list", list);return "front/order/order";}}catch (Exception e){e.printStackTrace();model.addAttribute("errMessage","服务器繁忙"+e.getMessage());return "500";}}/***  前台用户取消订单:条件是未发货状态* @param id* @param model* @return*/@RequestMapping("/delete")@ResponseBodypublic String delete(String id, Model model){model.addAttribute("id", id);try {int i = orderService.delete(id);if (i==0){model.addAttribute("errMessage","服务器繁忙操作失败");return "500";}}catch (Exception e){model.addAttribute("errMessage",e.getMessage());return "500";}//return "forward:/front/order/index";model.addAttribute("url", "/front/order/index");return "success";}/***  前台用户确认收货:条件是己发货状态* @param id* @param model* @return*/@RequestMapping("/update")@ResponseBodypublic String update(String id,Integer status, Model model){model.addAttribute("id", id);try {int i = orderService.updateStatus(id,status);if (i==0){model.addAttribute("errMessage","服务器繁忙操作失败");return "500";}}catch (Exception e){model.addAttribute("errMessage",e.getMessage());return "500";}//return "forward:/front/order/index";model.addAttribute("url", "/front/order/index");return "success";}
}
package com.yw.eshop.controller.front;import com.alibaba.fastjson.JSON;
import com.yw.eshop.domain.*;
import com.yw.eshop.service.*;
import com.yw.eshop.domain.*;
import com.yw.eshop.utils.UUIDUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yw.eshop.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** 购物车处理控制品接口*/
@Controller
@RequestMapping("front/shop_cart")
public class ShopCartController {@Autowiredprivate ReceiveAddressService receiveAddressService;@Autowiredprivate ShopCartProductService shopCartProductService;@Autowiredprivate ShopCartService shopCartService;@Autowiredprivate OrderService orderService;@Autowiredprivate OrderProductService orderProductService;@RequestMapping("/shopCart")public String index(HttpSession session, Model model){try{User user =(User) session.getAttribute("user");if (user ==null){return "redirect:/front/login/loginPage";}else {ShopCart shopCart=shopCartService.queryShopCartByUserID(user.getId());List receiveAddresses=receiveAddressService.queryAddressByUserID(user.getId());model.addAttribute("address",receiveAddresses);List list=shopCartProductService.queryCartProductAll(shopCart.getId());model.addAttribute("list",list);}return "front/shop_cart/shop_cart";}catch (Exception e){e.printStackTrace();model.addAttribute("errMessage","服务器繁忙"+e.getMessage());return "500";}}@RequestMapping("addProductToCart")@ResponseBodypublic String addProductToCart(HttpSession session, String product_id,Integer product_num) throws JsonProcessingException {Map map =new HashMap();try{User user =(User) session.getAttribute("user");if (user ==null){map.put("message","请登录后再操作");map.put("url","/front/login/loginPage");}else {ShopCart shopCart=shopCartService.queryShopCartByUserID(user.getId());ShopCartProduct shopCartProduct=new ShopCartProduct();Product product=new Product();product.setId(product_id);shopCartProduct.setProduct(product);shopCartProduct.setShopCart(shopCart);shopCartProduct.setProductNum(product_num);shopCartProductService.addShop(shopCartProduct);map.put("result",true);}}catch (Exception e){e.printStackTrace();map.put("message","添加失败"+e.getMessage());}ObjectMapper objectMapper = new ObjectMapper();String val = objectMapper.writeValueAsString(map);return val;}@RequestMapping("/deleteProduct")@ResponseBodypublic String delete(String id) throws JsonProcessingException {Map map =new HashMap();try {int i = shopCartProductService.deleteById(id);if (i==0){map.put("message","删除失败");}else {map.put("message","删除成功");map.put("result",true);}}catch (Exception e){e.printStackTrace();;map.put("message","删除失败:"+e.getMessage());}ObjectMapper objectMapper = new ObjectMapper();String val = objectMapper.writeValueAsString(map);System.out.println(val);return val;}@RequestMapping("/batchDel")@ResponseBodypublic String batchDel(String[] ids) throws JsonProcessingException {Map map =new HashMap();try {shopCartProductService.deleteAll(ids);map.put("message","删除成功");map.put("result",true);}catch (Exception e){e.printStackTrace();;map.put("message","删除失败:"+e.getMessage());}ObjectMapper objectMapper = new ObjectMapper();String val = objectMapper.writeValueAsString(map);System.out.println(val);return val;}@RequestMapping("compute")@ResponseBodypublic String compute(String products,String address_id,HttpSession session) throws JsonProcessingException {Map map =new HashMap();User user =(User) session.getAttribute("user");try {if (user ==null){map.put("message","请登录后再操作");map.put("url","/front/login/loginPage");}else {List proIdAndNums= JSON.parseArray(products,ProIdAndNum.class);Order order=new Order();String OrderProId=UUIDUtils.getId();order.setId(OrderProId);order.setCreateTime(new Date());order.setUserId(user.getId());ReceiveAddress receiveAddress = new ReceiveAddress();receiveAddress.setId(address_id);order.setReceiveAddress(receiveAddress);orderService.addOrderOne(order);ShopCart shopCart=shopCartService.queryShopCartByUserID(user.getId());for (ProIdAndNum proIdAndNum : proIdAndNums) {OrderProduct orderProduct=new OrderProduct();orderProduct.setId(UUIDUtils.getId());orderProduct.setOrder(order);Product product=new Product();product.setId(proIdAndNum.getId());orderProduct.setProduct(product);orderProduct.setProductNum(proIdAndNum.getNum());orderProductService.addOrdProOne(orderProduct);shopCartProductService.deleteShopCartBy(shopCart.getId(),proIdAndNum.getId());}map.put("message","结算成功");map.put("result",true);}}catch (Exception e){map.put("message","服务器繁忙:"+e.getMessage());}ObjectMapper objectMapper = new ObjectMapper();String val = objectMapper.writeValueAsString(map);System.out.println(val);return val;}}

五,项目总结

在目前电商为王的中国社会上,种类繁多的电子商务网站如雨后春笋般纷纷建立,百花齐鸣的发展态势可以在很大程度上,十分有效的解决原来时代的信息资源闭塞和地域上的限制[1]。网上交易代替了很多传统的线下消费,这种势头发展的越来越火热,而这一却都是伴随着用户的购买能力的提高,和IT信息化产业的发展以及新型互联网技术的应用[2]。

互联网以及移动互联网的普及应用,也使得消费者的消费路径更加快捷短暂,足不出户可一缆天下,一机在手可买遍全球。所以消费者基本上已经被新的消费模式所吸引,也具备了网络消费的应用水平。而对于广大的电商平台来讲,大而全的电商有之,小而美的电商也有自己的存活空间[3]。而最近这些年比较流行的垂直电商平台的崛起和应用,也让我们的用户可以直接找到自己所喜欢酒水的平台,进行点对点的消费,这就是我们进行酒水电商研究的一个基础背景[6]。

相关内容

热门资讯

埃菲尔铁塔在哪 中国仿建埃菲尔... 2019年4月26日,广西南宁市,街头惊现一座巨型山寨版埃菲尔铁塔,高约20米,白色塔身,造型逼真,...
苗族的传统节日 贵州苗族节日有... 【岜沙苗族芦笙节】岜沙,苗语叫“分送”,距从江县城7.5公里,是世界上最崇拜树木并以树为神的枪手部落...
北京的名胜古迹 北京最著名的景... 北京从元代开始,逐渐走上帝国首都的道路,先是成为大辽朝五大首都之一的南京城,随着金灭辽,金代从海陵王...
应用未安装解决办法 平板应用未... ---IT小技术,每天Get一个小技能!一、前言描述苹果IPad2居然不能安装怎么办?与此IPad不...
脚上的穴位图 脚面经络图对应的... 人体穴位作用图解大全更清晰直观的标注了各个人体穴位的作用,包括头部穴位图、胸部穴位图、背部穴位图、胳...
猫咪吃了塑料袋怎么办 猫咪误食... 你知道吗?塑料袋放久了会长猫哦!要说猫咪对塑料袋的喜爱程度完完全全可以媲美纸箱家里只要一有塑料袋的响...
长白山自助游攻略 吉林长白山游... 昨天介绍了西坡的景点详细请看链接:一个人的旅行,据说能看到长白山天池全凭运气,您的运气如何?今日介绍...
demo什么意思 demo版本... 618快到了,各位的小金库大概也在准备开闸放水了吧。没有小金库的,也该向老婆撒娇卖萌服个软了,一切只...
世界上最漂亮的人 世界上最漂亮... 此前在某网上,选出了全球265万颜值姣好的女性。从这些数量庞大的女性群体中,人们投票选出了心目中最美...
埃菲尔铁塔在哪 中国仿建埃菲尔... 2019年4月26日,广西南宁市,街头惊现一座巨型山寨版埃菲尔铁塔,高约20米,白色塔身,造型逼真,...
苗族的传统节日 贵州苗族节日有... 【岜沙苗族芦笙节】岜沙,苗语叫“分送”,距从江县城7.5公里,是世界上最崇拜树木并以树为神的枪手部落...
北京的名胜古迹 北京最著名的景... 北京从元代开始,逐渐走上帝国首都的道路,先是成为大辽朝五大首都之一的南京城,随着金灭辽,金代从海陵王...
应用未安装解决办法 平板应用未... ---IT小技术,每天Get一个小技能!一、前言描述苹果IPad2居然不能安装怎么办?与此IPad不...