|
|
|
@@ -6,7 +6,6 @@ import cn.hutool.core.util.NumberUtil;
|
|
|
|
import cn.hutool.core.util.ObjUtil;
|
|
|
|
import cn.hutool.core.util.ObjUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
|
|
|
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
|
|
|
import com.alibaba.excel.write.merge.OnceAbsoluteMergeStrategy;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
|
import com.alibaba.fastjson2.JSONWriter;
|
|
|
|
import com.alibaba.fastjson2.JSONWriter;
|
|
|
|
@@ -49,7 +48,6 @@ import java.time.LocalDate;
|
|
|
|
import java.time.LocalTime;
|
|
|
|
import java.time.LocalTime;
|
|
|
|
import java.time.format.TextStyle;
|
|
|
|
import java.time.format.TextStyle;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import static com.czg.constant.CacheConstant.ADMIN_CLIENT_PRODUCT_LIST;
|
|
|
|
import static com.czg.constant.CacheConstant.ADMIN_CLIENT_PRODUCT_LIST;
|
|
|
|
@@ -717,30 +715,36 @@ 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()
|
|
|
|
.eq(ProdSku::getProductId, prodSku.getProductId())
|
|
|
|
.eq(ProdSku::getProductId, prodSku.getProductId())
|
|
|
|
.eq(ProdSku::getIsGrounding, SystemConstants.OneZero.ZERO)
|
|
|
|
.eq(ProdSku::getIsGrounding, SystemConstants.OneZero.ONE)
|
|
|
|
.eq(ProdSku::getIsDel, SystemConstants.OneZero.ZERO)
|
|
|
|
.eq(ProdSku::getIsDel, SystemConstants.OneZero.ZERO)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (normalCount == 0) {
|
|
|
|
Product product = mapper.selectOneById(prodId);
|
|
|
|
|
|
|
|
if (normalCount == 0 && product.getIsSale() == SystemConstants.OneZero.ONE) {
|
|
|
|
UpdateChain.of(Product.class)
|
|
|
|
UpdateChain.of(Product.class)
|
|
|
|
.set(Product::getIsSale, isSale)
|
|
|
|
.set(Product::getIsSale, SystemConstants.OneZero.ZERO)
|
|
|
|
|
|
|
|
.eq(Product::getId, prodSku.getProductId())
|
|
|
|
|
|
|
|
.eq(Product::getShopId, shopId)
|
|
|
|
|
|
|
|
.update();
|
|
|
|
|
|
|
|
}else if(normalCount > 0 && product.getIsSale() == SystemConstants.OneZero.ZERO) {
|
|
|
|
|
|
|
|
UpdateChain.of(Product.class)
|
|
|
|
|
|
|
|
.set(Product::getIsSale, SystemConstants.OneZero.ONE)
|
|
|
|
.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();
|
|
|
|
|
|
|
|
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 +755,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();
|
|
|
|
|