——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot电脑商城系统(java+springboot+maven+html+thymeleaf+layui+mysql)
项目介绍
主要功能包括:
分别是前台用户模块、管理员以及店铺的模块
前台用户模块的功能描述:
(1)个人信息模块:用户可以查看个人信息,修改个人信息,修改个人密码。
(2)收藏管理:添加商品到收藏夹,如果商品已经存在收藏夹中,可以取消商品收藏。
(3)购物车管理:添加商品到购物车中,如果购物车有该商品,则商品数量加1,购物车中可以改变商品数量,可以将商品移出购物车,可以选定哪些商品进行结算或者全选结算,结算之后该商品将会移出购物车。
(4)收货信息管理:用户可以添加自己的收货信息,修改收货信息和删除收货信息,可以增加多条收货信息,并选择一条设置为默认的,在购买时将选取默认的收货地址。
(5)订单管理:用户支付成功之后,将在我的订单页面中看到订单的详情,若卖家发货了,则可以确认收货然后进行商品评价。若订单未进行支付,则可以点待支付可以进行重新支付。
(6)支付功能:用户选择商品和商品数量,进行订单详情页,进行支付,使用支付宝沙箱模拟支付。
(7)商品模块:用户可以浏览商品信息,根据商品的关键字搜索商品信息,用户购买商品,确认收货之后可以对商品进行评价,填写对商品的评价内容和选择星级。
店铺模块的功能描述:
(1)商品管理:卖家可以上架商品,下架商品,对商品信息进行修改,对商品的关键信息进行模糊查询。
(2)订单管理:卖家可以查看所有订单,根据订单的状态搜索订单信息,对已支付的订单进行发货操作。
(3)评论管理:卖家可以查看所有用户的评论信息,。可以按照商品的名称查询改商品的评论内容。
管理员模块的功能描述:
(1)用户管理:可以对用户信息进行增删改查操作。
(2)店铺管理:可以处理店铺的申请信息,可以停用店铺的运营,商城将移出该店铺的所有信息,也可以恢复店铺的运营。
(3)轮播图管理:对轮播图信息增删改查的操作和选用轮播图。
后端:springboot(Spring+SpringMVC+Mybatis)
前端:HTML,jquery,Thymeleaf,Layui
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 @Controller @RequestMapping("/evaluate") public class EvaluateController { @Autowired private EvaImgService evaImgService; @Autowired private EvaluateService evaluateService; @Autowired private OrderService orderService; @Autowired private GoodsService goodsService; @Autowired private StoreService storeService; @RequestMapping("/uploadEvaImg") @ResponseBody public JSONObject uploadEvaImg (@PathParam(value = "file") MultipartFile file, HttpServletRequest request) { String name = file.getOriginalFilename(); JSONObject jsonObject = new JSONObject(); String path = "E:/IdeaProjects/ec_system/src/main/resources/static/img/evaImg/" + name; try { file.transferTo(new File(path)); jsonObject.put("evaImg" , name); jsonObject.put("code" , 0 ); } catch (IOException e) { e.printStackTrace(); jsonObject.put("code" , 1 ); } return jsonObject; } @RequestMapping("/Receiving") @ResponseBody public String Receiving (@RequestParam(value = "orderId",required = true) Long orderId, @RequestParam(value = "fen",required = true) String fen, @RequestParam(value = "receiving",required = true) String text, HttpSession session) { int receiving = 0 ;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 public String toAddGoods () { return "/admin/addGoods" ; } @RequestMapping(value = "/upload") @ResponseBody public JSONObject upUserImg (@RequestParam(value = "file") MultipartFile file) throws IOException { if (file.isEmpty()) { throw new IOException("上传文件不能为空" ); } String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("." )+1 ); File path = new File(ResourceUtils.getURL("classpath:static" ).getPath()); if (!path.exists()) { path = new File("" ); } File upload = new File(path.getAbsolutePath(),"/img/header/goods/" ); if (!upload.exists()) { upload.mkdirs(); } String fileName = new Date().getTime()+"." +fileExt; File dest = new File(upload.getAbsolutePath()+"/" +fileName); file.transferTo(dest); FileUtils.copyFile(dest, new File(Constants.UPLOAD_IMG_PATH+File.separator+"goods" +File.separator+fileName)); JSONObject jsonObject = new JSONObject(); jsonObject.put("goodsImg" , fileName); return jsonObject; } @RequestMapping("/addGoods") @ResponseBody public String addGoods (Goods goods) { int rs = goodsService.addGoods(goods); if (rs>0 ){ return "success" ; }else { return "fail" ; } } @RequestMapping("/updateGoods") @ResponseBody public String updateGoods (Goods goods) { int rs = goodsService.updateGoods(goods); if (rs>0 ){ return "success" ; }else { return "fail" ; } } @RequestMapping("/getAllGoodsByStore")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 if (fen.equals("5星" )){ receiving = 5 ; } OrderDetail orderDetail = orderService.selectGoodsIdByOrderId(orderId); Orderinfo orderinfo = orderService.selectOrderByOrderId(orderId); int userId = (int ) session.getAttribute("userId" ); Evaluate evaluate = new Evaluate(); evaluate.setEvaUser(userId); evaluate.setEvaGoods(orderDetail.getDetailGoods()); evaluate.setEvaContent(text); evaluate.setEvaLevel(receiving); evaluate.setEvaDate(new Date()); evaluate.setEvaStore(orderinfo.getOrderStore()); evaluate.setEvaState(1 ); int i = evaluateService.insertEvaluate(evaluate); int j = goodsService.getGoodsByOK(orderId); if (i == 1 && j == 1 ){ return "success" ; }else { return "flag" ; } } @RequestMapping("/getAllEva") @ResponseBody public List<Evaluate2> getAllEva (HttpSession httpSession) { int userId = (int ) httpSession.getAttribute("userId" ); List<Evaluate2> evaluate2List = evaluateService.getAllEva2(userId); return evaluate2List; } @RequestMapping("/getCountWhereO") @ResponseBody public int getCountWhereO (HttpSession httpSession) { int userId = (int ) httpSession.getAttribute("userId" ); Store store = storeService.selectByUserId(userId); int count = evaluateService.getCountWhereO(store.getStoreId()); return count; } @RequestMapping("/getCountWhereF") @ResponseBody public int getCountWhereF (HttpSession httpSession) { int userId = (int ) httpSession.getAttribute("userId" ); Store store = storeService.selectByUserId(userId); int count = evaluateService.getCountWhereF(store.getStoreId()); return count; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 @Override public Store getByGoodsId (int goodsId) { return storeMapper.getByGoodsId(goodsId); } @Override public Store getByStoreId (int storeId) { return storeMapper.selectByPrimaryKey(storeId); } } @Controller @RequestMapping("admin") public class AdminController { @Autowired private AdminService adminService;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 public String checkByPhone (@PathVariable String userPhone) { String msg = "" ; User user = userService.getByPhone(userPhone); if (user == null ) { msg = "ok" ; } else { msg = "fail" ; } return msg; } @RequestMapping("/checkByPhone2/{userPhone}/{userId}") @ResponseBody public String checkByPhone2 (@PathVariable String userPhone, @PathVariable int userId) { String msg = "" ; User user = userService.getByPhone2(userPhone, userId); if (user == null ) { msg = "ok" ; } else { msg = "fail" ; } return msg; } @RequestMapping("/checkByEmail/{userEmail}") @ResponseBody public String checkByEmail (@PathVariable String userEmail) { String msg = "" ; User user = userService.getByEmail(userEmail); if (user == null ) { msg = "ok" ; } else { msg = "fail" ; } return msg; } @RequestMapping("/checkByEmail2/{userEmail}/{userId}") @ResponseBody public String checkByEmail2 (@PathVariable String userEmail, @PathVariable int userId) { String msg = "" ; User user = userService.getByEmail2(userEmail, userId); if (user == null ) { msg = "ok" ; } else { msg = "fail" ;
——————————PayStart——————————
项目链接: https://javayms.github.io?id=051524190701201jq https://javayms.pages.dev?id=051524190701201jq