Browse Source

导出报表加入点击率

yumeng 5 years ago
parent
commit
3b70ee2cea

+ 51 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCampaignGroupJob.java

@@ -0,0 +1,51 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import lombok.extern.slf4j.Slf4j;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+public class KuaishouCampaignGroupJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+
+    static ExecutorService executorService = null;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+        //1:查询当日数据
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+
+        executorService = Executors.newFixedThreadPool(5);
+        tokens.forEach(token -> {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        //1:获取全量广告计划数据
+                        kuaishouInterfaceService.getCampaignList(token, null, null);
+                        //1:获取全量广告组数据
+                        kuaishouInterfaceService.getGroupList(token, null, null);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    } finally {
+                    }
+                }
+            });
+        });
+        log.info("快手物料数据同步完成");
+    }
+}

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyReportLoadJob.java

@@ -46,7 +46,7 @@ public class KuaishouHourlyReportLoadJob implements Job {
             log.info("定时获取头条数据异常:为获取到可用的token");
             return;
         }
-        executorService = Executors.newFixedThreadPool(10);
+        executorService = Executors.newFixedThreadPool(5);
         countDownLatch = new CountDownLatch(tokens.size());
         Date finalGetDate = getDate;
         tokens.forEach(token -> {

+ 3 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouMaterialsLoadJob.java

@@ -34,18 +34,15 @@ public class KuaishouMaterialsLoadJob implements Job {
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
 
-        executorService = Executors.newFixedThreadPool(10);
+        executorService = Executors.newFixedThreadPool(5);
         tokens.forEach(token -> {
             executorService.submit(new Runnable() {
                 @Override
                 public void run() {
                     try {
-                        //1:获取全量广告计划数据
-                        kuaishouInterfaceService.getCampaignList(token,null,null);
-                        //1:获取全量广告组数据
-                        kuaishouInterfaceService.getGroupList(token,null,null);
+
                         //1:获取全量创意数据
-                      //  kuaishouInterfaceService.getCreativeList(token,startDate,endDate);
+                        kuaishouInterfaceService.getCreativeList(token,startDate,endDate);
                         //2:获取全量视频素材数据
                         kuaishouInterfaceService.getVideoList(token,startDate,endDate);
                         //3: 获取图片信息数据

+ 3 - 2
module-report/src/main/java/cn/com/ctop/bytedance/controller/DailyReportController.java

@@ -100,8 +100,9 @@ public class DailyReportController {
                 dailyGroup.add(groupReportVO.getPhotoShow()); // 展示数
                 dailyGroup.add(groupReportVO.getPhotoClick()); // 点击数
                 dailyGroup.add(groupReportVO.getBclick());   // 行为数
-                dailyGroup.add(RateUtil.getRate(groupReportVO.getActionRatio())); // 行为率
                 dailyGroup.add(RateUtil.getRate(groupReportVO.getPhotoClickRatio())); // 点击率
+                dailyGroup.add(RateUtil.getRate(groupReportVO.getActionRatio())); // 行为率
+
                 dailyGroup.add(groupReportVO.getImpression1kCost()); // 平均千次展现花费
                 dailyGroup.add(groupReportVO.getPhotoClickCost()); // 平均点击花费
                 dailyGroup.add(groupReportVO.getConversions()); // 转化数
@@ -114,7 +115,7 @@ public class DailyReportController {
         }
 
         String[] accountHeaders = {"时间", "消耗(元)", "激励花费(元)", "实际消耗(元)", "展示数", "点击数", "点击率", "平均点击花费(元)", "行为数", "行为率", "平均千次展现花费(元)", "转化数(元)", "转化单价", "转化率", "折后转化成本(元)"};
-        String[] groupHeaders = {"账号", "账号名称", "日期", "计划名称", "广告组名称", "消耗(元)", "折后消耗(元)", "展示数", "点击数", "行为数", "行为率", "点击率", "平均千次展示花费(元)", "平均点击花费(元)", "转化数", "转化单价(元)", "点击转化率", "折后转化成本(元)"};
+        String[] groupHeaders = {"账号", "账号名称", "日期", "计划名称", "广告组名称", "消耗(元)", "折后消耗(元)", "展示数", "行为数", "点击数", "行为率", "点击率", "平均千次展示花费(元)", "平均点击花费(元)", "转化数", "转化单价(元)", "点击转化率", "折后转化成本(元)"};
         OutputStream os = response.getOutputStream();
         ExportExcelUtils eeu = new ExportExcelUtils();
         XSSFWorkbook workbook = new XSSFWorkbook();