瀏覽代碼

Merge branch '20250530-wyp-contentPlatformDatastat' of Server/growth-manager into master

wangyunpeng 1 月之前
父節點
當前提交
4baecb19ae
共有 18 個文件被更改,包括 2757 次插入257 次删除
  1. 15 7
      api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformPlanController.java
  2. 30 0
      api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ContentPlatformVideoDataStatAggMapper.java
  3. 30 0
      api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ContentPlatformVideoDataStatMapper.java
  4. 13 1
      api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.java
  5. 81 232
      api-module/src/main/java/com/tzld/piaoquan/api/job/ContentPlatformDatastatJob.java
  6. 129 5
      api-module/src/main/java/com/tzld/piaoquan/api/job/ContentPlatformVideoJob.java
  7. 6 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/param/contentplatform/VideoContentListParam.java
  8. 112 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformVideoDataStat.java
  9. 112 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformVideoDataStatAgg.java
  10. 781 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformVideoDataStatAggExample.java
  11. 781 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformVideoDataStatExample.java
  12. 6 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/vo/contentplatform/VideoContentItemVO.java
  13. 3 1
      api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformApiServiceImpl.java
  14. 63 4
      api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java
  15. 278 0
      api-module/src/main/resources/mapper/contentplatform/ContentPlatformVideoDataStatAggMapper.xml
  16. 278 0
      api-module/src/main/resources/mapper/contentplatform/ContentPlatformVideoDataStatMapper.xml
  17. 37 6
      api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.xml
  18. 2 1
      api-module/src/main/resources/mybatis-api-contentPlatform-generator-config.xml

+ 15 - 7
api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformPlanController.java

@@ -97,19 +97,27 @@ public class ContentPlatformPlanController {
         return CommonResponse.success(planService.getSharePic(pageUrl));
     }
 
-    @ApiOperation(value = "同步最近14日top1000视频", hidden = true)
+    @ApiOperation(value = "同步最近top1000视频", hidden = true)
     @JwtIgnore
