Merge remote-tracking branch 'origin/zs2' into dev
This commit is contained in:
@@ -7,6 +7,8 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStatusDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStockDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.interceptor.LimitSubmitAspect;
|
||||
@@ -222,4 +224,28 @@ public class ProductService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateState(ProductStatusDTO productStatusDTO) {
|
||||
TbProduct product = tbProductMapper.selectByShopIdAndId(productStatusDTO.getProductId(), productStatusDTO.getShopId());
|
||||
if (productStatusDTO.getType().equals(0)) {
|
||||
tbProductMapper.updateGroundingByProId(product.getId(), productStatusDTO.getState());
|
||||
}else {
|
||||
tbProductMapper.pauseSale(productStatusDTO.getProductId(), productStatusDTO.getShopId(), productStatusDTO.getState());
|
||||
tbProductMapper.pauseSkuSale(productStatusDTO.getProductId(), productStatusDTO.getShopId(), productStatusDTO.getState());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateStock(ProductStockDTO productStockDTO) {
|
||||
TbProduct product = tbProductMapper.selectByShopIdAndId(productStockDTO.getProductId(), productStockDTO.getShopId());
|
||||
if (product == null) {
|
||||
throw new MsgException("商品不存在");
|
||||
}
|
||||
|
||||
if (product.getIsDistribute() != 1 && product.getTypeEnum().equals("sku")) {
|
||||
throw new MsgException("多规格非共享商品暂不支持修改库存");
|
||||
}else {
|
||||
tbProductSkuMapper.updateStock(productStockDTO.getProductId(), productStockDTO.getShopId(), productStockDTO.getStock());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user