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
*/
@NotBlank(message = "上下架类型不能为空", groups = DefaultGroup.class)
@NotBlank(message = "上下架属性不能为空", groups = DefaultGroup.class)
private String type;
/**
* 操作类型
* stock 库存 sale 上下架
*/
private String optType = "sale";
/**
* 商品id/sku id
*/

View File

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

View File

@@ -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();