Преглед на файлове

规范头条定时任务类名命名规则

syh преди 5 години
родител
ревизия
62f68acf23

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

@@ -18,10 +18,11 @@ import java.util.concurrent.Executors;
 
 /**
  * @author syh
+ * 头条广告主日报数据获取任务
  * 第二天凌晨跑前一天的数据
  */
 @Slf4j
-public class BytedanceDailyReportLoadJob implements Job {
+public class BytedanceAdvertiserDailyReportLoadJob implements Job {
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired

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

@@ -19,9 +19,10 @@ import java.util.concurrent.Executors;
 
 /**
  * @author syh
+ * 头条广告主时报获取任务
  */
 @Slf4j
-public class BytedanceHourlyReportLoadJob implements Job {
+public class BytedanceAdvertiserHourlyReportLoadJob implements Job {
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired

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

@@ -1,51 +0,0 @@
-package org.jeecg.modules.ctop.job;
-
-import cn.com.ctop.bytedance.service.IReportService;
-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 lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.util.DateUtils;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * 头条计划层级数据
- */
-@Slf4j
-public class BytedanceDailyPlanReportLoadJob implements Job {
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IReportService reportService;
-
-    static ExecutorService executorService = null;
-
-    @Override
-    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        Date getDate = DateUtils.addDay(new Date(), -1);
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
-            log.info("定时获取头条数据异常:为获取到可用的token");
-            return;
-        }
-        executorService = Executors.newFixedThreadPool(5);
-        tokens.forEach(token -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    //获取广告计划信息数据
-                    reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-                }
-            });
-        });
-    }
-}

+ 4 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceMaterialsLoadJob.java

@@ -34,7 +34,7 @@ public class BytedanceMaterialsLoadJob implements Job {
         String dateString = dateFormat.format(getDate);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        executorService = Executors.newFixedThreadPool(10);
+        executorService = Executors.newFixedThreadPool(4);
         tokens.forEach(token -> {
             executorService.submit(new Runnable() {
                 @Override
@@ -42,11 +42,11 @@ public class BytedanceMaterialsLoadJob implements Job {
                     try {
                         //1:获取当日广告组数据
                         advertiserDataService.getAdvertiserCampaign(token.getAccountId() + "", "", dateString);
-                        //1:获取当日广告计划数据
+                        //2:获取当日广告计划数据
                         advertiserDataService.getAdvertiserPlan(token, "", dateString, null);
-                        //1:获取全量创意数据
+                        //3:获取当日创意数据
                         creativeService.getAdvertiserCreative(token.getAccountId() + "", "", dateString);
-                        //2:获取全量素材数据
+                        //4:获取全量素材数据
                         advertiserDataService.getMaterialList(token);
                     } catch (Exception e) {
                         e.printStackTrace();

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

@@ -20,6 +20,9 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 
+/**
+ * 头条计划日报数据任务
+ */
 @Slf4j
 public class BytedancePlanDailyReportLoadJob implements Job {
     @Autowired
@@ -104,7 +107,7 @@ public class BytedancePlanDailyReportLoadJob implements Job {
                 String dateString = dateFormat.format(getDate)+" 00:00:00";
                 QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
                 queryWrapper.eq("advertiser_id", allocation.getAccountId())
-                .eq("stat_datetime",dateString);
+                        .eq("stat_datetime",dateString);
                 List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
                 if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
                     bytedancePlanDailyReports.forEach(report -> {

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

@@ -20,8 +20,11 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 
+/**
+ * 头条计划时报数据任务
+ */
 @Slf4j
-public class BytedancePlanLoadJob implements Job {
+public class BytedancePlanHourlyReportLoadJob implements Job {
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired
@@ -54,10 +57,10 @@ public class BytedancePlanLoadJob implements Job {
         //清洗关于附近约会数据
         formatData(222,finalGetDate);
 
-        log.info("头条全量计划数据获取完成");
+        log.info("头条计划时报数据获取完成");
     }
 
-    private void formatData(Integer projectId,Date finalGetDate){
+    private void formatData(Integer projectId, Date finalGetDate){
         QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("project_id", projectId);
         List<UserAllocation> fjyhAllocations = userAllocationService.list(queryWrapper);

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

@@ -15,8 +15,11 @@ import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
+/**
+ * 头条当日计划素材获取任务
+ */
 @Slf4j
-public class BytedanceNowDatePlanLoadJob implements Job {
+public class BytedancePlanRealTimeLoadJob implements Job {
     @Autowired
     private ICtopOauthTokenService tokenService;
     static ExecutorService executorService = null;

+ 4 - 4
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -119,7 +119,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         }
         JSONArray data = resultObject.getJSONObject("data").getJSONArray("list");
         if (null == data || data.size() <= 0) {
-            log.error("获取广告计划信息不存在==》accountId:{},message:{}", token.getAccountId(), resultObject.getString("message"));
+//            log.info("获取广告计划信息完成==》accountId:{},message:{}", token.getAccountId(), resultObject.getString("message"));
             return;
         }
         for (int i = 0; i < data.size(); i++) {
@@ -171,7 +171,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         Integer code = jsonObject.getInteger("code");
 
         if (null == code || !code.equals(0)) {
-            log.info("获取广告预算信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            log.error("获取广告预算信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
             resultMap.put("code", -1);
             resultMap.put("message", "获取广告预算信息接口异常");
             return resultMap;
@@ -213,14 +213,14 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         Integer code = jsonObject.getInteger("code");
 
         if (null == code || !code.equals(0)) {
-            log.info("获取广告主创意素材信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            log.error("获取广告主创意素材信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
             resultMap.put("code", -1);
             resultMap.put("message", "获取广告主创意素材信息接口异常");
             return resultMap;
         }
         JSONArray data = jsonObject.getJSONArray("data");
         if (null == data || data.size() <= 0) {
-            log.info("广告主创意素材信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+//            log.info("广告主创意素材信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
             resultMap.put("code", 0);
             resultMap.put("message", "获取广告主预算信息完成");
             return resultMap;