wangyunpeng 2 ヶ月 前
コミット
c5bf317ee0

+ 12 - 5
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformDatastatServiceImpl.java

@@ -201,15 +201,22 @@ public class ContentPlatformDatastatServiceImpl implements ContentPlatformDatast
             return null;
         }
         List<String> rootSourceIds = datastatList.stream().map(ContentPlatformQwDataStat::getRootSourceId).distinct().collect(Collectors.toList());
-        List<ContentPlatformQwPlan> qwPlanList = planService.getQwPlanListByRootSourceIds(rootSourceIds);
+        List<ContentPlatformQwPlan> qwPlanList = new ArrayList<>();
+        if (CollectionUtils.isNotEmpty(rootSourceIds)) {
+            qwPlanList = planService.getQwPlanListByRootSourceIds(rootSourceIds);
+        }
         Map<String, Long> qwPlanMap = qwPlanList.stream().collect(Collectors.toMap(ContentPlatformQwPlan::getRootSourceId, ContentPlatformQwPlan::getId));
         List<Long> planIds = qwPlanList.stream().map(ContentPlatformQwPlan::getId).distinct().collect(Collectors.toList());
-        List<ContentPlatformQwPlanVideo> qwPlanVideoList = planService.getQwPlanVideoListByPlanIds(planIds);
-        Map<Long, List<ContentPlatformQwPlanVideo>> qwPlanVideoMap = qwPlanVideoList.stream().collect(Collectors.groupingBy(ContentPlatformQwPlanVideo::getPlanId));
+        Map<Long, List<ContentPlatformQwPlanVideo>> qwPlanVideoMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(planIds)) {
+            List<ContentPlatformQwPlanVideo> qwPlanVideoList = planService.getQwPlanVideoListByPlanIds(planIds);
+            qwPlanVideoMap = qwPlanVideoList.stream().collect(Collectors.groupingBy(ContentPlatformQwPlanVideo::getPlanId));
+        }
         List<QwDatastatItemVO> result = new ArrayList<>();
         for (ContentPlatformQwDataStat datastat : datastatList) {
             QwDatastatItemVO vo = new QwDatastatItemVO();
             vo.setDateStr(datastat.getDateStr());
+            vo.setFirstLevel(datastat.getFirstLevelCount());
             vo.setScore(datastat.getScore());
             Long planId = qwPlanMap.get(datastat.getRootSourceId());
             if (Objects.nonNull(planId)) {
@@ -238,7 +245,7 @@ public class ContentPlatformDatastatServiceImpl implements ContentPlatformDatast
         if (CollectionUtils.isNotEmpty(dataList)) {
             for (GzhDatastatItemVO data : dataList) {
                 list.add(new GzhDatastatItemExportVO(data.getDateStr(), data.getName(),
-                        data.getFansIncreaseCount(), data.getFirstLevel(),  data.getOpenRate(), data.getScore()));
+                        data.getFansIncreaseCount(), data.getFirstLevel(), data.getOpenRate(), data.getScore()));
             }
         } else {
             list.add(new GzhDatastatItemExportVO());
@@ -265,7 +272,7 @@ public class ContentPlatformDatastatServiceImpl implements ContentPlatformDatast
         if (CollectionUtils.isNotEmpty(dataList)) {
             for (QwDatastatItemVO data : dataList) {
                 list.add(new QwDatastatItemExportVO(data.getDateStr(), data.getFirstLevel(),
-                        data.getScore(), data.getTitle(),  data.getVideoId()));
+                        data.getScore(), data.getTitle(), data.getVideoId()));
             }
         } else {
             list.add(new QwDatastatItemExportVO());