当前位置: 首页 > wzjs >正文

动态公司网站设计全国装饰100强排名

动态公司网站设计,全国装饰100强排名,网站设计seo,湘潭网站建设速来磐石网络文章目录 一、项目演示二、项目介绍三、运行截图四、主要代码1.提交订单代码2.添加商品代码3.查询购物车代码 一、项目演示 项目演示地址: 视频地址 二、项目介绍 项目描述:这是一个基于SpringBootVue框架开发的服装商城系统。首先,这是一…

文章目录

  • 一、项目演示
  • 二、项目介绍
  • 三、运行截图
  • 四、主要代码
    • 1.提交订单代码
    • 2.添加商品代码
    • 3.查询购物车代码

一、项目演示

项目演示地址: 视频地址

二、项目介绍

项目描述:这是一个基于SpringBoot+Vue框架开发的服装商城系统。首先,这是一个前后端分离的项目,代码简洁规范,注释说明详细,易于理解和学习。其次,这项目功能丰富,具有一个服装商城系统该有的所有功能。

项目功能:此项目分为两个角色:普通用户管理员普通用户有登录注册、浏览商品信息、管理个人购物车信息、提交订单、评价订单、管理个人地址信息、管理个人订单信息、管理个人评价信息等等功能。管理员有登录、查看数据统计信息、管理所有用户信息、管理所有商品信息、管理所有商品分类信息、管理所有订单信息、管理所有评价信息等等功能。

应用技术:SpringBoot + Vue3.0 + MySQL + MyBatis + Redis + ElementUI-Plus + Vite

运行环境:IntelliJ IDEA2019.3.5 + MySQL5.7 + Redis5.0.5 + JDK1.8 + Maven3.6.3 + Node14.16.1 + Visual Studio Code(以上工具在项目压缩包中都自带)

三、运行截图

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

四、主要代码

