Compare commits

2 Commits

Author SHA1 Message Date
22c1436375 库存 上下架 2026-03-30 16:20:22 +08:00
470f8884f5 默认值 0 2026-03-30 15:55:27 +08:00
3 changed files with 28 additions and 13 deletions

View File

@@ -25,9 +25,15 @@ public class ProductIsSaleParam implements Serializable {
/** /**
* 上下架类型 product-商品 sku-SKU * 上下架类型 product-商品 sku-SKU
*/ */
@NotBlank(message = "上下架类型不能为空", groups = DefaultGroup.class) @NotBlank(message = "上下架属性不能为空", groups = DefaultGroup.class)
private String type; private String type;
/**
* 操作类型
* stock 库存 sale 上下架
*/
private String optType = "sale";
/** /**
* 商品id/sku id * 商品id/sku id
*/ */

View File

@@ -1451,6 +1451,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
orderInfo.setTableCode(param.getTableCode()); orderInfo.setTableCode(param.getTableCode());
orderInfo.setPlaceNum(param.getPlaceNum()); orderInfo.setPlaceNum(param.getPlaceNum());
orderInfo.setOriginAmount(param.getOriginAmount()); orderInfo.setOriginAmount(param.getOriginAmount());
orderInfo.setDiscountAllAmount(BigDecimal.ZERO);
if (param.getOrderAmount() != null && param.getOrderAmount().compareTo(BigDecimal.ZERO) >= 0) { if (param.getOrderAmount() != null && param.getOrderAmount().compareTo(BigDecimal.ZERO) >= 0) {
orderInfo.setOrderAmount(param.getOrderAmount()); orderInfo.setOrderAmount(param.getOrderAmount());
} else { } else {

View File

@@ -717,11 +717,12 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
sensitiveOperation = "下架"; sensitiveOperation = "下架";
} }
Long prodId = null; Long prodId = null;
if (ProductIsSaleTypeEnum.SKU.value().equals(type)) { if (ProductIsSaleTypeEnum.SKU.value().equals(type) && "sale".equals(param.getOptType())) {
ProdSku prodSku = prodSkuMapper.selectOneById(id); ProdSku prodSku = prodSkuMapper.selectOneById(id);
if (prodSku == null) { if (prodSku == null) {
throw new CzgException("SKU不存在"); throw new CzgException("SKU不存在");
} }
prodId = prodSku.getProductId();
prodSku.setIsGrounding(isSale); prodSku.setIsGrounding(isSale);
prodSkuMapper.update(prodSku); prodSkuMapper.update(prodSku);
long normalCount = prodSkuMapper.selectCountByQuery(QueryWrapper.create() long normalCount = prodSkuMapper.selectCountByQuery(QueryWrapper.create()
@@ -735,12 +736,12 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
.eq(Product::getId, prodSku.getProductId()) .eq(Product::getId, prodSku.getProductId())
.eq(Product::getShopId, shopId) .eq(Product::getShopId, shopId)
.update(); .update();
prodId = prodSku.getProductId();
} }
Long productId = prodSku.getProductId(); Long productId = prodSku.getProductId();
Product product = mapper.selectOneById(productId); Product product = mapper.selectOneById(productId);
sensitiveOperation = sensitiveOperation + "商品:" + product.getName() + " 规格:" + prodSku.getSpecInfo(); sensitiveOperation = sensitiveOperation + "商品:" + product.getName() + " 规格:" + prodSku.getSpecInfo();
} else if (ProductIsSaleTypeEnum.PRODUCT.value().equals(type)) { } else if (ProductIsSaleTypeEnum.PRODUCT.value().equals(type)) {
if("sale".equals(param.getOptType())){
UpdateChain.of(Product.class) UpdateChain.of(Product.class)
.set(Product::getIsSale, isSale) .set(Product::getIsSale, isSale)
.eq(Product::getId, id) .eq(Product::getId, id)
@@ -751,6 +752,13 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
.eq(ProdSku::getProductId, id) .eq(ProdSku::getProductId, id)
.eq(ProdSku::getShopId, shopId) .eq(ProdSku::getShopId, shopId)
.update(); .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); Product product = mapper.selectOneById(id);
prodId = product.getId(); prodId = product.getId();
sensitiveOperation = sensitiveOperation + "商品:" + product.getName(); sensitiveOperation = sensitiveOperation + "商品:" + product.getName();