|
@@ -9,6 +9,8 @@ import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
|
import cn.com.ctop.crawler.modules.appium.service.IAppiumJobService;
|
|
|
+import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
|
|
|
+import cn.com.ctop.toutiao.service.IByteDanceCreativeService;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
@@ -44,9 +46,96 @@ public class SampleTest {
|
|
|
private IReportService reportService;
|
|
|
|
|
|
@Test
|
|
|
- public void getBytedancePlanReport(){
|
|
|
+ public void getYddData()throws Exception{
|
|
|
+ String dateString = "2020-01-06";
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date getDate = dateFormat.parse(dateString);
|
|
|
+ List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
|
|
|
+ if (null == tokens || tokens.size() <= 0) {
|
|
|
+ log.info("定时获取头条数据异常:为获取到可用的token");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ tokens.forEach(token -> {
|
|
|
+ reportService.getAdvertiserPlanReport(token,getDate,getDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ });
|
|
|
|
|
|
- Date getDate = DateUtils.addDay(new Date(), -1);
|
|
|
+ //清洗关于缘多多数据
|
|
|
+ //1:查询缘多多相关的用户数据
|
|
|
+ QueryWrapper<UserAllocation> yddWrapper = new QueryWrapper<>();
|
|
|
+ yddWrapper.eq("project_id",113);
|
|
|
+ List<UserAllocation> yddallocations = userAllocationService.list(yddWrapper);
|
|
|
+ if(null!=yddallocations&&yddallocations.size()>0){
|
|
|
+ yddallocations.forEach(allocation->{
|
|
|
+ //根据accountId和时间,查询相关的日报表信息
|
|
|
+ QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("advertiser_id",allocation.getAccountId())
|
|
|
+ //.eq("stat_datetime",dateString)
|
|
|
+ ;
|
|
|
+ List<BytedancePlanDailyReport>bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
|
|
|
+ if(null!=bytedancePlanDailyReports&&bytedancePlanDailyReports.size()>0){
|
|
|
+ bytedancePlanDailyReports.forEach(report->{
|
|
|
+ String adName = report.getAdName();
|
|
|
+ String[] tags = adName.split("-");
|
|
|
+ report.setChannelCode(tags[0]);
|
|
|
+ planDailyReportService.updateById(report);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //清洗关于缘多多数据
|
|
|
+ //1:查询缘多多相关的用户数据
|
|
|
+ QueryWrapper<UserAllocation> dsjyWrapper = new QueryWrapper<>();
|
|
|
+ yddWrapper.eq("project_id",112);
|
|
|
+ List<UserAllocation> dsjyAllocations = userAllocationService.list(dsjyWrapper);
|
|
|
+ if(null!=dsjyAllocations&&dsjyAllocations.size()>0){
|
|
|
+ dsjyAllocations.forEach(allocation->{
|
|
|
+ //根据accountId和时间,查询相关的日报表信息
|
|
|
+ QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("advertiser_id",allocation.getAccountId())
|
|
|
+ //.eq("stat_datetime",dateString)
|
|
|
+ ;
|
|
|
+ List<BytedancePlanDailyReport>bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
|
|
|
+ if(null!=bytedancePlanDailyReports&&bytedancePlanDailyReports.size()>0){
|
|
|
+ bytedancePlanDailyReports.forEach(report->{
|
|
|
+ String adName = report.getAdName();
|
|
|
+ String[] tags = adName.split("-");
|
|
|
+ report.setChannelCode(tags[0]);
|
|
|
+ planDailyReportService.updateById(report);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //清洗关于缘多多数据
|
|
|
+ //1:查询缘多多相关的用户数据
|
|
|
+ QueryWrapper<UserAllocation> fjyhWrapper = new QueryWrapper<>();
|
|
|
+ yddWrapper.eq("project_id",222);
|
|
|
+ List<UserAllocation> fjyhAllocations = userAllocationService.list(fjyhWrapper);
|
|
|
+ if(null!=fjyhAllocations&&fjyhAllocations.size()>0){
|
|
|
+ fjyhAllocations.forEach(allocation->{
|
|
|
+ //根据accountId和时间,查询相关的日报表信息
|
|
|
+ QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("advertiser_id",allocation.getAccountId())
|
|
|
+ //.eq("stat_datetime",dateString)
|
|
|
+ ;
|
|
|
+ List<BytedancePlanDailyReport>bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
|
|
|
+ if(null!=bytedancePlanDailyReports&&bytedancePlanDailyReports.size()>0){
|
|
|
+ bytedancePlanDailyReports.forEach(report->{
|
|
|
+ String adName = report.getAdName();
|
|
|
+ String[] tags = adName.split("-");
|
|
|
+ report.setChannelCode(tags[0]);
|
|
|
+ planDailyReportService.updateById(report);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @Test
|
|
|
+ public void getZybBytedancePlanReport(){
|
|
|
+
|
|
|
+// Date getDate = DateUtils.addDay(new Date(), -1);
|
|
|
+ Date getDate = new Date();
|
|
|
//1:查询作业帮相关的用户数据
|
|
|
QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
|
|
|
wrapper.eq("project_id",215);
|
|
@@ -55,7 +144,7 @@ public class SampleTest {
|
|
|
allocations.forEach(allocation->{
|
|
|
CtopOauthToken token = tokenService.getOauthTokenByAccountId(allocation.getAccountId()+"");
|
|
|
//3:获取广告计划信息数据
|
|
|
- reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -89,6 +178,10 @@ public class SampleTest {
|
|
|
report.setMaterialType("文字动画");
|
|
|
}else if(tag.contains("采访形式")){
|
|
|
report.setMaterialType("采访形式");
|
|
|
+ }else if(tag.contains("剧情")){
|
|
|
+ report.setMaterialType("剧情");
|
|
|
+ }else if(tag.contains("口播")){
|
|
|
+ report.setMaterialType("口播");
|
|
|
}else{
|
|
|
report.setMaterialType("其他");
|
|
|
}
|
|
@@ -99,6 +192,29 @@ public class SampleTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void getByteDanceCreativeDate()throws Exception{
|
|
|
+ String dateString = "2020-01-06";
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date getDate = dateFormat.parse(dateString);
|
|
|
+ List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
|
|
|
+ if (null == tokens || tokens.size() <= 0) {
|
|
|
+ log.info("定时获取头条数据异常:为获取到可用的token");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ tokens.forEach(token -> {
|
|
|
+ //3:获取广告计划信息数据
|
|
|
+// creativeService.getAdvertiserCreative(token.getAccountId() + "", "", null);
|
|
|
+ //2:获取全量素材数据
|
|
|
+// advertiserDataService.getMaterialList(token);
|
|
|
+ reportService.getAdvertiserPlanReport(token,getDate,getDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IByteDanceAdvertiserDataService advertiserDataService;
|
|
|
+ @Autowired
|
|
|
+ private IByteDanceCreativeService creativeService;
|
|
|
|
|
|
@Test
|
|
|
public void getBytedancePlanHourReport(){
|