-    @PostMapping("/syncContentPlatformVideoJob")
-    public CommonResponse<Void> syncContentPlatformVideoJob(@RequestBody QwPlanSaveParam param) {
-        videoJob.syncContentPlatformVideoJob(null);
+    @GetMapping("/job/syncContentPlatformVideoJob")
+    public CommonResponse<Void> syncContentPlatformVideoJob(String dateStr) {
+        videoJob.syncContentPlatformVideoJob(dateStr);
         return CommonResponse.success();
     }
 
     @ApiOperation(value = "检查视频状态", hidden = true)
     @JwtIgnore
-    @PostMapping("/checkContentPlatformVideoStatusJob")
-    public CommonResponse<Void> checkContentPlatformVideoStatusJob(@RequestBody QwPlanSaveParam param) {
-        videoJob.checkContentPlatformVideoStatusJob(null);
+    @GetMapping("/job/checkContentPlatformVideoStatusJob")
+    public CommonResponse<Void> checkContentPlatformVideoStatusJob(String dateStr) {
+        videoJob.checkContentPlatformVideoStatusJob(dateStr);
+        return CommonResponse.success();
+    }
+
+    @ApiOperation(value = "同步最近top1000视频统计数据", hidden = true)
+    @JwtIgnore
+    @GetMapping("/job/syncContentPlatformVideoDatastatJob")
+    public CommonResponse<Void> syncContentPlatformVideoDatastatJob(String dateStr) {
+        videoJob.syncContentPlatformVideoDatastatJob(dateStr);
         return CommonResponse.success();
     }
 }

+ 30 - 0
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ContentPlatformVideoDataStatAggMapper.java

@@ -0,0 +1,30 @@
+package com.tzld.piaoquan.api.dao.mapper.contentplatform;
+
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAgg;
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAggExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface ContentPlatformVideoDataStatAggMapper {
+    long countByExample(ContentPlatformVideoDataStatAggExample example);
+
+    int deleteByExample(ContentPlatformVideoDataStatAggExample example);
+
+    int deleteByPrimaryKey(Long id);
+
+    int insert(ContentPlatformVideoDataStatAgg record);
+
+    int insertSelective(ContentPlatformVideoDataStatAgg record);
+
+    List<ContentPlatformVideoDataStatAgg> selectByExample(ContentPlatformVideoDataStatAggExample example);
+
+    ContentPlatformVideoDataStatAgg selectByPrimaryKey(Long id);
+
+    int updateByExampleSelective(@Param("record") ContentPlatformVideoDataStatAgg record, @Param("example") ContentPlatformVideoDataStatAggExample example);
+
+    int updateByExample(@Param("record") ContentPlatformVideoDataStatAgg record, @Param("example") ContentPlatformVideoDataStatAggExample example);
+
+    int updateByPrimaryKeySelective(ContentPlatformVideoDataStatAgg record);
+
+    int updateByPrimaryKey(ContentPlatformVideoDataStatAgg record);
+}

+ 30 - 0
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ContentPlatformVideoDataStatMapper.java

@@ -0,0 +1,30 @@
+package com.tzld.piaoquan.api.dao.mapper.contentplatform;
+
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStat;
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface ContentPlatformVideoDataStatMapper {
+    long countByExample(ContentPlatformVideoDataStatExample example);
+
+    int deleteByExample(ContentPlatformVideoDataStatExample example);
+
+    int deleteByPrimaryKey(Long id);
+
+    int insert(ContentPlatformVideoDataStat record);
+
+    int insertSelective(ContentPlatformVideoDataStat record);
+
+    List<ContentPlatformVideoDataStat> selectByExample(ContentPlatformVideoDataStatExample example);
+
+    ContentPlatformVideoDataStat selectByPrimaryKey(Long id);
+
+    int updateByExampleSelective(@Param("record") ContentPlatformVideoDataStat record, @Param("example") ContentPlatformVideoDataStatExample example);
+
+    int updateByExample(@Param("record") ContentPlatformVideoDataStat record, @Param("example") ContentPlatformVideoDataStatExample example);
+
+    int updateByPrimaryKeySelective(ContentPlatformVideoDataStat record);
+
+    int updateByPrimaryKey(ContentPlatformVideoDataStat record);
+}

+ 13 - 1
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.java

@@ -28,6 +28,8 @@ public interface ContentPlatformPlanMapperExt {
 
     String getVideoMaxDt();
 
+    String getVideoDatastatMaxDt();
+
     int getVideoCount(@Param("param") VideoContentListParam param, @Param("dt") String dt,
                       @Param("minScore") Double minScore);
 
@@ -35,9 +37,13 @@ public interface ContentPlatformPlanMapperExt {
 
     List<ContentPlatformVideo> getVideoList(@Param("param") VideoContentListParam param,
                                             @Param("dt") String dt,
+                                            @Param("datastatDt") String datastatDt,
+                                            @Param("type") String type,
+                                            @Param("channel") String channel,
                                             @Param("minScore") Double minScore,
                                             @Param("offset") int offset,
-                                            @Param("pageSize") Integer pageSize);
+                                            @Param("pageSize") Integer pageSize,
+                                            @Param("sort") String sort);
 
     void batchInsertContentPlatformVideo(@Param("records") List<ContentPlatformVideo> saveList);
 
@@ -66,4 +72,10 @@ public interface ContentPlatformPlanMapperExt {
     List<ContentPlatformVideo> getVideoListByIds(@Param("videoIds") List<Long> videoIds);
 
     void deleteContentPlatformVideoAgg(@Param("dt") String dt);
+
+    void deleteContentPlatformVideoDatastatAgg(@Param("dt") String aggDt);
+
+    void batchInsertContentPlatformVideoDatastat(@Param("records") List<ContentPlatformVideoDataStat> saveList);
+
+    void batchInsertContentPlatformVideoDatastatAgg(@Param("records") List<ContentPlatformVideoDataStatAgg> saveAggList);
 }

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

@@ -1,7 +1,6 @@
 package com.tzld.piaoquan.api.job;
 
 import com.aliyun.odps.data.Record;
-import com.tzld.piaoquan.api.common.enums.contentplatform.ContentPlatformGzhPlanTypeEnum;
 import com.tzld.piaoquan.api.component.AigcApiService;
 import com.tzld.piaoquan.api.dao.mapper.contentplatform.*;
 import com.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformDataStatMapperExt;
@@ -45,9 +44,6 @@ public class ContentPlatformDatastatJob {
     @Autowired
     private ContentPlatformQwPlanMapper qwPlanMapper;
 
-    @Autowired
-    private ContentPlatformQwPlanVideoMapper qwPlanVideoMapper;
-
     @Autowired
     private ContentPlatformDataStatMapperExt dataStatMapperExt;
 
@@ -70,39 +66,30 @@ public class ContentPlatformDatastatJob {
         }
         Long now = System.currentTimeMillis();
         // 公众号自动回复数据统计
-        String sql = String.format("SELECT 合作方, 公众号id, 访问人数, 首层访问人数, dt " +
-                "FROM loghubods.loghubods.gzh_autoreply_behavior_uv_total WHERE dt=%s;", dt);
+        String sql = String.format("SELECT first_level.channel_shortname, first_level.subchannel, first_level.first_uv, fission.split_uv " +
+                "FROM    loghubods.out_channel_mid_first_total first_level " +
+                "left join loghubods.out_channel_mid_split_total fission " +
+                "on first_level.channel_shortname = fission.channel_shortname and first_level.subchannel = fission.subchannel and first_level.dt = fission.dt " +
+                "and first_level.type = fission.type and first_level.tag = fission.tag " +
+                "WHERE   first_level.dt = %s and first_level.type = '公众号即时回复' and first_level.tag = '投放渠道内分客户分账号去重';", dt);
         List<Record> dataList = OdpsUtil.getOdpsData(sql);
         // 所有公众号
         List<ContentPlatformGzhAccount> accountList = getAllGzhAccount();
         Map<String, ContentPlatformGzhAccount> accountMap = accountList.stream()
                 .collect(Collectors.toMap(ContentPlatformGzhAccount::getGhId, account -> account));
-        List<Long> accountIds = accountList.stream().map(ContentPlatformGzhAccount::getId).collect(Collectors.toList());
         List<String> ghIds = accountList.stream().map(ContentPlatformGzhAccount::getGhId).collect(Collectors.toList());
         List<String> accountExternalIds = accountList.stream().map(ContentPlatformGzhAccount::getExternalId).collect(Collectors.toList());
         String dateStr = dt.substring(0, 4) + "-" + dt.substring(4, 6) + "-" + dt.substring(6, 8);
         List<WxAccountDatastatVO> wxAccountDatastatVOList = aigcApiService.getWxAccountDatastat(dateStr, accountExternalIds);
         Map<String, WxAccountDatastatVO> wxAccountDatastatMap = wxAccountDatastatVOList.stream()
                 .collect(Collectors.toMap(WxAccountDatastatVO::getAccountId, wxAccountDatastatVO -> wxAccountDatastatVO));
-        List<ContentPlatformGzhPlan> gzhPlanList = planService.getGzhPlanListByCooperateAccountIds(accountIds,
-                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())));
-        List<ContentPlatformGzhPlanVideo> gzhPlanVideoList = planService.getGzhPlanVideoList(planIds);
-        Map<Long, List<ContentPlatformGzhPlanVideo>> gzhPlanVideoMap = gzhPlanVideoList.stream()
-                .collect(Collectors.groupingBy(ContentPlatformGzhPlanVideo::getPlanId));
-        List<Long> videoIds = gzhPlanVideoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
-        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) {
                 ContentPlatformGzhDataStat item = new ContentPlatformGzhDataStat();
                 String ghId = (String) record.get(1);
-                Integer firstLevelCount = Integer.valueOf((String) record.get(3));
+                Integer firstLevelCount = Integer.valueOf((String) record.get(2));
+                Integer fissionCount = parseInteger(record.get(3));
                 item.setDateStr(dt);
                 if (!ghIds.contains(ghId)) {
                     continue;
@@ -114,26 +101,9 @@ public class ContentPlatformDatastatJob {
                 if (Objects.nonNull(wxAccountDatastatVO)) {
                     item.setFansIncreaseCount(wxAccountDatastatVO.getFansIncreaseCount());
                 }
-                List<Long> planIdList = gzhPlanMap.get(gzhAccount.getId());
-                if (CollectionUtils.isEmpty(planIdList)) {
-                    continue;
-                }
-                Double score = 0.0;
-                int size = 0;
-                for (Long planId : planIdList) {
-                    List<ContentPlatformGzhPlanVideo> videoList = gzhPlanVideoMap.get(planId);
-                    if (CollectionUtils.isNotEmpty(videoList)) {
-                        List<Long> itemVideoIds = videoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
-                        for (Long videoId : itemVideoIds) {
-                            if (Objects.nonNull(videoMap.get(videoId))) {
-                                score += videoMap.get(videoId).getScore();
-                            }
-                        }
-                        size += videoList.size();
-                    }
-                }
-                if (size > 0) {
-                    BigDecimal num = BigDecimal.valueOf(score / size);
+
+                if (Objects.nonNull(fissionCount) && fissionCount > 0 && firstLevelCount > 0) {
+                    BigDecimal num = BigDecimal.valueOf(fissionCount.doubleValue() / firstLevelCount);
                     BigDecimal rounded = num.setScale(2, RoundingMode.HALF_UP);
                     item.setScore(rounded.doubleValue());
                 }
@@ -155,8 +125,12 @@ public class ContentPlatformDatastatJob {
         }
         Long now = System.currentTimeMillis();
         // 公众号自动回复数据统计
-        String sql = String.format("SELECT channel_shortname, first_uv, dt " +
-                "FROM loghubods.out_channel_mid_first_total WHERE tag = '投放渠道内去重' and type = '公众号即时回复' and dt=%s;", dt);
+        String sql = String.format("SELECT  first_level.channel_shortname, first_level.first_uv, fission.split_uv " +
+                "FROM    loghubods.out_channel_mid_first_total first_level " +
+                "left join loghubods.out_channel_mid_split_total fission " +
+                "on first_level.channel_shortname = fission.channel_shortname and first_level.dt = fission.dt " +
+                "and first_level.type = fission.type and first_level.tag = fission.tag " +
+                "WHERE   first_level.dt = %s and first_level.type = '公众号即时回复' and first_level.tag = '投放渠道内去重' ;", dt);
         List<Record> dataList = OdpsUtil.getOdpsData(sql);
         // 所有公众号
         List<ContentPlatformAccount> accountList = getAllAccount();
@@ -165,31 +139,18 @@ public class ContentPlatformDatastatJob {
         List<ContentPlatformGzhAccount> gzhAccountList = getAllGzhAccount();
         Map<Long, List<ContentPlatformGzhAccount>> gzhAccountMap = gzhAccountList.stream()
                 .collect(Collectors.groupingBy(ContentPlatformGzhAccount::getCreateAccountId));
-        List<Long> accountIds = gzhAccountList.stream().map(ContentPlatformGzhAccount::getId).collect(Collectors.toList());
         List<String> accountExternalIds = gzhAccountList.stream().map(ContentPlatformGzhAccount::getExternalId).collect(Collectors.toList());
         String dateStr = dt.substring(0, 4) + "-" + dt.substring(4, 6) + "-" + dt.substring(6, 8);
         List<WxAccountDatastatVO> wxAccountDatastatVOList = aigcApiService.getWxAccountDatastat(dateStr, accountExternalIds);
         Map<String, WxAccountDatastatVO> wxAccountDatastatMap = wxAccountDatastatVOList.stream()
                 .collect(Collectors.toMap(WxAccountDatastatVO::getAccountId, wxAccountDatastatVO -> wxAccountDatastatVO));
-        List<ContentPlatformGzhPlan> gzhPlanList = planService.getGzhPlanListByCooperateAccountIds(accountIds,
-                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())));
-        List<ContentPlatformGzhPlanVideo> gzhPlanVideoList = planService.getGzhPlanVideoList(planIds);
-        Map<Long, List<ContentPlatformGzhPlanVideo>> gzhPlanVideoMap = gzhPlanVideoList.stream()
-                .collect(Collectors.groupingBy(ContentPlatformGzhPlanVideo::getPlanId));
-        List<Long> videoIds = gzhPlanVideoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
-        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) {
                 ContentPlatformGzhDataStatTotal item = new ContentPlatformGzhDataStatTotal();
                 String channel = record.getString(0);
                 Integer firstLevelCount = Integer.valueOf((String) record.get(1));
+                Integer fissionCount = parseInteger(record.get(2));
                 item.setDateStr(dt);
                 item.setChannel(channel);
                 item.setFirstLevelCount(firstLevelCount);
@@ -199,33 +160,16 @@ public class ContentPlatformDatastatJob {
                 }
                 List<ContentPlatformGzhAccount> gzhAccounts = gzhAccountMap.get(account.getId());
                 int fansIncreaseCount = 0;
-                Double score = 0.0;
-                int size = 0;
                 for (ContentPlatformGzhAccount gzhAccount : gzhAccounts) {
                     WxAccountDatastatVO wxAccountDatastatVO = wxAccountDatastatMap.get(gzhAccount.getExternalId());
                     if (Objects.nonNull(wxAccountDatastatVO)) {
                         fansIncreaseCount += wxAccountDatastatVO.getFansIncreaseCount();
                     }
-                    List<Long> planIdList = gzhPlanMap.get(gzhAccount.getId());
-                    if (CollectionUtils.isEmpty(planIdList)) {
-                        continue;
-                    }
-                    for (Long planId : planIdList) {
-                        List<ContentPlatformGzhPlanVideo> videoList = gzhPlanVideoMap.get(planId);
-                        if (CollectionUtils.isNotEmpty(videoList)) {
-                            List<Long> itemVideoIds = videoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
-                            for (Long videoId : itemVideoIds) {
-                                if (Objects.nonNull(videoMap.get(videoId))) {
-                                    score += videoMap.get(videoId).getScore();
-                                }
-                            }
-                            size += videoList.size();
-                        }
-                    }
                 }
                 item.setFansIncreaseCount(fansIncreaseCount);
-                if (size > 0) {
-                    BigDecimal num = BigDecimal.valueOf(score / size);
+
+                if (Objects.nonNull(fissionCount) && fissionCount > 0 && firstLevelCount > 0) {
+                    BigDecimal num = BigDecimal.valueOf(fissionCount.doubleValue() / firstLevelCount);
                     BigDecimal rounded = num.setScale(2, RoundingMode.HALF_UP);
                     item.setScore(rounded.doubleValue());
                 }
@@ -252,39 +196,30 @@ public class ContentPlatformDatastatJob {
         }
         Long now = System.currentTimeMillis();
         // 公众号自动回复数据统计
-        String sql = String.format("SELECT ghid, 首层访问人数, dt " +
-                "FROM loghubods.loghubods.fwhhzdyy_data_per_ghid WHERE dt=%s;", dt);
+        String sql = String.format("SELECT first_level.subchannel, first_level.first_uv, fission.split_uv " +
+                "FROM    loghubods.out_channel_mid_first_total first_level " +
+                "left join loghubods.out_channel_mid_split_total fission " +
+                "on first_level.subchannel = fission.subchannel and first_level.dt = fission.dt " +
+                "and first_level.type = fission.type and first_level.tag = fission.tag " +
+                "WHERE   first_level.dt = %s and first_level.type = '服务号代运营' and first_level.tag = '投放渠道内分客户分账号去重' ;", dt);
         List<Record> dataList = OdpsUtil.getOdpsData(sql);
         // 所有公众号
         List<ContentPlatformGzhAccount> accountList = getAllGzhAccount();
         Map<String, ContentPlatformGzhAccount> accountMap = accountList.stream()
                 .collect(Collectors.toMap(ContentPlatformGzhAccount::getGhId, account -> account));
-        List<Long> accountIds = accountList.stream().map(ContentPlatformGzhAccount::getId).collect(Collectors.toList());
         List<String> ghIds = accountList.stream().map(ContentPlatformGzhAccount::getGhId).collect(Collectors.toList());
         List<String> accountExternalIds = accountList.stream().map(ContentPlatformGzhAccount::getExternalId).collect(Collectors.toList());
         String dateStr = dt.substring(0, 4) + "-" + dt.substring(4, 6) + "-" + dt.substring(6, 8);
         List<WxAccountDatastatVO> wxAccountDatastatVOList = aigcApiService.getWxAccountDatastat(dateStr, accountExternalIds);
         Map<String, WxAccountDatastatVO> wxAccountDatastatMap = wxAccountDatastatVOList.stream()
                 .collect(Collectors.toMap(WxAccountDatastatVO::getAccountId, wxAccountDatastatVO -> wxAccountDatastatVO));
-        List<ContentPlatformGzhPlan> gzhPlanList = planService.getGzhPlanListByCooperateAccountIds(accountIds,
-                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())));
-        List<ContentPlatformGzhPlanVideo> gzhPlanVideoList = planService.getGzhPlanVideoList(planIds);
-        Map<Long, List<ContentPlatformGzhPlanVideo>> gzhPlanVideoMap = gzhPlanVideoList.stream()
-                .collect(Collectors.groupingBy(ContentPlatformGzhPlanVideo::getPlanId));
-        List<Long> videoIds = gzhPlanVideoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
-        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) {
                 ContentPlatformFwhDataStat item = new ContentPlatformFwhDataStat();
                 String ghId = (String) record.get(0);
                 Integer firstLevelCount = Integer.valueOf((String) record.get(1));
+                Integer fissionCount = parseInteger(record.get(2));
                 item.setDateStr(dt);
                 if (!ghIds.contains(ghId)) {
                     continue;
@@ -296,26 +231,9 @@ public class ContentPlatformDatastatJob {
                 if (Objects.nonNull(wxAccountDatastatVO)) {
                     item.setFansIncreaseCount(wxAccountDatastatVO.getFansIncreaseCount());
                 }
-                List<Long> planIdList = gzhPlanMap.get(gzhAccount.getId());
-                if (CollectionUtils.isEmpty(planIdList)) {
-                    continue;
-                }
-                Double score = 0.0;
-                int size = 0;
-                for (Long planId : planIdList) {
-                    List<ContentPlatformGzhPlanVideo> videoList = gzhPlanVideoMap.get(planId);
-                    if (CollectionUtils.isNotEmpty(videoList)) {
-                        List<Long> itemVideoIds = videoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
-                        for (Long videoId : itemVideoIds) {
-                            if (Objects.nonNull(videoMap.get(videoId))) {
-                                score += videoMap.get(videoId).getScore();
-                            }
-                        }
-                        size += videoList.size();
-                    }
-                }
-                if (size > 0) {
-                    BigDecimal num = BigDecimal.valueOf(score / size);
+
+                if (Objects.nonNull(fissionCount) && fissionCount > 0 && firstLevelCount > 0) {
+                    BigDecimal num = BigDecimal.valueOf(fissionCount.doubleValue() / firstLevelCount);
                     BigDecimal rounded = num.setScale(2, RoundingMode.HALF_UP);
                     item.setScore(rounded.doubleValue());
                 }
@@ -337,8 +255,12 @@ public class ContentPlatformDatastatJob {
         }
         Long now = System.currentTimeMillis();
         // 公众号自动回复数据统计
-        String sql = String.format("SELECT channel_shortname, first_uv, dt " +
-                "FROM loghubods.out_channel_mid_first_total WHERE tag = '投放渠道内去重' and type = '服务号代运营' and dt=%s;", dt);
+        String sql = String.format("SELECT  first_level.channel_shortname, first_level.first_uv, fission.split_uv " +
+                "FROM    loghubods.out_channel_mid_first_total first_level " +
+                "left join loghubods.out_channel_mid_split_total fission " +
+                "on first_level.channel_shortname = fission.channel_shortname and first_level.dt = fission.dt " +
+                "and first_level.type = fission.type and first_level.tag = fission.tag " +
+                "WHERE   first_level.dt = %s and first_level.type = '服务号代运营' and first_level.tag = '投放渠道内去重' ;", dt);
         List<Record> dataList = OdpsUtil.getOdpsData(sql);
         // 所有公众号
         List<ContentPlatformAccount> accountList = getAllAccount();
@@ -347,31 +269,18 @@ public class ContentPlatformDatastatJob {
         List<ContentPlatformGzhAccount> gzhAccountList = getAllGzhAccount();
         Map<Long, List<ContentPlatformGzhAccount>> gzhAccountMap = gzhAccountList.stream()
                 .collect(Collectors.groupingBy(ContentPlatformGzhAccount::getCreateAccountId));
-        List<Long> accountIds = gzhAccountList.stream().map(ContentPlatformGzhAccount::getId).collect(Collectors.toList());
         List<String> accountExternalIds = gzhAccountList.stream().map(ContentPlatformGzhAccount::getExternalId).collect(Collectors.toList());
         String dateStr = dt.substring(0, 4) + "-" + dt.substring(4, 6) + "-" + dt.substring(6, 8);
         List<WxAccountDatastatVO> wxAccountDatastatVOList = aigcApiService.getWxAccountDatastat(dateStr, accountExternalIds);
         Map<String, WxAccountDatastatVO> wxAccountDatastatMap = wxAccountDatastatVOList.stream()
                 .collect(Collectors.toMap(WxAccountDatastatVO::getAccountId, wxAccountDatastatVO -> wxAccountDatastatVO));
-        List<ContentPlatformGzhPlan> gzhPlanList = planService.getGzhPlanListByCooperateAccountIds(accountIds,
-                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())));
-        List<ContentPlatformGzhPlanVideo> gzhPlanVideoList = planService.getGzhPlanVideoList(planIds);
-        Map<Long, List<ContentPlatformGzhPlanVideo>> gzhPlanVideoMap = gzhPlanVideoList.stream()
-                .collect(Collectors.groupingBy(ContentPlatformGzhPlanVideo::getPlanId));
-        List<Long> videoIds = gzhPlanVideoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
-        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) {
                 ContentPlatformFwhDataStatTotal item = new ContentPlatformFwhDataStatTotal();
                 String channel = record.getString(0);
                 Integer firstLevelCount = Integer.valueOf((String) record.get(1));
+                Integer fissionCount = parseInteger(record.get(2));
                 item.setDateStr(dt);
                 item.setChannel(channel);
                 item.setFirstLevelCount(firstLevelCount);
@@ -381,33 +290,16 @@ public class ContentPlatformDatastatJob {
                 }
                 List<ContentPlatformGzhAccount> gzhAccounts = gzhAccountMap.get(account.getId());
                 int fansIncreaseCount = 0;
-                Double score = 0.0;
-                int size = 0;
                 for (ContentPlatformGzhAccount gzhAccount : gzhAccounts) {
                     WxAccountDatastatVO wxAccountDatastatVO = wxAccountDatastatMap.get(gzhAccount.getExternalId());
                     if (Objects.nonNull(wxAccountDatastatVO)) {
                         fansIncreaseCount += wxAccountDatastatVO.getFansIncreaseCount();
                     }
-                    List<Long> planIdList = gzhPlanMap.get(gzhAccount.getId());
-                    if (CollectionUtils.isEmpty(planIdList)) {
-                        continue;
-                    }
-                    for (Long planId : planIdList) {
-                        List<ContentPlatformGzhPlanVideo> videoList = gzhPlanVideoMap.get(planId);
-                        if (CollectionUtils.isNotEmpty(videoList)) {
-                            List<Long> itemVideoIds = videoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
-                            for (Long videoId : itemVideoIds) {
-                                if (Objects.nonNull(videoMap.get(videoId))) {
-                                    score += videoMap.get(videoId).getScore();
-                                }
-                            }
-                            size += videoList.size();
-                        }
-                    }
                 }
                 item.setFansIncreaseCount(fansIncreaseCount);
-                if (size > 0) {
-                    BigDecimal num = BigDecimal.valueOf(score / size);
+
+                if (Objects.nonNull(fissionCount) && fissionCount > 0 && firstLevelCount > 0) {
+                    BigDecimal num = BigDecimal.valueOf(fissionCount.doubleValue() / firstLevelCount);
                     BigDecimal rounded = num.setScale(2, RoundingMode.HALF_UP);
                     item.setScore(rounded.doubleValue());
                 }
@@ -556,21 +448,20 @@ public class ContentPlatformDatastatJob {
         if (StringUtils.hasText(param)) {
             dt = param;
         }
-        dataStatMapperExt.deleteQwDatastatTotal(dt);
         Map<String, ContentPlatformQwDataStatTotal> saveMap = new HashMap<>();
-        String outSql = String.format("SELECT channel_shortname, first_uv, dt " +
-                "FROM loghubods.out_channel_mid_first_total WHERE tag = '投放渠道内去重' and type = '企微外部' and dt=%s;", dt);
-//        String outSql = String.format("SELECT * FROM loghubods.qw_out_touliu_behavior_total WHERE dt=%s;", dt);
+        String outSql = String.format("SELECT first_level.channel_shortname, first_level.first_uv, fission.split_uv " +
+                "FROM    loghubods.out_channel_mid_first_total first_level " +
+                "left join loghubods.out_channel_mid_split_total fission " +
+                "on first_level.channel_shortname = fission.channel_shortname and first_level.dt = fission.dt " +
+                "and first_level.type = fission.type and first_level.tag = fission.tag " +
+                "WHERE   first_level.dt = %s and first_level.type = '企微外部' and first_level.tag = '投放渠道内去重' ;", dt);
         List<Record> outDataList = OdpsUtil.getOdpsData(outSql);
         Long now = System.currentTimeMillis();
         if (CollectionUtils.isNotEmpty(outDataList)) {
             for (Record record : outDataList) {
-//                String type = (String) record.get(1);
-//                if (!"社群".equals(type) && !"自动回复".equals(type)) {
-//                    continue;
-//                }
                 String channel = (String) record.get(0);
                 int firstLevelCount = Integer.parseInt((String) record.get(1));
+                Integer fissionCount = parseInteger(record.get(2));
                 if (firstLevelCount == 0) {
                     continue;
                 }
@@ -580,50 +471,20 @@ public class ContentPlatformDatastatJob {
                 if (item.getFirstLevelCount() == null) {
                     item.setFirstLevelCount(0);
                 }
+
+                if (Objects.nonNull(fissionCount) && fissionCount > 0 && firstLevelCount > 0) {
+                    BigDecimal num = BigDecimal.valueOf(fissionCount.doubleValue() / firstLevelCount);
+                    BigDecimal rounded = num.setScale(2, RoundingMode.HALF_UP);
+                    item.setScore(rounded.doubleValue());
+                }
                 item.setFirstLevelCount(item.getFirstLevelCount() + firstLevelCount);
                 item.setCreateTimestamp(now);
                 saveMap.put(channel, item);
             }
         }
-//        String out2Sql = String.format("SELECT * FROM loghubods.qw_out2_touliu_behavior_total WHERE dt=%s;", dt);
-//        List<Record> out2DataList = OdpsUtil.getOdpsData(out2Sql);
-//        if (CollectionUtils.isNotEmpty(out2DataList)) {
-//            List<String> out2Channels = new ArrayList<>();
-//            for (Record record : out2DataList) {
-//                String type = (String) record.get(1);
-//                if (!"社群".equals(type) && !"自动回复".equals(type)) {
-//                    continue;
-//                }
-//                String channel = (String) record.get(33);
-//                int firstLevelCount = Integer.parseInt((String) record.get(6));
-//                if (firstLevelCount == 0) {
-//                    continue;
-//                }
-//                if (saveMap.containsKey(channel) && !out2Channels.contains(channel)) {
-//                    saveMap.remove(channel);
-//                }
-//                ContentPlatformQwDataStatTotal item = saveMap.getOrDefault(channel, new ContentPlatformQwDataStatTotal());
-//                item.setDateStr(dt);
-//                item.setChannel(channel);
-//                if (item.getFirstLevelCount() == null) {
-//                    item.setFirstLevelCount(0);
-//                }
-//                item.setFirstLevelCount(item.getFirstLevelCount() + firstLevelCount);
-//                item.setCreateTimestamp(now);
-//                out2Channels.add(channel);
-//                saveMap.put(channel, item);
-//            }
-//        }
         List<ContentPlatformQwDataStatTotal> saveList = new ArrayList<>(saveMap.values());
         if (CollectionUtils.isNotEmpty(saveList)) {
-            List<String> channels = saveList.stream().map(ContentPlatformQwDataStatTotal::getChannel).distinct().collect(Collectors.toList());
-            List<ContentPlatformQwDataStatTotal> channelScoreList = dataStatMapperExt.getQwTotalDatastatScoreList(dt, channels);
-            Map<String, Double> channelScoreMap = channelScoreList.stream()
-                    .filter(o -> Objects.nonNull(o.getChannel()) && Objects.nonNull(o.getScore()))
-                    .collect(Collectors.toMap(ContentPlatformQwDataStatTotal::getChannel, ContentPlatformQwDataStatTotal::getScore, (a, b) -> a));
-            for (ContentPlatformQwDataStatTotal item : saveList) {
-                item.setScore(channelScoreMap.get(item.getChannel()));
-            }
+            dataStatMapperExt.deleteQwDatastatTotal(dt);
             dataStatMapperExt.batchInsertQwDatastatTotal(saveList);
         }
         return ReturnT.SUCCESS;
@@ -635,7 +496,6 @@ public class ContentPlatformDatastatJob {
         if (StringUtils.hasText(param)) {
             dt = param;
         }
-        dataStatMapperExt.deleteQwDatastatReplyTotal(dt);
         Map<String, ContentPlatformQwDataStatReplyTotal> saveMap = new HashMap<>();
         String outSql = String.format("SELECT * FROM loghubods.qw_out_touliu_behavior_total WHERE dt=%s and 推送方式 = '自动回复';", dt);
         List<Record> outDataList = OdpsUtil.getOdpsData(outSql);
@@ -669,6 +529,7 @@ public class ContentPlatformDatastatJob {
                     continue;
                 }
                 if (saveMap.containsKey(channel) && !out2Channels.contains(channel)) {
+
                     saveMap.remove(channel);
                 }
                 ContentPlatformQwDataStatReplyTotal item = saveMap.getOrDefault(channel, new ContentPlatformQwDataStatReplyTotal());
@@ -692,6 +553,7 @@ public class ContentPlatformDatastatJob {
             for (ContentPlatformQwDataStatReplyTotal item : saveList) {
                 item.setScore(channelScoreMap.get(item.getChannel()));
             }
+            dataStatMapperExt.deleteQwDatastatReplyTotal(dt);
             dataStatMapperExt.batchInsertQwDatastatReplyTotal(saveList);
         }
         return ReturnT.SUCCESS;
@@ -704,7 +566,12 @@ public class ContentPlatformDatastatJob {
             dt = param;
         }
         List<ContentPlatformQwDataStatSubChannel> saveList = new ArrayList<>();
-        String outSql = String.format("SELECT channel, subchannel, first_uv FROM loghubods.qw_out_channel_mid_first_total WHERE dt=%s;", dt);
+        String outSql = String.format("SELECT  first_level.channel_shortname, first_level.subchannel, first_level.first_uv, fission.split_uv " +
+                "FROM    loghubods.out_channel_mid_first_total first_level " +
+                "left join loghubods.out_channel_mid_split_total fission " +
+                "on first_level.channel_shortname = fission.channel_shortname and first_level.subchannel = fission.subchannel and first_level.dt = fission.dt " +
+                "and first_level.type = fission.type and first_level.tag = fission.tag " +
+                "WHERE   first_level.dt = %s and first_level.type = '企微外部' and first_level.tag = '投放渠道内分客户分账号去重' ;", dt);
         List<Record> outDataList = OdpsUtil.getOdpsData(outSql);
         List<ContentPlatformAccount> accountList = getAllAccount();
         Map<String, ContentPlatformAccount> accountMap = accountList.stream()
@@ -712,20 +579,6 @@ public class ContentPlatformDatastatJob {
         List<ContentPlatformQwPlan> qwPlanList = getSubChannelQwPlanList();
         Map<Long, List<ContentPlatformQwPlan>> qwPlanMap = qwPlanList.stream().collect(
                 Collectors.groupingBy(ContentPlatformQwPlan::getCreateAccountId));
-        List<Long> qwPlanIds = qwPlanList.stream().map(ContentPlatformQwPlan::getId).collect(Collectors.toList());
-        List<ContentPlatformQwPlanVideo> qwPlanVideoList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(qwPlanIds)) {
-            qwPlanVideoList = getSubChannelQwPlanVideoList(qwPlanIds);
-        }
-        Map<Long, List<ContentPlatformQwPlanVideo>> qwPlanVideoMap = qwPlanVideoList.stream()
-               .collect(Collectors.groupingBy(ContentPlatformQwPlanVideo::getPlanId));
-        List<Long> videoIdList = qwPlanVideoList.stream().map(ContentPlatformQwPlanVideo::getVideoId).collect(Collectors.toList());
-        List<ContentPlatformVideo> videoList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(videoIdList)) {
-            videoList = planService.getVideoContentListByVideoIds(videoIdList);
-        }
-        Map<Long, Double> videoScoreMap = videoList.stream()
-                .collect(Collectors.toMap(ContentPlatformVideo::getVideoId, ContentPlatformVideo::getScore, (a, b) -> a));
         Long now = System.currentTimeMillis();
         if (CollectionUtils.isNotEmpty(outDataList)) {
             List<Record> noSubChannelRecordList = new ArrayList<>();
@@ -733,6 +586,7 @@ public class ContentPlatformDatastatJob {
                 String channel = (String) record.get(0);
                 String subChannel = (String) record.get(1);
                 int firstLevelCount = Integer.parseInt((String) record.get(2));
+                Integer fissionCount = parseInteger(record.get(3));
                 if (firstLevelCount == 0) {
                     continue;
                 }
@@ -753,23 +607,9 @@ public class ContentPlatformDatastatJob {
                 if (item.getFirstLevelCount() == null) {
                     item.setFirstLevelCount(0);
                 }
-                Double score = 0.0;
-                int size = 0;
-                for (ContentPlatformQwPlan qwPlan : qwPlans) {
-                    List<ContentPlatformQwPlanVideo> planVideoList = qwPlanVideoMap.get(qwPlan.getId());
-                    if (CollectionUtils.isEmpty(planVideoList)) {
-                        continue;
-                    }
-                    List<Long> videoIds = planVideoList.stream().map(ContentPlatformQwPlanVideo::getVideoId).collect(Collectors.toList());
-                    size += videoIds.size();
-                    for (Long videoId : videoIds) {
-                        if (Objects.nonNull(videoScoreMap.get(videoId))) {
-                            score += videoScoreMap.get(videoId);
-                        }
-                    }
-                }
-                if (size > 0) {
-                    BigDecimal num = BigDecimal.valueOf(score / size);
+
+                if (Objects.nonNull(fissionCount) && fissionCount > 0 && firstLevelCount > 0) {
+                    BigDecimal num = BigDecimal.valueOf(fissionCount.doubleValue() / firstLevelCount);
                     BigDecimal rounded = num.setScale(2, RoundingMode.HALF_UP);
                     item.setScore(rounded.doubleValue());
                 }
@@ -780,6 +620,7 @@ public class ContentPlatformDatastatJob {
             for (Record record : noSubChannelRecordList) {
                 String channel = (String) record.get(0);
                 int firstLevelCount = Integer.parseInt((String) record.get(2));
+                Integer fissionCount = parseInteger(record.get(3));
                 ContentPlatformQwDataStatSubChannel item = new ContentPlatformQwDataStatSubChannel();
                 item.setDateStr(dt);
                 ContentPlatformAccount account = accountMap.get(channel);
@@ -792,6 +633,12 @@ public class ContentPlatformDatastatJob {
                     item.setFirstLevelCount(0);
                 }
                 item.setFirstLevelCount(item.getFirstLevelCount() + firstLevelCount);
+
+                if (Objects.nonNull(fissionCount) && fissionCount > 0 && firstLevelCount > 0) {
+                    BigDecimal num = BigDecimal.valueOf(fissionCount.doubleValue() / firstLevelCount);
+                    BigDecimal rounded = num.setScale(2, RoundingMode.HALF_UP);
+                    item.setScore(rounded.doubleValue());
+                }
                 item.setCreateTimestamp(now);
                 saveList.add(item);
             }
@@ -808,11 +655,13 @@ public class ContentPlatformDatastatJob {
         example.createCriteria().andSubChannelIsNotNull();
         return qwPlanMapper.selectByExample(example);
     }
-
-    private List<ContentPlatformQwPlanVideo> getSubChannelQwPlanVideoList(List<Long> qwPlanIds) {
-        ContentPlatformQwPlanVideoExample example = new ContentPlatformQwPlanVideoExample();
-        example.createCriteria().andPlanIdIn(qwPlanIds);
-        return qwPlanVideoMapper.selectByExample(example);
+    
+    private Integer parseInteger(Object value) {
+        try {
+            return Integer.parseInt((String) value);
+        } catch (NumberFormatException e) {
+            return null;
+        }
     }
 
 }

+ 129 - 5
api-module/src/main/java/com/tzld/piaoquan/api/job/ContentPlatformVideoJob.java

@@ -3,12 +3,11 @@ package com.tzld.piaoquan.api.job;
 import com.aliyun.odps.data.Record;
 import com.google.common.collect.Lists;
 import com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformVideoAggMapper;
+import com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformVideoDataStatAggMapper;
+import com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformVideoDataStatMapper;
 import com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformVideoMapper;
 import com.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformPlanMapperExt;
-import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideo;
-import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoAgg;
-import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoAggExample;
-import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoExample;
+import com.tzld.piaoquan.api.model.po.contentplatform.*;
 import com.tzld.piaoquan.growth.common.model.bo.VideoDetail;
 import com.tzld.piaoquan.growth.common.service.MessageAttachmentService;
 import com.tzld.piaoquan.growth.common.utils.DateUtil;
@@ -20,7 +19,10 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -37,6 +39,12 @@ public class ContentPlatformVideoJob {
     @Autowired
     private ContentPlatformVideoAggMapper videoAggMapper;
 
+    @Autowired
+    private ContentPlatformVideoDataStatMapper videoDataStatMapper;
+
+    @Autowired
+    private ContentPlatformVideoDataStatAggMapper videoDataStatAggMapper;
+
     @Autowired
     private MessageAttachmentService messageAttachmentService;
 
@@ -46,7 +54,10 @@ public class ContentPlatformVideoJob {
     @XxlJob("syncContentPlatformVideoJob")
     public ReturnT<String> syncContentPlatformVideoJob(String param) {
         String aggDt = DateUtil.getBeforeDayDateString("yyyyMMdd");
-        List<String> dtList = DateUtil.getBeforeDays(videoAggDays);
+        if (StringUtils.hasText(param)) {
+            aggDt = param;
+        }
+        List<String> dtList = DateUtil.getBeforeDays(aggDt, null, videoAggDays);
         // 轮询查询大数据获取最近14天视频
         for (String dt : dtList) {
             long videoCount = getVideoCount(dt);
@@ -153,6 +164,9 @@ public class ContentPlatformVideoJob {
     @XxlJob("checkContentPlatformVideoStatusJob")
     public ReturnT<String> checkContentPlatformVideoStatusJob(String param) {
         String dt = planMapperExt.getVideoMaxDt();
+        if (StringUtils.hasText(param)) {
+            dt = param;
+        }
         List<ContentPlatformVideoAgg> videoList = getVideoListByDt(dt);
         Long now = System.currentTimeMillis();
         for (List<ContentPlatformVideoAgg> partition : Lists.partition(videoList, 20)) {
@@ -178,6 +192,116 @@ public class ContentPlatformVideoJob {
         return videoAggMapper.selectByExample(example);
     }
 
+    @XxlJob("syncContentPlatformVideoDatastatJob")
+    public ReturnT<String> syncContentPlatformVideoDatastatJob(String param) {
+        String aggDt = DateUtil.getBeforeDayDateString("yyyyMMdd");
+        if (StringUtils.hasText(param)) {
+            aggDt = param;
+        }
+        List<String> dtList = DateUtil.getBeforeDays(aggDt, aggDt, 6);
+        // 轮询查询大数据获取最近14天视频
+        for (String dt : dtList) {
+            long videoGroupScoreCount = getVideoGroupScoreCount(dt);
+            if (videoGroupScoreCount > 0) {
+                continue;
+            }
+
+            String sql = String.format("SELECT 行业, 渠道, vid, 首层访问人数, t0裂变人数, t0裂变率 " +
+                    "FROM loghubods.wecom_cooperation_video_candidate_pool_hy_qd WHERE dt=%s;", dt);
+            List<Record> dataList = OdpsUtil.getOdpsData(sql);
+            Long now = System.currentTimeMillis();
+            if (CollectionUtils.isNotEmpty(dataList)) {
+                List<ContentPlatformVideoDataStat> saveList = new ArrayList<>();
+                for (Record record : dataList) {
+                    ContentPlatformVideoDataStat item = new ContentPlatformVideoDataStat();
+                    String type = (String) record.get(0);
+                    String channel = (String) record.get(1);
+                    Long videoId = Long.parseLong((String) record.get(2));
+                    Long firstLevel = Long.parseLong((String) record.get(3));
+                    Long fission0 = Long.parseLong((String) record.get(4));
+                    Double fissionRate = Double.parseDouble((String) record.get(5));
+                    item.setDt(dt);
+                    item.setVideoId(videoId);
+                    item.setType(type);
+                    item.setChannel(channel);
+                    item.setFirstLevel(firstLevel);
+                    item.setFission0(fission0);
+                    item.setFissionRate(fissionRate);
+                    item.setCreateTimestamp(now);
+                    saveList.add(item);
+                }
+                // save
+                if (CollectionUtils.isNotEmpty(saveList)) {
+                    planMapperExt.batchInsertContentPlatformVideoDatastat(saveList);
+                }
+            }
+        }
+        // 聚合最近14天视频
+        List<ContentPlatformVideoDataStatAgg> saveAggList = buildVideoDataStatAggList(aggDt, dtList);
+        if (CollectionUtils.isNotEmpty(saveAggList)) {
+            planMapperExt.deleteContentPlatformVideoDatastatAgg(aggDt);
+            planMapperExt.batchInsertContentPlatformVideoDatastatAgg(saveAggList);
+        }
+        return ReturnT.SUCCESS;
+    }
+
+    private long getVideoGroupScoreCount(String dt) {
+        ContentPlatformVideoDataStatExample example = new ContentPlatformVideoDataStatExample();
+        example.createCriteria().andDtEqualTo(dt);
+        return videoDataStatMapper.countByExample(example);
+    }
+
+    private List<ContentPlatformVideoDataStatAgg> buildVideoDataStatAggList(String aggDt, List<String> dtList) {
+        Long now = System.currentTimeMillis();
+        List<ContentPlatformVideoDataStat> dataStatList = getVideoDatastatList(dtList);
+        Map<Long, Map<String, Map<String, List<ContentPlatformVideoDataStat>>>> videoIdMap = dataStatList.stream()
+                .filter(o -> {
+                    if ("sum".equals(o.getChannel())) {
+                        return o.getFirstLevel() > 300;
+                    } else {
+                        return o.getFirstLevel() > 100;
+                    }
+                })
+                .collect(Collectors.groupingBy(ContentPlatformVideoDataStat::getVideoId,
+                        Collectors.groupingBy(ContentPlatformVideoDataStat::getType,
+                                Collectors.groupingBy(ContentPlatformVideoDataStat::getChannel))));
+        List<ContentPlatformVideoDataStatAgg> result = new ArrayList<>();
+        for (Map.Entry<Long, Map<String, Map<String, List<ContentPlatformVideoDataStat>>>> entry : videoIdMap.entrySet()) {
+            Long videoId = entry.getKey();
+            Map<String, Map<String, List<ContentPlatformVideoDataStat>>> typeMap = entry.getValue();
+            for (Map.Entry<String, Map<String, List<ContentPlatformVideoDataStat>>> typeEntry : typeMap.entrySet()) {
+                String type = typeEntry.getKey();
+                Map<String, List<ContentPlatformVideoDataStat>> channelMap = typeEntry.getValue();
+                for (Map.Entry<String, List<ContentPlatformVideoDataStat>> channelEntry : channelMap.entrySet()) {
+                    String channel = channelEntry.getKey();
+                    List<ContentPlatformVideoDataStat> statList = channelEntry.getValue();
+                    Long sumFirstLevel = statList.stream().map(ContentPlatformVideoDataStat::getFirstLevel).reduce(0L, Long::sum);
+                    Long sumFission0 = statList.stream().map(ContentPlatformVideoDataStat::getFission0).reduce(0L, Long::sum);
+                    ContentPlatformVideoDataStatAgg item = new ContentPlatformVideoDataStatAgg();
+                    item.setDt(aggDt);
+                    item.setVideoId(videoId);
+                    item.setType(type);
+                    item.setChannel(channel);
+                    item.setFirstLevel(sumFirstLevel);
+                    item.setFission0(sumFission0);
+                    if (sumFirstLevel > 0) {
+                        BigDecimal fissionRate = new BigDecimal(sumFission0).divide(new BigDecimal(sumFirstLevel), 4, RoundingMode.HALF_UP);
+                        item.setFissionRate(fissionRate.doubleValue());
+                    }
+                    item.setCreateTimestamp(now);
+                    result.add(item);
+                }
+            }
+        }
+        return result;
+    }
+
+    private List<ContentPlatformVideoDataStat> getVideoDatastatList(List<String> dtList) {
+        ContentPlatformVideoDataStatExample example = new ContentPlatformVideoDataStatExample();
+        example.createCriteria().andDtIn(dtList);
+        return videoDataStatMapper.selectByExample(example);
+    }
+
 }
 
 

+ 6 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/param/contentplatform/VideoContentListParam.java

@@ -12,4 +12,10 @@ public class VideoContentListParam extends PageParam {
 
     @ApiModelProperty(value = "品类")
     private String category;
+
+    @ApiModelProperty(value = "排序 0-自动回复、1-服务号推送、2-企微-社群、3-企微-自动回复")
+    private Integer type = 999;
+
+    @ApiModelProperty(value = "排序 0-平台推荐 1-行业裂变率 2-本渠道裂变率")
+    private Integer sort = 0;
 }

+ 112 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformVideoDataStat.java

@@ -0,0 +1,112 @@
+package com.tzld.piaoquan.api.model.po.contentplatform;
+
+public class ContentPlatformVideoDataStat {
+    private Long id;
+
+    private String dt;
+
+    private Long videoId;
+
+    private String type;
+
+    private String channel;
+
+    private Long firstLevel;
+
+    private Long fission0;
+
+    private Double fissionRate;
+
+    private Long createTimestamp;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getDt() {
+        return dt;
+    }
+
+    public void setDt(String dt) {
+        this.dt = dt;
+    }
+
+    public Long getVideoId() {
+        return videoId;
+    }
+
+    public void setVideoId(Long videoId) {
+        this.videoId = videoId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getChannel() {
+        return channel;
+    }
+
+    public void setChannel(String channel) {
+        this.channel = channel;
+    }
+
+    public Long getFirstLevel() {
+        return firstLevel;
+    }
+
+    public void setFirstLevel(Long firstLevel) {
+        this.firstLevel = firstLevel;
+    }
+
+    public Long getFission0() {
+        return fission0;
+    }
+
+    public void setFission0(Long fission0) {
+        this.fission0 = fission0;
+    }
+
+    public Double getFissionRate() {
+        return fissionRate;
+    }
+
+    public void setFissionRate(Double fissionRate) {
+        this.fissionRate = fissionRate;
+    }
+
+    public Long getCreateTimestamp() {
+        return createTimestamp;
+    }
+
+    public void setCreateTimestamp(Long createTimestamp) {
+        this.createTimestamp = createTimestamp;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", dt=").append(dt);
+        sb.append(", videoId=").append(videoId);
+        sb.append(", type=").append(type);
+        sb.append(", channel=").append(channel);
+        sb.append(", firstLevel=").append(firstLevel);
+        sb.append(", fission0=").append(fission0);
+        sb.append(", fissionRate=").append(fissionRate);
+        sb.append(", createTimestamp=").append(createTimestamp);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 112 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformVideoDataStatAgg.java

@@ -0,0 +1,112 @@
+package com.tzld.piaoquan.api.model.po.contentplatform;
+
+public class ContentPlatformVideoDataStatAgg {
+    private Long id;
+
+    private String dt;
+
+    private Long videoId;
+
+    private String type;
+
+    private String channel;
+
+    private Long firstLevel;
+
+    private Long fission0;
+
+    private Double fissionRate;
+
+    private Long createTimestamp;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getDt() {
+        return dt;
+    }
+
+    public void setDt(String dt) {
+        this.dt = dt;
+    }
+
+    public Long getVideoId() {
+        return videoId;
+    }
+
+    public void setVideoId(Long videoId) {
+        this.videoId = videoId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getChannel() {
+        return channel;
+    }
+
+    public void setChannel(String channel) {
+        this.channel = channel;
+    }
+
+    public Long getFirstLevel() {
+        return firstLevel;
+    }
+
+    public void setFirstLevel(Long firstLevel) {
+        this.firstLevel = firstLevel;
+    }
+
+    public Long getFission0() {
+        return fission0;
+    }
+
+    public void setFission0(Long fission0) {
+        this.fission0 = fission0;
+    }
+
+    public Double getFissionRate() {
+        return fissionRate;
+    }
+
+    public void setFissionRate(Double fissionRate) {
+        this.fissionRate = fissionRate;
+    }
+
+    public Long getCreateTimestamp() {
+        return createTimestamp;
+    }
+
+    public void setCreateTimestamp(Long createTimestamp) {
+        this.createTimestamp = createTimestamp;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", dt=").append(dt);
+        sb.append(", videoId=").append(videoId);
+        sb.append(", type=").append(type);
+        sb.append(", channel=").append(channel);
+        sb.append(", firstLevel=").append(firstLevel);
+        sb.append(", fission0=").append(fission0);
+        sb.append(", fissionRate=").append(fissionRate);
+        sb.append(", createTimestamp=").append(createTimestamp);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 781 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformVideoDataStatAggExample.java

@@ -0,0 +1,781 @@
+package com.tzld.piaoquan.api.model.po.contentplatform;
+
+import com.tzld.piaoquan.growth.common.utils.page.Page;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ContentPlatformVideoDataStatAggExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    protected Page page;
+
+    public ContentPlatformVideoDataStatAggExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    public void setPage(Page page) {
+        this.page=page;
+    }
+
+    public Page getPage() {
+        return page;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Long value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Long value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Long value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Long value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Long value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Long> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Long> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Long value1, Long value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Long value1, Long value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtIsNull() {
+            addCriterion("dt is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtIsNotNull() {
+            addCriterion("dt is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtEqualTo(String value) {
+            addCriterion("dt =", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotEqualTo(String value) {
+            addCriterion("dt <>", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtGreaterThan(String value) {
+            addCriterion("dt >", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtGreaterThanOrEqualTo(String value) {
+            addCriterion("dt >=", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtLessThan(String value) {
+            addCriterion("dt <", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtLessThanOrEqualTo(String value) {
+            addCriterion("dt <=", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtLike(String value) {
+            addCriterion("dt like", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotLike(String value) {
+            addCriterion("dt not like", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtIn(List<String> values) {
+            addCriterion("dt in", values, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotIn(List<String> values) {
+            addCriterion("dt not in", values, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtBetween(String value1, String value2) {
+            addCriterion("dt between", value1, value2, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotBetween(String value1, String value2) {
+            addCriterion("dt not between", value1, value2, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIsNull() {
+            addCriterion("video_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIsNotNull() {
+            addCriterion("video_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdEqualTo(Long value) {
+            addCriterion("video_id =", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotEqualTo(Long value) {
+            addCriterion("video_id <>", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdGreaterThan(Long value) {
+            addCriterion("video_id >", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("video_id >=", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdLessThan(Long value) {
+            addCriterion("video_id <", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdLessThanOrEqualTo(Long value) {
+            addCriterion("video_id <=", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIn(List<Long> values) {
+            addCriterion("video_id in", values, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotIn(List<Long> values) {
+            addCriterion("video_id not in", values, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdBetween(Long value1, Long value2) {
+            addCriterion("video_id between", value1, value2, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotBetween(Long value1, Long value2) {
+            addCriterion("video_id not between", value1, value2, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeIsNull() {
+            addCriterion("`type` is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeIsNotNull() {
+            addCriterion("`type` is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeEqualTo(String value) {
+            addCriterion("`type` =", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotEqualTo(String value) {
+            addCriterion("`type` <>", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeGreaterThan(String value) {
+            addCriterion("`type` >", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeGreaterThanOrEqualTo(String value) {
+            addCriterion("`type` >=", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeLessThan(String value) {
+            addCriterion("`type` <", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeLessThanOrEqualTo(String value) {
+            addCriterion("`type` <=", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeLike(String value) {
+            addCriterion("`type` like", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotLike(String value) {
+            addCriterion("`type` not like", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeIn(List<String> values) {
+            addCriterion("`type` in", values, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotIn(List<String> values) {
+            addCriterion("`type` not in", values, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeBetween(String value1, String value2) {
+            addCriterion("`type` between", value1, value2, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotBetween(String value1, String value2) {
+            addCriterion("`type` not between", value1, value2, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelIsNull() {
+            addCriterion("channel is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelIsNotNull() {
+            addCriterion("channel is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelEqualTo(String value) {
+            addCriterion("channel =", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotEqualTo(String value) {
+            addCriterion("channel <>", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelGreaterThan(String value) {
+            addCriterion("channel >", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelGreaterThanOrEqualTo(String value) {
+            addCriterion("channel >=", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLessThan(String value) {
+            addCriterion("channel <", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLessThanOrEqualTo(String value) {
+            addCriterion("channel <=", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLike(String value) {
+            addCriterion("channel like", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotLike(String value) {
+            addCriterion("channel not like", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelIn(List<String> values) {
+            addCriterion("channel in", values, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotIn(List<String> values) {
+            addCriterion("channel not in", values, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelBetween(String value1, String value2) {
+            addCriterion("channel between", value1, value2, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotBetween(String value1, String value2) {
+            addCriterion("channel not between", value1, value2, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelIsNull() {
+            addCriterion("first_level is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelIsNotNull() {
+            addCriterion("first_level is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelEqualTo(Long value) {
+            addCriterion("first_level =", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelNotEqualTo(Long value) {
+            addCriterion("first_level <>", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelGreaterThan(Long value) {
+            addCriterion("first_level >", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelGreaterThanOrEqualTo(Long value) {
+            addCriterion("first_level >=", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelLessThan(Long value) {
+            addCriterion("first_level <", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelLessThanOrEqualTo(Long value) {
+            addCriterion("first_level <=", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelIn(List<Long> values) {
+            addCriterion("first_level in", values, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelNotIn(List<Long> values) {
+            addCriterion("first_level not in", values, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelBetween(Long value1, Long value2) {
+            addCriterion("first_level between", value1, value2, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelNotBetween(Long value1, Long value2) {
+            addCriterion("first_level not between", value1, value2, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0IsNull() {
+            addCriterion("fission0 is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0IsNotNull() {
+            addCriterion("fission0 is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0EqualTo(Long value) {
+            addCriterion("fission0 =", value, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0NotEqualTo(Long value) {
+            addCriterion("fission0 <>", value, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0GreaterThan(Long value) {
+            addCriterion("fission0 >", value, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0GreaterThanOrEqualTo(Long value) {
+            addCriterion("fission0 >=", value, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0LessThan(Long value) {
+            addCriterion("fission0 <", value, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0LessThanOrEqualTo(Long value) {
+            addCriterion("fission0 <=", value, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0In(List<Long> values) {
+            addCriterion("fission0 in", values, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0NotIn(List<Long> values) {
+            addCriterion("fission0 not in", values, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0Between(Long value1, Long value2) {
+            addCriterion("fission0 between", value1, value2, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0NotBetween(Long value1, Long value2) {
+            addCriterion("fission0 not between", value1, value2, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateIsNull() {
+            addCriterion("fission_rate is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateIsNotNull() {
+            addCriterion("fission_rate is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateEqualTo(Double value) {
+            addCriterion("fission_rate =", value, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateNotEqualTo(Double value) {
+            addCriterion("fission_rate <>", value, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateGreaterThan(Double value) {
+            addCriterion("fission_rate >", value, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateGreaterThanOrEqualTo(Double value) {
+            addCriterion("fission_rate >=", value, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateLessThan(Double value) {
+            addCriterion("fission_rate <", value, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateLessThanOrEqualTo(Double value) {
+            addCriterion("fission_rate <=", value, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateIn(List<Double> values) {
+            addCriterion("fission_rate in", values, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateNotIn(List<Double> values) {
+            addCriterion("fission_rate not in", values, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateBetween(Double value1, Double value2) {
+            addCriterion("fission_rate between", value1, value2, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateNotBetween(Double value1, Double value2) {
+            addCriterion("fission_rate not between", value1, value2, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIsNull() {
+            addCriterion("create_timestamp is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIsNotNull() {
+            addCriterion("create_timestamp is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampEqualTo(Long value) {
+            addCriterion("create_timestamp =", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotEqualTo(Long value) {
+            addCriterion("create_timestamp <>", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampGreaterThan(Long value) {
+            addCriterion("create_timestamp >", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampGreaterThanOrEqualTo(Long value) {
+            addCriterion("create_timestamp >=", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampLessThan(Long value) {
+            addCriterion("create_timestamp <", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampLessThanOrEqualTo(Long value) {
+            addCriterion("create_timestamp <=", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIn(List<Long> values) {
+            addCriterion("create_timestamp in", values, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotIn(List<Long> values) {
+            addCriterion("create_timestamp not in", values, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampBetween(Long value1, Long value2) {
+            addCriterion("create_timestamp between", value1, value2, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotBetween(Long value1, Long value2) {
+            addCriterion("create_timestamp not between", value1, value2, "createTimestamp");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 781 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformVideoDataStatExample.java

@@ -0,0 +1,781 @@
+package com.tzld.piaoquan.api.model.po.contentplatform;
+
+import com.tzld.piaoquan.growth.common.utils.page.Page;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ContentPlatformVideoDataStatExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    protected Page page;
+
+    public ContentPlatformVideoDataStatExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    public void setPage(Page page) {
+        this.page=page;
+    }
+
+    public Page getPage() {
+        return page;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Long value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Long value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Long value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Long value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Long value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Long> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Long> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Long value1, Long value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Long value1, Long value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtIsNull() {
+            addCriterion("dt is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtIsNotNull() {
+            addCriterion("dt is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtEqualTo(String value) {
+            addCriterion("dt =", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotEqualTo(String value) {
+            addCriterion("dt <>", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtGreaterThan(String value) {
+            addCriterion("dt >", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtGreaterThanOrEqualTo(String value) {
+            addCriterion("dt >=", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtLessThan(String value) {
+            addCriterion("dt <", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtLessThanOrEqualTo(String value) {
+            addCriterion("dt <=", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtLike(String value) {
+            addCriterion("dt like", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotLike(String value) {
+            addCriterion("dt not like", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtIn(List<String> values) {
+            addCriterion("dt in", values, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotIn(List<String> values) {
+            addCriterion("dt not in", values, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtBetween(String value1, String value2) {
+            addCriterion("dt between", value1, value2, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotBetween(String value1, String value2) {
+            addCriterion("dt not between", value1, value2, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIsNull() {
+            addCriterion("video_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIsNotNull() {
+            addCriterion("video_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdEqualTo(Long value) {
+            addCriterion("video_id =", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotEqualTo(Long value) {
+            addCriterion("video_id <>", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdGreaterThan(Long value) {
+            addCriterion("video_id >", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("video_id >=", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdLessThan(Long value) {
+            addCriterion("video_id <", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdLessThanOrEqualTo(Long value) {
+            addCriterion("video_id <=", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIn(List<Long> values) {
+            addCriterion("video_id in", values, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotIn(List<Long> values) {
+            addCriterion("video_id not in", values, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdBetween(Long value1, Long value2) {
+            addCriterion("video_id between", value1, value2, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotBetween(Long value1, Long value2) {
+            addCriterion("video_id not between", value1, value2, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeIsNull() {
+            addCriterion("`type` is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeIsNotNull() {
+            addCriterion("`type` is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeEqualTo(String value) {
+            addCriterion("`type` =", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotEqualTo(String value) {
+            addCriterion("`type` <>", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeGreaterThan(String value) {
+            addCriterion("`type` >", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeGreaterThanOrEqualTo(String value) {
+            addCriterion("`type` >=", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeLessThan(String value) {
+            addCriterion("`type` <", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeLessThanOrEqualTo(String value) {
+            addCriterion("`type` <=", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeLike(String value) {
+            addCriterion("`type` like", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotLike(String value) {
+            addCriterion("`type` not like", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeIn(List<String> values) {
+            addCriterion("`type` in", values, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotIn(List<String> values) {
+            addCriterion("`type` not in", values, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeBetween(String value1, String value2) {
+            addCriterion("`type` between", value1, value2, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotBetween(String value1, String value2) {
+            addCriterion("`type` not between", value1, value2, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelIsNull() {
+            addCriterion("channel is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelIsNotNull() {
+            addCriterion("channel is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelEqualTo(String value) {
+            addCriterion("channel =", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotEqualTo(String value) {
+            addCriterion("channel <>", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelGreaterThan(String value) {
+            addCriterion("channel >", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelGreaterThanOrEqualTo(String value) {
+            addCriterion("channel >=", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLessThan(String value) {
+            addCriterion("channel <", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLessThanOrEqualTo(String value) {
+            addCriterion("channel <=", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLike(String value) {
+            addCriterion("channel like", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotLike(String value) {
+            addCriterion("channel not like", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelIn(List<String> values) {
+            addCriterion("channel in", values, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotIn(List<String> values) {
+            addCriterion("channel not in", values, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelBetween(String value1, String value2) {
+            addCriterion("channel between", value1, value2, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotBetween(String value1, String value2) {
+            addCriterion("channel not between", value1, value2, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelIsNull() {
+            addCriterion("first_level is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelIsNotNull() {
+            addCriterion("first_level is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelEqualTo(Long value) {
+            addCriterion("first_level =", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelNotEqualTo(Long value) {
+            addCriterion("first_level <>", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelGreaterThan(Long value) {
+            addCriterion("first_level >", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelGreaterThanOrEqualTo(Long value) {
+            addCriterion("first_level >=", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelLessThan(Long value) {
+            addCriterion("first_level <", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelLessThanOrEqualTo(Long value) {
+            addCriterion("first_level <=", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelIn(List<Long> values) {
+            addCriterion("first_level in", values, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelNotIn(List<Long> values) {
+            addCriterion("first_level not in", values, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelBetween(Long value1, Long value2) {
+            addCriterion("first_level between", value1, value2, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelNotBetween(Long value1, Long value2) {
+            addCriterion("first_level not between", value1, value2, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0IsNull() {
+            addCriterion("fission0 is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0IsNotNull() {
+            addCriterion("fission0 is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0EqualTo(Long value) {
+            addCriterion("fission0 =", value, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0NotEqualTo(Long value) {
+            addCriterion("fission0 <>", value, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0GreaterThan(Long value) {
+            addCriterion("fission0 >", value, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0GreaterThanOrEqualTo(Long value) {
+            addCriterion("fission0 >=", value, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0LessThan(Long value) {
+            addCriterion("fission0 <", value, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0LessThanOrEqualTo(Long value) {
+            addCriterion("fission0 <=", value, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0In(List<Long> values) {
+            addCriterion("fission0 in", values, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0NotIn(List<Long> values) {
+            addCriterion("fission0 not in", values, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0Between(Long value1, Long value2) {
+            addCriterion("fission0 between", value1, value2, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFission0NotBetween(Long value1, Long value2) {
+            addCriterion("fission0 not between", value1, value2, "fission0");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateIsNull() {
+            addCriterion("fission_rate is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateIsNotNull() {
+            addCriterion("fission_rate is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateEqualTo(Double value) {
+            addCriterion("fission_rate =", value, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateNotEqualTo(Double value) {
+            addCriterion("fission_rate <>", value, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateGreaterThan(Double value) {
+            addCriterion("fission_rate >", value, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateGreaterThanOrEqualTo(Double value) {
+            addCriterion("fission_rate >=", value, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateLessThan(Double value) {
+            addCriterion("fission_rate <", value, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateLessThanOrEqualTo(Double value) {
+            addCriterion("fission_rate <=", value, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateIn(List<Double> values) {
+            addCriterion("fission_rate in", values, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateNotIn(List<Double> values) {
+            addCriterion("fission_rate not in", values, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateBetween(Double value1, Double value2) {
+            addCriterion("fission_rate between", value1, value2, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andFissionRateNotBetween(Double value1, Double value2) {
+            addCriterion("fission_rate not between", value1, value2, "fissionRate");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIsNull() {
+            addCriterion("create_timestamp is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIsNotNull() {
+            addCriterion("create_timestamp is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampEqualTo(Long value) {
+            addCriterion("create_timestamp =", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotEqualTo(Long value) {
+            addCriterion("create_timestamp <>", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampGreaterThan(Long value) {
+            addCriterion("create_timestamp >", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampGreaterThanOrEqualTo(Long value) {
+            addCriterion("create_timestamp >=", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampLessThan(Long value) {
+            addCriterion("create_timestamp <", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampLessThanOrEqualTo(Long value) {
+            addCriterion("create_timestamp <=", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIn(List<Long> values) {
+            addCriterion("create_timestamp in", values, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotIn(List<Long> values) {
+            addCriterion("create_timestamp not in", values, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampBetween(Long value1, Long value2) {
+            addCriterion("create_timestamp between", value1, value2, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotBetween(Long value1, Long value2) {
+            addCriterion("create_timestamp not between", value1, value2, "createTimestamp");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 6 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/vo/contentplatform/VideoContentItemVO.java

@@ -20,4 +20,10 @@ public class VideoContentItemVO {
 
     @ApiModelProperty(value = "传播效率")
     private Double score;
+
+    @ApiModelProperty(value = "行业裂变率")
+    private Double industryFissionRate;
+
+    @ApiModelProperty(value = "本渠道裂变率")
+    private Double channelFissionRate;
 }

+ 3 - 1
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformApiServiceImpl.java

@@ -91,13 +91,15 @@ public class ContentPlatformApiServiceImpl implements ContentPlatformApiService
         Page<VideoIdTitleVO> result = new Page<>(param.getPageNum(), param.getPageSize());
         int offset = (param.getPageNum() - 1) * param.getPageSize();
         String dt = planMapperExt.getVideoMaxDt();
+        String datastatDt = planMapperExt.getVideoDatastatMaxDt();
         VideoContentListParam listParam = new VideoContentListParam();
         int count = planMapperExt.getVideoCount(listParam, dt, videoMinScore);
         result.setTotalSize(count);
         if (count == 0) {
             return result;
         }
-        List<ContentPlatformVideo> videoList = planMapperExt.getVideoList(listParam, dt, videoMinScore, offset, param.getPageSize());
+        List<ContentPlatformVideo> videoList = planMapperExt.getVideoList(listParam, dt, datastatDt, "", "sum", videoMinScore,
+                offset, param.getPageSize(), "video.score desc");
         List<VideoIdTitleVO> list = videoList.stream().map(video -> {
             VideoIdTitleVO vo = new VideoIdTitleVO();
             vo.setVideoId(video.getVideoId());

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

@@ -70,6 +70,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     @Autowired
     private ContentPlatformGzhPlanChangeLogMapper gzhPlanChangeLogMapper;
     @Autowired
+    private ContentPlatformVideoDataStatAggMapper videoDataStatAggMapper;
+    @Autowired
     private ContentPlatformCooperateAccountService cooperateAccountService;
     @Autowired
     private GhDetailService ghDetailService;
@@ -453,32 +455,81 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
 
     @Override
     public Page<VideoContentItemVO> getVideoContentList(VideoContentListParam param) {
+        ContentPlatformAccount user = LoginUserContext.getUser();
         Page<VideoContentItemVO> result = new Page<>(param.getPageNum(), param.getPageSize());
         int offset = (param.getPageNum() - 1) * param.getPageSize();
         String dt = planMapperExt.getVideoMaxDt();
+        String datastatDt = planMapperExt.getVideoDatastatMaxDt();
         int count = planMapperExt.getVideoCount(param, dt, videoMinScore);
         result.setTotalSize(count);
         if (count == 0) {
             return result;
         }
-        List<ContentPlatformVideo> videoList = planMapperExt.getVideoList(param, dt, videoMinScore, offset, param.getPageSize());
-        List<VideoContentItemVO> list = buildVideoContentItemVOList(videoList);
+        String sort = getVideoContentListSort(param.getSort());
+        String type = getVideoContentListType(param.getType());
+        String channel = getVideoContentListChannel(param.getSort(), user.getChannel());
+        List<ContentPlatformVideo> videoList = planMapperExt.getVideoList(param, dt, datastatDt, type, channel, videoMinScore, offset, param.getPageSize(), sort);
+        List<VideoContentItemVO> list = buildVideoContentItemVOList(videoList, type, channel, user.getChannel(), datastatDt);
         result.setObjs(list);
         return result;
     }
 
-    private List<VideoContentItemVO> buildVideoContentItemVOList(List<ContentPlatformVideo> videoList) {
+    private String getVideoContentListType(Integer type) {
+        switch (type) {
+            case 0:
+                return "自动回复";
+            case 1:
+                return "服务号推送";
+            case 2:
+                return "企微-社群";
+            case 3:
+                return "企微-自动回复";
+            default:
+                return "";
+        }
+    }
+
+    private String getVideoContentListChannel(Integer sort, String channel) {
+        if (sort == 2) {
+            return channel;
+        }
+        return "sum";
+    }
+
+    private String getVideoContentListSort(Integer sort) {
+        switch (sort) {
+            case 0:
+                return "video.score desc";
+            case 1:
+                return "datastat.fission_rate desc, video.score desc";
+            case 2:
+                return "datastat.fission_rate desc, video.score desc";
+            default:
+                return "video.score desc";
+        }
+    }
+
+    private List<VideoContentItemVO> buildVideoContentItemVOList(List<ContentPlatformVideo> videoList,
+                                                                 String type, String channel, String userChannel, String datastatDt) {
         if (CollectionUtils.isEmpty(videoList)) {
             return null;
         }
         List<Long> videoIds = videoList.stream()
+                .map(ContentPlatformVideo::getVideoId).distinct().collect(Collectors.toList());
+        List<Long> getCoverVideoIds = videoList.stream()
                 .filter(o -> !StringUtils.hasText(o.getCover()))
                 .map(ContentPlatformVideo::getVideoId).distinct().collect(Collectors.toList());
         Map<Long, VideoDetail> coverMap = new HashMap<>();
-        for (List<Long> partition : Lists.partition(videoIds, 20)) {
+        for (List<Long> partition : Lists.partition(getCoverVideoIds, 20)) {
             Set<Long> ids = new HashSet<>(partition);
             coverMap.putAll(messageAttachmentService.getVideoDetail(ids));
         }
+        List<ContentPlatformVideoDataStatAgg> typeVideoDataStatAggList = getTypeChannelVideoDataStatAggList(datastatDt, type, channel, videoIds);
+        Map<Long, Double> typeVideoScoreMap = typeVideoDataStatAggList.stream().collect(Collectors.toMap(
+                ContentPlatformVideoDataStatAgg::getVideoId, ContentPlatformVideoDataStatAgg::getFissionRate));
+        List<ContentPlatformVideoDataStatAgg> channelVideoDataStatAggList = getTypeChannelVideoDataStatAggList(datastatDt, type, userChannel, videoIds);
+        Map<Long, Double> channelVideoScoreMap = channelVideoDataStatAggList.stream().collect(Collectors.toMap(
+                ContentPlatformVideoDataStatAgg::getVideoId, ContentPlatformVideoDataStatAgg::getFissionRate));
         List<VideoContentItemVO> result = new ArrayList<>();
         for (ContentPlatformVideo video : videoList) {
             VideoContentItemVO item = new VideoContentItemVO();
@@ -492,11 +543,19 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
             }
             item.setVideo(video.getVideo());
             item.setScore(video.getScore());
+            item.setIndustryFissionRate(typeVideoScoreMap.get(video.getVideoId()));
+            item.setChannelFissionRate(channelVideoScoreMap.get(video.getVideoId()));
             result.add(item);
         }
         return result;
     }
 
+    private List<ContentPlatformVideoDataStatAgg> getTypeChannelVideoDataStatAggList(String datastatDt, String type, String channel, List<Long> videoIds) {
+        ContentPlatformVideoDataStatAggExample example = new ContentPlatformVideoDataStatAggExample();
+        example.createCriteria().andVideoIdIn(videoIds).andDtEqualTo(datastatDt).andTypeEqualTo(type).andChannelEqualTo(channel);
+        return videoDataStatAggMapper.selectByExample(example);
+    }
+
     @Override
     public List<String> getVideoContentCategoryList() {
         String dt = planMapperExt.getVideoMaxDt();

+ 278 - 0
api-module/src/main/resources/mapper/contentplatform/ContentPlatformVideoDataStatAggMapper.xml

@@ -0,0 +1,278 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformVideoDataStatAggMapper">
+  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAgg">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="dt" jdbcType="VARCHAR" property="dt" />
+    <result column="video_id" jdbcType="BIGINT" property="videoId" />
+    <result column="type" jdbcType="VARCHAR" property="type" />
+    <result column="channel" jdbcType="VARCHAR" property="channel" />
+    <result column="first_level" jdbcType="BIGINT" property="firstLevel" />
+    <result column="fission0" jdbcType="BIGINT" property="fission0" />
+    <result column="fission_rate" jdbcType="DOUBLE" property="fissionRate" />
+    <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    id, dt, video_id, `type`, channel, first_level, fission0, fission_rate, create_timestamp
+  </sql>
+  <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAggExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from content_platform_video_datastat_agg
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+    <if test="page != null">
+      limit #{page.offset} , #{page.pageSize}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from content_platform_video_datastat_agg
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from content_platform_video_datastat_agg
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAggExample">
+    delete from content_platform_video_datastat_agg
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAgg">
+    insert into content_platform_video_datastat_agg (id, dt, video_id, 
+      `type`, channel, first_level, 
+      fission0, fission_rate, create_timestamp
+      )
+    values (#{id,jdbcType=BIGINT}, #{dt,jdbcType=VARCHAR}, #{videoId,jdbcType=BIGINT}, 
+      #{type,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR}, #{firstLevel,jdbcType=BIGINT}, 
+      #{fission0,jdbcType=BIGINT}, #{fissionRate,jdbcType=DOUBLE}, #{createTimestamp,jdbcType=BIGINT}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAgg">
+    insert into content_platform_video_datastat_agg
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="dt != null">
+        dt,
+      </if>
+      <if test="videoId != null">
+        video_id,
+      </if>
+      <if test="type != null">
+        `type`,
+      </if>
+      <if test="channel != null">
+        channel,
+      </if>
+      <if test="firstLevel != null">
+        first_level,
+      </if>
+      <if test="fission0 != null">
+        fission0,
+      </if>
+      <if test="fissionRate != null">
+        fission_rate,
+      </if>
+      <if test="createTimestamp != null">
+        create_timestamp,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="dt != null">
+        #{dt,jdbcType=VARCHAR},
+      </if>
+      <if test="videoId != null">
+        #{videoId,jdbcType=BIGINT},
+      </if>
+      <if test="type != null">
+        #{type,jdbcType=VARCHAR},
+      </if>
+      <if test="channel != null">
+        #{channel,jdbcType=VARCHAR},
+      </if>
+      <if test="firstLevel != null">
+        #{firstLevel,jdbcType=BIGINT},
+      </if>
+      <if test="fission0 != null">
+        #{fission0,jdbcType=BIGINT},
+      </if>
+      <if test="fissionRate != null">
+        #{fissionRate,jdbcType=DOUBLE},
+      </if>
+      <if test="createTimestamp != null">
+        #{createTimestamp,jdbcType=BIGINT},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAggExample" resultType="java.lang.Long">
+    select count(*) from content_platform_video_datastat_agg
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update content_platform_video_datastat_agg
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=BIGINT},
+      </if>
+      <if test="record.dt != null">
+        dt = #{record.dt,jdbcType=VARCHAR},
+      </if>
+      <if test="record.videoId != null">
+        video_id = #{record.videoId,jdbcType=BIGINT},
+      </if>
+      <if test="record.type != null">
+        `type` = #{record.type,jdbcType=VARCHAR},
+      </if>
+      <if test="record.channel != null">
+        channel = #{record.channel,jdbcType=VARCHAR},
+      </if>
+      <if test="record.firstLevel != null">
+        first_level = #{record.firstLevel,jdbcType=BIGINT},
+      </if>
+      <if test="record.fission0 != null">
+        fission0 = #{record.fission0,jdbcType=BIGINT},
+      </if>
+      <if test="record.fissionRate != null">
+        fission_rate = #{record.fissionRate,jdbcType=DOUBLE},
+      </if>
+      <if test="record.createTimestamp != null">
+        create_timestamp = #{record.createTimestamp,jdbcType=BIGINT},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update content_platform_video_datastat_agg
+    set id = #{record.id,jdbcType=BIGINT},
+      dt = #{record.dt,jdbcType=VARCHAR},
+      video_id = #{record.videoId,jdbcType=BIGINT},
+      `type` = #{record.type,jdbcType=VARCHAR},
+      channel = #{record.channel,jdbcType=VARCHAR},
+      first_level = #{record.firstLevel,jdbcType=BIGINT},
+      fission0 = #{record.fission0,jdbcType=BIGINT},
+      fission_rate = #{record.fissionRate,jdbcType=DOUBLE},
+      create_timestamp = #{record.createTimestamp,jdbcType=BIGINT}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAgg">
+    update content_platform_video_datastat_agg
+    <set>
+      <if test="dt != null">
+        dt = #{dt,jdbcType=VARCHAR},
+      </if>
+      <if test="videoId != null">
+        video_id = #{videoId,jdbcType=BIGINT},
+      </if>
+      <if test="type != null">
+        `type` = #{type,jdbcType=VARCHAR},
+      </if>
+      <if test="channel != null">
+        channel = #{channel,jdbcType=VARCHAR},
+      </if>
+      <if test="firstLevel != null">
+        first_level = #{firstLevel,jdbcType=BIGINT},
+      </if>
+      <if test="fission0 != null">
+        fission0 = #{fission0,jdbcType=BIGINT},
+      </if>
+      <if test="fissionRate != null">
+        fission_rate = #{fissionRate,jdbcType=DOUBLE},
+      </if>
+      <if test="createTimestamp != null">
+        create_timestamp = #{createTimestamp,jdbcType=BIGINT},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAgg">
+    update content_platform_video_datastat_agg
+    set dt = #{dt,jdbcType=VARCHAR},
+      video_id = #{videoId,jdbcType=BIGINT},
+      `type` = #{type,jdbcType=VARCHAR},
+      channel = #{channel,jdbcType=VARCHAR},
+      first_level = #{firstLevel,jdbcType=BIGINT},
+      fission0 = #{fission0,jdbcType=BIGINT},
+      fission_rate = #{fissionRate,jdbcType=DOUBLE},
+      create_timestamp = #{createTimestamp,jdbcType=BIGINT}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+</mapper>

+ 278 - 0
api-module/src/main/resources/mapper/contentplatform/ContentPlatformVideoDataStatMapper.xml

@@ -0,0 +1,278 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformVideoDataStatMapper">
+  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStat">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="dt" jdbcType="VARCHAR" property="dt" />
+    <result column="video_id" jdbcType="BIGINT" property="videoId" />
+    <result column="type" jdbcType="VARCHAR" property="type" />
+    <result column="channel" jdbcType="VARCHAR" property="channel" />
+    <result column="first_level" jdbcType="BIGINT" property="firstLevel" />
+    <result column="fission0" jdbcType="BIGINT" property="fission0" />
+    <result column="fission_rate" jdbcType="DOUBLE" property="fissionRate" />
+    <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    id, dt, video_id, `type`, channel, first_level, fission0, fission_rate, create_timestamp
+  </sql>
+  <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from content_platform_video_datastat
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+    <if test="page != null">
+      limit #{page.offset} , #{page.pageSize}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from content_platform_video_datastat
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from content_platform_video_datastat
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatExample">
+    delete from content_platform_video_datastat
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStat">
+    insert into content_platform_video_datastat (id, dt, video_id, 
+      `type`, channel, first_level, 
+      fission0, fission_rate, create_timestamp
+      )
+    values (#{id,jdbcType=BIGINT}, #{dt,jdbcType=VARCHAR}, #{videoId,jdbcType=BIGINT}, 
+      #{type,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR}, #{firstLevel,jdbcType=BIGINT}, 
+      #{fission0,jdbcType=BIGINT}, #{fissionRate,jdbcType=DOUBLE}, #{createTimestamp,jdbcType=BIGINT}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStat">
+    insert into content_platform_video_datastat
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="dt != null">
+        dt,
+      </if>
+      <if test="videoId != null">
+        video_id,
+      </if>
+      <if test="type != null">
+        `type`,
+      </if>
+      <if test="channel != null">
+        channel,
+      </if>
+      <if test="firstLevel != null">
+        first_level,
+      </if>
+      <if test="fission0 != null">
+        fission0,
+      </if>
+      <if test="fissionRate != null">
+        fission_rate,
+      </if>
+      <if test="createTimestamp != null">
+        create_timestamp,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="dt != null">
+        #{dt,jdbcType=VARCHAR},
+      </if>
+      <if test="videoId != null">
+        #{videoId,jdbcType=BIGINT},
+      </if>
+      <if test="type != null">
+        #{type,jdbcType=VARCHAR},
+      </if>
+      <if test="channel != null">
+        #{channel,jdbcType=VARCHAR},
+      </if>
+      <if test="firstLevel != null">
+        #{firstLevel,jdbcType=BIGINT},
+      </if>
+      <if test="fission0 != null">
+        #{fission0,jdbcType=BIGINT},
+      </if>
+      <if test="fissionRate != null">
+        #{fissionRate,jdbcType=DOUBLE},
+      </if>
+      <if test="createTimestamp != null">
+        #{createTimestamp,jdbcType=BIGINT},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatExample" resultType="java.lang.Long">
+    select count(*) from content_platform_video_datastat
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update content_platform_video_datastat
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=BIGINT},
+      </if>
+      <if test="record.dt != null">
+        dt = #{record.dt,jdbcType=VARCHAR},
+      </if>
+      <if test="record.videoId != null">
+        video_id = #{record.videoId,jdbcType=BIGINT},
+      </if>
+      <if test="record.type != null">
+        `type` = #{record.type,jdbcType=VARCHAR},
+      </if>
+      <if test="record.channel != null">
+        channel = #{record.channel,jdbcType=VARCHAR},
+      </if>
+      <if test="record.firstLevel != null">
+        first_level = #{record.firstLevel,jdbcType=BIGINT},
+      </if>
+      <if test="record.fission0 != null">
+        fission0 = #{record.fission0,jdbcType=BIGINT},
+      </if>
+      <if test="record.fissionRate != null">
+        fission_rate = #{record.fissionRate,jdbcType=DOUBLE},
+      </if>
+      <if test="record.createTimestamp != null">
+        create_timestamp = #{record.createTimestamp,jdbcType=BIGINT},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update content_platform_video_datastat
+    set id = #{record.id,jdbcType=BIGINT},
+      dt = #{record.dt,jdbcType=VARCHAR},
+      video_id = #{record.videoId,jdbcType=BIGINT},
+      `type` = #{record.type,jdbcType=VARCHAR},
+      channel = #{record.channel,jdbcType=VARCHAR},
+      first_level = #{record.firstLevel,jdbcType=BIGINT},
+      fission0 = #{record.fission0,jdbcType=BIGINT},
+      fission_rate = #{record.fissionRate,jdbcType=DOUBLE},
+      create_timestamp = #{record.createTimestamp,jdbcType=BIGINT}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStat">
+    update content_platform_video_datastat
+    <set>
+      <if test="dt != null">
+        dt = #{dt,jdbcType=VARCHAR},
+      </if>
+      <if test="videoId != null">
+        video_id = #{videoId,jdbcType=BIGINT},
+      </if>
+      <if test="type != null">
+        `type` = #{type,jdbcType=VARCHAR},
+      </if>
+      <if test="channel != null">
+        channel = #{channel,jdbcType=VARCHAR},
+      </if>
+      <if test="firstLevel != null">
+        first_level = #{firstLevel,jdbcType=BIGINT},
+      </if>
+      <if test="fission0 != null">
+        fission0 = #{fission0,jdbcType=BIGINT},
+      </if>
+      <if test="fissionRate != null">
+        fission_rate = #{fissionRate,jdbcType=DOUBLE},
+      </if>
+      <if test="createTimestamp != null">
+        create_timestamp = #{createTimestamp,jdbcType=BIGINT},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStat">
+    update content_platform_video_datastat
+    set dt = #{dt,jdbcType=VARCHAR},
+      video_id = #{videoId,jdbcType=BIGINT},
+      `type` = #{type,jdbcType=VARCHAR},
+      channel = #{channel,jdbcType=VARCHAR},
+      first_level = #{firstLevel,jdbcType=BIGINT},
+      fission0 = #{fission0,jdbcType=BIGINT},
+      fission_rate = #{fissionRate,jdbcType=DOUBLE},
+      create_timestamp = #{createTimestamp,jdbcType=BIGINT}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+</mapper>

+ 37 - 6
api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.xml

@@ -93,6 +93,11 @@
         from content_platform_video_agg
     </select>
 
+    <select id="getVideoDatastatMaxDt" resultType="java.lang.String">
+        select max(dt)
+        from content_platform_video_datastat_agg
+    </select>
+
     <select id="getVideoCount" resultType="java.lang.Integer">
         select count(1)
         from content_platform_video_agg
@@ -106,16 +111,18 @@
     </select>
 
     <select id="getVideoList" resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideo">
-        select *
-        from content_platform_video_agg
-        where dt = #{dt} and status = 1 and score > #{minScore}
+        select video.*
+        from content_platform_video_agg video
+        left join content_platform_video_datastat_agg datastat
+            on datastat.dt = #{datastatDt} and datastat.type = #{type} and datastat.channel = #{channel} and datastat.video_id = video.video_id
+        where video.dt = #{dt} and video.status = 1 and video.score > #{minScore}
         <if test="param.title!= null and param.title!= ''">
-            and title like concat('%', #{param.title}, '%')
+            and video.title like concat('%', #{param.title}, '%')
         </if>
         <if test="param.category!= null and param.category!= ''">
-            and category = #{param.category}
+            and video.category = #{param.category}
         </if>
-        order by score desc
+        order by ${sort}
         limit #{offset}, #{pageSize}
     </select>
 
@@ -263,4 +270,28 @@
         delete from content_platform_video_agg where dt = #{dt}
     </delete>
 
+    <delete id="deleteContentPlatformVideoDatastatAgg">
+        delete from content_platform_video_datastat_agg where dt = #{dt}
+    </delete>
+
+    <insert id="batchInsertContentPlatformVideoDatastat">
+        insert into content_platform_video_datastat (dt, video_id, `type`, channel, first_level, fission0,
+                                                         fission_rate, create_timestamp)
+        values
+        <foreach collection="records" item="item" separator=",">
+            (#{item.dt}, #{item.videoId}, #{item.type}, #{item.channel}, #{item.firstLevel},
+            #{item.fission0}, #{item.fissionRate}, #{item.createTimestamp})
+        </foreach>
+    </insert>
+
+    <insert id="batchInsertContentPlatformVideoDatastatAgg">
+        insert into content_platform_video_datastat_agg (dt, video_id, `type`, channel, first_level, fission0,
+                                                         fission_rate, create_timestamp)
+        values
+        <foreach collection="records" item="item" separator=",">
+            (#{item.dt}, #{item.videoId}, #{item.type}, #{item.channel}, #{item.firstLevel},
+            #{item.fission0}, #{item.fissionRate}, #{item.createTimestamp})
+        </foreach>
+    </insert>
+
 </mapper>

+ 2 - 1
api-module/src/main/resources/mybatis-api-contentPlatform-generator-config.xml

@@ -68,7 +68,8 @@
         <table tableName="content_platform_verify_code" domainObjectName="ContentPlatformVerifyCode" alias=""/>
         <table tableName="content_platform_video" domainObjectName="ContentPlatformVideo" alias=""/>
         <table tableName="content_platform_video_agg" domainObjectName="ContentPlatformVideoAgg" alias=""/>
-
+        <table tableName="content_platform_video_datastat" domainObjectName="ContentPlatformVideoDataStat" alias=""/>
+        <table tableName="content_platform_video_datastat_agg" domainObjectName="ContentPlatformVideoDataStatAgg" alias=""/>
     </context>
 
 </generatorConfiguration>