Browse Source

商品分类创建逻辑修复bug

zhangwl 2 weeks ago
parent
commit
bda3d267cb
1 changed files with 12 additions and 1 deletions
  1. 12 1
      src/main/java/zs/payment/messages/KafkaConsumer.java

+ 12 - 1
src/main/java/zs/payment/messages/KafkaConsumer.java

@@ -133,6 +133,7 @@ public class KafkaConsumer {
                         category1.setLevel(1);
                         category1.setLevel(1);
                         category1.setName(dto.getCategory_1().getName());
                         category1.setName(dto.getCategory_1().getName());
                         category1.setParentId(0);
                         category1.setParentId(0);
+                        category1.setUniacId(uniacid);
                         imsEweiShopCategoryService.save(category1);
                         imsEweiShopCategoryService.save(category1);
                     }
                     }
                     pcate=category1.getId();
                     pcate=category1.getId();
@@ -143,6 +144,7 @@ public class KafkaConsumer {
                         category2.setLevel(2);
                         category2.setLevel(2);
                         category2.setName(dto.getCategory_2().getName());
                         category2.setName(dto.getCategory_2().getName());
                         category2.setParentId(pcate.intValue());
                         category2.setParentId(pcate.intValue());
+                        category2.setUniacId(uniacid);
                         imsEweiShopCategoryService.save(category2);
                         imsEweiShopCategoryService.save(category2);
                     }
                     }
                     ccate=category2.getId();
                     ccate=category2.getId();
@@ -154,6 +156,7 @@ public class KafkaConsumer {
                         category3.setLevel(3);
                         category3.setLevel(3);
                         category3.setName(dto.getCategory_3().getName());
                         category3.setName(dto.getCategory_3().getName());
                         category3.setParentId(ccate.intValue());
                         category3.setParentId(ccate.intValue());
+                        category3.setUniacId(uniacid);
                         imsEweiShopCategoryService.save(category3);
                         imsEweiShopCategoryService.save(category3);
                     }
                     }
                     tcate=category3.getId();
                     tcate=category3.getId();
@@ -161,6 +164,8 @@ public class KafkaConsumer {
 
 
                     //todo 创建商品
                     //todo 创建商品
                     ImsEweiShopGoods goods=new  ImsEweiShopGoods();
                     ImsEweiShopGoods goods=new  ImsEweiShopGoods();
+                    //直接作为推荐商品展示
+                    goods.setIsrecommand(1);
                     goods.setPcate(pcate);
                     goods.setPcate(pcate);
                     goods.setCcate(ccate);
                     goods.setCcate(ccate);
                     goods.setTcate(tcate);
                     goods.setTcate(tcate);
@@ -212,6 +217,7 @@ public class KafkaConsumer {
                     goods.setProductsn(dto.getBarcode());
                     goods.setProductsn(dto.getBarcode());
                     //默认发布给云悦生活
                     //默认发布给云悦生活
                     goods.setUniacid(uniacid);
                     goods.setUniacid(uniacid);
+
                     //创建商品表
                     //创建商品表
                     boolean b2 = imsEweiShopGoodsService.save(goods);
                     boolean b2 = imsEweiShopGoodsService.save(goods);
 
 
@@ -268,12 +274,17 @@ public class KafkaConsumer {
                         goodsOption.setIsfullback(0);
                         goodsOption.setIsfullback(0);
                         goodsOption.setIslive(0);
                         goodsOption.setIslive(0);
                         goodsOption.setLiveprice(new BigDecimal(0));
                         goodsOption.setLiveprice(new BigDecimal(0));
+                        //企云商城的商品重量为0时,金额为0
+                        goodsOption.setWeight(sku.getWeight()==0?new BigDecimal(1):new BigDecimal(sku.getWeight()));
 
 
                         boolean b5 = imsEweiShopGoodsOptionService.save(goodsOption);
                         boolean b5 = imsEweiShopGoodsOptionService.save(goodsOption);
                     }
                     }
+                    redisUtils.sadd(ProductSupplyRedis.SYNC_SUPPLY_ID, dto.getId().toString());
+                }else{
+                    log.error("====商品{}已同步过=====",productId);
+
                 }
                 }
 
 
-                redisUtils.sadd(ProductSupplyRedis.SYNC_SUPPLY_ID, dto.getId().toString());
             });
             });
             log.info("=======productId:{} goodsAlter end=======",ids);
             log.info("=======productId:{} goodsAlter end=======",ids);
         }else {
         }else {