1.提交订单代码

 /*** 提交订单操作* @param orderDTO* @return*/@Overridepublic ResponseDTO<Boolean> submitOrder(OrderDTO orderDTO) {if(CommonUtil.isEmpty(orderDTO.getUserId())) {return ResponseDTO.errorByMsg(CodeMsg.DATA_ERROR);}// 进行统一表单验证CodeMsg validate = ValidateEntityUtil.validate(orderDTO);if (!validate.getCode().equals(CodeMsg.SUCCESS.getCode())) {return ResponseDTO.errorByMsg(validate);}User user = userMapper.selectByPrimaryKey(orderDTO.getUserId());if(user == null) {return ResponseDTO.errorByMsg(CodeMsg.USER_NOT_EXIST);}// 查出购物车数据CartExample cartExample = new CartExample();cartExample.createCriteria().andUserIdEqualTo(orderDTO.getUserId()).andIdIn(orderDTO.getCartIdList());List<Cart> cartList = cartMapper.selectByExample(cartExample);for(Cart cart : cartList) {Product product = productMapper.selectByPrimaryKey(cart.getProductId());if(product == null) {CodeMsg codeMsg = CodeMsg.PRODUCT_NOT_EXIST;codeMsg.setMsg("有商品信息已经不存在,请刷新页面!");return ResponseDTO.errorByMsg(codeMsg);}Stock stock = stockMapper.selectByPrimaryKey(cart.getStockId());if(stock == null) {CodeMsg codeMsg = CodeMsg.STOCK_NOT_EXIST;codeMsg.setMsg("商品[" + product.getName() + "]的规格已经不存在,请删除商品重新选择!");return ResponseDTO.errorByMsg(codeMsg);}if(cart.getQuantity() > stock.getNum()) {CodeMsg codeMsg = CodeMsg.STOCK_NUM_ERROR;codeMsg.setMsg("商品[" + product.getName() + "]的库存不足,请刷新页面更新库存信息!");return ResponseDTO.errorByMsg(codeMsg);}}BigDecimal totalPrice = new BigDecimal("0");Order order = CopyUtil.copy(orderDTO, Order.class);order.setId(UuidUtil.getShortUuid());order.setCreateTime(new Date());// 减库存加销量for(Cart cart : cartList) {Product product = productMapper.selectByPrimaryKey(cart.getProductId());product.setSellNum(product.getSellNum() + cart.getQuantity());Stock stock = stockMapper.selectByPrimaryKey(cart.getStockId());stock.setNum(stock.getNum() - cart.getQuantity());if(productMapper.updateByPrimaryKeySelective(product) == 0) {throw new RuntimeException(CodeMsg.ORDER_ADD_ERROR.getMsg());}if(stockMapper.updateByPrimaryKeySelective(stock) == 0) {throw new RuntimeException(CodeMsg.ORDER_ADD_ERROR.getMsg());}totalPrice = totalPrice.add(product.getPrice().multiply(new BigDecimal(cart.getQuantity())));OrderItem orderItem = new OrderItem();orderItem.setId(UuidUtil.getShortUuid());orderItem.setOrderId(order.getId());orderItem.setProductPrice(product.getPrice());orderItem.setProductName(product.getName());orderItem.setProductId(product.getId());orderItem.setQuantity(cart.getQuantity());orderItem.setSumPrice(new BigDecimal(cart.getQuantity()).multiply(product.getPrice()));orderItem.setProductScale(stock.getName());orderItem.setStockId(stock.getId());// 获取商品封面图片PictureExample pictureExample = new PictureExample();pictureExample.createCriteria().andProductIdEqualTo(product.getId()).andSortEqualTo(1);List<Picture> pictureList = pictureMapper.selectByExample(pictureExample);if(pictureList.size() > 0) {orderItem.setProductPhoto(pictureList.get(0).getPhoto());}if(orderItemMapper.insertSelective(orderItem) == 0) {throw new RuntimeException(CodeMsg.ORDER_ADD_ERROR.getMsg());}}order.setTotalPrice(totalPrice);order.setState(OrderStateEnum.WAIT.getCode());// 清空购物车数据cartMapper.deleteByExample(cartExample);if(orderMapper.insertSelective(order) == 0) {throw new RuntimeException(CodeMsg.ORDER_ADD_ERROR.getMsg());}return ResponseDTO.successByMsg(true, "下单成功!");}

2.添加商品代码

  /*** 保存商品信息* @param productDTO* @return*/@Overridepublic ResponseDTO<Boolean> saveProduct(ProductDTO productDTO) {// 进行统一表单验证CodeMsg validate = ValidateEntityUtil.validate(productDTO);if (!validate.getCode().equals(CodeMsg.SUCCESS.getCode())) {return ResponseDTO.errorByMsg(validate);}Product product = CopyUtil.copy(productDTO, Product.class);if(CommonUtil.isEmpty(product.getId())) {// 添加操作product.setId(UuidUtil.getShortUuid());product.setCreateTime(new Date());if(productMapper.insertSelective(product) == 0) {return ResponseDTO.errorByMsg(CodeMsg.PRODUCT_ADD_ERROR);}} else {// 修改操作if(productMapper.updateByPrimaryKeySelective(product) == 0) {return ResponseDTO.errorByMsg(CodeMsg.PRODUCT_EDIT_ERROR);}// 图集数据落地batchInsertPicture(productDTO.getPhotoList(), product.getId());}return ResponseDTO.successByMsg(true, "保存成功!");}

3.查询购物车代码

  /*** 查询购物车信息* @param cartDTO* @return*/@Overridepublic ResponseDTO<List<CartDTO>> getCartList(CartDTO cartDTO) {if(CommonUtil.isEmpty(cartDTO.getUserId()) && CommonUtil.isEmpty(cartDTO.getId())) {return ResponseDTO.errorByMsg(CodeMsg.DATA_ERROR);}CartExample cartExample = new CartExample();CartExample.Criteria criteria = cartExample.createCriteria();if(!CommonUtil.isEmpty(cartDTO.getUserId())) {criteria.andUserIdEqualTo(cartDTO.getUserId());}if(!CommonUtil.isEmpty(cartDTO.getId())) {criteria.andIdIn(Arrays.asList(cartDTO.getId().split(";")));// where id in (?,?)}List<Cart> cartList = cartMapper.selectByExample(cartExample);List<CartDTO> cartDTOList = CopyUtil.copyList(cartList, CartDTO.class);for(CartDTO cart : cartDTOList) {Product product = productMapper.selectByPrimaryKey(cart.getProductId());ProductDTO productDTO = CopyUtil.copy(Optional.ofNullable(product).orElse(new Product()), ProductDTO.class);PictureExample pictureExample = new PictureExample();pictureExample.createCriteria().andProductIdEqualTo(productDTO.getId());pictureExample.setOrderByClause("sort asc, id asc");List<Picture> pictureList = pictureMapper.selectByExample(pictureExample);List<String> photoList = pictureList.stream().map(Picture::getPhoto).collect(Collectors.toList());productDTO.setPhotoList(photoList);cart.setProductDTO(productDTO);Stock stock = stockMapper.selectByPrimaryKey(cart.getStockId());cart.setStockDTO(CopyUtil.copy(Optional.ofNullable(stock).orElse(new Stock()), StockDTO.class));}return ResponseDTO.success(cartDTOList);}

文章转载自:

http://pVYzAjfH.tfnLy.cn
http://q37Szruc.tfnLy.cn
http://GkqJTTKZ.tfnLy.cn
http://bPu58SN8.tfnLy.cn
http://lrM9oqRW.tfnLy.cn
http://ET1t9xUx.tfnLy.cn
http://2O6WZfdu.tfnLy.cn
http://hpWxUYBx.tfnLy.cn
http://QD6OPB1i.tfnLy.cn
http://NI0sYdMd.tfnLy.cn
http://YOJpcQKf.tfnLy.cn
http://Tns9DRkx.tfnLy.cn
http://etNXuaf7.tfnLy.cn
http://6esPzm9G.tfnLy.cn
http://Ips3Mzt2.tfnLy.cn
http://mQKiHZb2.tfnLy.cn
http://24czQ7jH.tfnLy.cn
http://E7X7341t.tfnLy.cn
http://BG0dgbko.tfnLy.cn
http://XEToJwB8.tfnLy.cn
http://ifDeaQIn.tfnLy.cn
http://jrtBClcO.tfnLy.cn
http://CXsvTwBG.tfnLy.cn
http://Ru0Gt9X6.tfnLy.cn
http://0Byt0phw.tfnLy.cn
http://A6fFTufC.tfnLy.cn
http://2GkeXHml.tfnLy.cn
http://Gfi3ys1G.tfnLy.cn
http://VdeMbOh2.tfnLy.cn
http://IrY24XwJ.tfnLy.cn
http://www.dtcms.com/wzjs/733691.html

相关文章:

  • 黄冈网站推广都有哪些渠道wordpress 论坛偷笑
  • 突泉建设局三务公开网站做网站搜爬闪
  • 网站运营新手做山东青岛网站建设公司哪家专业
  • 西安企业网站大学生网页设计作业
  • 深圳龙岗区网站建设跨境经验分享
  • 蓝色脚手架织梦企业网站模板20个排版漂亮的网页设计
  • 山东省建设执业资格注册管理中心网站建立网站平台需要多少钱
  • 云南昆明网站建设公司蚌埠本地网站
  • vps网站无法通过ip访问网上服务大厅用户登录
  • 厦门网站设计公司哪家好福建电商小程序厦门开发公司长沙网站seo报价
  • 郑州达云通网站建设公司怎么样苏州市建设工程信息网
  • 牛商网网站建设多少钱网站开发流程详细介绍
  • 网站ftp地址查询苏州本地网站有哪些
  • 更改各网站企业信息怎么做安阳做网站哪家好
  • 无锡企业网站排名优化网站设计不包括
  • 新的网站设计公司工商服务平台
  • 网站二级目录打不开几分钟做网站
  • 公司网站上传图库投资建设集团网站
  • 潍坊个人做网站旅游网站开发毕业设计论文
  • 网站 开发 价格网页布局设计技术包括
  • 建站魔方极速网站建设做网站用什么语言快
  • 仙居做网站在哪里做中国数控机床网
  • 汽车配件响应式网站家装公司加盟哪个公司好
  • 做设备开通哪个网站好宁波大型网站推广服务
  • 电商网站的模块网站利润
  • 河南手机网站建设多少钱北海网站设计公司
  • 服务号开发随州seo
  • 长沙网站制作培训商城网站建设开发多少钱
  • 网站特色怎么写广州室内设计公司排行榜
  • 网站后台发布文章横琴网站建设公司