|
@@ -28,6 +28,7 @@ import com.slodon.b2b2c.model.seller.StoreModel;
|
|
|
import com.slodon.b2b2c.seller.example.StoreLabelBindGoodsExample;
|
|
|
import com.slodon.b2b2c.seller.pojo.*;
|
|
|
import com.slodon.b2b2c.system.pojo.SysSeo;
|
|
|
+import io.swagger.annotations.ApiModelProperty;
|
|
|
import io.swagger.models.auth.In;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
@@ -125,7 +126,7 @@ public class GoodsSellerModel {
|
|
|
public void saveGoods(Vendor vendor, GoodsPublishInsertDTO insertDTO) {
|
|
|
List<GoodsPublishFrontParamDTO.ProductInfo> productList = insertDTO.getProductList();//货品列表
|
|
|
//-校验sku是否重复
|
|
|
- this.checkSku(productList);
|
|
|
+ this.checkSku(productList,insertDTO.getDistributionChannel());
|
|
|
|
|
|
//-保存商品信息
|
|
|
Goods goods = this.insertGoods(vendor, insertDTO);
|
|
@@ -163,7 +164,7 @@ public class GoodsSellerModel {
|
|
|
*
|
|
|
* @param productList
|
|
|
*/
|
|
|
- private void checkSku(List<GoodsPublishFrontParamDTO.ProductInfo> productList) {
|
|
|
+ private void checkSku(List<GoodsPublishFrontParamDTO.ProductInfo> productList,String distributionChannel) {
|
|
|
Set<String> set = new HashSet<>();//用于校验自身sku是否重复
|
|
|
productList.forEach(productInfo -> {
|
|
|
if (!StringUtils.isEmpty(productInfo.getProductCode())) {
|
|
@@ -171,6 +172,7 @@ public class GoodsSellerModel {
|
|
|
ProductExample example = new ProductExample();
|
|
|
example.setProductCode(productInfo.getProductCode());
|
|
|
example.setProductIdNotEquals(((GoodsPublishInsertDTO.ProductInsertInfo) productInfo).getProductId());
|
|
|
+ example.setDistributionChannel(distributionChannel);
|
|
|
int count = productModel.countByExample(example);
|
|
|
AssertUtil.isTrue(count > 0, "商品货号[" + productInfo.getProductCode() + "]已存在,请重新输入");
|
|
|
}
|
|
@@ -346,6 +348,7 @@ public class GoodsSellerModel {
|
|
|
product.setProductId(GoodsIdGenerator.productIdGenerator());
|
|
|
}
|
|
|
product.setGoodsId(goods.getGoodsId());
|
|
|
+ product.setDistributionChannel(goods.getDistributionChannel());
|
|
|
product.setGoodsName(goods.getGoodsName());
|
|
|
product.setSpecValues(productInsertInfo.getSpecValues());
|
|
|
product.setSpecValueIds(productInsertInfo.getSpecValueIds());
|
|
@@ -588,7 +591,7 @@ public class GoodsSellerModel {
|
|
|
this.compareSpecWithDb(goodsDb.getGoodsId(), productList, addProductList, updateProductList, deleteProductList);
|
|
|
|
|
|
//-校验sku是否重复
|
|
|
- this.checkSku(productList);
|
|
|
+ this.checkSku(productList, goodsDb.getDistributionChannel());
|
|
|
|
|
|
//-更新商品信息
|
|
|
Goods updateGoods = this.updateGoods(insertDTO, vendor);
|