浏览代码

Merge branch 'master' into 20250522-wyp-qwPlanSubChannel

# Conflicts:
#	api-module/src/main/java/com/tzld/piaoquan/api/job/ContentPlatformDatastatJob.java
wangyunpeng 1 月之前
父节点
当前提交
21445abdd6

+ 15 - 15
api-module/src/main/java/com/tzld/piaoquan/api/job/ContentPlatformDatastatJob.java

@@ -94,9 +94,9 @@ public class ContentPlatformDatastatJob {
         Map<Long, List<ContentPlatformGzhPlanVideo>> gzhPlanVideoMap = gzhPlanVideoList.stream()
                 .collect(Collectors.groupingBy(ContentPlatformGzhPlanVideo::getPlanId));
         List<Long> videoIds = gzhPlanVideoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
-        List<ContentPlatformVideo> contentPlatformVideoList = planService.getVideoContentListByVideoIds(videoIds);
-        Map<Long, ContentPlatformVideo> videoMap = contentPlatformVideoList.stream()
-                .collect(Collectors.toMap(ContentPlatformVideo::getVideoId, video -> video, (a, b) -> a));
+        List<ContentPlatformVideoAgg> contentPlatformVideoList = planService.getVideoContentAggListByVideoIds(videoIds);
+        Map<Long, ContentPlatformVideoAgg> videoMap = contentPlatformVideoList.stream()
+                .collect(Collectors.toMap(ContentPlatformVideoAgg::getVideoId, video -> video, (a, b) -> a));
         if (CollectionUtils.isNotEmpty(dataList)) {
             List<ContentPlatformGzhDataStat> saveList = new ArrayList<>();
             for (Record record : dataList) {
@@ -181,9 +181,9 @@ public class ContentPlatformDatastatJob {
         Map<Long, List<ContentPlatformGzhPlanVideo>> gzhPlanVideoMap = gzhPlanVideoList.stream()
                 .collect(Collectors.groupingBy(ContentPlatformGzhPlanVideo::getPlanId));
         List<Long> videoIds = gzhPlanVideoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
-        List<ContentPlatformVideo> contentPlatformVideoList = planService.getVideoContentListByVideoIds(videoIds);
-        Map<Long, ContentPlatformVideo> videoMap = contentPlatformVideoList.stream()
-                .collect(Collectors.toMap(ContentPlatformVideo::getVideoId, video -> video, (a, b) -> a));
+        List<ContentPlatformVideoAgg> contentPlatformVideoList = planService.getVideoContentAggListByVideoIds(videoIds);
+        Map<Long, ContentPlatformVideoAgg> videoMap = contentPlatformVideoList.stream()
+                .collect(Collectors.toMap(ContentPlatformVideoAgg::getVideoId, video -> video, (a, b) -> a));
         if (CollectionUtils.isNotEmpty(dataList)) {
             List<ContentPlatformGzhDataStatTotal> saveList = new ArrayList<>();
             for (Record record : dataList) {
@@ -276,9 +276,9 @@ public class ContentPlatformDatastatJob {
         Map<Long, List<ContentPlatformGzhPlanVideo>> gzhPlanVideoMap = gzhPlanVideoList.stream()
                 .collect(Collectors.groupingBy(ContentPlatformGzhPlanVideo::getPlanId));
         List<Long> videoIds = gzhPlanVideoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
-        List<ContentPlatformVideo> contentPlatformVideoList = planService.getVideoContentListByVideoIds(videoIds);
-        Map<Long, ContentPlatformVideo> videoMap = contentPlatformVideoList.stream()
-                .collect(Collectors.toMap(ContentPlatformVideo::getVideoId, video -> video, (a, b) -> a));
+        List<ContentPlatformVideoAgg> contentPlatformVideoList = planService.getVideoContentAggListByVideoIds(videoIds);
+        Map<Long, ContentPlatformVideoAgg> videoMap = contentPlatformVideoList.stream()
+                .collect(Collectors.toMap(ContentPlatformVideoAgg::getVideoId, video -> video, (a, b) -> a));
         if (CollectionUtils.isNotEmpty(dataList)) {
             List<ContentPlatformFwhDataStat> saveList = new ArrayList<>();
             for (Record record : dataList) {
@@ -363,9 +363,9 @@ public class ContentPlatformDatastatJob {
         Map<Long, List<ContentPlatformGzhPlanVideo>> gzhPlanVideoMap = gzhPlanVideoList.stream()
                 .collect(Collectors.groupingBy(ContentPlatformGzhPlanVideo::getPlanId));
         List<Long> videoIds = gzhPlanVideoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
-        List<ContentPlatformVideo> contentPlatformVideoList = planService.getVideoContentListByVideoIds(videoIds);
-        Map<Long, ContentPlatformVideo> videoMap = contentPlatformVideoList.stream()
-                .collect(Collectors.toMap(ContentPlatformVideo::getVideoId, video -> video, (a, b) -> a));
+        List<ContentPlatformVideoAgg> contentPlatformVideoList = planService.getVideoContentAggListByVideoIds(videoIds);
+        Map<Long, ContentPlatformVideoAgg> videoMap = contentPlatformVideoList.stream()
+                .collect(Collectors.toMap(ContentPlatformVideoAgg::getVideoId, video -> video, (a, b) -> a));
         if (CollectionUtils.isNotEmpty(dataList)) {
             List<ContentPlatformFwhDataStatTotal> saveList = new ArrayList<>();
             for (Record record : dataList) {
@@ -471,9 +471,9 @@ public class ContentPlatformDatastatJob {
         Map<Long, Long> planVideoMap = planVideoList.stream()
                 .collect(Collectors.toMap(ContentPlatformQwPlanVideo::getPlanId, ContentPlatformQwPlanVideo::getVideoId));
         List<Long> videoIds = planVideoList.stream().map(ContentPlatformQwPlanVideo::getVideoId).collect(Collectors.toList());
-        List<ContentPlatformVideo> videoList = planService.getVideoContentListByVideoIds(videoIds);
+        List<ContentPlatformVideoAgg> videoList = planService.getVideoContentAggListByVideoIds(videoIds);
         Map<Long, Double> videoScoreMap = videoList.stream()
-                .collect(Collectors.toMap(ContentPlatformVideo::getVideoId, ContentPlatformVideo::getScore, (a, b) -> a));
+                .collect(Collectors.toMap(ContentPlatformVideoAgg::getVideoId, ContentPlatformVideoAgg::getScore, (a, b) -> a));
         List<ContentPlatformQwDataStat> saveList = new ArrayList<>();
         List<String> rootSourceIds = qwPlanList.stream().map(ContentPlatformQwPlan::getRootSourceId).collect(Collectors.toList());
         String outSql = String.format("SELECT * FROM loghubods.qw_out_touliu_behavior_detail WHERE dt=%s;", dt);
@@ -687,7 +687,7 @@ public class ContentPlatformDatastatJob {
         if (CollectionUtils.isNotEmpty(saveList)) {
             List<String> channels = saveList.stream().map(ContentPlatformQwDataStatReplyTotal::getChannel).distinct().collect(Collectors.toList());
             List<ContentPlatformQwDataStatReplyTotal> channelScoreList = dataStatMapperExt.getQwTotalDatastatReplyScoreList(dt, channels);
-            Map<String, Double> channelScoreMap = channelScoreList.stream()
+            Map<String, Double> channelScoreMap = channelScoreList.stream().filter(o -> Objects.nonNull(o.getChannel()) && Objects.nonNull(o.getScore()))
                     .collect(Collectors.toMap(ContentPlatformQwDataStatReplyTotal::getChannel, ContentPlatformQwDataStatReplyTotal::getScore, (a, b) -> a));
             for (ContentPlatformQwDataStatReplyTotal item : saveList) {
                 item.setScore(channelScoreMap.get(item.getChannel()));

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformPlanService.java

@@ -58,6 +58,8 @@ public interface ContentPlatformPlanService {
 
     List<ContentPlatformVideo> getVideoContentListByVideoIds(List<Long> videoIds);
 
+    List<ContentPlatformVideoAgg> getVideoContentAggListByVideoIds(List<Long> videoIds);
+
     List<ContentPlatformGzhPlanVideo> getGzhPlanVideoList(List<Long> planIds);
 
     void gzhPlanDelete(Long id);

+ 11 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java

@@ -66,6 +66,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     @Autowired
     private ContentPlatformVideoMapper contentPlatformVideoMapper;
     @Autowired
+    private ContentPlatformVideoAggMapper contentPlatformVideoAggMapper;
+    @Autowired
     private ContentPlatformGzhPlanChangeLogMapper gzhPlanChangeLogMapper;
     @Autowired
     private ContentPlatformCooperateAccountService cooperateAccountService;
@@ -556,9 +558,18 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     public List<ContentPlatformVideo> getVideoContentListByVideoIds(List<Long> videoIds) {
         ContentPlatformVideoExample example = new ContentPlatformVideoExample();
         example.createCriteria().andVideoIdIn(videoIds);
+        example.setOrderByClause("id asc");
         return contentPlatformVideoMapper.selectByExample(example);
     }
 
+    @Override
+    public List<ContentPlatformVideoAgg> getVideoContentAggListByVideoIds(List<Long> videoIds) {
+        ContentPlatformVideoAggExample example = new ContentPlatformVideoAggExample();
+        example.createCriteria().andVideoIdIn(videoIds);
+        example.setOrderByClause("id asc");
+        return contentPlatformVideoAggMapper.selectByExample(example);
+    }
+
     @Override
     public List<QwPlanItemVO> qwPlanSave(QwPlanSaveParam param) {
         ContentPlatformAccount loginUser = LoginUserContext.getUser();