库存 上下架
This commit is contained in:
@@ -25,9 +25,15 @@ public class ProductIsSaleParam implements Serializable {
|
||||
/**
|
||||
* 上下架类型 product-商品 sku-SKU
|
||||
*/
|
||||
@NotBlank(message = "上下架类型不能为空", groups = DefaultGroup.class)
|
||||
@NotBlank(message = "上下架属性不能为空", groups = DefaultGroup.class)
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 操作类型
|
||||
* stock 库存 sale 上下架
|
||||
*/
|
||||
private String optType = "sale";
|
||||
|
||||
/**
|
||||
* 商品id/sku id
|
||||
*/
|
||||
|
||||
@@ -717,11 +717,12 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
sensitiveOperation = "下架";
|
||||
}
|
||||
Long prodId = null;
|
||||
if (ProductIsSaleTypeEnum.SKU.value().equals(type)) {
|
||||
if (ProductIsSaleTypeEnum.SKU.value().equals(type) && "sale".equals(param.getOptType())) {
|
||||
ProdSku prodSku = prodSkuMapper.selectOneById(id);
|
||||
if (prodSku == null) {
|
||||
throw new CzgException("SKU不存在");
|
||||
}
|
||||
prodId = prodSku.getProductId();
|
||||
prodSku.setIsGrounding(isSale);
|
||||
prodSkuMapper.update(prodSku);
|
||||
long normalCount = prodSkuMapper.selectCountByQuery(QueryWrapper.create()
|
||||
@@ -735,22 +736,29 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
.eq(Product::getId, prodSku.getProductId())
|
||||
.eq(Product::getShopId, shopId)
|
||||
.update();
|
||||
prodId = prodSku.getProductId();
|
||||
}
|
||||
Long productId = prodSku.getProductId();
|
||||
Product product = mapper.selectOneById(productId);
|
||||
sensitiveOperation = sensitiveOperation + "商品:" + product.getName() + " 规格:" + prodSku.getSpecInfo();
|
||||
} else if (ProductIsSaleTypeEnum.PRODUCT.value().equals(type)) {
|
||||
UpdateChain.of(Product.class)
|
||||
.set(Product::getIsSale, isSale)
|
||||
.eq(Product::getId, id)
|
||||
.eq(Product::getShopId, shopId)
|
||||
.update();
|
||||
UpdateChain.of(ProdSku.class)
|
||||
.set(ProdSku::getIsGrounding, isSale)
|
||||
.eq(ProdSku::getProductId, id)
|
||||
.eq(ProdSku::getShopId, shopId)
|
||||
.update();
|
||||
if("sale".equals(param.getOptType())){
|
||||
UpdateChain.of(Product.class)
|
||||
.set(Product::getIsSale, isSale)
|
||||
.eq(Product::getId, id)
|
||||
.eq(Product::getShopId, shopId)
|
||||
.update();
|
||||
UpdateChain.of(ProdSku.class)
|
||||
.set(ProdSku::getIsGrounding, isSale)
|
||||
.eq(ProdSku::getProductId, id)
|
||||
.eq(ProdSku::getShopId, shopId)
|
||||
.update();
|
||||
}else if("stock".equals(param.getOptType())){
|
||||
UpdateChain.of(Product.class)
|
||||
.set(Product::getIsStock, isSale)
|
||||
.eq(Product::getId, id)
|
||||
.eq(Product::getShopId, shopId)
|
||||
.update();
|
||||
}
|
||||
Product product = mapper.selectOneById(id);
|
||||
prodId = product.getId();
|
||||
sensitiveOperation = sensitiveOperation + "商品:" + product.getName();
|
||||
|
||||
Reference in New Issue
Block a user