chao преди 3 години
родител
ревизия
c133c39daa
променени са 1 файла, в които са добавени 11 реда и са изтрити 9 реда
  1. 11 9
      src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

+ 11 - 9
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -349,15 +349,17 @@ public class PageServiceImpl implements PageService {
         product.setPriceGrade(priceUtilService.getPriceGrade(product.getPrice()));
         //供应商信息
         ShopVo shop = shopMapper.getProductShopById(product.getShopId());
-        Integer normalNum = shopMapper.getProductNumById(product.getShopId());
-        shop.setNormalNum(normalNum == null ? 0 : normalNum);
-        if (shop.getBusinessScope() != null && shop.getBusinessScope().contains("/")) {
-            String[] businessScopeArray = shop.getBusinessScope().split("/");
-            shop.setBusinessScopeArray(businessScopeArray);
-        }
-        shop.setLogo(ImageUtils.getImageURL("shopLogo", shop.getLogo(), 0, domain));
-        shop.setBusinessLicense(ImageUtils.getImageURL("shopLogo", shop.getBusinessLicense(), 0, domain));
-        product.setShop(shop);
+        if (null != shop) {
+            Integer normalNum = shopMapper.getProductNumById(product.getShopId());
+            shop.setNormalNum(null == normalNum ? 0 : normalNum);
+            if (shop.getBusinessScope() != null && shop.getBusinessScope().contains("/")) {
+                String[] businessScopeArray = shop.getBusinessScope().split("/");
+                shop.setBusinessScopeArray(businessScopeArray);
+            }
+            shop.setLogo(ImageUtils.getImageURL("shopLogo", shop.getLogo(), 0, domain));
+            shop.setBusinessLicense(ImageUtils.getImageURL("shopLogo", shop.getBusinessLicense(), 0, domain));
+            product.setShop(shop);
+        }
         // 商品可见度:3:所有人可见,2:普通机构可见,1:会员机构可见
         Integer visibility = product.getVisibility();
         if (null != userId && userId > 0) {