Browse Source

修改营销系统

YPZ 3 weeks ago
parent
commit
4ad409d7ba

+ 13 - 3
java/storlead-sasa/storlead-trade/src/main/java/com/storlead/trade/service/impl/MarketingCampaignEntityServiceImpl.java

@@ -87,9 +87,19 @@ public class MarketingCampaignEntityServiceImpl
 
         for (int i = 0; i < marketingCampaignVOList.size(); i++) {
             int finalI = i;
-            List<CustomerBaseEntity> customerBaseList = customerBaseEntityList.stream().filter(customerBaseEntity -> customerBaseEntity.getCustomerAnalysisId().equals(customerAnalysisResultEntityList.get(finalI).getId())).collect(Collectors.toList());
-            List<Long> customerAnalysisResultIdList = customerBaseList.stream().filter(e -> e.getMarketingCampaignId().equals(marketingCampaignVOList.get(finalI).getId())).map(CustomerBaseEntity::getCustomerAnalysisId).collect(Collectors.toList());
-            List<CustomerAnalysisResultEntity> customerAnalysisResultEntityListI = customerAnalysisResultEntityList.stream().filter(customerAnalysisResultEntity -> customerAnalysisResultIdList.contains(customerAnalysisResultEntity.getId())).collect(Collectors.toList());
+            List<CustomerBaseEntity> customerBaseList = customerBaseEntityList.stream()
+                    .filter(customerBaseEntity -> customerBaseEntity.getMarketingCampaignId().equals(marketingCampaignVOList.get(finalI).getId()))
+                    .collect(Collectors.toList());
+            List<Long> customerAnalysisResultIdList = customerBaseList.stream()
+                    .map(CustomerBaseEntity::getCustomerAnalysisId)
+                    .collect(Collectors.toList());
+            if (CollectionUtils.isEmpty(customerAnalysisResultIdList)) {
+                marketingCampaignVOList.get(i).setCustomerList(new ArrayList<>());
+                continue;
+            }
+            List<CustomerAnalysisResultEntity> customerAnalysisResultEntityListI = customerAnalysisResultEntityList.stream()
+                    .filter(customerAnalysisResultEntity -> customerAnalysisResultIdList.contains(customerAnalysisResultEntity.getId()))
+                    .collect(Collectors.toList());
             marketingCampaignVOList.get(i).setCustomerList(customerAnalysisResultEntityListI);
         }