Просмотр исходного кода

getViewStoreInfo判断下获取数据为空

jlutt@163.com 2 лет назад
Родитель
Сommit
f5f651733b

+ 3 - 3
ddBusiness/src/main/java/com/dderp/business/service/StoreServiceImpl.java

@@ -344,16 +344,16 @@ public class StoreServiceImpl extends BaseService implements StoreService {
                 null
         );
 
-        if (readInvoice) {
+        if ((storeInfo != null) && (readInvoice)) {
             StoreInvoiceInfo storeInvoiceInfo = this.getStoreInvoiceInfo(idStore, supplierCode);
             storeInfo.setInvoiceInfo(storeInvoiceInfo);
         }
 
-        if (readEmployee) { //先不用
+        if ((storeInfo != null) && (readEmployee)) { //先不用
 
         }
 
-        if (readPlatform) {
+        if ((storeInfo != null) && (readPlatform)) {
             List<StorePlatform> platformList = searchESList(esClient, jsonConvert, StorePlatform.class,
                     null,
                     ((sd) -> {

+ 14 - 9
ddCommon/src/main/java/com/dderp/common/entity/store/ViewStoreInfo.java

@@ -19,17 +19,22 @@ public class ViewStoreInfo extends BaseEntity {
     @Comment("门店开通的配送平台")
     private Map<String, Object> deliveryPlatforms;
 
+    public ViewStoreInfo() {
+    }
+
     public ViewStoreInfo(StoreInfo storeInfo) {
         this.storeInfo = storeInfo;
-        storeInfo.getPlatformList().forEach(storePlatform -> {
-            String status = "未开通";
-            if (storePlatform.getEnableStatue() == 1) status = "已开通";
-            if (storePlatform.getPlatformType() == PlatformType.order.getValue()) {
-                this.orderPlatforms.put(storePlatform.getPlatformName() + "-" + storePlatform.getId(), status);
-            } else if (storePlatform.getPlatformType() == PlatformType.delivery.getValue()) {
-                this.deliveryPlatforms.put(storePlatform.getPlatformName() + "-" + storePlatform.getId(), status);
-            }
-        });
+        if (storeInfo != null) {
+            storeInfo.getPlatformList().forEach(storePlatform -> {
+                String status = "未开通";
+                if (storePlatform.getEnableStatue() == 1) status = "已开通";
+                if (storePlatform.getPlatformType() == PlatformType.order.getValue()) {
+                    this.orderPlatforms.put(storePlatform.getPlatformName() + "-" + storePlatform.getId(), status);
+                } else if (storePlatform.getPlatformType() == PlatformType.delivery.getValue()) {
+                    this.deliveryPlatforms.put(storePlatform.getPlatformName() + "-" + storePlatform.getId(), status);
+                }
+            });
+        }
     }
 
     public StoreInfo getStoreInfo() {