Browse Source

ProductService.getRelatedPackges, check pkgId but not productId while scaning relatedPkgs

xuchaolang 6 years ago
parent
commit
4c631931cd

+ 4 - 4
rankin-product-service/src/main/java/cn/rankin/productservice/service/ProductService.java

@@ -161,13 +161,13 @@ public class ProductService {
 
         for(PackageProductRelation rel : currentRelationList){
             //skip pid not belong merchant
-
-            if(null == merchantProductRepository.findByPidAndMerchantId(pid, merchantId)){
-                log.info("Skip, Pid not Belong Merchant, pid={}, merchantId={}", pid, merchantId);
+            String pkgId = rel.getPkgId();
+            if(null == pkgId || null == merchantProductRepository.findByPidAndMerchantId(pkgId, merchantId)){
+                log.info("Skip, pkgId not Belong Merchant, pkgId={}, merchantId={}", pkgId, merchantId);
                 continue;
             }
 
-            pids.add(rel.getPkgId());
+            pids.add(pkgId);
         }
 
         if (pids.isEmpty()){