|
@@ -41,7 +41,6 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
private final SkuMapper skuMapper;
|
|
|
private final ShopSkuMapper shopSkuMapper;
|
|
|
private final ShopDetailMapper shopDetailMapper;
|
|
|
- private final FrontCategoryMapper frontCategoryMapper;
|
|
|
private final CategoryProdMapper categoryProdMapper;
|
|
|
|
|
|
@Override
|
|
@@ -313,7 +312,14 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
JSONObject bodyJson = JSON.parseObject(bodyStr);
|
|
|
|
|
|
String spuId = bodyJson.getString("spuId");
|
|
|
- Product product = productMapper.selectByHbSpuId(spuId);
|
|
|
+ Product product;
|
|
|
+ if (ObjectUtil.isEmpty(spuId)) {
|
|
|
+ product = productMapper.selectOne(new LambdaQueryWrapper<Product>()
|
|
|
+ .eq(Product::getChannelCode, bodyJson.getString("channelCode"))
|
|
|
+ .eq(Product::getIsDelete, 0));
|
|
|
+ } else {
|
|
|
+ product = productMapper.selectByHbSpuId(spuId);
|
|
|
+ }
|
|
|
if (!ObjectUtil.isEmpty(product)) {
|
|
|
product.setIsDelete(1);
|
|
|
productMapper.updateById(product);
|
|
@@ -421,6 +427,7 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
log.info("productInfo:{}", productInfo);
|
|
|
// 直接映射字段
|
|
|
product.setHbSpuId(productInfo.getLong("spuId"));
|
|
|
+ product.setChannelCode(productInfo.getString("channelCode"));
|
|
|
product.setProdName(productInfo.getString("spuName"));
|
|
|
product.setBrief(productInfo.getString("sellPoint"));//简要描述,卖点等
|
|
|
product.setVideo(productInfo.getString(""));//商品视频
|
|
@@ -530,7 +537,7 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
String ztFrontCategoryCodeLevel = jsonObject.getString("ztFrontCategoryCodeLevel2");
|
|
|
if (StringUtils.isEmpty(ztFrontCategoryCodeLevel)) {
|
|
|
ztFrontCategoryCodeLevel = jsonObject.getString("ztFrontCategoryCode");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//如果是二级,一级对应商品不存在也需要添加
|
|
|
addCategoryProd(spuId, ztFrontCategoryCodeLevel);
|
|
|
ztFrontCategoryCodeLevel = jsonObject.getString("ztFrontCategoryCode");
|