Selaa lähdekoodia

Merge branch '20250526-wyp-datastat' of Server/growth-manager into master

wangyunpeng 1 kuukausi sitten
vanhempi
commit
f89e6ce078

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

@@ -85,15 +85,15 @@ public class ContentPlatformDatastatJob {
                 ContentPlatformGzhPlanTypeEnum.AUTO_REPLY.getVal());
         List<Long> planIds = gzhPlanList.stream().map(ContentPlatformGzhPlan::getId).collect(Collectors.toList());
         Map<Long, List<Long>> gzhPlanMap = gzhPlanList.stream()
-               .collect(Collectors.groupingBy(ContentPlatformGzhPlan::getAccountId,
-                       Collectors.mapping(ContentPlatformGzhPlan::getId, Collectors.toList())));
+                .collect(Collectors.groupingBy(ContentPlatformGzhPlan::getAccountId,
+                        Collectors.mapping(ContentPlatformGzhPlan::getId, Collectors.toList())));
         List<ContentPlatformGzhPlanVideo> gzhPlanVideoList = planService.getGzhPlanVideoList(planIds);
         Map<Long, List<ContentPlatformGzhPlanVideo>> gzhPlanVideoMap = gzhPlanVideoList.stream()
-              .collect(Collectors.groupingBy(ContentPlatformGzhPlanVideo::getPlanId));
+                .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) {
@@ -158,7 +158,7 @@ public class ContentPlatformDatastatJob {
         // 所有公众号
         List<ContentPlatformAccount> accountList = getAllAccount();
         Map<String, ContentPlatformAccount> accountMap = accountList.stream()
-              .collect(Collectors.toMap(ContentPlatformAccount::getChannel, account -> account));
+                .collect(Collectors.toMap(ContentPlatformAccount::getChannel, account -> account));
         List<ContentPlatformGzhAccount> gzhAccountList = getAllGzhAccount();
         Map<Long, List<ContentPlatformGzhAccount>> gzhAccountMap = gzhAccountList.stream()
                 .collect(Collectors.groupingBy(ContentPlatformGzhAccount::getCreateAccountId));
@@ -172,15 +172,15 @@ public class ContentPlatformDatastatJob {
                 ContentPlatformGzhPlanTypeEnum.AUTO_REPLY.getVal());
         List<Long> planIds = gzhPlanList.stream().map(ContentPlatformGzhPlan::getId).collect(Collectors.toList());
         Map<Long, List<Long>> gzhPlanMap = gzhPlanList.stream()
-               .collect(Collectors.groupingBy(ContentPlatformGzhPlan::getAccountId,
-                       Collectors.mapping(ContentPlatformGzhPlan::getId, Collectors.toList())));
+                .collect(Collectors.groupingBy(ContentPlatformGzhPlan::getAccountId,
+                        Collectors.mapping(ContentPlatformGzhPlan::getId, Collectors.toList())));
         List<ContentPlatformGzhPlanVideo> gzhPlanVideoList = planService.getGzhPlanVideoList(planIds);
         Map<Long, List<ContentPlatformGzhPlanVideo>> gzhPlanVideoMap = gzhPlanVideoList.stream()
-              .collect(Collectors.groupingBy(ContentPlatformGzhPlanVideo::getPlanId));
+                .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) {
@@ -267,15 +267,15 @@ public class ContentPlatformDatastatJob {
                 ContentPlatformGzhPlanTypeEnum.FWH_PUSH.getVal());
         List<Long> planIds = gzhPlanList.stream().map(ContentPlatformGzhPlan::getId).collect(Collectors.toList());
         Map<Long, List<Long>> gzhPlanMap = gzhPlanList.stream()
-               .collect(Collectors.groupingBy(ContentPlatformGzhPlan::getAccountId,
-                       Collectors.mapping(ContentPlatformGzhPlan::getId, Collectors.toList())));
+                .collect(Collectors.groupingBy(ContentPlatformGzhPlan::getAccountId,
+                        Collectors.mapping(ContentPlatformGzhPlan::getId, Collectors.toList())));
         List<ContentPlatformGzhPlanVideo> gzhPlanVideoList = planService.getGzhPlanVideoList(planIds);
         Map<Long, List<ContentPlatformGzhPlanVideo>> gzhPlanVideoMap = gzhPlanVideoList.stream()
-              .collect(Collectors.groupingBy(ContentPlatformGzhPlanVideo::getPlanId));
+                .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) {
@@ -360,9 +360,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) {
@@ -462,15 +462,15 @@ public class ContentPlatformDatastatJob {
         List<ContentPlatformQwDataStat> existList = getQwDatastatCount(dt);
         List<String> existRootSourceIds = existList.stream().map(ContentPlatformQwDataStat::getRootSourceId).collect(Collectors.toList());
         Map<String, Long> rootSourceIdMap = qwPlanList.stream()
-            .collect(Collectors.toMap(ContentPlatformQwPlan::getRootSourceId, ContentPlatformQwPlan::getId));
+                .collect(Collectors.toMap(ContentPlatformQwPlan::getRootSourceId, ContentPlatformQwPlan::getId));
         List<Long> planIds = qwPlanList.stream().map(ContentPlatformQwPlan::getId).collect(Collectors.toList());
         List<ContentPlatformQwPlanVideo> planVideoList = planService.getQwPlanVideoList(planIds);
         Map<Long, Long> planVideoMap = planVideoList.stream()
-              .collect(Collectors.toMap(ContentPlatformQwPlanVideo::getPlanId, ContentPlatformQwPlanVideo::getVideoId));
+                .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);

+ 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;
@@ -555,9 +557,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();