Browse Source

直接查询imsEweishopGoods表判断商品是否存在

zhangwl 3 weeks ago
parent
commit
6d6935f51e

+ 3 - 4
src/main/java/zs/payment/messages/KafkaConsumer.java

@@ -160,7 +160,7 @@ public class KafkaConsumer {
         ProductDetailReq req = new ProductDetailReq();
         ProductDetailReq req = new ProductDetailReq();
         req.setIds(ids);
         req.setIds(ids);
         Result result = productSupplyService.detailList(req);
         Result result = productSupplyService.detailList(req);
-
+        Integer uniacid = 463;//463-云悦生活  465-云享生态
         if (result.isSuccess()) {
         if (result.isSuccess()) {
 
 
             List<OrderDetailDTO> list = JSONObject.parseArray(
             List<OrderDetailDTO> list = JSONObject.parseArray(
@@ -176,12 +176,11 @@ public class KafkaConsumer {
                     return;
                     return;
                 }
                 }
 
 
-                Boolean b = redisUtils.sismember(ProductSupplyRedis.SYNC_SUPPLY_ID, dto.getId().toString());
+                Boolean b =  imsEweiShopGoodsService.existsBySupplyId(uniacid,dto.getId().toString());
+
                 if (!b) {
                 if (!b) {
                     //不存在,则需要添加
                     //不存在,则需要添加
 
 
-                    Integer uniacid = 463;//463-云悦生活  465-云享生态
-
                     //第一级
                     //第一级
                     Long pcate = 0L;
                     Long pcate = 0L;
                     //第二级
                     //第二级

+ 8 - 0
src/main/java/zs/payment/service/Imseweishopgoods/ImsEweiShopGoodsService.java

@@ -18,4 +18,12 @@ public interface ImsEweiShopGoodsService extends IService<ImsEweiShopGoods> {
      */
      */
     ImsEweiShopGoods getByGdId(Integer gdId, Integer uniacid);
     ImsEweiShopGoods getByGdId(Integer gdId, Integer uniacid);
 
 
+    /**
+     * 判断商品是否存在
+     * @param uniacid
+     * @param supplyId
+     * @return
+     */
+    Boolean existsBySupplyId(Integer uniacid,String supplyId);
+
 }
 }

+ 8 - 0
src/main/java/zs/payment/service/Imseweishopgoods/impl/ImsEweiShopGoodsServiceImpl.java

@@ -46,4 +46,12 @@ public class ImsEweiShopGoodsServiceImpl  extends ServiceImpl<ImsEweiShopGoodsMa
             .eq(ImsEweiShopGoods::getUniacid, uniacid)
             .eq(ImsEweiShopGoods::getUniacid, uniacid)
             .one();
             .one();
     }
     }
+
+    @Override
+    public Boolean existsBySupplyId(Integer uniacid, String supplyId) {
+        return lambdaQuery().eq(ImsEweiShopGoods::getSupplyId, supplyId)
+            .eq(ImsEweiShopGoods::getDeleted, 0)
+            .eq(ImsEweiShopGoods::getUniacid, uniacid).count()>0;
+
+    }
 }
 }