产品管理、产品分类管理

main
cheney 11 months ago
parent b9c74832e3
commit 53efa6436e
  1. 2
      common/src/main/java/com/huoran/common/response/ResponseEnum.java
  2. 26
      common/src/main/java/com/huoran/common/response/ServerResponseEntity.java
  3. 4
      common/src/main/java/com/huoran/common/utils/JwtUtils.java
  4. 6
      common/src/main/java/com/huoran/common/utils/TokenUtils.java
  5. 159
      nakadai/src/main/java/com/huoran/nakadai/controller/CategoryController.java
  6. 115
      nakadai/src/main/java/com/huoran/nakadai/controller/OrderController.java
  7. 5
      nakadai/src/main/java/com/huoran/nakadai/controller/PickAddrController.java
  8. 2
      nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java
  9. 130
      nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java
  10. 8
      nakadai/src/main/java/com/huoran/nakadai/controller/ShopDetailController.java
  11. 2
      nakadai/src/main/java/com/huoran/nakadai/controller/SpecController.java
  12. 4
      nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/BasketItemDto.java
  13. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ProductDto.java
  14. 4
      nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ProductItemDto.java
  15. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartDto.java
  16. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartItemDto.java
  17. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/ShopCartOrderDto.java
  18. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/SkuDto.java
  19. 4
      nakadai/src/main/java/com/huoran/nakadai/entity/app/param/ChangeShopCartParam.java
  20. 6
      nakadai/src/main/java/com/huoran/nakadai/entity/app/param/OrderItemParam.java
  21. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/app/param/ProdCommParam.java
  22. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/dto/ProductDto.java
  23. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/dto/SearchProdDto.java
  24. 4
      nakadai/src/main/java/com/huoran/nakadai/entity/model/Basket.java
  25. 6
      nakadai/src/main/java/com/huoran/nakadai/entity/model/Category.java
  26. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/model/CategoryProp.java
  27. 5
      nakadai/src/main/java/com/huoran/nakadai/entity/model/Order.java
  28. 6
      nakadai/src/main/java/com/huoran/nakadai/entity/model/OrderItem.java
  29. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/model/PickAddr.java
  30. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdComm.java
  31. 4
      nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdImg.java
  32. 7
      nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdProp.java
  33. 6
      nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdPropValue.java
  34. 5
      nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdTag.java
  35. 5
      nakadai/src/main/java/com/huoran/nakadai/entity/model/ProdTagReference.java
  36. 47
      nakadai/src/main/java/com/huoran/nakadai/entity/model/Product.java
  37. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/model/ShopDetail.java
  38. 27
      nakadai/src/main/java/com/huoran/nakadai/entity/model/Sku.java
  39. 5
      nakadai/src/main/java/com/huoran/nakadai/entity/model/UserCollection.java
  40. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/param/OrderParam.java
  41. 20
      nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java
  42. 6
      nakadai/src/main/java/com/huoran/nakadai/entity/param/ShopDetailParam.java
  43. 2
      nakadai/src/main/java/com/huoran/nakadai/mapper/BasketMapper.java
  44. 40
      nakadai/src/main/java/com/huoran/nakadai/mapper/CategoryMapper.java
  45. 2
      nakadai/src/main/java/com/huoran/nakadai/mapper/CategoryPropMapper.java
  46. 2
      nakadai/src/main/java/com/huoran/nakadai/mapper/PlatformTeamAccountMapper.java
  47. 4
      nakadai/src/main/java/com/huoran/nakadai/mapper/ProdCommMapper.java
  48. 4
      nakadai/src/main/java/com/huoran/nakadai/mapper/ProdPropMapper.java
  49. 4
      nakadai/src/main/java/com/huoran/nakadai/mapper/ProdPropValueMapper.java
  50. 6
      nakadai/src/main/java/com/huoran/nakadai/mapper/ProdTagReferenceMapper.java
  51. 6
      nakadai/src/main/java/com/huoran/nakadai/mapper/ProductMapper.java
  52. 8
      nakadai/src/main/java/com/huoran/nakadai/mapper/SkuMapper.java
  53. 55
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CategoryMapper.xml
  54. 5
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml
  55. 4
      nakadai/src/main/java/com/huoran/nakadai/service/BasketService.java
  56. 65
      nakadai/src/main/java/com/huoran/nakadai/service/CategoryService.java
  57. 2
      nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java
  58. 4
      nakadai/src/main/java/com/huoran/nakadai/service/ProdCommService.java
  59. 2
      nakadai/src/main/java/com/huoran/nakadai/service/ProdPropService.java
  60. 2
      nakadai/src/main/java/com/huoran/nakadai/service/ProdTagReferenceService.java
  61. 6
      nakadai/src/main/java/com/huoran/nakadai/service/ProductService.java
  62. 6
      nakadai/src/main/java/com/huoran/nakadai/service/ShopDetailService.java
  63. 6
      nakadai/src/main/java/com/huoran/nakadai/service/SkuService.java
  64. 8
      nakadai/src/main/java/com/huoran/nakadai/service/impl/BasketServiceImpl.java
  65. 145
      nakadai/src/main/java/com/huoran/nakadai/service/impl/CategoryServiceImpl.java
  66. 4
      nakadai/src/main/java/com/huoran/nakadai/service/impl/OrderServiceImpl.java
  67. 7
      nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java
  68. 4
      nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdCommServiceImpl.java
  69. 2
      nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdPropServiceImpl.java
  70. 2
      nakadai/src/main/java/com/huoran/nakadai/service/impl/ProdTagReferenceServiceImpl.java
  71. 18
      nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductServiceImpl.java
  72. 6
      nakadai/src/main/java/com/huoran/nakadai/service/impl/ShopDetailServiceImpl.java
  73. 6
      nakadai/src/main/java/com/huoran/nakadai/service/impl/SkuServiceImpl.java

