From 53efa6436e82752333a2441287ca86fff7c6f0f1 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Fri, 29 Dec 2023 18:58:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86=E3=80=81?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=88=86=E7=B1=BB=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../huoran/common/response/ResponseEnum.java | 2 +- .../common/response/ServerResponseEntity.java | 26 +-- .../com/huoran/common/utils/JwtUtils.java | 4 +- .../com/huoran/common/utils/TokenUtils.java | 6 +- .../controller/CategoryController.java | 159 ++++++++++++++++++ .../nakadai/controller/OrderController.java | 115 +++++++++++-- .../controller/PickAddrController.java | 5 - .../PlatformTeamAccountController.java | 2 +- .../nakadai/controller/ProductController.java | 130 +++++++------- .../controller/ShopDetailController.java | 8 +- .../nakadai/controller/SpecController.java | 2 +- .../nakadai/entity/app/dto/BasketItemDto.java | 4 +- .../nakadai/entity/app/dto/ProductDto.java | 2 +- .../entity/app/dto/ProductItemDto.java | 4 +- .../nakadai/entity/app/dto/ShopCartDto.java | 2 +- .../entity/app/dto/ShopCartItemDto.java | 2 +- .../entity/app/dto/ShopCartOrderDto.java | 2 +- .../huoran/nakadai/entity/app/dto/SkuDto.java | 2 +- .../entity/app/param/ChangeShopCartParam.java | 4 +- .../entity/app/param/OrderItemParam.java | 6 +- .../entity/app/param/ProdCommParam.java | 2 +- .../huoran/nakadai/entity/dto/ProductDto.java | 2 +- .../nakadai/entity/dto/SearchProdDto.java | 2 +- .../huoran/nakadai/entity/model/Basket.java | 4 +- .../huoran/nakadai/entity/model/Category.java | 6 +- .../nakadai/entity/model/CategoryProp.java | 2 +- .../huoran/nakadai/entity/model/Order.java | 5 +- .../nakadai/entity/model/OrderItem.java | 6 +- .../huoran/nakadai/entity/model/PickAddr.java | 2 +- .../huoran/nakadai/entity/model/ProdComm.java | 2 +- .../huoran/nakadai/entity/model/ProdImg.java | 4 +- .../huoran/nakadai/entity/model/ProdProp.java | 7 +- .../nakadai/entity/model/ProdPropValue.java | 6 +- .../huoran/nakadai/entity/model/ProdTag.java | 5 +- .../entity/model/ProdTagReference.java | 5 +- .../huoran/nakadai/entity/model/Product.java | 47 +++--- .../nakadai/entity/model/ShopDetail.java | 2 +- .../com/huoran/nakadai/entity/model/Sku.java | 27 ++- .../nakadai/entity/model/UserCollection.java | 5 +- .../nakadai/entity/param/OrderParam.java | 2 +- .../nakadai/entity/param/ProductParam.java | 20 ++- .../nakadai/entity/param/ShopDetailParam.java | 6 +- .../huoran/nakadai/mapper/BasketMapper.java | 2 +- .../huoran/nakadai/mapper/CategoryMapper.java | 40 +++++ .../nakadai/mapper/CategoryPropMapper.java | 2 +- .../mapper/PlatformTeamAccountMapper.java | 2 + .../huoran/nakadai/mapper/ProdCommMapper.java | 4 +- .../huoran/nakadai/mapper/ProdPropMapper.java | 4 +- .../nakadai/mapper/ProdPropValueMapper.java | 4 +- .../mapper/ProdTagReferenceMapper.java | 6 +- .../huoran/nakadai/mapper/ProductMapper.java | 6 +- .../com/huoran/nakadai/mapper/SkuMapper.java | 8 +- .../nakadai/mapper/xml/CategoryMapper.xml | 55 ++++++ .../mapper/xml/PlatformTeamAccountMapper.xml | 5 + .../huoran/nakadai/service/BasketService.java | 4 +- .../nakadai/service/CategoryService.java | 65 +++++++ .../service/PlatformTeamAccountService.java | 2 + .../nakadai/service/ProdCommService.java | 4 +- .../nakadai/service/ProdPropService.java | 2 +- .../service/ProdTagReferenceService.java | 2 +- .../nakadai/service/ProductService.java | 6 +- .../nakadai/service/ShopDetailService.java | 6 +- .../huoran/nakadai/service/SkuService.java | 6 +- .../service/impl/BasketServiceImpl.java | 8 +- .../service/impl/CategoryServiceImpl.java | 145 ++++++++++++++++ .../service/impl/OrderServiceImpl.java | 4 +- .../impl/PlatformTeamAccountServiceImpl.java | 7 + .../service/impl/ProdCommServiceImpl.java | 4 +- .../service/impl/ProdPropServiceImpl.java | 2 +- .../impl/ProdTagReferenceServiceImpl.java | 2 +- .../service/impl/ProductServiceImpl.java | 18 +- .../service/impl/ShopDetailServiceImpl.java | 6 +- .../nakadai/service/impl/SkuServiceImpl.java | 6 +- 73 files changed, 846 insertions(+), 247 deletions(-) create mode 100644 nakadai/src/main/java/com/huoran/nakadai/controller/CategoryController.java create mode 100644 nakadai/src/main/java/com/huoran/nakadai/mapper/CategoryMapper.java create mode 100644 nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CategoryMapper.xml create mode 100644 nakadai/src/main/java/com/huoran/nakadai/service/CategoryService.java create mode 100644 nakadai/src/main/java/com/huoran/nakadai/service/impl/CategoryServiceImpl.java diff --git a/common/src/main/java/com/huoran/common/response/ResponseEnum.java b/common/src/main/java/com/huoran/common/response/ResponseEnum.java index 619b083..f628815 100644 --- a/common/src/main/java/com/huoran/common/response/ResponseEnum.java +++ b/common/src/main/java/com/huoran/common/response/ResponseEnum.java @@ -18,7 +18,7 @@ public enum ResponseEnum { /** * ok */ - OK("00000", "ok"), + OK("200", "ok"), SHOW_FAIL("A00001", ""), /** diff --git a/common/src/main/java/com/huoran/common/response/ServerResponseEntity.java b/common/src/main/java/com/huoran/common/response/ServerResponseEntity.java index f17aec7..51befd1 100644 --- a/common/src/main/java/com/huoran/common/response/ServerResponseEntity.java +++ b/common/src/main/java/com/huoran/common/response/ServerResponseEntity.java @@ -39,7 +39,7 @@ public class ServerResponseEntity implements Serializable { /** * 版本 */ - private String version; +// private String version; /** * 时间 @@ -81,13 +81,13 @@ public class ServerResponseEntity implements Serializable { return this; } - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } +// public String getVersion() { +// return version; +// } +// +// public void setVersion(String version) { +// this.version = version; +// } public Long getTimestamp() { return timestamp; @@ -104,10 +104,10 @@ public class ServerResponseEntity implements Serializable { return !Objects.equals(ResponseEnum.OK.value(), this.code); } - public ServerResponseEntity() { - // 版本号 - this.version = "mall4j.v230424"; - } +// public ServerResponseEntity() { +// // 版本号 +// this.version = "mall4j.v230424"; +// } public static ServerResponseEntity success(T data) { ServerResponseEntity serverResponseEntity = new ServerResponseEntity<>(); @@ -190,7 +190,7 @@ public class ServerResponseEntity implements Serializable { "code='" + code + '\'' + ", msg='" + msg + '\'' + ", data=" + data + - ", version='" + version + '\'' + +// ", version='" + version + '\'' + ", timestamp=" + timestamp + ", sign='" + sign + '\'' + '}'; diff --git a/common/src/main/java/com/huoran/common/utils/JwtUtils.java b/common/src/main/java/com/huoran/common/utils/JwtUtils.java index 17101ba..3f0fcd7 100644 --- a/common/src/main/java/com/huoran/common/utils/JwtUtils.java +++ b/common/src/main/java/com/huoran/common/utils/JwtUtils.java @@ -33,8 +33,8 @@ public class JwtUtils { } public static void main(String[] args) { -// String jwtToken = getJwtToken("108"); -// System.out.println(jwtToken); + String jwtToken = getJwtToken("1",1L,1); + System.out.println(jwtToken); // boolean jwtToken = checkToken("\n" + // "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiaWF0IjoxNjk4OTkwNzc3LCJleHAiOjE2OTk4NTQ3NzcsImFjY291bnRJZCI6IjMxIn0.PkzSpCHaRNtFd2k0ik4zfqg0KhoYR1e-r51lbb1S0nc"); diff --git a/common/src/main/java/com/huoran/common/utils/TokenUtils.java b/common/src/main/java/com/huoran/common/utils/TokenUtils.java index e681d98..6ca1a49 100644 --- a/common/src/main/java/com/huoran/common/utils/TokenUtils.java +++ b/common/src/main/java/com/huoran/common/utils/TokenUtils.java @@ -46,14 +46,14 @@ public class TokenUtils { return (String)claims.get("accountId"); } - public static Long getShopIdByJwtToken(HttpServletRequest request) { + public static Integer getShopIdByJwtToken(HttpServletRequest request) { String jwtToken = request.getHeader("token"); if(StringUtils.isEmpty(jwtToken)) { - return 0L; + return 0; } Jws claimsJws = Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(jwtToken); Claims claims = claimsJws.getBody(); - return (Long)claims.get("shopId"); + return (Integer)claims.get("shopId"); } public static Integer getPlatformIdByJwtToken(HttpServletRequest request) { diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/CategoryController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/CategoryController.java new file mode 100644 index 0000000..29d3b0e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/CategoryController.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. + * + * https://www.mall4j.com/ + * + * 未经允许,不可做商业用途! + * + * 版权所有,侵权必究! + */ + +package com.huoran.nakadai.controller; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.huoran.common.exception.YamiShopBindException; +import com.huoran.common.response.ServerResponseEntity; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.app.dto.CategoryDto; +import com.huoran.nakadai.entity.model.Category; +import com.huoran.nakadai.entity.model.Product; +import com.huoran.nakadai.service.CategoryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +/** + * @author lanhai + */ +@RestController +@RequestMapping("/category") +@Api(tags = "商品分类管理") +public class CategoryController { + + @Autowired + private CategoryService categoryService; + + + /** + * 分类信息列表接口 + */ + @GetMapping("/categoryInfo") + @ApiOperation(value = "根据父id查询分类列表") + public ServerResponseEntity> categoryInfo( + @RequestParam(value = "parentId", defaultValue = "0") Long parentId) { + List categories = categoryService.listByParentId(parentId); + List categoryDtos = BeanUtil.copyToList(categories, CategoryDto.class); + return ServerResponseEntity.success(categoryDtos); + } + + + /** + * 获取菜单页面的表 + * @return + */ + @GetMapping("/list") + @ApiOperation(value = "获取店铺所有分类列表") + public ServerResponseEntity> table(HttpServletRequest request){ + List categoryMenuList = categoryService.tableCategory(TokenUtils.getShopIdByJwtToken(request)); + return ServerResponseEntity.success(categoryMenuList); + } + + /** + * 获取分类信息 + */ + @GetMapping("/info") + @ApiOperation(value = "获取分类信息") + public ServerResponseEntity info(@RequestParam("categoryId") Long categoryId){ + Category category = categoryService.getById(categoryId); + return ServerResponseEntity.success(category); + } + + + + /** + * 保存分类 + */ + @PostMapping("/save") + @ApiOperation(value = "保存分类信息") + public ServerResponseEntity save(@RequestBody Category category,HttpServletRequest request){ + category.setShopId(TokenUtils.getShopIdByJwtToken(request)); + category.setRecTime(new Date()); + Category categoryName = categoryService.getOne(new LambdaQueryWrapper().eq(Category::getCategoryName,category.getCategoryName()) + .eq(Category::getShopId,category.getShopId())); + if(categoryName != null){ + throw new YamiShopBindException("类目名称已存在!"); + } + categoryService.saveCategory(category); + return ServerResponseEntity.success(); + } + + /** + * 更新分类 + */ + @PostMapping("/update") + @ApiOperation(value = "更新分类信息") + public ServerResponseEntity update(@RequestBody Category category,HttpServletRequest request){ + category.setShopId(TokenUtils.getShopIdByJwtToken(request)); + if (Objects.equals(category.getParentId(),category.getCategoryId())) { + return ServerResponseEntity.showFailMsg("分类的上级不能是自己本身"); + } + Category categoryName = categoryService.getOne(new LambdaQueryWrapper().eq(Category::getCategoryName,category.getCategoryName()) + .eq(Category::getShopId,category.getShopId()).ne(Category::getCategoryId,category.getCategoryId())); + if(categoryName != null){ + throw new YamiShopBindException("类目名称已存在!"); + } + Category categoryDb = categoryService.getById(category.getCategoryId()); + // 如果从下线改成正常,则需要判断上级的状态 + if (Objects.equals(categoryDb.getStatus(),0) && Objects.equals(category.getStatus(),1) && !Objects.equals(category.getParentId(),0L)){ + Category parentCategory = categoryService.getOne(new LambdaQueryWrapper().eq(Category::getCategoryId, category.getParentId())); + if(Objects.isNull(parentCategory) || Objects.equals(parentCategory.getStatus(),0)){ + // 修改失败,上级分类不存在或者不为正常状态 + throw new YamiShopBindException("修改失败,上级分类不存在或者不为正常状态"); + } + } + categoryService.updateCategory(category); + return ServerResponseEntity.success(); + } + + /** + * 删除分类 + */ + @PostMapping("/delete") + @ApiOperation(value = "删除分类信息") + public ServerResponseEntity delete(@RequestParam("categoryId") Long categoryId){ + if (categoryService.count(new LambdaQueryWrapper().eq(Category::getParentId,categoryId)) >0) { + return ServerResponseEntity.showFailMsg("请删除子分类,再删除该分类"); + } + categoryService.deleteCategory(categoryId); + return ServerResponseEntity.success(); + } + + /** + * 所有的 + */ + @GetMapping("/listCategory") + public ServerResponseEntity> listCategory(HttpServletRequest request){ + return ServerResponseEntity.success(categoryService.list(new LambdaQueryWrapper() + .le(Category::getGrade, 2) + .eq(Category::getShopId, TokenUtils.getShopIdByJwtToken(request)) + .orderByAsc(Category::getSeq))); + } + + /** + * 所有的产品分类 + */ + @GetMapping("/listProdCategory") + public ServerResponseEntity> listProdCategory(HttpServletRequest request){ + List categories = categoryService.treeSelect(TokenUtils.getShopIdByJwtToken(request),2); + return ServerResponseEntity.success(categories); + } + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/OrderController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/OrderController.java index 02aac08..a149a4d 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/OrderController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/OrderController.java @@ -10,6 +10,8 @@ package com.huoran.nakadai.controller; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.IORuntimeException; @@ -21,18 +23,24 @@ import com.google.common.base.Objects; import com.huoran.common.exception.YamiShopBindException; import com.huoran.common.response.ServerResponseEntity; import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.app.dto.*; +import com.huoran.nakadai.entity.app.param.OrderParam; +import com.huoran.nakadai.entity.app.param.OrderShopParam; +import com.huoran.nakadai.entity.app.param.SubmitOrderParam; import com.huoran.nakadai.entity.enums.OrderStatus; import com.huoran.nakadai.entity.model.Order; import com.huoran.nakadai.entity.model.OrderItem; +import com.huoran.nakadai.entity.model.UserAddr; import com.huoran.nakadai.entity.model.UserAddrOrder; import com.huoran.nakadai.entity.param.DeliveryOrderParam; -import com.huoran.nakadai.entity.param.OrderParam; import com.huoran.nakadai.service.OrderItemService; import com.huoran.nakadai.service.OrderService; import com.huoran.nakadai.service.ProductService; import com.huoran.nakadai.service.SkuService; +import com.huoran.nakadai.utils.Arith; import com.huoran.nakadai.utils.PageParam; +import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Sheet; import org.springframework.beans.factory.annotation.Autowired; @@ -42,11 +50,15 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; +import static com.huoran.nakadai.utils.SpringContextUtils.applicationContext; + /** * @author lgh on 2018/09/15. */ @@ -61,34 +73,103 @@ public class OrderController { @Autowired private OrderItemService orderItemService; -// @Autowired -// private UserAddrOrderService userAddrOrderService; - @Autowired private ProductService productService; @Autowired private SkuService skuService; + +// @PostMapping("/sendInquiryForm") +// @ApiOperation(value = "根据店铺发送询价单给商家或留言") +// public ServerResponseEntity confirm(@Valid @RequestBody OrderParam orderParam,HttpServletRequest request) { +// String userId = SecurityUtils.getUser().getUserId(); +// TokenUtils.getShopIdByJwtToken(request); +// // 订单的地址信息 +// UserAddr userAddr = userAddrService.getUserAddrByUserId(orderParam.getAddrId(), userId); +// UserAddrDto userAddrDto = BeanUtil.copyProperties(userAddr, UserAddrDto.class); +// +// +// // 组装获取用户提交的购物车商品项 +// List shopCartItems = basketService.getShopCartItemsByOrderItems(orderParam.getBasketIds(),orderParam.getOrderItem(),userId); +// +// if (CollectionUtil.isEmpty(shopCartItems)) { +// throw new YamiShopBindException("请选择您需要的商品加入购物车"); +// } +// +// // 根据店铺组装购车中的商品信息,返回每个店铺中的购物车商品信息 +// List shopCarts = basketService.getShopCarts(shopCartItems); +// +// // 将要返回给前端的完整的订单信息 +// ShopCartOrderMergerDto shopCartOrderMergerDto = new ShopCartOrderMergerDto(); +// +// shopCartOrderMergerDto.setUserAddr(userAddrDto); +// +// // 所有店铺的订单信息 +// List shopCartOrders = new ArrayList<>(); +// +// double actualTotal = 0.0; +// double total = 0.0; +// int totalCount = 0; +// double orderReduce = 0.0; +// for (ShopCartDto shopCart : shopCarts) { +// +// // 每个店铺的订单信息 +// ShopCartOrderDto shopCartOrder = new ShopCartOrderDto(); +// shopCartOrder.setShopId(shopCart.getShopId()); +// shopCartOrder.setShopName(shopCart.getShopName()); +// +// +// List shopCartItemDiscounts = shopCart.getShopCartItemDiscounts(); +// +// // 店铺中的所有商品项信息 +// List shopAllShopCartItems = new ArrayList<>(); +// for (ShopCartItemDiscountDto shopCartItemDiscount : shopCartItemDiscounts) { +// List discountShopCartItems = shopCartItemDiscount.getShopCartItems(); +// shopAllShopCartItems.addAll(discountShopCartItems); +// } +// +// shopCartOrder.setShopCartItemDiscounts(shopCartItemDiscounts); +// +// applicationContext.publishEvent(new ConfirmOrderEvent(shopCartOrder,orderParam,shopAllShopCartItems)); +// +// actualTotal = Arith.add(actualTotal,shopCartOrder.getActualTotal()); +// total = Arith.add(total,shopCartOrder.getTotal()); +// totalCount = totalCount + shopCartOrder.getTotalCount(); +// orderReduce = Arith.add(orderReduce,shopCartOrder.getShopReduce()); +// shopCartOrders.add(shopCartOrder); +// +// +// } +// +// shopCartOrderMergerDto.setActualTotal(actualTotal); +// shopCartOrderMergerDto.setTotal(total); +// shopCartOrderMergerDto.setTotalCount(totalCount); +// shopCartOrderMergerDto.setShopCartOrders(shopCartOrders); +// shopCartOrderMergerDto.setOrderReduce(orderReduce); +// +// shopCartOrderMergerDto = orderService.putConfirmOrderCache(userId, shopCartOrderMergerDto); +// +// return ServerResponseEntity.success(shopCartOrderMergerDto); +// } + /** * 分页获取 */ - @GetMapping("/page") - public ServerResponseEntity> page(OrderParam orderParam, PageParam page, HttpServletRequest request) { - Long shopId = TokenUtils.getShopIdByJwtToken(request); - orderParam.setShopId(shopId); - IPage orderPage = orderService.pageOrdersDetailByOrderParam(page, orderParam); - return ServerResponseEntity.success(orderPage); - - - } +// @GetMapping("/page") +// public ServerResponseEntity> page(OrderParam orderParam, PageParam page, HttpServletRequest request) { +// Integer shopId = TokenUtils.getShopIdByJwtToken(request); +// orderParam.setShopId(shopId); +// IPage orderPage = orderService.pageOrdersDetailByOrderParam(page, orderParam); +// return ServerResponseEntity.success(orderPage); +// } /** * 获取信息 */ @GetMapping("/orderInfo/{orderNumber}") public ServerResponseEntity info(@PathVariable("orderNumber") String orderNumber,HttpServletRequest request) { - Long shopId = TokenUtils.getShopIdByJwtToken(request); + Integer shopId = TokenUtils.getShopIdByJwtToken(request); Order order = orderService.getOrderByOrderNumber(orderNumber); if (!Objects.equal(shopId, order.getShopId())) { throw new YamiShopBindException("您没有权限获取该订单信息"); @@ -105,7 +186,7 @@ public class OrderController { */ @PutMapping("/delivery") public ServerResponseEntity delivery(@RequestBody DeliveryOrderParam deliveryOrderParam,HttpServletRequest request) { - Long shopId = TokenUtils.getShopIdByJwtToken(request); + Integer shopId = TokenUtils.getShopIdByJwtToken(request); Order order = orderService.getOrderByOrderNumber(deliveryOrderParam.getOrderNumber()); if (!Objects.equal(shopId, order.getShopId())) { throw new YamiShopBindException("您没有权限修改该订单信息"); @@ -141,7 +222,7 @@ public class OrderController { public void waitingConsignmentExcel(Order order, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime, String consignmentName, String consignmentMobile, String consignmentAddr, HttpServletResponse response,HttpServletRequest request) { - Long shopId = TokenUtils.getShopIdByJwtToken(request); + Integer shopId = TokenUtils.getShopIdByJwtToken(request); order.setShopId(shopId); order.setStatus(OrderStatus.PADYED.value()); List orders = orderService.listOrdersDetailByOrder(order, startTime, endTime); @@ -194,7 +275,7 @@ public class OrderController { @GetMapping("/soldExcel") public void soldExcel(Order order, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime, HttpServletResponse response,HttpServletRequest request) { - Long shopId = TokenUtils.getShopIdByJwtToken(request); + Integer shopId = TokenUtils.getShopIdByJwtToken(request); order.setShopId(shopId); order.setIsPayed(1); List orders = orderService.listOrdersDetailByOrder(order, startTime, endTime); diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PickAddrController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PickAddrController.java index 81ec51a..3f4fb1b 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/PickAddrController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PickAddrController.java @@ -30,11 +30,6 @@ import java.util.Arrays; import java.util.Objects; - -/** - * - * @author lgh on 2018/10/17. - */ @RestController @RequestMapping("/shop/pickAddr") public class PickAddrController { diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java index 10707a7..681daf6 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java @@ -190,7 +190,7 @@ public class PlatformTeamAccountController { @ApiOperation(value = "获取当前平台用户的团队信息", response = PartnerAccountResp.class) @GetMapping("/getTeamsByPlatformId") public R getTeamsByPlatformId(@ApiParam(name = "platformId", value = "平台id") @RequestParam Integer platformId, HttpServletRequest request) { - String accountId = TokenUtils.getIdByJwtToken(request); + String accountId = platformTeamAccountService.getCurrentPlatformAccount(TokenUtils.getIdByJwtToken(request), platformId); return platformTeamAccountService.getTeamsByPlatformId(accountId, platformId); } diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java index ed837eb..5454ffb 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java @@ -21,12 +21,16 @@ import com.huoran.common.utils.TokenUtils; import com.huoran.nakadai.entity.model.Product; import com.huoran.nakadai.entity.model.Sku; import com.huoran.nakadai.entity.param.ProductParam; +import com.huoran.nakadai.entity.res.PlatformTeamAccountResp; import com.huoran.nakadai.service.BasketService; import com.huoran.nakadai.service.ProdTagReferenceService; import com.huoran.nakadai.service.ProductService; import com.huoran.nakadai.service.SkuService; import com.huoran.nakadai.utils.Json; import com.huoran.nakadai.utils.PageParam; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -37,19 +41,14 @@ import java.util.List; import java.util.Objects; -/** - * 商品列表、商品发布controller - * - * @author lgh - */ +@Api(tags = "商品列表、商品发布管理") @RestController -@RequestMapping("/prod/prod") +@RequestMapping("/prod") public class ProductController { @Autowired private ProductService productService; - @Autowired private SkuService skuService; @@ -59,11 +58,10 @@ public class ProductController { @Autowired private BasketService basketService; - /** - * 分页获取商品信息 - */ @GetMapping("/page") - public ServerResponseEntity> page(ProductParam product, PageParam page,HttpServletRequest request) { + @ApiOperation(value = "分页获取商品信息", response = Product.class) + public ServerResponseEntity> page(ProductParam product,HttpServletRequest request) { + PageParam page = new PageParam<>(); IPage products = productService.page(page, new LambdaQueryWrapper() .like(StrUtil.isNotBlank(product.getProdName()), Product::getProdName, product.getProdName()) @@ -73,11 +71,10 @@ public class ProductController { return ServerResponseEntity.success(products); } - /** - * 获取信息 - */ - @GetMapping("/info/{prodId}") - public ServerResponseEntity info(@PathVariable("prodId") Long prodId, HttpServletRequest request) { + + @GetMapping("/info") + @ApiOperation(value = "获取商品信息", response = Product.class) + public ServerResponseEntity info(@RequestParam("prodId") Integer prodId, HttpServletRequest request) { Product prod = productService.getProductByProdId(prodId); if (!Objects.equals(prod.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { throw new YamiShopBindException("没有权限获取该商品规格信息"); @@ -86,23 +83,21 @@ public class ProductController { prod.setSkuList(skuList); //获取分组标签 - List listTagId = prodTagReferenceService.listTagIdByProdId(prodId); - prod.setTagList(listTagId); +// List listTagId = prodTagReferenceService.listTagIdByProdId(prodId); +// prod.setTagList(listTagId); return ServerResponseEntity.success(prod); } - /** - * 保存 - */ - @PostMapping + @PostMapping("/save") + @ApiOperation(value = "保存商品信息") public ServerResponseEntity save(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) { checkParam(productParam); Product product = BeanUtil.copyProperties(productParam, Product.class); - product.setDeliveryMode(Json.toJsonString(productParam.getDeliveryModeVo())); +// product.setDeliveryMode(Json.toJsonString(productParam.getDeliveryModeVo())); product.setShopId(TokenUtils.getShopIdByJwtToken(request)); product.setUpdateTime(new Date()); - if (product.getStatus() == 1) { + if (product.getStatus() == 0) { product.setPutawayTime(new Date()); } product.setCreateTime(new Date()); @@ -110,10 +105,9 @@ public class ProductController { return ServerResponseEntity.success(); } - /** - * 修改 - */ - @PutMapping + + @PostMapping("/update") + @ApiOperation(value = "修改商品信息") public ServerResponseEntity update(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) { checkParam(productParam); Product dbProduct = productService.getProductByProdId(productParam.getProdId()); @@ -123,23 +117,22 @@ public class ProductController { List dbSkus = skuService.listByProdId(dbProduct.getProdId()); - Product product = BeanUtil.copyProperties(productParam, Product.class); - product.setDeliveryMode(Json.toJsonString(productParam.getDeliveryModeVo())); +// product.setDeliveryMode(Json.toJsonString(productParam.getDeliveryModeVo())); product.setUpdateTime(new Date()); - if (dbProduct.getStatus() == 0 || productParam.getStatus() == 1) { + if (productParam.getStatus() == 1) { product.setPutawayTime(new Date()); } dbProduct.setSkuList(dbSkus); productService.updateProduct(product, dbProduct); - List userIds = basketService.listUserIdByProdId(product.getProdId()); - - for (String userId : userIds) { - basketService.removeShopCartItemsCacheByUserId(userId); - } +// List userIds = basketService.listUserIdByProdId(product.getProdId()); +// +// for (String userId : userIds) { +// basketService.removeShopCartItemsCacheByUserId(userId); +// } for (Sku sku : dbSkus) { skuService.removeSkuCacheBySkuId(sku.getSkuId(), sku.getProdId()); } @@ -149,7 +142,7 @@ public class ProductController { /** * 删除 */ - public ServerResponseEntity delete(Long prodId,HttpServletRequest request) { + public ServerResponseEntity delete(Integer prodId,HttpServletRequest request) { Product dbProduct = productService.getProductByProdId(prodId); if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { throw new YamiShopBindException("无法获取非本店铺商品信息"); @@ -163,31 +156,32 @@ public class ProductController { } - List userIds = basketService.listUserIdByProdId(prodId); - - for (String userId : userIds) { - basketService.removeShopCartItemsCacheByUserId(userId); - } +// List userIds = basketService.listUserIdByProdId(prodId); +// +// for (String userId : userIds) { +// basketService.removeShopCartItemsCacheByUserId(userId); +// } return ServerResponseEntity.success(); } - /** - * 批量删除 - */ - @DeleteMapping - public ServerResponseEntity batchDelete(@RequestBody Long[] prodIds,HttpServletRequest request) { - for (Long prodId : prodIds) { + @PostMapping("/batchDelete") + @ApiOperation(value = "批量删除商品信息") + public ServerResponseEntity batchDelete(@RequestBody Integer[] prodIds,HttpServletRequest request) { + for (Integer prodId : prodIds) { delete(prodId,request); } return ServerResponseEntity.success(); } - /** - * 更新商品状态 - */ - @PutMapping("/prodStatus") - public ServerResponseEntity shopStatus(@RequestParam Long prodId, @RequestParam Integer prodStatus) { + + @PostMapping("/prodStatus") + @ApiOperation(value = "更新商品状态") + public ServerResponseEntity shopStatus( + @ApiParam(value = "商品id") + @RequestParam Integer prodId, + @ApiParam(value = "prodStatus:默认是1,表示上架, 2下架,3草稿,4审核,0为删除") + @RequestParam Integer prodStatus) { Product product = new Product(); product.setProdId(prodId); product.setStatus(prodStatus); @@ -196,25 +190,25 @@ public class ProductController { } productService.updateById(product); productService.removeProductCacheByProdId(prodId); - List userIds = basketService.listUserIdByProdId(prodId); - - for (String userId : userIds) { - basketService.removeShopCartItemsCacheByUserId(userId); - } +// List userIds = basketService.listUserIdByProdId(prodId); +// +// for (String userId : userIds) { +// basketService.removeShopCartItemsCacheByUserId(userId); +// } return ServerResponseEntity.success(); } private void checkParam(ProductParam productParam) { - if (CollectionUtil.isEmpty(productParam.getTagList())) { - throw new YamiShopBindException("请选择产品分组"); - } - - Product.DeliveryModeVO deliveryMode = productParam.getDeliveryModeVo(); - boolean hasDeliverMode = deliveryMode != null - && (deliveryMode.getHasShopDelivery() || deliveryMode.getHasUserPickUp()); - if (!hasDeliverMode) { - throw new YamiShopBindException("请选择配送方式"); - } +// if (CollectionUtil.isEmpty(productParam.getTagList())) { +// throw new YamiShopBindException("请选择产品分组"); +// } + +// Product.DeliveryModeVO deliveryMode = productParam.getDeliveryModeVo(); +// boolean hasDeliverMode = deliveryMode != null +// && (deliveryMode.getHasShopDelivery() || deliveryMode.getHasUserPickUp()); +// if (!hasDeliverMode) { +// throw new YamiShopBindException("请选择配送方式"); +// } List skuList = productParam.getSkuList(); boolean isAllUnUse = true; for (Sku sku : skuList) { diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ShopDetailController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ShopDetailController.java index cb91c71..b761523 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/ShopDetailController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ShopDetailController.java @@ -49,7 +49,7 @@ public class ShopDetailController { @PutMapping("/isDistribution") public ServerResponseEntity updateIsDistribution(@RequestParam Integer isDistribution, HttpServletRequest request){ ShopDetail shopDetail=new ShopDetail(); - Long shopId = TokenUtils.getShopIdByJwtToken(request); + Integer shopId = TokenUtils.getShopIdByJwtToken(request); shopDetail.setShopId(shopId); shopDetail.setIsDistribution(isDistribution); shopDetailService.updateById(shopDetail); @@ -83,7 +83,7 @@ public class ShopDetailController { * 获取信息 */ @GetMapping("/info/{shopId}") - public ServerResponseEntity info(@PathVariable("shopId") Long shopId){ + public ServerResponseEntity info(@PathVariable("shopId") Integer shopId){ ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(shopId); // 店铺图片 return ServerResponseEntity.success(shopDetail); @@ -117,7 +117,7 @@ public class ShopDetailController { * 删除 */ @DeleteMapping("/{id}") - public ServerResponseEntity delete(@PathVariable Long id){ + public ServerResponseEntity delete(@PathVariable Integer id){ shopDetailService.deleteShopDetailByShopId(id); return ServerResponseEntity.success(); } @@ -126,7 +126,7 @@ public class ShopDetailController { * 更新店铺状态 */ @PutMapping("/shopStatus") - public ServerResponseEntity shopStatus(@RequestParam Long shopId,@RequestParam Integer shopStatus){ + public ServerResponseEntity shopStatus(@RequestParam Integer shopId,@RequestParam Integer shopStatus){ ShopDetail shopDetail = new ShopDetail(); shopDetail.setShopId(shopId); shopDetail.setShopStatus(shopStatus); diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/SpecController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/SpecController.java index 71868b3..da53e67 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/SpecController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/SpecController.java @@ -104,7 +104,7 @@ public class SpecController { * 删除 */ @DeleteMapping("/{id}") - public ServerResponseEntity delete(@PathVariable Long id,HttpServletRequest request) { + public ServerResponseEntity delete(@PathVariable Integer id,HttpServletRequest request) { prodPropService.deleteProdPropAndValues(id, ProdPropRule.SPEC.value(), TokenUtils.getShopIdByJwtToken(request)); return ServerResponseEntity.success(); } diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/BasketItemDto.java b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/BasketItemDto.java index ded117d..2e88615 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/BasketItemDto.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/BasketItemDto.java @@ -37,10 +37,10 @@ public class BasketItemDto implements Serializable { private String shopName; @ApiModelProperty(value = "产品ID" , required = true) - private Long prodId; + private Integer prodId; @ApiModelProperty(value = "skuID" , required = true) - private Long skuId; + private Integer skuId; @ApiModelProperty(value = "产品个数" , required = true) private Integer prodCount; diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ProductDto.java b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ProductDto.java index 52c8748..d49ee38 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ProductDto.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ProductDto.java @@ -37,7 +37,7 @@ public class ProductDto { * 商品ID */ // @Schema(description = "商品ID" , required = true) - private Long prodId; + private Integer prodId; /** * 商品名称 diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ProductItemDto.java b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ProductItemDto.java index 4a4a144..30b008b 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ProductItemDto.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ProductItemDto.java @@ -39,10 +39,10 @@ public class ProductItemDto implements Serializable { private Double productTotalAmount; @ApiModelProperty(value = "产品ID" ,required=true) - private Long prodId; + private Integer prodId; @ApiModelProperty(value = "skuId" ,required=true) - private Long skuId; + private Integer skuId; @ApiModelProperty(value = "规格名称" , required = true) private String skuName; diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartDto.java b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartDto.java index 513d28e..3d3d518 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartDto.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartDto.java @@ -23,7 +23,7 @@ import java.util.List; public class ShopCartDto implements Serializable { @ApiModelProperty(value = "店铺ID" , required = true) - private Long shopId; + private Integer shopId; @ApiModelProperty(value = "店铺名称" , required = true) private String shopName; diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartItemDto.java b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartItemDto.java index 7da9e2f..4482786 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartItemDto.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartItemDto.java @@ -29,7 +29,7 @@ public class ShopCartItemDto extends ProductItemDto implements Serializable { private Long basketId; @ApiModelProperty(value = "店铺ID" , required = true) - private Long shopId; + private Integer shopId; @ApiModelProperty(value = "规格名称" , required = true) private String skuName; diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartOrderDto.java b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartOrderDto.java index 284d365..12aafd8 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartOrderDto.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartOrderDto.java @@ -24,7 +24,7 @@ import java.util.List; public class ShopCartOrderDto implements Serializable{ @ApiModelProperty(value = "店铺id" , required = true) - private Long shopId; + private Integer shopId; @ApiModelProperty(value = "店铺名称" , required = true) private String shopName; diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/SkuDto.java b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/SkuDto.java index cfac785..a1e9351 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/SkuDto.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/SkuDto.java @@ -25,7 +25,7 @@ public class SkuDto implements Serializable { private static final long serialVersionUID = 6457261945829470666L; @ApiModelProperty(value = "skuId" , required = true) - private Long skuId; + private Integer skuId; @ApiModelProperty(value = "价格" , required = true) private Double price; @ApiModelProperty(value = "原价" ) diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/app/param/ChangeShopCartParam.java b/nakadai/src/main/java/com/huoran/nakadai/entity/app/param/ChangeShopCartParam.java index fabb38c..73a44b8 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/app/param/ChangeShopCartParam.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/app/param/ChangeShopCartParam.java @@ -26,11 +26,11 @@ public class ChangeShopCartParam { @NotNull(message = "商品ID不能为空") @ApiModelProperty(value = "商品ID" , required = true) - private Long prodId; + private Integer prodId; @NotNull(message = "skuId不能为空") @ApiModelProperty(value = "skuId" , required = true) - private Long skuId; + private Integer skuId; @NotNull(message = "店铺ID不能为空") @ApiModelProperty(value = "店铺ID" , required = true) diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/app/param/OrderItemParam.java b/nakadai/src/main/java/com/huoran/nakadai/entity/app/param/OrderItemParam.java index dfec563..e6a94e0 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/app/param/OrderItemParam.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/app/param/OrderItemParam.java @@ -25,11 +25,11 @@ public class OrderItemParam { @NotNull(message = "产品ID不能为空") @ApiModelProperty(value = "产品ID" ,required=true) - private Long prodId; + private Integer prodId; @NotNull(message = "skuId不能为空") @ApiModelProperty(value = "skuId" ,required=true) - private Long skuId; + private Integer skuId; @NotNull(message = "产品数量不能为空") @Min(value = 1,message = "产品数量不能为空") @@ -38,7 +38,7 @@ public class OrderItemParam { @NotNull(message = "店铺id不能为空") @ApiModelProperty(value = "店铺id" ,required=true) - private Long shopId; + private Integer shopId; @ApiModelProperty(value = "推广员使用的推销卡号" ) private String distributionCardNo; diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/app/param/ProdCommParam.java b/nakadai/src/main/java/com/huoran/nakadai/entity/app/param/ProdCommParam.java index 4c7070f..7343307 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/app/param/ProdCommParam.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/app/param/ProdCommParam.java @@ -25,7 +25,7 @@ public class ProdCommParam { * 商品ID */ @ApiModelProperty(value = "商品id" ) - private Long prodId; + private Integer prodId; /** * 订单项ID */ diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/dto/ProductDto.java b/nakadai/src/main/java/com/huoran/nakadai/entity/dto/ProductDto.java index 08f0cd4..c5d5817 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/dto/ProductDto.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/dto/ProductDto.java @@ -24,7 +24,7 @@ public class ProductDto { /** * 商品ID */ - private Long prodId; + private Integer prodId; /** * 店铺id diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/dto/SearchProdDto.java b/nakadai/src/main/java/com/huoran/nakadai/entity/dto/SearchProdDto.java index c45f6d3..117a636 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/dto/SearchProdDto.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/dto/SearchProdDto.java @@ -20,7 +20,7 @@ import lombok.Data; public class SearchProdDto { // @Schema(description = "商品id" ) - private Long prodId; + private Integer prodId; // @Schema(description = "商品照片" ) private String pic; diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/Basket.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/Basket.java index 40ed0d6..b0d2323 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/Basket.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/Basket.java @@ -40,13 +40,13 @@ public class Basket implements Serializable { * 产品ID */ - private Long prodId; + private Integer prodId; /** * SkuID */ - private Long skuId; + private Integer skuId; /** * 用户ID diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/Category.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/Category.java index 21ca382..9b9a4da 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/Category.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/Category.java @@ -10,6 +10,7 @@ package com.huoran.nakadai.entity.model; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -30,14 +31,13 @@ public class Category implements Serializable { * 类目ID * */ - @TableId - + @TableId(type = IdType.AUTO) private Long categoryId; /** * 店铺id */ - private Long shopId; + private Integer shopId; /** * 父节点 diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/CategoryProp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/CategoryProp.java index 303dd3f..339c975 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/CategoryProp.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/CategoryProp.java @@ -36,5 +36,5 @@ public class CategoryProp implements Serializable { * 商品属性id即表tz_prod_prop中的prop_id */ - private Long propId; + private Integer propId; } \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/Order.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/Order.java index c3cb856..59ba124 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/Order.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/Order.java @@ -10,6 +10,7 @@ package com.huoran.nakadai.entity.model; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -30,13 +31,13 @@ public class Order implements Serializable { /** * 订单ID */ - @TableId + @TableId(type = IdType.AUTO) private Long orderId; /** * 店铺id */ - private Long shopId; + private Integer shopId; /** * 产品名称,多个产品将会以逗号隔开 diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/OrderItem.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/OrderItem.java index b847a73..3afead7 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/OrderItem.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/OrderItem.java @@ -33,7 +33,7 @@ public class OrderItem implements Serializable { private Long orderItemId; - private Long shopId; + private Integer shopId; /** * 订单sub_number @@ -45,13 +45,13 @@ public class OrderItem implements Serializable { * 产品ID */ - private Long prodId; + private Integer prodId; /** * 产品SkuID */ - private Long skuId; + private Integer skuId; /** * 购物车产品个数 diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/PickAddr.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/PickAddr.java index 0528c38..7be80d4 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/PickAddr.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/PickAddr.java @@ -77,6 +77,6 @@ public class PickAddr implements Serializable { /** * 店铺id */ - private Long shopId; + private Integer shopId; } \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdComm.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdComm.java index 823ac23..6b23d71 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdComm.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdComm.java @@ -41,7 +41,7 @@ public class ProdComm implements Serializable{ /** * 商品ID */ - private Long prodId; + private Integer prodId; /** * 订单项ID */ diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdImg.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdImg.java index ad234f1..fea93fd 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdImg.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdImg.java @@ -33,13 +33,13 @@ public class ProdImg implements Serializable { * 产品ID */ - private Long prodId; + private Integer prodId; /** * skuID(商品通用图片 skuid为0) */ - private Long skuId; + private Integer skuId; /** * 文件路径 diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdProp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdProp.java index 0a00b5b..d159cb1 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdProp.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdProp.java @@ -10,6 +10,7 @@ package com.huoran.nakadai.entity.model; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -32,8 +33,8 @@ public class ProdProp implements Serializable { /** * 属性id */ - @TableId - private Long propId; + @TableId(type = IdType.AUTO) + private Integer propId; /** * 属性名称 @@ -46,7 +47,7 @@ public class ProdProp implements Serializable { */ private Integer rule; - private Long shopId; + private Integer shopId; /** * 属性值 diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdPropValue.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdPropValue.java index b4bf0c4..d7c6b00 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdPropValue.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdPropValue.java @@ -10,6 +10,7 @@ package com.huoran.nakadai.entity.model; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -30,8 +31,7 @@ public class ProdPropValue implements Serializable{ /** * 属性值ID */ - @TableId - + @TableId(type = IdType.AUTO) private Long valueId; /** @@ -44,6 +44,6 @@ public class ProdPropValue implements Serializable{ * 属性ID */ - private Long propId; + private Integer propId; } \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdTag.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdTag.java index 11c87bc..8562571 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdTag.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdTag.java @@ -10,6 +10,7 @@ package com.huoran.nakadai.entity.model; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -31,7 +32,7 @@ public class ProdTag implements Serializable { /** * 分组标签id */ - @TableId + @TableId(type = IdType.AUTO) private Long id; /** * 分组标题 @@ -40,7 +41,7 @@ public class ProdTag implements Serializable { /** * 店铺Id */ - private Long shopId; + private Integer shopId; /** * 状态(1为正常,0为删除) */ diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdTagReference.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdTagReference.java index f7a6380..f247da8 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdTagReference.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdTagReference.java @@ -10,6 +10,7 @@ package com.huoran.nakadai.entity.model; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -31,7 +32,7 @@ public class ProdTagReference implements Serializable{ /** * 分组引用id */ - @TableId + @TableId(type = IdType.AUTO) private Long referenceId; /** * 店铺id @@ -44,7 +45,7 @@ public class ProdTagReference implements Serializable{ /** * 商品id */ - private Long prodId; + private Integer prodId; /** * 状态(1:正常,0:删除) */ diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/Product.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/Product.java index 4b171fb..7ca8c40 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/Product.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/Product.java @@ -10,12 +10,12 @@ package com.huoran.nakadai.entity.model; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.annotation.Version; +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Date; import java.util.List; @@ -31,47 +31,57 @@ public class Product implements Serializable { /** * 商品ID */ - @TableId - private Long prodId; + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "产品ID") + private Integer prodId; /** * 店铺id */ - private Long shopId; + @ApiModelProperty(value = "店铺id") + private Integer shopId; + + + @ApiModelProperty(value = "商品名称") + private String prodName; + /** - * 商品名称 + * 商品价格 */ - private String prodName; + @ApiModelProperty(value = "商品价格") + private Double price; /** - * 原价 + * 商品价格 */ + @ApiModelProperty(value = "商品原价") private Double oriPrice; /** - * 现价 + * 库存量 */ - private Double price; + @ApiModelProperty(value = "库存量") + private Integer totalStocks; /** * 简要描述,卖点等 */ + @ApiModelProperty(value = "简要描述,卖点等") private String brief; - /** - * 商品主图 - */ + @ApiModelProperty(value = "商品主图") private String pic; /** * 商品图片 */ + @ApiModelProperty(value = "商品图片") private String imgs; - /** * 默认是1,表示正常状态, -1表示删除, 0下架 */ + @ApiModelProperty(value = "默认是1,表示上架, 2下架,3草稿,4审核,0为删除") private Integer status; /** @@ -84,11 +94,6 @@ public class Product implements Serializable { */ private Integer soldNum; - /** - * 库存量 - */ - private Integer totalStocks; - /** * 配送方式json */ diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ShopDetail.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ShopDetail.java index a55c81b..02e49a6 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/ShopDetail.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/ShopDetail.java @@ -28,7 +28,7 @@ public class ShopDetail implements Serializable{ * 店铺id */ @TableId - private Long shopId; + private Integer shopId; /** * 店铺名称(数字、中文,英文(可混合,不可有特殊字符),可修改)、不唯一 diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/Sku.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/Sku.java index 7a0b91a..1aeb5cb 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/Sku.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/Sku.java @@ -10,8 +10,10 @@ package com.huoran.nakadai.entity.model; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; @@ -27,96 +29,115 @@ public class Sku implements Serializable { /** * 单品ID */ - @TableId - private Long skuId; + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "单品ID") + private Integer skuId; /** * 商品ID */ - private Long prodId; + @ApiModelProperty(value = "商品ID") + private Integer prodId; /** * 销售属性组合字符串,格式是p1:v1;p2:v2 */ + @ApiModelProperty(value = "销售属性组合字符串,格式是p1:v1;p2:v2") private String properties; /** * 原价 */ + @ApiModelProperty(value = "原价") private Double oriPrice; /** * 价格 */ + @ApiModelProperty(value = "价格") private Double price; /** * 库存 */ + @ApiModelProperty(value = "库存") private Integer stocks; /** * 实际库存 */ + @ApiModelProperty(value = "实际库存") private Integer actualStocks; /** * 修改时间 */ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "修改时间") private Date updateTime; /** * 记录时间 */ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "记录时间") private Date recTime; /** * 商家编码 */ + @ApiModelProperty(value = "商家编码",hidden = true) private String partyCode; /** * 商品条形码 */ + @ApiModelProperty(value = "商品条形码",hidden = true) private String modelId; /** * sku图片 */ + @ApiModelProperty(value = "sku图片") private String pic; /** * sku名称 */ + @ApiModelProperty(value = "sku名称") private String skuName; /** * 商品名称 */ + @ApiModelProperty(value = "商品名称") private String prodName; + @ApiModelProperty(value = "版本号") private Integer version; /** * 重量 */ + @ApiModelProperty(value = "重量",hidden = true) private Double weight; /** * 体积 */ + @ApiModelProperty(value = "体积",hidden = true) private Double volume; /** * 状态:0禁用 1 启用 */ + @ApiModelProperty(value = "状态:0禁用 1 启用") private Integer status; /** * 0 正常 1 已被删除 */ + @ApiModelProperty(value = "0 正常 1 已被删除") private Integer isDelete; } diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/model/UserCollection.java b/nakadai/src/main/java/com/huoran/nakadai/entity/model/UserCollection.java index 6512461..27f95b0 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/model/UserCollection.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/model/UserCollection.java @@ -10,6 +10,7 @@ package com.huoran.nakadai.entity.model; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -33,12 +34,12 @@ public class UserCollection implements Serializable{ /** * 收藏表 */ - @TableId + @TableId(type = IdType.AUTO) private Long id; /** * 商品id */ - private Long prodId; + private Integer prodId; /** * 用户id */ diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/param/OrderParam.java b/nakadai/src/main/java/com/huoran/nakadai/entity/param/OrderParam.java index f71d6b9..4bceb82 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/param/OrderParam.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/param/OrderParam.java @@ -23,7 +23,7 @@ public class OrderParam { /** * 店铺id */ - private Long shopId; + private Integer shopId; /** * 订单状态 -1 已取消 0:待付款 1:待发货 2:待收货 3:已完成 diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java b/nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java index 36e8564..c2812f9 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java @@ -13,6 +13,7 @@ package com.huoran.nakadai.entity.param; import com.huoran.nakadai.entity.model.Product; import com.huoran.nakadai.entity.model.Sku; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotBlank; @@ -29,11 +30,13 @@ public class ProductParam { /** * 产品ID */ - private Long prodId; + @ApiModelProperty(value = "产品ID") + private Integer prodId; /** * 状态 */ + @ApiModelProperty(value = "默认是0,表示上架, 2下架,3草稿,4审核") private Integer status; /** @@ -41,6 +44,7 @@ public class ProductParam { */ @NotBlank(message = "商品名称不能为空") @Size(max = 200, message = "商品名称长度应该小于{max}") + @ApiModelProperty(value = "商品名称") private String prodName; @@ -48,64 +52,76 @@ public class ProductParam { * 商品价格 */ @NotNull(message = "请输入商品价格") + @ApiModelProperty(value = "商品价格") private Double price; /** * 商品价格 */ @NotNull(message = "请输入商品原价") + @ApiModelProperty(value = "商品原价") private Double oriPrice; /** * 库存量 */ @NotNull(message = "请输入商品库存") + @ApiModelProperty(value = "商品库存") private Integer totalStocks; /** * 简要描述,卖点等 */ @Size(max = 500, message = "商品卖点长度应该小于{max}") + @ApiModelProperty(value = "简要描述,卖点等") private String brief; @NotBlank(message = "请选择图片上传") + @ApiModelProperty(value = "商品主图") private String pic; /** * 商品图片 */ - @NotBlank(message = "请选择图片上传") +// @NotBlank(message = "请选择图片上传") + @ApiModelProperty(value = "商品图片",hidden = true) private String imgs; /** * 商品分类 */ @NotNull(message = "请选择商品分类") + @ApiModelProperty(value = "商品分类") private Long categoryId; /** * sku列表字符串 */ + @ApiModelProperty(value = "sku列表字符串") private List skuList; /** * content 商品详情 */ + @ApiModelProperty(value = "商品详情") private String content; /** * 是否能够用户自提 */ + @ApiModelProperty(value = "是否能够用户自提",hidden = true) private Product.DeliveryModeVO deliveryModeVo; /** * 运费模板id */ + @ApiModelProperty(value = "运费模板id",hidden = true) private Long deliveryTemplateId; /** * 分组标签列表 */ + @ApiModelProperty(value = "分组标签列表",hidden = true) private List tagList; } diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/param/ShopDetailParam.java b/nakadai/src/main/java/com/huoran/nakadai/entity/param/ShopDetailParam.java index 6d2e5cb..2a77c9e 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/param/ShopDetailParam.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/param/ShopDetailParam.java @@ -20,7 +20,7 @@ import javax.validation.constraints.Size; public class ShopDetailParam { - private Long shopId; + private Integer shopId; /** * 店铺名称(数字、中文,英文(可混合,不可有特殊字符),可修改)、不唯一 @@ -212,11 +212,11 @@ public class ShopDetailParam { this.shopStatus = shopStatus; } - public Long getShopId() { + public Integer getShopId() { return shopId; } - public void setShopId(Long shopId) { + public void setShopId(Integer shopId) { this.shopId = shopId; } diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/BasketMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/BasketMapper.java index 8cbd49e..1b84c8d 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/BasketMapper.java +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/BasketMapper.java @@ -70,6 +70,6 @@ public interface BasketMapper extends BaseMapper { * @param prodId * @return */ - List listUserIdByProdId(@Param("prodId")Long prodId); + List listUserIdByProdId(@Param("prodId")Integer prodId); } diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CategoryMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CategoryMapper.java new file mode 100644 index 0000000..eaf140b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CategoryMapper.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. + * + * https://www.mall4j.com/ + * + * 未经允许,不可做商业用途! + * + * 版权所有,侵权必究! + */ + +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.model.Category; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @author lanhai + */ +@Mapper +public interface CategoryMapper extends BaseMapper { + + /** + * 根据父级id获取分类列表 + * + * @param parentId + * @return + */ + List listByParentId(Long parentId); + + /** + * 根据店铺id获取分类列表 + * + * @param shopId + * @return + */ + List tableCategory(Integer shopId); +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CategoryPropMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CategoryPropMapper.java index b3d2498..93062b5 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/CategoryPropMapper.java +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CategoryPropMapper.java @@ -38,5 +38,5 @@ public interface CategoryPropMapper extends BaseMapper { * 根据属性id删除分类属性 * @param propId */ - void deleteByPropId(Long propId); + void deleteByPropId( Integer propId); } \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PlatformTeamAccountMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PlatformTeamAccountMapper.java index 8fe5830..280b776 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/PlatformTeamAccountMapper.java +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PlatformTeamAccountMapper.java @@ -45,4 +45,6 @@ public interface PlatformTeamAccountMapper extends BaseMapper { * @param prodId * @return */ - ProdCommDataDto getProdCommDataByProdId(@Param("prodId") Long prodId); + ProdCommDataDto getProdCommDataByProdId(@Param("prodId") Integer prodId); /** * 根据评价等级和商品id分页获取商品评价 @@ -36,7 +36,7 @@ public interface ProdCommMapper extends BaseMapper { * @param evaluate * @return */ - IPage getProdCommDtoPageByProdId(@Param("page") Page page, @Param("prodId") Long prodId, @Param("evaluate") Integer evaluate); + IPage getProdCommDtoPageByProdId(@Param("page") Page page, @Param("prodId") Integer prodId, @Param("evaluate") Integer evaluate); /** * 根据用户id分页获取评论列表 diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProdPropMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProdPropMapper.java index 541ebab..fa9ffa4 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProdPropMapper.java +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProdPropMapper.java @@ -44,7 +44,7 @@ public interface ProdPropMapper extends BaseMapper { * @param shopId * @return */ - int deleteByPropId(@Param("propId") Long propId, @Param("rule") Integer rule, @Param("shopId") Long shopId); + int deleteByPropId(@Param("propId") Integer propId, @Param("rule") Integer rule, @Param("shopId") Integer shopId); /** * 根据店铺id和属性名称获取商品属性 @@ -53,5 +53,5 @@ public interface ProdPropMapper extends BaseMapper { * @param rule * @return */ - ProdProp getProdPropByPropNameAndShopId(@Param("propName") String propName, @Param("shopId") Long shopId, @Param("rule") Integer rule); + ProdProp getProdPropByPropNameAndShopId(@Param("propName") String propName, @Param("shopId") Integer shopId, @Param("rule") Integer rule); } diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProdPropValueMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProdPropValueMapper.java index b754889..334362b 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProdPropValueMapper.java +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProdPropValueMapper.java @@ -26,11 +26,11 @@ public interface ProdPropValueMapper extends BaseMapper { * @param propId * @param prodPropValues */ - void insertPropValues(@Param("propId") Long propId, @Param("prodPropValues") List prodPropValues); + void insertPropValues(@Param("propId") Integer propId, @Param("prodPropValues") List prodPropValues); /** * 删除属性数值 * @param propId */ - void deleteByPropId(@Param("propId") Long propId); + void deleteByPropId(@Param("propId") Integer propId); } \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProdTagReferenceMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProdTagReferenceMapper.java index 094272a..667110b 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProdTagReferenceMapper.java +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProdTagReferenceMapper.java @@ -13,6 +13,7 @@ package com.huoran.nakadai.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huoran.nakadai.entity.model.ProdTagReference; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -23,6 +24,7 @@ import java.util.List; * @author hzm * @date 2019-04-18 16:28:01 */ +@Mapper public interface ProdTagReferenceMapper extends BaseMapper { /** * 插入标签 @@ -30,13 +32,13 @@ public interface ProdTagReferenceMapper extends BaseMapper { * @param prodId * @param tagList */ - void insertBatch(@Param("shopId") Long shopId, @Param("prodId") Long prodId, @Param("tagList") List tagList); + void insertBatch(@Param("shopId") Integer shopId, @Param("prodId") Integer prodId, @Param("tagList") List tagList); /** * 根据属性获取标签id列表 * @param prodId * @return */ - List listTagIdByProdId(@Param("prodId") Long prodId); + List listTagIdByProdId(@Param("prodId") Integer prodId); } diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductMapper.java index 14f98fb..cac78a0 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductMapper.java +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductMapper.java @@ -18,6 +18,7 @@ import com.huoran.nakadai.entity.app.dto.TagProductDto; import com.huoran.nakadai.entity.dto.SearchProdDto; import com.huoran.nakadai.entity.model.Product; import com.huoran.nakadai.utils.PageParam; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -26,6 +27,7 @@ import java.util.Map; /** * @author lanhai */ +@Mapper public interface ProductMapper extends BaseMapper { /** * 更新商品库存 @@ -40,13 +42,13 @@ public interface ProductMapper extends BaseMapper { * @param shopId * @return */ - Product getProductByProdNameAndShopId(@Param("prodName") String prodName, @Param("shopId") Long shopId); + Product getProductByProdNameAndShopId(@Param("prodName") String prodName, @Param("shopId") Integer shopId); /** * 返回库存 * @param prodCollect */ - void returnStock(@Param("prodCollect") Map prodCollect); + void returnStock(@Param("prodCollect") Map prodCollect); /** * 根据上架时间分页获取商品 diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/SkuMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/SkuMapper.java index b50b042..1de2cfe 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/SkuMapper.java +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/SkuMapper.java @@ -29,14 +29,14 @@ public interface SkuMapper extends BaseMapper { * @param prodId 商品id * @param skuList sku列表 */ - void insertBatch(@Param("prodId") Long prodId, @Param("skuList") List skuList); + void insertBatch(@Param("prodId") Integer prodId, @Param("skuList") List skuList); /** * 根据商品id获取商品sku列表 * @param prodId * @return */ - List listByProdId(Long prodId); + List listByProdId(Integer prodId); /** * 更新sku库存 @@ -49,12 +49,12 @@ public interface SkuMapper extends BaseMapper { * 根据商品id删除sku * @param prodId */ - void deleteByProdId(@Param("prodId") Long prodId); + void deleteByProdId(@Param("prodId") Integer prodId); /** * 返回sku库存 * @param skuCollect */ - void returnStock(@Param("skuCollect") Map skuCollect); + void returnStock(@Param("skuCollect") Map skuCollect); } \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CategoryMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CategoryMapper.xml new file mode 100644 index 0000000..dcac6a7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CategoryMapper.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml index 0df78b0..44a912a 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml @@ -162,4 +162,9 @@ a.app_open_id = #{openId} AND a.platform_id = #{platformId} and tc.is_team = 1 and ta.is_del = 0 + diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/BasketService.java b/nakadai/src/main/java/com/huoran/nakadai/service/BasketService.java index 31435cb..abb8aa3 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/BasketService.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/BasketService.java @@ -91,7 +91,7 @@ public interface BasketService extends IService { * @param prodId 商品id * @return 用户id */ - List listUserIdByProdId(Long prodId); + List listUserIdByProdId(Integer prodId); /** * 根据店铺组装购车中的商品信息,返回每个店铺中的购物车商品信息 @@ -107,6 +107,6 @@ public interface BasketService extends IService { * @param basketId 购物车id * @return 所有的商品购物项 */ - List getShopCartItemsByOrderItems(List basketId, OrderItemParam orderItem, String userId); + List getShopCartItemsByOrderItems(List basketId, OrderItemParam orderItem, String userId); } diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/CategoryService.java b/nakadai/src/main/java/com/huoran/nakadai/service/CategoryService.java new file mode 100644 index 0000000..5d28684 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/CategoryService.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. + * + * https://www.mall4j.com/ + * + * 未经允许,不可做商业用途! + * + * 版权所有,侵权必究! + */ + +package com.huoran.nakadai.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.model.Category; + +import java.util.List; + +/** + * @author lanhai + * 商品分类 + */ +public interface CategoryService extends IService { + + /** + * 根据parentId获取分类 + * @param parentId 0 一级分类 + * @return + */ + List listByParentId(Long parentId); + + /** + * 获取用于页面表单展现的category列表,根据seq排序 + * @param shopId 店铺id + * @return + */ + List tableCategory(Integer shopId); + + /** + * 保存分类、品牌、参数 + * @param category + */ + void saveCategory(Category category); + + /** + * 修改分类、品牌、参数 + * @param category + */ + void updateCategory(Category category); + + /** + * 删除分类、品牌、参数 以及分类对应的图片 + * @param categoryId 分类id + */ + void deleteCategory(Long categoryId); + + /** + * 根据店铺id和层级,获取商品分类树 + * @param shopId + * @param grade + * @return + */ + List treeSelect(Integer shopId,int grade); + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java index cdbe3f9..4e10acf 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java @@ -33,4 +33,6 @@ public interface PlatformTeamAccountService extends IService { * @param prodId * @return */ - ProdCommDataDto getProdCommDataByProdId(Long prodId); + ProdCommDataDto getProdCommDataByProdId(Integer prodId); /** * 根据用户id分页获取商品评论 @@ -48,7 +48,7 @@ public interface ProdCommService extends IService { * @param evaluate * @return */ - IPage getProdCommDtoPageByProdId(Page page, Long prodId, Integer evaluate); + IPage getProdCommDtoPageByProdId(Page page, Integer prodId, Integer evaluate); /** * 根据参数分页获取商品评价 diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ProdPropService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ProdPropService.java index 61ae2e9..370eebb 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/ProdPropService.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ProdPropService.java @@ -48,6 +48,6 @@ public interface ProdPropService extends IService { * @param propRule * @param shopId */ - void deleteProdPropAndValues(Long propId,Integer propRule,Long shopId); + void deleteProdPropAndValues( Integer propId,Integer propRule,Integer shopId); } diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ProdTagReferenceService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ProdTagReferenceService.java index bd8353d..d9c8207 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/ProdTagReferenceService.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ProdTagReferenceService.java @@ -28,5 +28,5 @@ public interface ProdTagReferenceService extends IService { * @param prodId * @return */ - List listTagIdByProdId(Long prodId); + List listTagIdByProdId(Integer prodId); } diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ProductService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ProductService.java index b8f2b24..355cc24 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/ProductService.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ProductService.java @@ -48,19 +48,19 @@ public interface ProductService extends IService { * @param prodId * @return */ - Product getProductByProdId(Long prodId); + Product getProductByProdId(Integer prodId); /** * 根据商品id删除商品 * @param prodId */ - void removeProductByProdId(Long prodId); + void removeProductByProdId(Integer prodId); /** * 根据商品id删除缓存 * @param prodId */ - void removeProductCacheByProdId(Long prodId); + void removeProductCacheByProdId(Integer prodId); /** * 根据上架时间倒序分页获取商品 diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ShopDetailService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ShopDetailService.java index bbb0813..498784e 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/ShopDetailService.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ShopDetailService.java @@ -29,18 +29,18 @@ public interface ShopDetailService extends IService { * 删除店铺详情 * @param id */ - void deleteShopDetailByShopId(Long id); + void deleteShopDetailByShopId(Integer id); /** * 根据店铺id获取店铺信息 * @param shopId * @return */ - ShopDetail getShopDetailByShopId(Long shopId); + ShopDetail getShopDetailByShopId(Integer shopId); /** * 根据店铺id删除店铺详情信息 * @param shopId */ - void removeShopDetailCacheByShopId(Long shopId); + void removeShopDetailCacheByShopId(Integer shopId); } diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/SkuService.java b/nakadai/src/main/java/com/huoran/nakadai/service/SkuService.java index 9243070..b8d2a7d 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/SkuService.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/SkuService.java @@ -26,19 +26,19 @@ public interface SkuService extends IService { * @param prodId 商品id * @return sku列表 */ - List listByProdId(Long prodId); + List listByProdId(Integer prodId); /** * 根据skuId获取sku信息(将会被缓存起来) * @param skuId * @return */ - Sku getSkuBySkuId(Long skuId); + Sku getSkuBySkuId(Integer skuId); /** * 根据商品id和skuId删除缓存 * @param skuId * @param prodId */ - void removeSkuCacheBySkuId(Long skuId,Long prodId); + void removeSkuCacheBySkuId(Integer skuId,Integer prodId); } diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/BasketServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/BasketServiceImpl.java index 3786bdf..7265b65 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/impl/BasketServiceImpl.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/BasketServiceImpl.java @@ -132,18 +132,18 @@ public class BasketServiceImpl extends ServiceImpl impleme } @Override - public List listUserIdByProdId(Long prodId) { + public List listUserIdByProdId(Integer prodId) { return basketMapper.listUserIdByProdId(prodId); } @Override public List getShopCarts(List shopCartItems) { // 根据店铺ID划分item - Map> shopCartMap = shopCartItems.stream().collect(Collectors.groupingBy(ShopCartItemDto::getShopId)); + Map> shopCartMap = shopCartItems.stream().collect(Collectors.groupingBy(ShopCartItemDto::getShopId)); // 返回一个店铺的所有信息 List shopCartDtos = Lists.newArrayList(); - for (Long shopId : shopCartMap.keySet()) { + for (Integer shopId : shopCartMap.keySet()) { //获取店铺的所有商品项 List shopCartItemDtoList = shopCartMap.get(shopId); @@ -164,7 +164,7 @@ public class BasketServiceImpl extends ServiceImpl impleme } @Override - public List getShopCartItemsByOrderItems(List basketId, OrderItemParam orderItem, String userId) { + public List getShopCartItemsByOrderItems(List basketId, OrderItemParam orderItem, String userId) { if (orderItem == null && CollectionUtil.isEmpty(basketId)) { return Collections.emptyList(); } diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CategoryServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CategoryServiceImpl.java new file mode 100644 index 0000000..c820380 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CategoryServiceImpl.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. + * + * https://www.mall4j.com/ + * + * 未经允许,不可做商业用途! + * + * 版权所有,侵权必究! + */ + +package com.huoran.nakadai.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; + +import com.huoran.nakadai.entity.model.Category; +import com.huoran.nakadai.mapper.CategoryMapper; +import com.huoran.nakadai.service.CategoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author lanhai + */ +@Service +public class CategoryServiceImpl extends ServiceImpl implements CategoryService { + + @Autowired + private CategoryMapper categoryMapper; + +// @Autowired +// private CategoryBrandMapper categoryBrandMapper; +// +// @Autowired +// private CategoryPropMapper categoryPropMapper; + + + @Override + public List listByParentId(Long parentId) { + return categoryMapper.listByParentId(parentId); + } + + @Override + public List tableCategory(Integer shopId) { + return categoryMapper.tableCategory(shopId); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void saveCategory(Category category) { + category.setRecTime(new Date()); + // 保存分类信息 + categoryMapper.insert(category); + +// insertBrandsAndAttributes(category); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateCategory(Category category) { + Category dbCategory = categoryMapper.selectById(category.getCategoryId()); + category.setUpdateTime(new Date()); + // 保存分类信息 + categoryMapper.updateById(category); + // 先删除后增加 +// deleteBrandsAndAttributes(category.getCategoryId()); +// insertBrandsAndAttributes(category); + // 如果以前有图片,并且图片与现在不同,则删除以前的图片 +// if (StrUtil.isNotBlank(dbCategory.getPic()) && !dbCategory.getPic().equals(category.getPic())) { +// attachFileService.deleteFile(dbCategory.getPic()); +// } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteCategory(Long categoryId) { + Category category = categoryMapper.selectById(categoryId); + categoryMapper.deleteById(categoryId); + +// deleteBrandsAndAttributes(categoryId); +// if (StrUtil.isNotBlank(category.getPic())) { +// attachFileService.deleteFile(category.getPic()); +// } + } + + +// private void deleteBrandsAndAttributes(Long categoryId) { +// // 删除所有分类所关联的品牌 +// categoryBrandMapper.deleteByCategoryId(categoryId); +// // 删除所有分类所关联的参数 +// categoryPropMapper.deleteByCategoryId(categoryId); +// } + +// private void insertBrandsAndAttributes(Category category) { +// //保存分类与品牌信息 +// if(CollUtil.isNotEmpty(category.getBrandIds())){ +// categoryBrandMapper.insertCategoryBrand(category.getCategoryId(), category.getBrandIds()); +// } +// +// //保存分类与参数信息 +// if(CollUtil.isNotEmpty(category.getAttributeIds())){ +// categoryPropMapper.insertCategoryProp(category.getCategoryId(), category.getAttributeIds()); +// } +// } + + @Override + public List treeSelect(Integer shopId,int grade) { + List categories = categoryMapper.selectList(new LambdaQueryWrapper().le(Category::getGrade,grade).eq(Category::getShopId,shopId)); + return categoryListToTree(categories); + } + + public List categoryListToTree(List categorys){ + if (CollectionUtils.isEmpty(categorys)) { + return Lists.newArrayList(); + } + Map> categoryMap = categorys.stream().collect(Collectors.groupingBy(Category::getParentId)); + + List rootList = categoryMap.get(0L); + transformCategoryTree(rootList,categoryMap); + return rootList; + } + + public void transformCategoryTree(List categorys,Map> categoryMap) { + for (Category category : categorys) { + List nextList = categoryMap.get(category.getCategoryId()); + if (CollectionUtils.isEmpty(nextList)) { + continue; + } + // 将排序完成的list设为下一层级 + category.setCategories(nextList); + // 处理下 下一层级 + transformCategoryTree(nextList, categoryMap); + } + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/OrderServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/OrderServiceImpl.java index fa993cd..75e4fc4 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/impl/OrderServiceImpl.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/OrderServiceImpl.java @@ -118,8 +118,8 @@ public class OrderServiceImpl extends ServiceImpl implements if (CollectionUtil.isEmpty(allOrderItems)) { return; } - Map prodCollect = new HashMap<>(16); - Map skuCollect = new HashMap<>(16); + Map prodCollect = new HashMap<>(16); + Map skuCollect = new HashMap<>(16); allOrderItems.stream().collect(Collectors.groupingBy(OrderItem::getProdId)).forEach((prodId, orderItems) -> { int prodTotalNum = orderItems.stream().mapToInt(OrderItem::getProdCount).sum(); diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java index ecdff9a..8d72cd7 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java @@ -134,6 +134,13 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl data = new HashedMap(); diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdCommServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdCommServiceImpl.java index 07ec8cf..98a402c 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdCommServiceImpl.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdCommServiceImpl.java @@ -37,7 +37,7 @@ public class ProdCommServiceImpl extends ServiceImpl i private ProdCommMapper prodCommMapper; @Override - public ProdCommDataDto getProdCommDataByProdId(Long prodId) { + public ProdCommDataDto getProdCommDataByProdId(Integer prodId) { ProdCommDataDto prodCommDataDto=prodCommMapper.getProdCommDataByProdId(prodId); //计算出好评率 if(prodCommDataDto.getPraiseNumber() == 0||prodCommDataDto.getNumber() == 0){ @@ -54,7 +54,7 @@ public class ProdCommServiceImpl extends ServiceImpl i } @Override - public IPage getProdCommDtoPageByProdId(Page page, Long prodId, Integer evaluate) { + public IPage getProdCommDtoPageByProdId(Page page, Integer prodId, Integer evaluate) { IPage prodCommDtos = prodCommMapper.getProdCommDtoPageByProdId(page, prodId, evaluate); prodCommDtos.getRecords().forEach(prodCommDto -> { diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdPropServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdPropServiceImpl.java index a60fc0b..c408fb0 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdPropServiceImpl.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdPropServiceImpl.java @@ -86,7 +86,7 @@ public class ProdPropServiceImpl extends ServiceImpl i @Override @Transactional(rollbackFor = Exception.class) - public void deleteProdPropAndValues(Long propId, Integer propRule, Long shopId) { + public void deleteProdPropAndValues( Integer propId, Integer propRule, Integer shopId) { int deleteRows = prodPropMapper.deleteByPropId(propId, propRule, shopId); if (deleteRows == 0) { return; diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdTagReferenceServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdTagReferenceServiceImpl.java index 20f0596..8514e24 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdTagReferenceServiceImpl.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdTagReferenceServiceImpl.java @@ -34,7 +34,7 @@ public class ProdTagReferenceServiceImpl extends ServiceImpl listTagIdByProdId(Long prodId) { + public List listTagIdByProdId(Integer prodId) { return prodTagReferenceMapper.listTagIdByProdId(prodId); } } diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductServiceImpl.java index 05d03b0..608a645 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductServiceImpl.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductServiceImpl.java @@ -51,8 +51,6 @@ public class ProductServiceImpl extends ServiceImpl impl private ProductMapper productMapper; @Autowired private SkuMapper skuMapper; -// @Autowired -// private AttachFileService attachFileService; @Autowired private ProdTagReferenceMapper prodTagReferenceMapper; @@ -65,7 +63,7 @@ public class ProductServiceImpl extends ServiceImpl impl if (CollectionUtil.isNotEmpty(product.getSkuList())) { skuMapper.insertBatch(product.getProdId(), product.getSkuList()); } - prodTagReferenceMapper.insertBatch(product.getShopId(), product.getProdId(), product.getTagList()); +// prodTagReferenceMapper.insertBatch(product.getShopId(), product.getProdId(), product.getTagList()); } @@ -78,7 +76,7 @@ public class ProductServiceImpl extends ServiceImpl impl public void updateProduct(Product product, Product dbProduct) { productMapper.updateById(product); - List dbSkuIds = dbProduct.getSkuList().stream().map(Sku::getSkuId).collect(Collectors.toList()); + List dbSkuIds = dbProduct.getSkuList().stream().map(Sku::getSkuId).collect(Collectors.toList()); // 将所有该商品的sku标记为已删除状态 skuMapper.deleteByProdId(product.getProdId()); @@ -115,7 +113,7 @@ public class ProductServiceImpl extends ServiceImpl impl @Override @Cacheable(cacheNames = "product", key = "#prodId") - public Product getProductByProdId(Long prodId) { + public Product getProductByProdId(Integer prodId) { return productMapper.selectById(prodId); } @@ -125,16 +123,16 @@ public class ProductServiceImpl extends ServiceImpl impl @CacheEvict(cacheNames = "product", key = "#prodId"), @CacheEvict(cacheNames = "skuList", key = "#prodId") }) - public void removeProductByProdId(Long prodId) { - Product dbProduct = getProductByProdId(prodId); + public void removeProductByProdId(Integer prodId) { +// Product dbProduct = getProductByProdId(prodId); productMapper.deleteById(prodId); skuMapper.deleteByProdId(prodId); //删除商品关联的分组标签 - prodTagReferenceMapper.delete(new LambdaQueryWrapper() - .eq(ProdTagReference::getProdId, prodId)); +// prodTagReferenceMapper.delete(new LambdaQueryWrapper() +// .eq(ProdTagReference::getProdId, prodId)); // 删除数据库中的商品图片 // if (StrUtil.isNotBlank(dbProduct.getImgs())) { @@ -150,7 +148,7 @@ public class ProductServiceImpl extends ServiceImpl impl @CacheEvict(cacheNames = "product", key = "#prodId"), @CacheEvict(cacheNames = "skuList", key = "#prodId") }) - public void removeProductCacheByProdId(Long prodId) { + public void removeProductCacheByProdId(Integer prodId) { } diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ShopDetailServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ShopDetailServiceImpl.java index af98777..f53792b 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ShopDetailServiceImpl.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ShopDetailServiceImpl.java @@ -62,18 +62,18 @@ public class ShopDetailServiceImpl extends ServiceImpl implements SkuSe @Override @Cacheable(cacheNames = "skuList", key = "#prodId") - public List listByProdId(Long prodId) { + public List listByProdId(Integer prodId) { return skuMapper.listByProdId(prodId); } @Override @Cacheable(cacheNames = "sku", key = "#skuId") - public Sku getSkuBySkuId(Long skuId) { + public Sku getSkuBySkuId(Integer skuId) { return skuMapper.selectById(skuId); } @@ -50,7 +50,7 @@ public class SkuServiceImpl extends ServiceImpl implements SkuSe @CacheEvict(cacheNames = "sku", key = "#skuId"), @CacheEvict(cacheNames = "skuList", key = "#prodId") }) - public void removeSkuCacheBySkuId(Long skuId,Long prodId) { + public void removeSkuCacheBySkuId(Integer skuId,Integer prodId) { }