|  | @@ -1,10 +1,15 @@
 | 
											
												
													
														|  |  package com.tzld.piaoquan.api.job;
 |  |  package com.tzld.piaoquan.api.job;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  import com.aliyun.odps.data.Record;
 |  |  import com.aliyun.odps.data.Record;
 | 
											
												
													
														|  | -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.ContentPlatformVideoExample;
 |  | 
 | 
											
												
													
														|  | 
 |  | +import com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformGzhAccountMapper;
 | 
											
												
													
														|  | 
 |  | +import com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformGzhDataStatMapper;
 | 
											
												
													
														|  | 
 |  | +import com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformQwDataStatMapper;
 | 
											
												
													
														|  | 
 |  | +import com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformQwPlanMapper;
 | 
											
												
													
														|  | 
 |  | +import com.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformDataStatMapperExt;
 | 
											
												
													
														|  | 
 |  | +import com.tzld.piaoquan.api.model.po.contentplatform.*;
 | 
											
												
													
														|  | 
 |  | +import com.tzld.piaoquan.api.model.vo.WxAccountDatastatVO;
 | 
											
												
													
														|  | 
 |  | +import com.tzld.piaoquan.api.remote.AigcApiService;
 | 
											
												
													
														|  | 
 |  | +import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformPlanService;
 | 
											
												
													
														|  |  import com.tzld.piaoquan.growth.common.utils.DateUtil;
 |  |  import com.tzld.piaoquan.growth.common.utils.DateUtil;
 | 
											
												
													
														|  |  import com.tzld.piaoquan.growth.common.utils.OdpsUtil;
 |  |  import com.tzld.piaoquan.growth.common.utils.OdpsUtil;
 | 
											
												
													
														|  |  import com.xxl.job.core.biz.model.ReturnT;
 |  |  import com.xxl.job.core.biz.model.ReturnT;
 | 
											
										
											
												
													
														|  | @@ -16,91 +21,201 @@ import org.springframework.stereotype.Component;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  import java.util.ArrayList;
 |  |  import java.util.ArrayList;
 | 
											
												
													
														|  |  import java.util.List;
 |  |  import java.util.List;
 | 
											
												
													
														|  | 
 |  | +import java.util.Map;
 | 
											
												
													
														|  | 
 |  | +import java.util.Objects;
 | 
											
												
													
														|  | 
 |  | +import java.util.stream.Collectors;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  @Slf4j
 |  |  @Slf4j
 | 
											
												
													
														|  |  @Component
 |  |  @Component
 | 
											
												
													
														|  |  public class ContentPlatformDatastatJob {
 |  |  public class ContentPlatformDatastatJob {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  | -    private ContentPlatformPlanMapperExt planMapperExt;
 |  | 
 | 
											
												
													
														|  | 
 |  | +    private ContentPlatformGzhDataStatMapper gzhDataStatMapper;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  | -    private ContentPlatformVideoMapper videoMapper;
 |  | 
 | 
											
												
													
														|  | 
 |  | +    private ContentPlatformGzhAccountMapper gzhAccountMapper;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private ContentPlatformQwDataStatMapper qwDataStatMapper;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private ContentPlatformQwPlanMapper qwPlanMapper;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private ContentPlatformDataStatMapperExt dataStatMapperExt;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private AigcApiService aigcApiService;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private ContentPlatformPlanService planService;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @XxlJob("syncContentPlatformGzhDatastatJob")
 |  |      @XxlJob("syncContentPlatformGzhDatastatJob")
 | 
											
												
													
														|  |      public ReturnT<String> syncContentPlatformGzhDatastatJob(String param) {
 |  |      public ReturnT<String> syncContentPlatformGzhDatastatJob(String param) {
 | 
											
												
													
														|  | -        String dt = DateUtil.getBeforeDayDateString();
 |  | 
 | 
											
												
													
														|  | -        long videoCount = getVideoCount(dt);
 |  | 
 | 
											
												
													
														|  | -        if (videoCount > 0) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +        String dt = DateUtil.getBeforeDayDateString("yyyyMMdd");
 | 
											
												
													
														|  | 
 |  | +        long count = getGzhDatastatCount(dt);
 | 
											
												
													
														|  | 
 |  | +        if (count > 0) {
 | 
											
												
													
														|  |              return ReturnT.SUCCESS;
 |  |              return ReturnT.SUCCESS;
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        String sql = String.format("SELECT * FROM loghubods.wecom_cooperation_video_candidate_pool WHERE dt=%s;", dt);
 |  | 
 | 
											
												
													
														|  | -        List<Record> dataList = OdpsUtil.getOdpsData(sql);
 |  | 
 | 
											
												
													
														|  |          Long now = System.currentTimeMillis();
 |  |          Long now = System.currentTimeMillis();
 | 
											
												
													
														|  | 
 |  | +        // 公众号自动回复数据统计
 | 
											
												
													
														|  | 
 |  | +        String sql = String.format("SELECT 合作方, 公众号id, 访问人数, 首层访问人数, dt " +
 | 
											
												
													
														|  | 
 |  | +                "FROM loghubods.loghubods.gzh_autoreply_behavior_uv_total WHERE dt=%s;", 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 = DateUtil.getBeforeDayDateString("yyyy-MM-dd");
 | 
											
												
													
														|  | 
 |  | +        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);
 | 
											
												
													
														|  | 
 |  | +        List<Long> planIds = gzhPlanList.stream().map(ContentPlatformGzhPlan::getId).collect(Collectors.toList());
 | 
											
												
													
														|  | 
 |  | +        Map<Long, Long> gzhPlanMap = gzhPlanList.stream()
 | 
											
												
													
														|  | 
 |  | +               .collect(Collectors.toMap(ContentPlatformGzhPlan::getAccountId, ContentPlatformGzhPlan::getId));
 | 
											
												
													
														|  | 
 |  | +        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<ContentPlatformVideo> contentPlatformVideoList = planService.getVideoContentListByVideoIds(videoIds);
 | 
											
												
													
														|  | 
 |  | +        Map<Long, ContentPlatformVideo> videoMap = contentPlatformVideoList.stream()
 | 
											
												
													
														|  | 
 |  | +              .collect(Collectors.toMap(ContentPlatformVideo::getId, video -> video));
 | 
											
												
													
														|  |          if (CollectionUtils.isNotEmpty(dataList)) {
 |  |          if (CollectionUtils.isNotEmpty(dataList)) {
 | 
											
												
													
														|  | -            List<ContentPlatformVideo> saveList = new ArrayList<>();
 |  | 
 | 
											
												
													
														|  | 
 |  | +            List<ContentPlatformGzhDataStat> saveList = new ArrayList<>();
 | 
											
												
													
														|  |              for (Record record : dataList) {
 |  |              for (Record record : dataList) {
 | 
											
												
													
														|  | -                ContentPlatformVideo item = new ContentPlatformVideo();
 |  | 
 | 
											
												
													
														|  | -                Long videoId = Long.parseLong((String) record.get(0));
 |  | 
 | 
											
												
													
														|  | -                String category = (String) record.get(1);
 |  | 
 | 
											
												
													
														|  | -                String title = (String) record.get(2);
 |  | 
 | 
											
												
													
														|  | -                String videoUrl = (String) record.get(3);
 |  | 
 | 
											
												
													
														|  | -                Double score = Double.parseDouble((String) record.get(4));
 |  | 
 | 
											
												
													
														|  | -                item.setDt(dt);
 |  | 
 | 
											
												
													
														|  | -                item.setVideoId(videoId);
 |  | 
 | 
											
												
													
														|  | -                item.setCategory(category);
 |  | 
 | 
											
												
													
														|  | -                item.setTitle(title);
 |  | 
 | 
											
												
													
														|  | -                item.setVideo(videoUrl);
 |  | 
 | 
											
												
													
														|  | -                item.setScore(score);
 |  | 
 | 
											
												
													
														|  | 
 |  | +                ContentPlatformGzhDataStat item = new ContentPlatformGzhDataStat();
 | 
											
												
													
														|  | 
 |  | +                String ghId = (String) record.get(1);
 | 
											
												
													
														|  | 
 |  | +                Integer firstLevelCount = Integer.valueOf((String) record.get(3));
 | 
											
												
													
														|  | 
 |  | +                item.setDateStr(dt);
 | 
											
												
													
														|  | 
 |  | +                if (!ghIds.contains(ghId)) {
 | 
											
												
													
														|  | 
 |  | +                    continue;
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +                ContentPlatformGzhAccount gzhAccount = accountMap.get(ghId);
 | 
											
												
													
														|  | 
 |  | +                item.setAccountId(gzhAccount.getId());
 | 
											
												
													
														|  | 
 |  | +                item.setFirstLevelCount(firstLevelCount);
 | 
											
												
													
														|  | 
 |  | +                WxAccountDatastatVO wxAccountDatastatVO = wxAccountDatastatMap.get(gzhAccount.getExternalId());
 | 
											
												
													
														|  | 
 |  | +                if (Objects.nonNull(wxAccountDatastatVO)) {
 | 
											
												
													
														|  | 
 |  | +                    item.setFansIncreaseCount(wxAccountDatastatVO.getFansIncreaseCount());
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +                List<ContentPlatformGzhPlanVideo> videoList = gzhPlanVideoMap.get(gzhPlanMap.get(gzhAccount.getId()));
 | 
											
												
													
														|  | 
 |  | +                if (CollectionUtils.isNotEmpty(videoList)) {
 | 
											
												
													
														|  | 
 |  | +                    List<Long> itemVideoIds = videoList.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
 | 
											
												
													
														|  | 
 |  | +                    Double score = 0.0;
 | 
											
												
													
														|  | 
 |  | +                    for (Long videoId : itemVideoIds) {
 | 
											
												
													
														|  | 
 |  | +                        score += videoMap.get(videoId).getScore();
 | 
											
												
													
														|  | 
 |  | +                    }
 | 
											
												
													
														|  | 
 |  | +                    item.setScore(score / itemVideoIds.size());
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  |                  item.setCreateTimestamp(now);
 |  |                  item.setCreateTimestamp(now);
 | 
											
												
													
														|  |                  saveList.add(item);
 |  |                  saveList.add(item);
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |              if (CollectionUtils.isNotEmpty(saveList)) {
 |  |              if (CollectionUtils.isNotEmpty(saveList)) {
 | 
											
												
													
														|  | -                planMapperExt.batchInsertContentPlatformVideo(saveList);
 |  | 
 | 
											
												
													
														|  | 
 |  | +                dataStatMapperExt.batchInsertGzhDatastat(saveList);
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          return ReturnT.SUCCESS;
 |  |          return ReturnT.SUCCESS;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    private long getVideoCount(String dt) {
 |  | 
 | 
											
												
													
														|  | -        ContentPlatformVideoExample example = new ContentPlatformVideoExample();
 |  | 
 | 
											
												
													
														|  | -        example.createCriteria().andDtEqualTo(dt);
 |  | 
 | 
											
												
													
														|  | -        return videoMapper.countByExample(example);
 |  | 
 | 
											
												
													
														|  | 
 |  | +    private List<ContentPlatformGzhAccount> getAllGzhAccount() {
 | 
											
												
													
														|  | 
 |  | +        ContentPlatformGzhAccountExample example = new ContentPlatformGzhAccountExample();
 | 
											
												
													
														|  | 
 |  | +        example.createCriteria().andStatusEqualTo(1);
 | 
											
												
													
														|  | 
 |  | +        return gzhAccountMapper.selectByExample(example);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    private long getGzhDatastatCount(String dt) {
 | 
											
												
													
														|  | 
 |  | +        ContentPlatformGzhDataStatExample example = new ContentPlatformGzhDataStatExample();
 | 
											
												
													
														|  | 
 |  | +        example.createCriteria().andDateStrEqualTo(dt);
 | 
											
												
													
														|  | 
 |  | +        return gzhDataStatMapper.countByExample(example);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    private long getQwDatastatCount(String dt) {
 | 
											
												
													
														|  | 
 |  | +        ContentPlatformQwDataStatExample example = new ContentPlatformQwDataStatExample();
 | 
											
												
													
														|  | 
 |  | +        example.createCriteria().andDateStrEqualTo(dt);
 | 
											
												
													
														|  | 
 |  | +        return qwDataStatMapper.countByExample(example);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @XxlJob("syncContentPlatformQwDatastatJob")
 |  |      @XxlJob("syncContentPlatformQwDatastatJob")
 | 
											
												
													
														|  |      public ReturnT<String> syncContentPlatformQwDatastatJob(String param) {
 |  |      public ReturnT<String> syncContentPlatformQwDatastatJob(String param) {
 | 
											
												
													
														|  | -        String dt = DateUtil.getBeforeDayDateString();
 |  | 
 | 
											
												
													
														|  | -        long videoCount = getVideoCount(dt);
 |  | 
 | 
											
												
													
														|  | -        if (videoCount > 0) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +        String dt = DateUtil.getBeforeDayDateString("yyyyMMdd");
 | 
											
												
													
														|  | 
 |  | +        long count = getQwDatastatCount(dt);
 | 
											
												
													
														|  | 
 |  | +        if (count > 0) {
 | 
											
												
													
														|  |              return ReturnT.SUCCESS;
 |  |              return ReturnT.SUCCESS;
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        String sql = String.format("SELECT * FROM loghubods.wecom_cooperation_video_candidate_pool WHERE dt=%s;", dt);
 |  | 
 | 
											
												
													
														|  | -        List<Record> dataList = OdpsUtil.getOdpsData(sql);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        List<ContentPlatformQwPlan> qwPlanList = getAllQwPlan();
 | 
											
												
													
														|  | 
 |  | +        if (CollectionUtils.isEmpty(qwPlanList)) {
 | 
											
												
													
														|  | 
 |  | +            return ReturnT.SUCCESS;
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        Map<String, Long> rootSourceIdMap = qwPlanList.stream()
 | 
											
												
													
														|  | 
 |  | +            .collect(Collectors.toMap(ContentPlatformQwPlan::getRootSourceId, ContentPlatformQwPlan::getId));
 | 
											
												
													
														|  | 
 |  | +        List<Long> planIds = qwPlanList.stream().map(ContentPlatformQwPlan::getId).collect(Collectors.toList());
 | 
											
												
													
														|  | 
 |  | +        List<ContentPlatformQwPlanVideo> planVideoList = planService.getQwPlanVideoList(planIds);
 | 
											
												
													
														|  | 
 |  | +        Map<Long, Long> planVideoMap = planVideoList.stream()
 | 
											
												
													
														|  | 
 |  | +              .collect(Collectors.toMap(ContentPlatformQwPlanVideo::getPlanId, ContentPlatformQwPlanVideo::getVideoId));
 | 
											
												
													
														|  | 
 |  | +        List<Long> videoIds = planVideoList.stream().map(ContentPlatformQwPlanVideo::getVideoId).collect(Collectors.toList());
 | 
											
												
													
														|  | 
 |  | +        List<ContentPlatformVideo> videoList = planService.getVideoContentListByVideoIds(videoIds);
 | 
											
												
													
														|  | 
 |  | +        Map<Long, Double> videoScoreMap = videoList.stream()
 | 
											
												
													
														|  | 
 |  | +              .collect(Collectors.toMap(ContentPlatformVideo::getId, ContentPlatformVideo::getScore));
 | 
											
												
													
														|  | 
 |  | +        Map<Long, ContentPlatformVideo> videoMap = videoList.stream()
 | 
											
												
													
														|  | 
 |  | +               .collect(Collectors.toMap(ContentPlatformVideo::getId, video -> video));
 | 
											
												
													
														|  | 
 |  | +        List<ContentPlatformQwDataStat> saveList = new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        List<String> rootSourceIds = qwPlanList.stream().map(ContentPlatformQwPlan::getRootSourceId).collect(Collectors.toList());
 | 
											
												
													
														|  | 
 |  | +        String outSql = String.format("SELECT * FROM loghubods.qw_out_touliu_behavior_detail WHERE dt=%s;", dt);
 | 
											
												
													
														|  | 
 |  | +        List<Record> outDataList = OdpsUtil.getOdpsData(outSql);
 | 
											
												
													
														|  |          Long now = System.currentTimeMillis();
 |  |          Long now = System.currentTimeMillis();
 | 
											
												
													
														|  | -        if (CollectionUtils.isNotEmpty(dataList)) {
 |  | 
 | 
											
												
													
														|  | -            List<ContentPlatformVideo> saveList = new ArrayList<>();
 |  | 
 | 
											
												
													
														|  | -            for (Record record : dataList) {
 |  | 
 | 
											
												
													
														|  | -                ContentPlatformVideo item = new ContentPlatformVideo();
 |  | 
 | 
											
												
													
														|  | -                Long videoId = Long.parseLong((String) record.get(0));
 |  | 
 | 
											
												
													
														|  | -                String category = (String) record.get(1);
 |  | 
 | 
											
												
													
														|  | -                String title = (String) record.get(2);
 |  | 
 | 
											
												
													
														|  | -                String videoUrl = (String) record.get(3);
 |  | 
 | 
											
												
													
														|  | -                Double score = Double.parseDouble((String) record.get(4));
 |  | 
 | 
											
												
													
														|  | -                item.setDt(dt);
 |  | 
 | 
											
												
													
														|  | -                item.setVideoId(videoId);
 |  | 
 | 
											
												
													
														|  | -                item.setCategory(category);
 |  | 
 | 
											
												
													
														|  | -                item.setTitle(title);
 |  | 
 | 
											
												
													
														|  | -                item.setVideo(videoUrl);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (CollectionUtils.isNotEmpty(outDataList)) {
 | 
											
												
													
														|  | 
 |  | +            for (Record record : outDataList) {
 | 
											
												
													
														|  | 
 |  | +                ContentPlatformQwDataStat item = new ContentPlatformQwDataStat();
 | 
											
												
													
														|  | 
 |  | +                String rootSourceId = (String) record.get(0);
 | 
											
												
													
														|  | 
 |  | +                if (!rootSourceIds.contains(rootSourceId)) {
 | 
											
												
													
														|  | 
 |  | +                    continue;
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +                Integer firstLevelCount = Integer.valueOf((String) record.get(8));
 | 
											
												
													
														|  | 
 |  | +                item.setDateStr(dt);
 | 
											
												
													
														|  | 
 |  | +                Long planId = rootSourceIdMap.get(rootSourceId);
 | 
											
												
													
														|  | 
 |  | +                Long videoId = planVideoMap.get(planId);
 | 
											
												
													
														|  | 
 |  | +                Double score = videoScoreMap.get(videoId);
 | 
											
												
													
														|  |                  item.setScore(score);
 |  |                  item.setScore(score);
 | 
											
												
													
														|  | 
 |  | +                item.setRootSourceId(rootSourceId);
 | 
											
												
													
														|  | 
 |  | +                item.setFirstLevelCount(firstLevelCount);
 | 
											
												
													
														|  |                  item.setCreateTimestamp(now);
 |  |                  item.setCreateTimestamp(now);
 | 
											
												
													
														|  |                  saveList.add(item);
 |  |                  saveList.add(item);
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  | -            if (CollectionUtils.isNotEmpty(saveList)) {
 |  | 
 | 
											
												
													
														|  | -                planMapperExt.batchInsertContentPlatformVideo(saveList);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        String out2Sql = String.format("SELECT * FROM loghubods.qw_out2_touliu_behavior_detail WHERE dt=%s;", dt);
 | 
											
												
													
														|  | 
 |  | +        List<Record> out2DataList = OdpsUtil.getOdpsData(out2Sql);
 | 
											
												
													
														|  | 
 |  | +        if (CollectionUtils.isNotEmpty(out2DataList)) {
 | 
											
												
													
														|  | 
 |  | +            for (Record record : out2DataList) {
 | 
											
												
													
														|  | 
 |  | +                ContentPlatformQwDataStat item = new ContentPlatformQwDataStat();
 | 
											
												
													
														|  | 
 |  | +                String rootSourceId = (String) record.get(0);
 | 
											
												
													
														|  | 
 |  | +                if (!rootSourceIds.contains(rootSourceId)) {
 | 
											
												
													
														|  | 
 |  | +                    continue;
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +                Integer firstLevelCount = Integer.valueOf((String) record.get(8));
 | 
											
												
													
														|  | 
 |  | +                item.setDateStr(dt);
 | 
											
												
													
														|  | 
 |  | +                Long planId = rootSourceIdMap.get(rootSourceId);
 | 
											
												
													
														|  | 
 |  | +                Long videoId = planVideoMap.get(planId);
 | 
											
												
													
														|  | 
 |  | +                Double score = videoScoreMap.get(videoId);
 | 
											
												
													
														|  | 
 |  | +                item.setScore(score);
 | 
											
												
													
														|  | 
 |  | +                item.setRootSourceId(rootSourceId);
 | 
											
												
													
														|  | 
 |  | +                item.setFirstLevelCount(firstLevelCount);
 | 
											
												
													
														|  | 
 |  | +                item.setCreateTimestamp(now);
 | 
											
												
													
														|  | 
 |  | +                saveList.add(item);
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | 
 |  | +        if (CollectionUtils.isNotEmpty(saveList)) {
 | 
											
												
													
														|  | 
 |  | +            dataStatMapperExt.batchInsertQwDatastat(saveList);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |          return ReturnT.SUCCESS;
 |  |          return ReturnT.SUCCESS;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    private List<ContentPlatformQwPlan> getAllQwPlan() {
 | 
											
												
													
														|  | 
 |  | +        ContentPlatformQwPlanExample example = new ContentPlatformQwPlanExample();
 | 
											
												
													
														|  | 
 |  | +        return qwPlanMapper.selectByExample(example);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  }
 |  |  }
 |