@ -18,7 +18,7 @@ public enum ResponseEnum {
/** /**
* ok * ok
*/ */
OK("00000", "ok"), OK("200", "ok"),
SHOW_FAIL("A00001", ""), SHOW_FAIL("A00001", ""),
/** /**

@ -39,7 +39,7 @@ public class ServerResponseEntity<T> implements Serializable {
/** /**
* 版本 * 版本
*/ */
private String version; // private String version;
/** /**
* 时间 * 时间
@ -81,13 +81,13 @@ public class ServerResponseEntity<T> implements Serializable {
return this; return this;
} }
public String getVersion() { // public String getVersion() {
return version; // return version;
} // }
//
public void setVersion(String version) { // public void setVersion(String version) {
this.version = version; // this.version = version;
} // }
public Long getTimestamp() { public Long getTimestamp() {
return timestamp; return timestamp;
@ -104,10 +104,10 @@ public class ServerResponseEntity<T> implements Serializable {
return !Objects.equals(ResponseEnum.OK.value(), this.code); return !Objects.equals(ResponseEnum.OK.value(), this.code);
} }
public ServerResponseEntity() { // public ServerResponseEntity() {
// 版本号 // // 版本号
this.version = "mall4j.v230424"; // this.version = "mall4j.v230424";
} // }
public static <T> ServerResponseEntity<T> success(T data) { public static <T> ServerResponseEntity<T> success(T data) {
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>(); ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
@ -190,7 +190,7 @@ public class ServerResponseEntity<T> implements Serializable {
"code='" + code + '\'' + "code='" + code + '\'' +
", msg='" + msg + '\'' + ", msg='" + msg + '\'' +
", data=" + data + ", data=" + data +
", version='" + version + '\'' + // ", version='" + version + '\'' +
", timestamp=" + timestamp + ", timestamp=" + timestamp +
", sign='" + sign + '\'' + ", sign='" + sign + '\'' +
'}'; '}';

@ -33,8 +33,8 @@ public class JwtUtils {
} }
public static void main(String[] args) { public static void main(String[] args) {
// String jwtToken = getJwtToken("108"); String jwtToken = getJwtToken("1",1L,1);
// System.out.println(jwtToken); System.out.println(jwtToken);
// boolean jwtToken = checkToken("\n" + // boolean jwtToken = checkToken("\n" +
// "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiaWF0IjoxNjk4OTkwNzc3LCJleHAiOjE2OTk4NTQ3NzcsImFjY291bnRJZCI6IjMxIn0.PkzSpCHaRNtFd2k0ik4zfqg0KhoYR1e-r51lbb1S0nc"); // "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiaWF0IjoxNjk4OTkwNzc3LCJleHAiOjE2OTk4NTQ3NzcsImFjY291bnRJZCI6IjMxIn0.PkzSpCHaRNtFd2k0ik4zfqg0KhoYR1e-r51lbb1S0nc");

@ -46,14 +46,14 @@ public class TokenUtils {
return (String)claims.get("accountId"); return (String)claims.get("accountId");
} }
public static Long getShopIdByJwtToken(HttpServletRequest request) { public static Integer getShopIdByJwtToken(HttpServletRequest request) {
String jwtToken = request.getHeader("token"); String jwtToken = request.getHeader("token");
if(StringUtils.isEmpty(jwtToken)) { if(StringUtils.isEmpty(jwtToken)) {
return 0L; return 0;
} }
Jws<Claims> claimsJws = Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(jwtToken); Jws<Claims> claimsJws = Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(jwtToken);
Claims claims = claimsJws.getBody(); Claims claims = claimsJws.getBody();
return (Long)claims.get("shopId"); return (Integer)claims.get("shopId");
} }
public static Integer getPlatformIdByJwtToken(HttpServletRequest request) { public static Integer getPlatformIdByJwtToken(HttpServletRequest request) {

@ -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<List<CategoryDto>> categoryInfo(
@RequestParam(value = "parentId", defaultValue = "0") Long parentId) {
List<Category> categories = categoryService.listByParentId(parentId);
List<CategoryDto> categoryDtos = BeanUtil.copyToList(categories, CategoryDto.class);
return ServerResponseEntity.success(categoryDtos);
}
/**
* 获取菜单页面的表
* @return
*/
@GetMapping("/list")
@ApiOperation(value = "获取店铺所有分类列表")
public ServerResponseEntity<List<Category>> table(HttpServletRequest request){
List<Category> categoryMenuList = categoryService.tableCategory(TokenUtils.getShopIdByJwtToken(request));
return ServerResponseEntity.success(categoryMenuList);
}
/**
* 获取分类信息
*/
@GetMapping("/info")
@ApiOperation(value = "获取分类信息")
public ServerResponseEntity<Category> info(@RequestParam("categoryId") Long categoryId){
Category category = categoryService.getById(categoryId);
return ServerResponseEntity.success(category);
}
/**
* 保存分类
*/
@PostMapping("/save")
@ApiOperation(value = "保存分类信息")
public ServerResponseEntity<Void> save(@RequestBody Category category,HttpServletRequest request){
category.setShopId(TokenUtils.getShopIdByJwtToken(request));
category.setRecTime(new Date());
Category categoryName = categoryService.getOne(new LambdaQueryWrapper<Category>().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<String> 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<Category>().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<Category>().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<String> delete(@RequestParam("categoryId") Long categoryId){
if (categoryService.count(new LambdaQueryWrapper<Category>().eq(Category::getParentId,categoryId)) >0) {
return ServerResponseEntity.showFailMsg("请删除子分类,再删除该分类");
}
categoryService.deleteCategory(categoryId);
return ServerResponseEntity.success();
}
/**
* 所有的
*/
@GetMapping("/listCategory")
public ServerResponseEntity<List<Category>> listCategory(HttpServletRequest request){
return ServerResponseEntity.success(categoryService.list(new LambdaQueryWrapper<Category>()
.le(Category::getGrade, 2)
.eq(Category::getShopId, TokenUtils.getShopIdByJwtToken(request))
.orderByAsc(Category::getSeq)));
}
/**
* 所有的产品分类
*/
@GetMapping("/listProdCategory")
public ServerResponseEntity<List<Category>> listProdCategory(HttpServletRequest request){
List<Category> categories = categoryService.treeSelect(TokenUtils.getShopIdByJwtToken(request),2);
return ServerResponseEntity.success(categories);
}
}

@ -10,6 +10,8 @@
package com.huoran.nakadai.controller; 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.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.IORuntimeException; 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.exception.YamiShopBindException;
import com.huoran.common.response.ServerResponseEntity; import com.huoran.common.response.ServerResponseEntity;
import com.huoran.common.utils.TokenUtils; 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.enums.OrderStatus;
import com.huoran.nakadai.entity.model.Order; import com.huoran.nakadai.entity.model.Order;
import com.huoran.nakadai.entity.model.OrderItem; 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.model.UserAddrOrder;
import com.huoran.nakadai.entity.param.DeliveryOrderParam; 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.OrderItemService;
import com.huoran.nakadai.service.OrderService; import com.huoran.nakadai.service.OrderService;
import com.huoran.nakadai.service.ProductService; import com.huoran.nakadai.service.ProductService;
import com.huoran.nakadai.service.SkuService; import com.huoran.nakadai.service.SkuService;
import com.huoran.nakadai.utils.Arith;
import com.huoran.nakadai.utils.PageParam; import com.huoran.nakadai.utils.PageParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -42,11 +50,15 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import static com.huoran.nakadai.utils.SpringContextUtils.applicationContext;
/** /**
* @author lgh on 2018/09/15. * @author lgh on 2018/09/15.
*/ */
@ -61,34 +73,103 @@ public class OrderController {
@Autowired @Autowired
private OrderItemService orderItemService; private OrderItemService orderItemService;
// @Autowired
// private UserAddrOrderService userAddrOrderService;
@Autowired @Autowired
private ProductService productService; private ProductService productService;
@Autowired @Autowired
private SkuService skuService; private SkuService skuService;
// @PostMapping("/sendInquiryForm")
// @ApiOperation(value = "根据店铺发送询价单给商家或留言")
// public ServerResponseEntity<ShopCartOrderMergerDto> 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<ShopCartItemDto> shopCartItems = basketService.getShopCartItemsByOrderItems(orderParam.getBasketIds(),orderParam.getOrderItem(),userId);
//
// if (CollectionUtil.isEmpty(shopCartItems)) {
// throw new YamiShopBindException("请选择您需要的商品加入购物车");
// }
//
// // 根据店铺组装购车中的商品信息,返回每个店铺中的购物车商品信息
// List<ShopCartDto> shopCarts = basketService.getShopCarts(shopCartItems);
//
// // 将要返回给前端的完整的订单信息
// ShopCartOrderMergerDto shopCartOrderMergerDto = new ShopCartOrderMergerDto();
//
// shopCartOrderMergerDto.setUserAddr(userAddrDto);
//
// // 所有店铺的订单信息
// List<ShopCartOrderDto> 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<ShopCartItemDiscountDto> shopCartItemDiscounts = shopCart.getShopCartItemDiscounts();
//
// // 店铺中的所有商品项信息
// List<ShopCartItemDto> shopAllShopCartItems = new ArrayList<>();
// for (ShopCartItemDiscountDto shopCartItemDiscount : shopCartItemDiscounts) {
// List<ShopCartItemDto> 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") // @GetMapping("/page")
public ServerResponseEntity<IPage<Order>> page(OrderParam orderParam, PageParam<Order> page, HttpServletRequest request) { // public ServerResponseEntity<IPage<Order>> page(OrderParam orderParam, PageParam<Order> page, HttpServletRequest request) {
Long shopId = TokenUtils.getShopIdByJwtToken(request); // Integer shopId = TokenUtils.getShopIdByJwtToken(request);
orderParam.setShopId(shopId); // orderParam.setShopId(shopId);
IPage<Order> orderPage = orderService.pageOrdersDetailByOrderParam(page, orderParam); // IPage<Order> orderPage = orderService.pageOrdersDetailByOrderParam(page, orderParam);
return ServerResponseEntity.success(orderPage); // return ServerResponseEntity.success(orderPage);
// }
}
/** /**
* 获取信息 * 获取信息
*/ */
@GetMapping("/orderInfo/{orderNumber}") @GetMapping("/orderInfo/{orderNumber}")
public ServerResponseEntity<Order> info(@PathVariable("orderNumber") String orderNumber,HttpServletRequest request) { public ServerResponseEntity<Order> info(@PathVariable("orderNumber") String orderNumber,HttpServletRequest request) {
Long shopId = TokenUtils.getShopIdByJwtToken(request); Integer shopId = TokenUtils.getShopIdByJwtToken(request);
Order order = orderService.getOrderByOrderNumber(orderNumber); Order order = orderService.getOrderByOrderNumber(orderNumber);
if (!Objects.equal(shopId, order.getShopId())) { if (!Objects.equal(shopId, order.getShopId())) {
throw new YamiShopBindException("您没有权限获取该订单信息"); throw new YamiShopBindException("您没有权限获取该订单信息");
@ -105,7 +186,7 @@ public class OrderController {
*/ */
@PutMapping("/delivery") @PutMapping("/delivery")
public ServerResponseEntity<Void> delivery(@RequestBody DeliveryOrderParam deliveryOrderParam,HttpServletRequest request) { public ServerResponseEntity<Void> delivery(@RequestBody DeliveryOrderParam deliveryOrderParam,HttpServletRequest request) {
Long shopId = TokenUtils.getShopIdByJwtToken(request); Integer shopId = TokenUtils.getShopIdByJwtToken(request);
Order order = orderService.getOrderByOrderNumber(deliveryOrderParam.getOrderNumber()); Order order = orderService.getOrderByOrderNumber(deliveryOrderParam.getOrderNumber());
if (!Objects.equal(shopId, order.getShopId())) { if (!Objects.equal(shopId, order.getShopId())) {
throw new YamiShopBindException("您没有权限修改该订单信息"); 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, 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, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime, String consignmentName, String consignmentMobile,
String consignmentAddr, HttpServletResponse response,HttpServletRequest request) { String consignmentAddr, HttpServletResponse response,HttpServletRequest request) {
Long shopId = TokenUtils.getShopIdByJwtToken(request); Integer shopId = TokenUtils.getShopIdByJwtToken(request);
order.setShopId(shopId); order.setShopId(shopId);
order.setStatus(OrderStatus.PADYED.value()); order.setStatus(OrderStatus.PADYED.value());
List<Order> orders = orderService.listOrdersDetailByOrder(order, startTime, endTime); List<Order> orders = orderService.listOrdersDetailByOrder(order, startTime, endTime);
@ -194,7 +275,7 @@ public class OrderController {
@GetMapping("/soldExcel") @GetMapping("/soldExcel")
public void soldExcel(Order order, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime, 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) { @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.setShopId(shopId);
order.setIsPayed(1); order.setIsPayed(1);
List<Order> orders = orderService.listOrdersDetailByOrder(order, startTime, endTime); List<Order> orders = orderService.listOrdersDetailByOrder(order, startTime, endTime);

@ -30,11 +30,6 @@ import java.util.Arrays;
import java.util.Objects; import java.util.Objects;
/**
*
* @author lgh on 2018/10/17.
*/
@RestController @RestController
@RequestMapping("/shop/pickAddr") @RequestMapping("/shop/pickAddr")
public class PickAddrController { public class PickAddrController {

@ -190,7 +190,7 @@ public class PlatformTeamAccountController {
@ApiOperation(value = "获取当前平台用户的团队信息", response = PartnerAccountResp.class) @ApiOperation(value = "获取当前平台用户的团队信息", response = PartnerAccountResp.class)
@GetMapping("/getTeamsByPlatformId") @GetMapping("/getTeamsByPlatformId")
public R getTeamsByPlatformId(@ApiParam(name = "platformId", value = "平台id") @RequestParam Integer platformId, HttpServletRequest request) { 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); return platformTeamAccountService.getTeamsByPlatformId(accountId, platformId);
} }

@ -21,12 +21,16 @@ import com.huoran.common.utils.TokenUtils;
import com.huoran.nakadai.entity.model.Product; import com.huoran.nakadai.entity.model.Product;
import com.huoran.nakadai.entity.model.Sku; import com.huoran.nakadai.entity.model.Sku;
import com.huoran.nakadai.entity.param.ProductParam; 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.BasketService;
import com.huoran.nakadai.service.ProdTagReferenceService; import com.huoran.nakadai.service.ProdTagReferenceService;
import com.huoran.nakadai.service.ProductService; import com.huoran.nakadai.service.ProductService;
import com.huoran.nakadai.service.SkuService; import com.huoran.nakadai.service.SkuService;
import com.huoran.nakadai.utils.Json; import com.huoran.nakadai.utils.Json;
import com.huoran.nakadai.utils.PageParam; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -37,19 +41,14 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
/** @Api(tags = "商品列表、商品发布管理")
* 商品列表商品发布controller
*
* @author lgh
*/
@RestController @RestController
@RequestMapping("/prod/prod") @RequestMapping("/prod")
public class ProductController { public class ProductController {
@Autowired @Autowired
private ProductService productService; private ProductService productService;
@Autowired @Autowired
private SkuService skuService; private SkuService skuService;
@ -59,11 +58,10 @@ public class ProductController {
@Autowired @Autowired
private BasketService basketService; private BasketService basketService;
/**
* 分页获取商品信息
*/
@GetMapping("/page") @GetMapping("/page")
public ServerResponseEntity<IPage<Product>> page(ProductParam product, PageParam<Product> page,HttpServletRequest request) { @ApiOperation(value = "分页获取商品信息", response = Product.class)
public ServerResponseEntity<IPage<Product>> page(ProductParam product,HttpServletRequest request) {
PageParam<Product> page = new PageParam<>();
IPage<Product> products = productService.page(page, IPage<Product> products = productService.page(page,
new LambdaQueryWrapper<Product>() new LambdaQueryWrapper<Product>()
.like(StrUtil.isNotBlank(product.getProdName()), Product::getProdName, product.getProdName()) .like(StrUtil.isNotBlank(product.getProdName()), Product::getProdName, product.getProdName())
@ -73,11 +71,10 @@ public class ProductController {
return ServerResponseEntity.success(products); return ServerResponseEntity.success(products);
} }
/**
* 获取信息 @GetMapping("/info")
*/ @ApiOperation(value = "获取商品信息", response = Product.class)
@GetMapping("/info/{prodId}") public ServerResponseEntity<Product> info(@RequestParam("prodId") Integer prodId, HttpServletRequest request) {
public ServerResponseEntity<Product> info(@PathVariable("prodId") Long prodId, HttpServletRequest request) {
Product prod = productService.getProductByProdId(prodId); Product prod = productService.getProductByProdId(prodId);
if (!Objects.equals(prod.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { if (!Objects.equals(prod.getShopId(), TokenUtils.getShopIdByJwtToken(request))) {
throw new YamiShopBindException("没有权限获取该商品规格信息"); throw new YamiShopBindException("没有权限获取该商品规格信息");
@ -86,23 +83,21 @@ public class ProductController {
prod.setSkuList(skuList); prod.setSkuList(skuList);
//获取分组标签 //获取分组标签
List<Long> listTagId = prodTagReferenceService.listTagIdByProdId(prodId); // List<Long> listTagId = prodTagReferenceService.listTagIdByProdId(prodId);
prod.setTagList(listTagId); // prod.setTagList(listTagId);
return ServerResponseEntity.success(prod); return ServerResponseEntity.success(prod);
} }
/** @PostMapping("/save")
* 保存 @ApiOperation(value = "保存商品信息")
*/
@PostMapping
public ServerResponseEntity<String> save(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) { public ServerResponseEntity<String> save(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) {
checkParam(productParam); checkParam(productParam);
Product product = BeanUtil.copyProperties(productParam, Product.class); 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.setShopId(TokenUtils.getShopIdByJwtToken(request));
product.setUpdateTime(new Date()); product.setUpdateTime(new Date());
if (product.getStatus() == 1) { if (product.getStatus() == 0) {
product.setPutawayTime(new Date()); product.setPutawayTime(new Date());
} }
product.setCreateTime(new Date()); product.setCreateTime(new Date());
@ -110,10 +105,9 @@ public class ProductController {
return ServerResponseEntity.success(); return ServerResponseEntity.success();
} }
/**
* 修改 @PostMapping("/update")
*/ @ApiOperation(value = "修改商品信息")
@PutMapping
public ServerResponseEntity<String> update(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) { public ServerResponseEntity<String> update(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) {
checkParam(productParam); checkParam(productParam);
Product dbProduct = productService.getProductByProdId(productParam.getProdId()); Product dbProduct = productService.getProductByProdId(productParam.getProdId());
@ -123,23 +117,22 @@ public class ProductController {
List<Sku> dbSkus = skuService.listByProdId(dbProduct.getProdId()); List<Sku> dbSkus = skuService.listByProdId(dbProduct.getProdId());
Product product = BeanUtil.copyProperties(productParam, Product.class); Product product = BeanUtil.copyProperties(productParam, Product.class);
product.setDeliveryMode(Json.toJsonString(productParam.getDeliveryModeVo())); // product.setDeliveryMode(Json.toJsonString(productParam.getDeliveryModeVo()));
product.setUpdateTime(new Date()); product.setUpdateTime(new Date());
if (dbProduct.getStatus() == 0 || productParam.getStatus() == 1) { if (productParam.getStatus() == 1) {
product.setPutawayTime(new Date()); product.setPutawayTime(new Date());
} }
dbProduct.setSkuList(dbSkus); dbProduct.setSkuList(dbSkus);
productService.updateProduct(product, dbProduct); productService.updateProduct(product, dbProduct);
List<String> userIds = basketService.listUserIdByProdId(product.getProdId()); // List<String> userIds = basketService.listUserIdByProdId(product.getProdId());
//
for (String userId : userIds) { // for (String userId : userIds) {
basketService.removeShopCartItemsCacheByUserId(userId); // basketService.removeShopCartItemsCacheByUserId(userId);
} // }
for (Sku sku : dbSkus) { for (Sku sku : dbSkus) {
skuService.removeSkuCacheBySkuId(sku.getSkuId(), sku.getProdId()); skuService.removeSkuCacheBySkuId(sku.getSkuId(), sku.getProdId());
} }
@ -149,7 +142,7 @@ public class ProductController {
/** /**
* 删除 * 删除
*/ */
public ServerResponseEntity<Void> delete(Long prodId,HttpServletRequest request) { public ServerResponseEntity<Void> delete(Integer prodId,HttpServletRequest request) {
Product dbProduct = productService.getProductByProdId(prodId); Product dbProduct = productService.getProductByProdId(prodId);
if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) {
throw new YamiShopBindException("无法获取非本店铺商品信息"); throw new YamiShopBindException("无法获取非本店铺商品信息");
@ -163,31 +156,32 @@ public class ProductController {
} }
List<String> userIds = basketService.listUserIdByProdId(prodId); // List<String> userIds = basketService.listUserIdByProdId(prodId);
//
for (String userId : userIds) { // for (String userId : userIds) {
basketService.removeShopCartItemsCacheByUserId(userId); // basketService.removeShopCartItemsCacheByUserId(userId);
} // }
return ServerResponseEntity.success(); return ServerResponseEntity.success();
} }
/** @PostMapping("/batchDelete")
* 批量删除 @ApiOperation(value = "批量删除商品信息")
*/ public ServerResponseEntity<Void> batchDelete(@RequestBody Integer[] prodIds,HttpServletRequest request) {
@DeleteMapping for (Integer prodId : prodIds) {
public ServerResponseEntity<Void> batchDelete(@RequestBody Long[] prodIds,HttpServletRequest request) {
for (Long prodId : prodIds) {
delete(prodId,request); delete(prodId,request);
} }
return ServerResponseEntity.success(); return ServerResponseEntity.success();
} }
/**
* 更新商品状态 @PostMapping("/prodStatus")
*/ @ApiOperation(value = "更新商品状态")
@PutMapping("/prodStatus") public ServerResponseEntity<Void> shopStatus(
public ServerResponseEntity<Void> shopStatus(@RequestParam Long prodId, @RequestParam Integer prodStatus) { @ApiParam(value = "商品id")
@RequestParam Integer prodId,
@ApiParam(value = "prodStatus:默认是1,表示上架, 2下架,3草稿,4审核,0为删除")
@RequestParam Integer prodStatus) {
Product product = new Product(); Product product = new Product();
product.setProdId(prodId); product.setProdId(prodId);
product.setStatus(prodStatus); product.setStatus(prodStatus);
@ -196,25 +190,25 @@ public class ProductController {
} }
productService.updateById(product); productService.updateById(product);
productService.removeProductCacheByProdId(prodId); productService.removeProductCacheByProdId(prodId);
List<String> userIds = basketService.listUserIdByProdId(prodId); // List<String> userIds = basketService.listUserIdByProdId(prodId);
//
for (String userId : userIds) { // for (String userId : userIds) {
basketService.removeShopCartItemsCacheByUserId(userId); // basketService.removeShopCartItemsCacheByUserId(userId);
} // }
return ServerResponseEntity.success(); return ServerResponseEntity.success();
} }
private void checkParam(ProductParam productParam) { private void checkParam(ProductParam productParam) {
if (CollectionUtil.isEmpty(productParam.getTagList())) { // if (CollectionUtil.isEmpty(productParam.getTagList())) {
throw new YamiShopBindException("请选择产品分组"); // throw new YamiShopBindException("请选择产品分组");
} // }
Product.DeliveryModeVO deliveryMode = productParam.getDeliveryModeVo(); // Product.DeliveryModeVO deliveryMode = productParam.getDeliveryModeVo();
boolean hasDeliverMode = deliveryMode != null // boolean hasDeliverMode = deliveryMode != null
&& (deliveryMode.getHasShopDelivery() || deliveryMode.getHasUserPickUp()); // && (deliveryMode.getHasShopDelivery() || deliveryMode.getHasUserPickUp());
if (!hasDeliverMode) { // if (!hasDeliverMode) {
throw new YamiShopBindException("请选择配送方式"); // throw new YamiShopBindException("请选择配送方式");
} // }
List<Sku> skuList = productParam.getSkuList(); List<Sku> skuList = productParam.getSkuList();
boolean isAllUnUse = true; boolean isAllUnUse = true;
for (Sku sku : skuList) { for (Sku sku : skuList) {

@ -49,7 +49,7 @@ public class ShopDetailController {
@PutMapping("/isDistribution") @PutMapping("/isDistribution")
public ServerResponseEntity<Void> updateIsDistribution(@RequestParam Integer isDistribution, HttpServletRequest request){ public ServerResponseEntity<Void> updateIsDistribution(@RequestParam Integer isDistribution, HttpServletRequest request){
ShopDetail shopDetail=new ShopDetail(); ShopDetail shopDetail=new ShopDetail();
Long shopId = TokenUtils.getShopIdByJwtToken(request); Integer shopId = TokenUtils.getShopIdByJwtToken(request);
shopDetail.setShopId(shopId); shopDetail.setShopId(shopId);
shopDetail.setIsDistribution(isDistribution); shopDetail.setIsDistribution(isDistribution);
shopDetailService.updateById(shopDetail); shopDetailService.updateById(shopDetail);
@ -83,7 +83,7 @@ public class ShopDetailController {
* 获取信息 * 获取信息
*/ */
@GetMapping("/info/{shopId}") @GetMapping("/info/{shopId}")
public ServerResponseEntity<ShopDetail> info(@PathVariable("shopId") Long shopId){ public ServerResponseEntity<ShopDetail> info(@PathVariable("shopId") Integer shopId){
ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(shopId); ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(shopId);
// 店铺图片 // 店铺图片
return ServerResponseEntity.success(shopDetail); return ServerResponseEntity.success(shopDetail);
@ -117,7 +117,7 @@ public class ShopDetailController {
* 删除 * 删除
*/ */
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public ServerResponseEntity<Void> delete(@PathVariable Long id){ public ServerResponseEntity<Void> delete(@PathVariable Integer id){
shopDetailService.deleteShopDetailByShopId(id); shopDetailService.deleteShopDetailByShopId(id);
return ServerResponseEntity.success(); return ServerResponseEntity.success();
} }
@ -126,7 +126,7 @@ public class ShopDetailController {
* 更新店铺状态 * 更新店铺状态
*/ */
@PutMapping("/shopStatus") @PutMapping("/shopStatus")
public ServerResponseEntity<Void> shopStatus(@RequestParam Long shopId,@RequestParam Integer shopStatus){ public ServerResponseEntity<Void> shopStatus(@RequestParam Integer shopId,@RequestParam Integer shopStatus){
ShopDetail shopDetail = new ShopDetail(); ShopDetail shopDetail = new ShopDetail();
shopDetail.setShopId(shopId); shopDetail.setShopId(shopId);
shopDetail.setShopStatus(shopStatus); shopDetail.setShopStatus(shopStatus);

@ -104,7 +104,7 @@ public class SpecController {
* 删除 * 删除
*/ */
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public ServerResponseEntity<Void> delete(@PathVariable Long id,HttpServletRequest request) { public ServerResponseEntity<Void> delete(@PathVariable Integer id,HttpServletRequest request) {
prodPropService.deleteProdPropAndValues(id, ProdPropRule.SPEC.value(), TokenUtils.getShopIdByJwtToken(request)); prodPropService.deleteProdPropAndValues(id, ProdPropRule.SPEC.value(), TokenUtils.getShopIdByJwtToken(request));
return ServerResponseEntity.success(); return ServerResponseEntity.success();
} }

@ -37,10 +37,10 @@ public class BasketItemDto implements Serializable {
private String shopName; private String shopName;
@ApiModelProperty(value = "产品ID" , required = true) @ApiModelProperty(value = "产品ID" , required = true)
private Long prodId; private Integer prodId;
@ApiModelProperty(value = "skuID" , required = true) @ApiModelProperty(value = "skuID" , required = true)
private Long skuId; private Integer skuId;
@ApiModelProperty(value = "产品个数" , required = true) @ApiModelProperty(value = "产品个数" , required = true)
private Integer prodCount; private Integer prodCount;

@ -37,7 +37,7 @@ public class ProductDto {
* 商品ID * 商品ID
*/ */
// @Schema(description = "商品ID" , required = true) // @Schema(description = "商品ID" , required = true)
private Long prodId; private Integer prodId;
/** /**
* 商品名称 * 商品名称

@ -39,10 +39,10 @@ public class ProductItemDto implements Serializable {
private Double productTotalAmount; private Double productTotalAmount;
@ApiModelProperty(value = "产品ID" ,required=true) @ApiModelProperty(value = "产品ID" ,required=true)
private Long prodId; private Integer prodId;
@ApiModelProperty(value = "skuId" ,required=true) @ApiModelProperty(value = "skuId" ,required=true)
private Long skuId; private Integer skuId;
@ApiModelProperty(value = "规格名称" , required = true) @ApiModelProperty(value = "规格名称" , required = true)
private String skuName; private String skuName;

@ -23,7 +23,7 @@ import java.util.List;
public class ShopCartDto implements Serializable { public class ShopCartDto implements Serializable {
@ApiModelProperty(value = "店铺ID" , required = true) @ApiModelProperty(value = "店铺ID" , required = true)
private Long shopId; private Integer shopId;
@ApiModelProperty(value = "店铺名称" , required = true) @ApiModelProperty(value = "店铺名称" , required = true)
private String shopName; private String shopName;

@ -29,7 +29,7 @@ public class ShopCartItemDto extends ProductItemDto implements Serializable {
private Long basketId; private Long basketId;
@ApiModelProperty(value = "店铺ID" , required = true) @ApiModelProperty(value = "店铺ID" , required = true)
private Long shopId; private Integer shopId;
@ApiModelProperty(value = "规格名称" , required = true) @ApiModelProperty(value = "规格名称" , required = true)
private String skuName; private String skuName;

@ -24,7 +24,7 @@ import java.util.List;
public class ShopCartOrderDto implements Serializable{ public class ShopCartOrderDto implements Serializable{
@ApiModelProperty(value = "店铺id" , required = true) @ApiModelProperty(value = "店铺id" , required = true)
private Long shopId; private Integer shopId;
@ApiModelProperty(value = "店铺名称" , required = true) @ApiModelProperty(value = "店铺名称" , required = true)
private String shopName; private String shopName;

@ -25,7 +25,7 @@ public class SkuDto implements Serializable {
private static final long serialVersionUID = 6457261945829470666L; private static final long serialVersionUID = 6457261945829470666L;
@ApiModelProperty(value = "skuId" , required = true) @ApiModelProperty(value = "skuId" , required = true)
private Long skuId; private Integer skuId;
@ApiModelProperty(value = "价格" , required = true) @ApiModelProperty(value = "价格" , required = true)
private Double price; private Double price;
@ApiModelProperty(value = "原价" ) @ApiModelProperty(value = "原价" )

@ -26,11 +26,11 @@ public class ChangeShopCartParam {
@NotNull(message = "商品ID不能为空") @NotNull(message = "商品ID不能为空")
@ApiModelProperty(value = "商品ID" , required = true) @ApiModelProperty(value = "商品ID" , required = true)
private Long prodId; private Integer prodId;
@NotNull(message = "skuId不能为空") @NotNull(message = "skuId不能为空")
@ApiModelProperty(value = "skuId" , required = true) @ApiModelProperty(value = "skuId" , required = true)
private Long skuId; private Integer skuId;
@NotNull(message = "店铺ID不能为空") @NotNull(message = "店铺ID不能为空")
@ApiModelProperty(value = "店铺ID" , required = true) @ApiModelProperty(value = "店铺ID" , required = true)

@ -25,11 +25,11 @@ public class OrderItemParam {
@NotNull(message = "产品ID不能为空") @NotNull(message = "产品ID不能为空")
@ApiModelProperty(value = "产品ID" ,required=true) @ApiModelProperty(value = "产品ID" ,required=true)
private Long prodId; private Integer prodId;
@NotNull(message = "skuId不能为空") @NotNull(message = "skuId不能为空")
@ApiModelProperty(value = "skuId" ,required=true) @ApiModelProperty(value = "skuId" ,required=true)
private Long skuId; private Integer skuId;
@NotNull(message = "产品数量不能为空") @NotNull(message = "产品数量不能为空")
@Min(value = 1,message = "产品数量不能为空") @Min(value = 1,message = "产品数量不能为空")
@ -38,7 +38,7 @@ public class OrderItemParam {
@NotNull(message = "店铺id不能为空") @NotNull(message = "店铺id不能为空")
@ApiModelProperty(value = "店铺id" ,required=true) @ApiModelProperty(value = "店铺id" ,required=true)
private Long shopId; private Integer shopId;
@ApiModelProperty(value = "推广员使用的推销卡号" ) @ApiModelProperty(value = "推广员使用的推销卡号" )
private String distributionCardNo; private String distributionCardNo;

@ -25,7 +25,7 @@ public class ProdCommParam {
* 商品ID * 商品ID
*/ */
@ApiModelProperty(value = "商品id" ) @ApiModelProperty(value = "商品id" )
private Long prodId; private Integer prodId;
/** /**
* 订单项ID * 订单项ID
*/ */

@ -24,7 +24,7 @@ public class ProductDto {
/** /**
* 商品ID * 商品ID
*/ */
private Long prodId; private Integer prodId;
/** /**
* 店铺id * 店铺id

@ -20,7 +20,7 @@ import lombok.Data;
public class SearchProdDto { public class SearchProdDto {
// @Schema(description = "商品id" ) // @Schema(description = "商品id" )
private Long prodId; private Integer prodId;
// @Schema(description = "商品照片" ) // @Schema(description = "商品照片" )
private String pic; private String pic;

@ -40,13 +40,13 @@ public class Basket implements Serializable {
* 产品ID * 产品ID
*/ */
private Long prodId; private Integer prodId;
/** /**
* SkuID * SkuID
*/ */
private Long skuId; private Integer skuId;
/** /**
* 用户ID * 用户ID

@ -10,6 +10,7 @@
package com.huoran.nakadai.entity.model; package com.huoran.nakadai.entity.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@ -30,14 +31,13 @@ public class Category implements Serializable {
* 类目ID * 类目ID
* *
*/ */
@TableId @TableId(type = IdType.AUTO)
private Long categoryId; private Long categoryId;
/** /**
* 店铺id * 店铺id
*/ */
private Long shopId; private Integer shopId;
/** /**
* 父节点 * 父节点

@ -36,5 +36,5 @@ public class CategoryProp implements Serializable {
* 商品属性id即表tz_prod_prop中的prop_id * 商品属性id即表tz_prod_prop中的prop_id
*/ */
private Long propId; private Integer propId;
} }

@ -10,6 +10,7 @@
package com.huoran.nakadai.entity.model; package com.huoran.nakadai.entity.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@ -30,13 +31,13 @@ public class Order implements Serializable {
/** /**
* 订单ID * 订单ID
*/ */
@TableId @TableId(type = IdType.AUTO)
private Long orderId; private Long orderId;
/** /**
* 店铺id * 店铺id
*/ */
private Long shopId; private Integer shopId;
/** /**
* 产品名称,多个产品将会以逗号隔开 * 产品名称,多个产品将会以逗号隔开

@ -33,7 +33,7 @@ public class OrderItem implements Serializable {
private Long orderItemId; private Long orderItemId;
private Long shopId; private Integer shopId;
/** /**
* 订单sub_number * 订单sub_number
@ -45,13 +45,13 @@ public class OrderItem implements Serializable {
* 产品ID * 产品ID
*/ */
private Long prodId; private Integer prodId;
/** /**
* 产品SkuID * 产品SkuID
*/ */
private Long skuId; private Integer skuId;
/** /**
* 购物车产品个数 * 购物车产品个数

@ -77,6 +77,6 @@ public class PickAddr implements Serializable {
/** /**
* 店铺id * 店铺id
*/ */
private Long shopId; private Integer shopId;
} }

@ -41,7 +41,7 @@ public class ProdComm implements Serializable{
/** /**
* 商品ID * 商品ID
*/ */
private Long prodId; private Integer prodId;
/** /**
* 订单项ID * 订单项ID
*/ */

@ -33,13 +33,13 @@ public class ProdImg implements Serializable {
* 产品ID * 产品ID
*/ */
private Long prodId; private Integer prodId;
/** /**
* skuID(商品通用图片 skuid为0) * skuID(商品通用图片 skuid为0)
*/ */
private Long skuId; private Integer skuId;
/** /**
* 文件路径 * 文件路径

@ -10,6 +10,7 @@
package com.huoran.nakadai.entity.model; package com.huoran.nakadai.entity.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@ -32,8 +33,8 @@ public class ProdProp implements Serializable {
/** /**
* 属性id * 属性id
*/ */
@TableId @TableId(type = IdType.AUTO)
private Long propId; private Integer propId;
/** /**
* 属性名称 * 属性名称
@ -46,7 +47,7 @@ public class ProdProp implements Serializable {
*/ */
private Integer rule; private Integer rule;
private Long shopId; private Integer shopId;
/** /**
* 属性值 * 属性值

@ -10,6 +10,7 @@
package com.huoran.nakadai.entity.model; package com.huoran.nakadai.entity.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@ -30,8 +31,7 @@ public class ProdPropValue implements Serializable{
/** /**
* 属性值ID * 属性值ID
*/ */
@TableId @TableId(type = IdType.AUTO)
private Long valueId; private Long valueId;
/** /**
@ -44,6 +44,6 @@ public class ProdPropValue implements Serializable{
* 属性ID * 属性ID
*/ */
private Long propId; private Integer propId;
} }

@ -10,6 +10,7 @@
package com.huoran.nakadai.entity.model; package com.huoran.nakadai.entity.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@ -31,7 +32,7 @@ public class ProdTag implements Serializable {
/** /**
* 分组标签id * 分组标签id
*/ */
@TableId @TableId(type = IdType.AUTO)
private Long id; private Long id;
/** /**
* 分组标题 * 分组标题
@ -40,7 +41,7 @@ public class ProdTag implements Serializable {
/** /**
* 店铺Id * 店铺Id
*/ */
private Long shopId; private Integer shopId;
/** /**
* 状态(1为正常,0为删除) * 状态(1为正常,0为删除)
*/ */

@ -10,6 +10,7 @@
package com.huoran.nakadai.entity.model; package com.huoran.nakadai.entity.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@ -31,7 +32,7 @@ public class ProdTagReference implements Serializable{
/** /**
* 分组引用id * 分组引用id
*/ */
@TableId @TableId(type = IdType.AUTO)
private Long referenceId; private Long referenceId;
/** /**
* 店铺id * 店铺id
@ -44,7 +45,7 @@ public class ProdTagReference implements Serializable{
/** /**
* 商品id * 商品id
*/ */
private Long prodId; private Integer prodId;
/** /**
* 状态(1:正常,0:删除) * 状态(1:正常,0:删除)
*/ */

@ -10,12 +10,12 @@
package com.huoran.nakadai.entity.model; package com.huoran.nakadai.entity.model;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableId; import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -31,47 +31,57 @@ public class Product implements Serializable {
/** /**
* 商品ID * 商品ID
*/ */
@TableId @TableId(type = IdType.AUTO)
private Long prodId; @ApiModelProperty(value = "产品ID")
private Integer prodId;
/** /**
* 店铺id * 店铺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 oriPrice;
/** /**
* 现价 * 库存量
*/ */
private Double price; @ApiModelProperty(value = "库存量")
private Integer totalStocks;
/** /**
* 简要描述,卖点等 * 简要描述,卖点等
*/ */
@ApiModelProperty(value = "简要描述,卖点等")
private String brief; private String brief;
/** @ApiModelProperty(value = "商品主图")
* 商品主图
*/
private String pic; private String pic;
/** /**
* 商品图片 * 商品图片
*/ */
@ApiModelProperty(value = "商品图片")
private String imgs; private String imgs;
/** /**
* 默认是1表示正常状态, -1表示删除, 0下架 * 默认是1表示正常状态, -1表示删除, 0下架
*/ */
@ApiModelProperty(value = "默认是1,表示上架, 2下架,3草稿,4审核,0为删除")
private Integer status; private Integer status;
/** /**
@ -84,11 +94,6 @@ public class Product implements Serializable {
*/ */
private Integer soldNum; private Integer soldNum;
/**
* 库存量
*/
private Integer totalStocks;
/** /**
* 配送方式json * 配送方式json
*/ */

@ -28,7 +28,7 @@ public class ShopDetail implements Serializable{
* 店铺id * 店铺id
*/ */
@TableId @TableId
private Long shopId; private Integer shopId;
/** /**
* 店铺名称(数字中文英文(可混合不可有特殊字符)可修改)不唯一 * 店铺名称(数字中文英文(可混合不可有特殊字符)可修改)不唯一

@ -10,8 +10,10 @@
package com.huoran.nakadai.entity.model; package com.huoran.nakadai.entity.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@ -27,96 +29,115 @@ public class Sku implements Serializable {
/** /**
* 单品ID * 单品ID
*/ */
@TableId @TableId(type = IdType.AUTO)
private Long skuId; @ApiModelProperty(value = "单品ID")
private Integer skuId;
/** /**
* 商品ID * 商品ID
*/ */
private Long prodId; @ApiModelProperty(value = "商品ID")
private Integer prodId;
/** /**
* 销售属性组合字符串,格式是p1:v1;p2:v2 * 销售属性组合字符串,格式是p1:v1;p2:v2
*/ */
@ApiModelProperty(value = "销售属性组合字符串,格式是p1:v1;p2:v2")
private String properties; private String properties;
/** /**
* 原价 * 原价
*/ */
@ApiModelProperty(value = "原价")
private Double oriPrice; private Double oriPrice;
/** /**
* 价格 * 价格
*/ */
@ApiModelProperty(value = "价格")
private Double price; private Double price;
/** /**
* 库存 * 库存
*/ */
@ApiModelProperty(value = "库存")
private Integer stocks; private Integer stocks;
/** /**
* 实际库存 * 实际库存
*/ */
@ApiModelProperty(value = "实际库存")
private Integer actualStocks; private Integer actualStocks;
/** /**
* 修改时间 * 修改时间
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime; private Date updateTime;
/** /**
* 记录时间 * 记录时间
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "记录时间")
private Date recTime; private Date recTime;
/** /**
* 商家编码 * 商家编码
*/ */
@ApiModelProperty(value = "商家编码",hidden = true)
private String partyCode; private String partyCode;
/** /**
* 商品条形码 * 商品条形码
*/ */
@ApiModelProperty(value = "商品条形码",hidden = true)
private String modelId; private String modelId;
/** /**
* sku图片 * sku图片
*/ */
@ApiModelProperty(value = "sku图片")
private String pic; private String pic;
/** /**
* sku名称 * sku名称
*/ */
@ApiModelProperty(value = "sku名称")
private String skuName; private String skuName;
/** /**
* 商品名称 * 商品名称
*/ */
@ApiModelProperty(value = "商品名称")
private String prodName; private String prodName;
@ApiModelProperty(value = "版本号")
private Integer version; private Integer version;
/** /**
* 重量 * 重量
*/ */
@ApiModelProperty(value = "重量",hidden = true)
private Double weight; private Double weight;
/** /**
* 体积 * 体积
*/ */
@ApiModelProperty(value = "体积",hidden = true)
private Double volume; private Double volume;
/** /**
* 状态0禁用 1 启用 * 状态0禁用 1 启用
*/ */
@ApiModelProperty(value = "状态:0禁用 1 启用")
private Integer status; private Integer status;
/** /**
* 0 正常 1 已被删除 * 0 正常 1 已被删除
*/ */
@ApiModelProperty(value = "0 正常 1 已被删除")
private Integer isDelete; private Integer isDelete;
} }

@ -10,6 +10,7 @@
package com.huoran.nakadai.entity.model; package com.huoran.nakadai.entity.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@ -33,12 +34,12 @@ public class UserCollection implements Serializable{
/** /**
* 收藏表 * 收藏表
*/ */
@TableId @TableId(type = IdType.AUTO)
private Long id; private Long id;
/** /**
* 商品id * 商品id
*/ */
private Long prodId; private Integer prodId;
/** /**
* 用户id * 用户id
*/ */

@ -23,7 +23,7 @@ public class OrderParam {
/** /**
* 店铺id * 店铺id
*/ */
private Long shopId; private Integer shopId;
/** /**
* 订单状态 -1 已取消 0:待付款 1:待发货 2:待收货 3:已完成 * 订单状态 -1 已取消 0:待付款 1:待发货 2:待收货 3:已完成

@ -13,6 +13,7 @@ package com.huoran.nakadai.entity.param;
import com.huoran.nakadai.entity.model.Product; import com.huoran.nakadai.entity.model.Product;
import com.huoran.nakadai.entity.model.Sku; import com.huoran.nakadai.entity.model.Sku;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@ -29,11 +30,13 @@ public class ProductParam {
/** /**
* 产品ID * 产品ID
*/ */
private Long prodId; @ApiModelProperty(value = "产品ID")
private Integer prodId;
/** /**
* 状态 * 状态
*/ */
@ApiModelProperty(value = "默认是0,表示上架, 2下架,3草稿,4审核")
private Integer status; private Integer status;
/** /**
@ -41,6 +44,7 @@ public class ProductParam {
*/ */
@NotBlank(message = "商品名称不能为空") @NotBlank(message = "商品名称不能为空")
@Size(max = 200, message = "商品名称长度应该小于{max}") @Size(max = 200, message = "商品名称长度应该小于{max}")
@ApiModelProperty(value = "商品名称")
private String prodName; private String prodName;
@ -48,64 +52,76 @@ public class ProductParam {
* 商品价格 * 商品价格
*/ */
@NotNull(message = "请输入商品价格") @NotNull(message = "请输入商品价格")
@ApiModelProperty(value = "商品价格")
private Double price; private Double price;
/** /**
* 商品价格 * 商品价格
*/ */
@NotNull(message = "请输入商品原价") @NotNull(message = "请输入商品原价")
@ApiModelProperty(value = "商品原价")
private Double oriPrice; private Double oriPrice;
/** /**
* 库存量 * 库存量
*/ */
@NotNull(message = "请输入商品库存") @NotNull(message = "请输入商品库存")
@ApiModelProperty(value = "商品库存")
private Integer totalStocks; private Integer totalStocks;
/** /**
* 简要描述,卖点等 * 简要描述,卖点等
*/ */
@Size(max = 500, message = "商品卖点长度应该小于{max}") @Size(max = 500, message = "商品卖点长度应该小于{max}")
@ApiModelProperty(value = "简要描述,卖点等")
private String brief; private String brief;
@NotBlank(message = "请选择图片上传") @NotBlank(message = "请选择图片上传")
@ApiModelProperty(value = "商品主图")
private String pic; private String pic;
/** /**
* 商品图片 * 商品图片
*/ */
@NotBlank(message = "请选择图片上传") // @NotBlank(message = "请选择图片上传")
@ApiModelProperty(value = "商品图片",hidden = true)
private String imgs; private String imgs;
/** /**
* 商品分类 * 商品分类
*/ */
@NotNull(message = "请选择商品分类") @NotNull(message = "请选择商品分类")
@ApiModelProperty(value = "商品分类")
private Long categoryId; private Long categoryId;
/** /**
* sku列表字符串 * sku列表字符串
*/ */
@ApiModelProperty(value = "sku列表字符串")
private List<Sku> skuList; private List<Sku> skuList;
/** /**
* content 商品详情 * content 商品详情
*/ */
@ApiModelProperty(value = "商品详情")
private String content; private String content;
/** /**
* 是否能够用户自提 * 是否能够用户自提
*/ */
@ApiModelProperty(value = "是否能够用户自提",hidden = true)
private Product.DeliveryModeVO deliveryModeVo; private Product.DeliveryModeVO deliveryModeVo;
/** /**
* 运费模板id * 运费模板id
*/ */
@ApiModelProperty(value = "运费模板id",hidden = true)
private Long deliveryTemplateId; private Long deliveryTemplateId;
/** /**
* 分组标签列表 * 分组标签列表
*/ */
@ApiModelProperty(value = "分组标签列表",hidden = true)
private List<Long> tagList; private List<Long> tagList;
} }

@ -20,7 +20,7 @@ import javax.validation.constraints.Size;
public class ShopDetailParam { public class ShopDetailParam {
private Long shopId; private Integer shopId;
/** /**
* 店铺名称(数字中文英文(可混合不可有特殊字符)可修改)不唯一 * 店铺名称(数字中文英文(可混合不可有特殊字符)可修改)不唯一
@ -212,11 +212,11 @@ public class ShopDetailParam {
this.shopStatus = shopStatus; this.shopStatus = shopStatus;
} }
public Long getShopId() { public Integer getShopId() {
return shopId; return shopId;
} }
public void setShopId(Long shopId) { public void setShopId(Integer shopId) {
this.shopId = shopId; this.shopId = shopId;
} }

@ -70,6 +70,6 @@ public interface BasketMapper extends BaseMapper<Basket> {
* @param prodId * @param prodId
* @return * @return
*/ */
List<String> listUserIdByProdId(@Param("prodId")Long prodId); List<String> listUserIdByProdId(@Param("prodId")Integer prodId);
} }

@ -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<Category> {
/**
* 根据父级id获取分类列表
*
* @param parentId
* @return
*/
List<Category> listByParentId(Long parentId);
/**
* 根据店铺id获取分类列表
*
* @param shopId
* @return
*/
List<Category> tableCategory(Integer shopId);
}

@ -38,5 +38,5 @@ public interface CategoryPropMapper extends BaseMapper<CategoryProp> {
* 根据属性id删除分类属性 * 根据属性id删除分类属性
* @param propId * @param propId
*/ */
void deleteByPropId(Long propId); void deleteByPropId( Integer propId);
} }

@ -45,4 +45,6 @@ public interface PlatformTeamAccountMapper extends BaseMapper<PlatformTeamAccoun
void updateAccountPhone(@Param("phone")String phone, @Param("accountId")Integer accountId); void updateAccountPhone(@Param("phone")String phone, @Param("accountId")Integer accountId);
Long selectShopIdByOpenId(@Param("openId")String openId,@Param("platformId") Integer platformId); Long selectShopIdByOpenId(@Param("openId")String openId,@Param("platformId") Integer platformId);
UserAccount selectAccountPlatform(@Param("accountId")String accountId);
} }

@ -27,7 +27,7 @@ public interface ProdCommMapper extends BaseMapper<ProdComm> {
* @param prodId * @param prodId
* @return * @return
*/ */
ProdCommDataDto getProdCommDataByProdId(@Param("prodId") Long prodId); ProdCommDataDto getProdCommDataByProdId(@Param("prodId") Integer prodId);
/** /**
* 根据评价等级和商品id分页获取商品评价 * 根据评价等级和商品id分页获取商品评价
@ -36,7 +36,7 @@ public interface ProdCommMapper extends BaseMapper<ProdComm> {
* @param evaluate * @param evaluate
* @return * @return
*/ */
IPage<ProdCommDto> getProdCommDtoPageByProdId(@Param("page") Page page, @Param("prodId") Long prodId, @Param("evaluate") Integer evaluate); IPage<ProdCommDto> getProdCommDtoPageByProdId(@Param("page") Page page, @Param("prodId") Integer prodId, @Param("evaluate") Integer evaluate);
/** /**
* 根据用户id分页获取评论列表 * 根据用户id分页获取评论列表

@ -44,7 +44,7 @@ public interface ProdPropMapper extends BaseMapper<ProdProp> {
* @param shopId * @param shopId
* @return * @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和属性名称获取商品属性 * 根据店铺id和属性名称获取商品属性
@ -53,5 +53,5 @@ public interface ProdPropMapper extends BaseMapper<ProdProp> {
* @param rule * @param rule
* @return * @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);
} }

@ -26,11 +26,11 @@ public interface ProdPropValueMapper extends BaseMapper<ProdPropValue> {
* @param propId * @param propId
* @param prodPropValues * @param prodPropValues
*/ */
void insertPropValues(@Param("propId") Long propId, @Param("prodPropValues") List<ProdPropValue> prodPropValues); void insertPropValues(@Param("propId") Integer propId, @Param("prodPropValues") List<ProdPropValue> prodPropValues);
/** /**
* 删除属性数值 * 删除属性数值
* @param propId * @param propId
*/ */
void deleteByPropId(@Param("propId") Long propId); void deleteByPropId(@Param("propId") Integer propId);
} }

@ -13,6 +13,7 @@ package com.huoran.nakadai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huoran.nakadai.entity.model.ProdTagReference; import com.huoran.nakadai.entity.model.ProdTagReference;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -23,6 +24,7 @@ import java.util.List;
* @author hzm * @author hzm
* @date 2019-04-18 16:28:01 * @date 2019-04-18 16:28:01
*/ */
@Mapper
public interface ProdTagReferenceMapper extends BaseMapper<ProdTagReference> { public interface ProdTagReferenceMapper extends BaseMapper<ProdTagReference> {
/** /**
* 插入标签 * 插入标签
@ -30,13 +32,13 @@ public interface ProdTagReferenceMapper extends BaseMapper<ProdTagReference> {
* @param prodId * @param prodId
* @param tagList * @param tagList
*/ */
void insertBatch(@Param("shopId") Long shopId, @Param("prodId") Long prodId, @Param("tagList") List<Long> tagList); void insertBatch(@Param("shopId") Integer shopId, @Param("prodId") Integer prodId, @Param("tagList") List<Long> tagList);
/** /**
* 根据属性获取标签id列表 * 根据属性获取标签id列表
* @param prodId * @param prodId
* @return * @return
*/ */
List<Long> listTagIdByProdId(@Param("prodId") Long prodId); List<Long> listTagIdByProdId(@Param("prodId") Integer prodId);
} }

@ -18,6 +18,7 @@ import com.huoran.nakadai.entity.app.dto.TagProductDto;
import com.huoran.nakadai.entity.dto.SearchProdDto; import com.huoran.nakadai.entity.dto.SearchProdDto;
import com.huoran.nakadai.entity.model.Product; import com.huoran.nakadai.entity.model.Product;
import com.huoran.nakadai.utils.PageParam; import com.huoran.nakadai.utils.PageParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -26,6 +27,7 @@ import java.util.Map;
/** /**
* @author lanhai * @author lanhai
*/ */
@Mapper
public interface ProductMapper extends BaseMapper<Product> { public interface ProductMapper extends BaseMapper<Product> {
/** /**
* 更新商品库存 * 更新商品库存
@ -40,13 +42,13 @@ public interface ProductMapper extends BaseMapper<Product> {
* @param shopId * @param shopId
* @return * @return
*/ */
Product getProductByProdNameAndShopId(@Param("prodName") String prodName, @Param("shopId") Long shopId); Product getProductByProdNameAndShopId(@Param("prodName") String prodName, @Param("shopId") Integer shopId);
/** /**
* 返回库存 * 返回库存
* @param prodCollect * @param prodCollect
*/ */
void returnStock(@Param("prodCollect") Map<Long, Integer> prodCollect); void returnStock(@Param("prodCollect") Map<Integer, Integer> prodCollect);
/** /**
* 根据上架时间分页获取商品 * 根据上架时间分页获取商品

@ -29,14 +29,14 @@ public interface SkuMapper extends BaseMapper<Sku> {
* @param prodId 商品id * @param prodId 商品id
* @param skuList sku列表 * @param skuList sku列表
*/ */
void insertBatch(@Param("prodId") Long prodId, @Param("skuList") List<Sku> skuList); void insertBatch(@Param("prodId") Integer prodId, @Param("skuList") List<Sku> skuList);
/** /**
* 根据商品id获取商品sku列表 * 根据商品id获取商品sku列表
* @param prodId * @param prodId
* @return * @return
*/ */
List<Sku> listByProdId(Long prodId); List<Sku> listByProdId(Integer prodId);
/** /**
* 更新sku库存 * 更新sku库存
@ -49,12 +49,12 @@ public interface SkuMapper extends BaseMapper<Sku> {
* 根据商品id删除sku * 根据商品id删除sku
* @param prodId * @param prodId
*/ */
void deleteByProdId(@Param("prodId") Long prodId); void deleteByProdId(@Param("prodId") Integer prodId);
/** /**
* 返回sku库存 * 返回sku库存
* @param skuCollect * @param skuCollect
*/ */
void returnStock(@Param("skuCollect") Map<Long, Integer> skuCollect); void returnStock(@Param("skuCollect") Map<Integer, Integer> skuCollect);
} }

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.huoran.nakadai.mapper.CategoryMapper">
<resultMap id="categoryProdMap" type="com.huoran.nakadai.entity.model.Category">
<id column="category_id" jdbcType="BIGINT" property="categoryId" />
<result column="category_name" jdbcType="VARCHAR" property="categoryName" />
<collection property="products" column="prod_id" ofType="com.huoran.nakadai.entity.model.Product">
<!--修改-->
<!--<result column="prod_id" jdbcType="BIGINT" property="prodId" />-->
<!--<result column="prod_name" jdbcType="VARCHAR" property="prodName" />-->
<!--<result column="price" jdbcType="DECIMAL" property="price" />-->
<!--<result column="brief" jdbcType="VARCHAR" property="brief" />-->
<!--<result column="imgs" jdbcType="VARCHAR" property="imgs" />-->
<!--<result column="prod_category_id" jdbcType="BIGINT" property="categoryId" />-->
<!--<result column="buys" jdbcType="INTEGER" property="buys" />-->
<!--<result column="stocks" jdbcType="INTEGER" property="stocks" />-->
<!--<result column="has_prop" jdbcType="INTEGER" property="hasProp" />-->
<!--<result column="spec_list_str" jdbcType="VARCHAR" property="specListStr" />-->
<id property="prodId" column="prod_id"/>
<result property="prodName" column="prod_name"/>
<result property="shopId" column="shop_id"/>
<result property="oriPrice" column="ori_price"/>
<result property="price" column="price"/>
<result property="brief" column="brief"/>
<result property="content" column="content"/>
<result property="imgs" column="imgs"/>
<result property="status" column="status"/>
<result property="categoryId" column="category_id"/>
<result property="soldNum" column="sold_num"/>
<result property="totalStocks" column="total_stocks"/>
<!-- <result property="transportMode" column="transport_mode"/>-->
<!-- <result property="transportId" column="transport_id"/>-->
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<!--<collection property="skuList" column="sku_id" ofType="com.yami.shop.model.model.Sku">-->
<!--<result column="sku_id" jdbcType="BIGINT" property="skuId" />-->
<!--<result column="sPrice" jdbcType="DECIMAL" property="price" />-->
<!--<result column="sStocks" jdbcType="INTEGER" property="stocks" />-->
<!--<result column="sName" jdbcType="VARCHAR" property="name" />-->
<!--</collection>-->
</collection>
</resultMap>
<select id="listByParentId" resultType="com.huoran.nakadai.entity.model.Category">
select category_id,category_name,`seq`,`status`,pic from tz_category where parent_id = #{parentId} and `status` = 1 order by seq
</select>
<select id="tableCategory" resultType="com.huoran.nakadai.entity.model.Category">
select category_id ,parent_id ,category_name,pic,seq,status from tz_category where shop_id = #{shopId} order by seq
</select>
</mapper>

@ -162,4 +162,9 @@
a.app_open_id = #{openId} a.app_open_id = #{openId}
AND a.platform_id = #{platformId} and tc.is_team = 1 and ta.is_del = 0 AND a.platform_id = #{platformId} and tc.is_team = 1 and ta.is_del = 0
</select> </select>
<select id="selectAccountPlatform" resultType="com.huoran.nakadai.entity.UserAccount">
SELECT *
from hr_user_account
WHERE is_del = 0 and id = #{accountId}
</select>
</mapper> </mapper>

@ -91,7 +91,7 @@ public interface BasketService extends IService<Basket> {
* @param prodId 商品id * @param prodId 商品id
* @return 用户id * @return 用户id
*/ */
List<String> listUserIdByProdId(Long prodId); List<String> listUserIdByProdId(Integer prodId);
/** /**
* 根据店铺组装购车中的商品信息返回每个店铺中的购物车商品信息 * 根据店铺组装购车中的商品信息返回每个店铺中的购物车商品信息
@ -107,6 +107,6 @@ public interface BasketService extends IService<Basket> {
* @param basketId 购物车id * @param basketId 购物车id
* @return 所有的商品购物项 * @return 所有的商品购物项
*/ */
List<ShopCartItemDto> getShopCartItemsByOrderItems(List<Long> basketId, OrderItemParam orderItem, String userId); List<ShopCartItemDto> getShopCartItemsByOrderItems(List<Integer> basketId, OrderItemParam orderItem, String userId);
} }

@ -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<Category> {
/**
* 根据parentId获取分类
* @param parentId 0 一级分类
* @return
*/
List<Category> listByParentId(Long parentId);
/**
* 获取用于页面表单展现的category列表根据seq排序
* @param shopId 店铺id
* @return
*/
List<Category> 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<Category> treeSelect(Integer shopId,int grade);
}

@ -33,4 +33,6 @@ public interface PlatformTeamAccountService extends IService<PlatformTeamAccount
R inviteJoinOrganization(InviteJoinInfo inviteJoinInfo); R inviteJoinOrganization(InviteJoinInfo inviteJoinInfo);
R transferTeam(TransferTeamReq transferTeamReq); R transferTeam(TransferTeamReq transferTeamReq);
String getCurrentPlatformAccount(String accountId, Integer platformId);
} }

@ -31,7 +31,7 @@ public interface ProdCommService extends IService<ProdComm> {
* @param prodId * @param prodId
* @return * @return
*/ */
ProdCommDataDto getProdCommDataByProdId(Long prodId); ProdCommDataDto getProdCommDataByProdId(Integer prodId);
/** /**
* 根据用户id分页获取商品评论 * 根据用户id分页获取商品评论
@ -48,7 +48,7 @@ public interface ProdCommService extends IService<ProdComm> {
* @param evaluate * @param evaluate
* @return * @return
*/ */
IPage<ProdCommDto> getProdCommDtoPageByProdId(Page page, Long prodId, Integer evaluate); IPage<ProdCommDto> getProdCommDtoPageByProdId(Page page, Integer prodId, Integer evaluate);
/** /**
* 根据参数分页获取商品评价 * 根据参数分页获取商品评价

@ -48,6 +48,6 @@ public interface ProdPropService extends IService<ProdProp> {
* @param propRule * @param propRule
* @param shopId * @param shopId
*/ */
void deleteProdPropAndValues(Long propId,Integer propRule,Long shopId); void deleteProdPropAndValues( Integer propId,Integer propRule,Integer shopId);
} }

@ -28,5 +28,5 @@ public interface ProdTagReferenceService extends IService<ProdTagReference> {
* @param prodId * @param prodId
* @return * @return
*/ */
List<Long> listTagIdByProdId(Long prodId); List<Long> listTagIdByProdId(Integer prodId);
} }

@ -48,19 +48,19 @@ public interface ProductService extends IService<Product> {
* @param prodId * @param prodId
* @return * @return
*/ */
Product getProductByProdId(Long prodId); Product getProductByProdId(Integer prodId);
/** /**
* 根据商品id删除商品 * 根据商品id删除商品
* @param prodId * @param prodId
*/ */
void removeProductByProdId(Long prodId); void removeProductByProdId(Integer prodId);
/** /**
* 根据商品id删除缓存 * 根据商品id删除缓存
* @param prodId * @param prodId
*/ */
void removeProductCacheByProdId(Long prodId); void removeProductCacheByProdId(Integer prodId);
/** /**
* 根据上架时间倒序分页获取商品 * 根据上架时间倒序分页获取商品

@ -29,18 +29,18 @@ public interface ShopDetailService extends IService<ShopDetail> {
* 删除店铺详情 * 删除店铺详情
* @param id * @param id
*/ */
void deleteShopDetailByShopId(Long id); void deleteShopDetailByShopId(Integer id);
/** /**
* 根据店铺id获取店铺信息 * 根据店铺id获取店铺信息
* @param shopId * @param shopId
* @return * @return
*/ */
ShopDetail getShopDetailByShopId(Long shopId); ShopDetail getShopDetailByShopId(Integer shopId);
/** /**
* 根据店铺id删除店铺详情信息 * 根据店铺id删除店铺详情信息
* @param shopId * @param shopId
*/ */
void removeShopDetailCacheByShopId(Long shopId); void removeShopDetailCacheByShopId(Integer shopId);
} }

@ -26,19 +26,19 @@ public interface SkuService extends IService<Sku> {
* @param prodId 商品id * @param prodId 商品id
* @return sku列表 * @return sku列表
*/ */
List<Sku> listByProdId(Long prodId); List<Sku> listByProdId(Integer prodId);
/** /**
* 根据skuId获取sku信息将会被缓存起来 * 根据skuId获取sku信息将会被缓存起来
* @param skuId * @param skuId
* @return * @return
*/ */
Sku getSkuBySkuId(Long skuId); Sku getSkuBySkuId(Integer skuId);
/** /**
* 根据商品id和skuId删除缓存 * 根据商品id和skuId删除缓存
* @param skuId * @param skuId
* @param prodId * @param prodId
*/ */
void removeSkuCacheBySkuId(Long skuId,Long prodId); void removeSkuCacheBySkuId(Integer skuId,Integer prodId);
} }

@ -132,18 +132,18 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme
} }
@Override @Override
public List<String> listUserIdByProdId(Long prodId) { public List<String> listUserIdByProdId(Integer prodId) {
return basketMapper.listUserIdByProdId(prodId); return basketMapper.listUserIdByProdId(prodId);
} }
@Override @Override
public List<ShopCartDto> getShopCarts(List<ShopCartItemDto> shopCartItems) { public List<ShopCartDto> getShopCarts(List<ShopCartItemDto> shopCartItems) {
// 根据店铺ID划分item // 根据店铺ID划分item
Map<Long, List<ShopCartItemDto>> shopCartMap = shopCartItems.stream().collect(Collectors.groupingBy(ShopCartItemDto::getShopId)); Map<Integer, List<ShopCartItemDto>> shopCartMap = shopCartItems.stream().collect(Collectors.groupingBy(ShopCartItemDto::getShopId));
// 返回一个店铺的所有信息 // 返回一个店铺的所有信息
List<ShopCartDto> shopCartDtos = Lists.newArrayList(); List<ShopCartDto> shopCartDtos = Lists.newArrayList();
for (Long shopId : shopCartMap.keySet()) { for (Integer shopId : shopCartMap.keySet()) {
//获取店铺的所有商品项 //获取店铺的所有商品项
List<ShopCartItemDto> shopCartItemDtoList = shopCartMap.get(shopId); List<ShopCartItemDto> shopCartItemDtoList = shopCartMap.get(shopId);
@ -164,7 +164,7 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme
} }
@Override @Override
public List<ShopCartItemDto> getShopCartItemsByOrderItems(List<Long> basketId, OrderItemParam orderItem, String userId) { public List<ShopCartItemDto> getShopCartItemsByOrderItems(List<Integer> basketId, OrderItemParam orderItem, String userId) {
if (orderItem == null && CollectionUtil.isEmpty(basketId)) { if (orderItem == null && CollectionUtil.isEmpty(basketId)) {
return Collections.emptyList(); return Collections.emptyList();
} }

@ -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<CategoryMapper, Category> implements CategoryService {
@Autowired
private CategoryMapper categoryMapper;
// @Autowired
// private CategoryBrandMapper categoryBrandMapper;
//
// @Autowired
// private CategoryPropMapper categoryPropMapper;
@Override
public List<Category> listByParentId(Long parentId) {
return categoryMapper.listByParentId(parentId);
}
@Override
public List<Category> 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<Category> treeSelect(Integer shopId,int grade) {
List<Category> categories = categoryMapper.selectList(new LambdaQueryWrapper<Category>().le(Category::getGrade,grade).eq(Category::getShopId,shopId));
return categoryListToTree(categories);
}
public List<Category> categoryListToTree(List<Category> categorys){
if (CollectionUtils.isEmpty(categorys)) {
return Lists.newArrayList();
}
Map<Long, List<Category>> categoryMap = categorys.stream().collect(Collectors.groupingBy(Category::getParentId));
List<Category> rootList = categoryMap.get(0L);
transformCategoryTree(rootList,categoryMap);
return rootList;
}
public void transformCategoryTree(List<Category> categorys,Map<Long, List<Category>> categoryMap) {
for (Category category : categorys) {
List<Category> nextList = categoryMap.get(category.getCategoryId());
if (CollectionUtils.isEmpty(nextList)) {
continue;
}
// 将排序完成的list设为下一层级
category.setCategories(nextList);
// 处理下 下一层级
transformCategoryTree(nextList, categoryMap);
}
}
}

@ -118,8 +118,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
if (CollectionUtil.isEmpty(allOrderItems)) { if (CollectionUtil.isEmpty(allOrderItems)) {
return; return;
} }
Map<Long, Integer> prodCollect = new HashMap<>(16); Map<Integer, Integer> prodCollect = new HashMap<>(16);
Map<Long, Integer> skuCollect = new HashMap<>(16); Map<Integer, Integer> skuCollect = new HashMap<>(16);
allOrderItems.stream().collect(Collectors.groupingBy(OrderItem::getProdId)).forEach((prodId, orderItems) -> { allOrderItems.stream().collect(Collectors.groupingBy(OrderItem::getProdId)).forEach((prodId, orderItems) -> {
int prodTotalNum = orderItems.stream().mapToInt(OrderItem::getProdCount).sum(); int prodTotalNum = orderItems.stream().mapToInt(OrderItem::getProdCount).sum();

@ -134,6 +134,13 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl<PlatformTeamAcco
return baseMapper.selectShopIdByOpenId(openId, platformId); return baseMapper.selectShopIdByOpenId(openId, platformId);
} }
@Override
public String getCurrentPlatformAccount(String accountId, Integer platformId) {
UserAccount userAccount = baseMapper.selectAccountPlatform(accountId);
UserAccount currentPlatformAccount = baseMapper.selectAccountByOpenId(userAccount.getAppOpenId(), platformId);
return currentPlatformAccount.getId().toString();
}
@Override @Override
public R kindergartenWeChatApplication(AppletCallbackReq appletCallbackReq) { public R kindergartenWeChatApplication(AppletCallbackReq appletCallbackReq) {
Map<String, Object> data = new HashedMap<String, Object>(); Map<String, Object> data = new HashedMap<String, Object>();

@ -37,7 +37,7 @@ public class ProdCommServiceImpl extends ServiceImpl<ProdCommMapper, ProdComm> i
private ProdCommMapper prodCommMapper; private ProdCommMapper prodCommMapper;
@Override @Override
public ProdCommDataDto getProdCommDataByProdId(Long prodId) { public ProdCommDataDto getProdCommDataByProdId(Integer prodId) {
ProdCommDataDto prodCommDataDto=prodCommMapper.getProdCommDataByProdId(prodId); ProdCommDataDto prodCommDataDto=prodCommMapper.getProdCommDataByProdId(prodId);
//计算出好评率 //计算出好评率
if(prodCommDataDto.getPraiseNumber() == 0||prodCommDataDto.getNumber() == 0){ if(prodCommDataDto.getPraiseNumber() == 0||prodCommDataDto.getNumber() == 0){
@ -54,7 +54,7 @@ public class ProdCommServiceImpl extends ServiceImpl<ProdCommMapper, ProdComm> i
} }
@Override @Override
public IPage<ProdCommDto> getProdCommDtoPageByProdId(Page page, Long prodId, Integer evaluate) { public IPage<ProdCommDto> getProdCommDtoPageByProdId(Page page, Integer prodId, Integer evaluate) {
IPage<ProdCommDto> prodCommDtos = prodCommMapper.getProdCommDtoPageByProdId(page, prodId, evaluate); IPage<ProdCommDto> prodCommDtos = prodCommMapper.getProdCommDtoPageByProdId(page, prodId, evaluate);
prodCommDtos.getRecords().forEach(prodCommDto -> { prodCommDtos.getRecords().forEach(prodCommDto -> {

@ -86,7 +86,7 @@ public class ProdPropServiceImpl extends ServiceImpl<ProdPropMapper, ProdProp> i
@Override @Override
@Transactional(rollbackFor = Exception.class) @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); int deleteRows = prodPropMapper.deleteByPropId(propId, propRule, shopId);
if (deleteRows == 0) { if (deleteRows == 0) {
return; return;

@ -34,7 +34,7 @@ public class ProdTagReferenceServiceImpl extends ServiceImpl<ProdTagReferenceMap
private ProdTagReferenceMapper prodTagReferenceMapper; private ProdTagReferenceMapper prodTagReferenceMapper;
@Override @Override
public List<Long> listTagIdByProdId(Long prodId) { public List<Long> listTagIdByProdId(Integer prodId) {
return prodTagReferenceMapper.listTagIdByProdId(prodId); return prodTagReferenceMapper.listTagIdByProdId(prodId);
} }
} }

@ -51,8 +51,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
private ProductMapper productMapper; private ProductMapper productMapper;
@Autowired @Autowired
private SkuMapper skuMapper; private SkuMapper skuMapper;
// @Autowired
// private AttachFileService attachFileService;
@Autowired @Autowired
private ProdTagReferenceMapper prodTagReferenceMapper; private ProdTagReferenceMapper prodTagReferenceMapper;
@ -65,7 +63,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
if (CollectionUtil.isNotEmpty(product.getSkuList())) { if (CollectionUtil.isNotEmpty(product.getSkuList())) {
skuMapper.insertBatch(product.getProdId(), 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<ProductMapper, Product> impl
public void updateProduct(Product product, Product dbProduct) { public void updateProduct(Product product, Product dbProduct) {
productMapper.updateById(product); productMapper.updateById(product);
List<Long> dbSkuIds = dbProduct.getSkuList().stream().map(Sku::getSkuId).collect(Collectors.toList()); List<Integer> dbSkuIds = dbProduct.getSkuList().stream().map(Sku::getSkuId).collect(Collectors.toList());
// 将所有该商品的sku标记为已删除状态 // 将所有该商品的sku标记为已删除状态
skuMapper.deleteByProdId(product.getProdId()); skuMapper.deleteByProdId(product.getProdId());
@ -115,7 +113,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
@Override @Override
@Cacheable(cacheNames = "product", key = "#prodId") @Cacheable(cacheNames = "product", key = "#prodId")
public Product getProductByProdId(Long prodId) { public Product getProductByProdId(Integer prodId) {
return productMapper.selectById(prodId); return productMapper.selectById(prodId);
} }
@ -125,16 +123,16 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
@CacheEvict(cacheNames = "product", key = "#prodId"), @CacheEvict(cacheNames = "product", key = "#prodId"),
@CacheEvict(cacheNames = "skuList", key = "#prodId") @CacheEvict(cacheNames = "skuList", key = "#prodId")
}) })
public void removeProductByProdId(Long prodId) { public void removeProductByProdId(Integer prodId) {
Product dbProduct = getProductByProdId(prodId); // Product dbProduct = getProductByProdId(prodId);
productMapper.deleteById(prodId); productMapper.deleteById(prodId);
skuMapper.deleteByProdId(prodId); skuMapper.deleteByProdId(prodId);
//删除商品关联的分组标签 //删除商品关联的分组标签
prodTagReferenceMapper.delete(new LambdaQueryWrapper<ProdTagReference>() // prodTagReferenceMapper.delete(new LambdaQueryWrapper<ProdTagReference>()
.eq(ProdTagReference::getProdId, prodId)); // .eq(ProdTagReference::getProdId, prodId));
// 删除数据库中的商品图片 // 删除数据库中的商品图片
// if (StrUtil.isNotBlank(dbProduct.getImgs())) { // if (StrUtil.isNotBlank(dbProduct.getImgs())) {
@ -150,7 +148,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
@CacheEvict(cacheNames = "product", key = "#prodId"), @CacheEvict(cacheNames = "product", key = "#prodId"),
@CacheEvict(cacheNames = "skuList", key = "#prodId") @CacheEvict(cacheNames = "skuList", key = "#prodId")
}) })
public void removeProductCacheByProdId(Long prodId) { public void removeProductCacheByProdId(Integer prodId) {
} }

@ -62,18 +62,18 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet
@Override @Override
@Transactional(rollbackFor=Exception.class) @Transactional(rollbackFor=Exception.class)
@CacheEvict(cacheNames = "shop_detail", key = "#shopId") @CacheEvict(cacheNames = "shop_detail", key = "#shopId")
public void deleteShopDetailByShopId(Long shopId) { public void deleteShopDetailByShopId(Integer shopId) {
shopDetailMapper.deleteById(shopId); shopDetailMapper.deleteById(shopId);
} }
@Override @Override
@Cacheable(cacheNames = "shop_detail", key = "#shopId") @Cacheable(cacheNames = "shop_detail", key = "#shopId")
public ShopDetail getShopDetailByShopId(Long shopId) { public ShopDetail getShopDetailByShopId(Integer shopId) {
return shopDetailMapper.selectById(shopId); return shopDetailMapper.selectById(shopId);
} }
@Override @Override
@CacheEvict(cacheNames = "shop_detail", key = "#shopId") @CacheEvict(cacheNames = "shop_detail", key = "#shopId")
public void removeShopDetailCacheByShopId(Long shopId) { public void removeShopDetailCacheByShopId(Integer shopId) {
} }
} }

@ -35,13 +35,13 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements SkuSe
@Override @Override
@Cacheable(cacheNames = "skuList", key = "#prodId") @Cacheable(cacheNames = "skuList", key = "#prodId")
public List<Sku> listByProdId(Long prodId) { public List<Sku> listByProdId(Integer prodId) {
return skuMapper.listByProdId(prodId); return skuMapper.listByProdId(prodId);
} }
@Override @Override
@Cacheable(cacheNames = "sku", key = "#skuId") @Cacheable(cacheNames = "sku", key = "#skuId")
public Sku getSkuBySkuId(Long skuId) { public Sku getSkuBySkuId(Integer skuId) {
return skuMapper.selectById(skuId); return skuMapper.selectById(skuId);
} }
@ -50,7 +50,7 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements SkuSe
@CacheEvict(cacheNames = "sku", key = "#skuId"), @CacheEvict(cacheNames = "sku", key = "#skuId"),
@CacheEvict(cacheNames = "skuList", key = "#prodId") @CacheEvict(cacheNames = "skuList", key = "#prodId")
}) })
public void removeSkuCacheBySkuId(Long skuId,Long prodId) { public void removeSkuCacheBySkuId(Integer skuId,Integer prodId) {
} }

Loading…
Cancel
Save