瀏覽代碼

修改定时任务线程池初始化方法

syh 5 年之前
父節點
當前提交
baab505de3
共有 60 個文件被更改,包括 204 次插入320 次删除
  1. 26 93
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountBidJob.java
  3. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountCpaBidJob.java
  4. 0 45
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BakDataBaseJob.java
  5. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceCleanMaterialJob.java
  6. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceHourlyAccountWarningLoadJob.java
  7. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceRefreshTokenJob.java
  8. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserDailyReportLoadJob.java
  9. 2 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserDataLoadJob.java
  10. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserHourlyReportLoadJob.java
  11. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceCreativeDailyReportLoadJob.java
  12. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceCreativeHourlyReportLoadJob.java
  13. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanDailyReportLoadJob.java
  14. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanHourlyReportLoadJob.java
  15. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanLoadJob.java
  16. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanRealTimeLoadJob.java
  17. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceSameDayCreativeLoadJob.java
  18. 0 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/DailyFlowsJob.java
  19. 7 29
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ToutiaoMaterialsLoadJob.java
  20. 4 0
      jeecg-boot-module-system/src/main/resources/quartz.properties
  21. 5 14
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  22. 1 2
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCleanMaterialJob.java
  23. 4 6
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceHourlyAccountWarningLoadJob.java
  24. 1 3
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAdvertiserDailyReportLoadJob.java
  25. 2 3
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAdvertiserHourlyReportLoadJob.java
  26. 2 3
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAdvertisingDataLoadJob.java
  27. 1 2
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCampaignDailyReportLoadJob.java
  28. 1 2
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCampaignHourlyReportLoadJob.java
  29. 3 4
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCreativeDailyReportLoadJob.java
  30. 4 5
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCreativeHourlyReportLoadJob.java
  31. 4 11
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceFlowFundJob.java
  32. 9 8
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanDailyReportLoadJob.java
  33. 3 5
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanHourlyReportLoadJob.java
  34. 2 4
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanLoadJob.java
  35. 2 3
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanRealTimeLoadJob.java
  36. 1 2
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceSameDayCreativeLoadJob.java
  37. 1 2
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceVideoInfoLoadJob.java
  38. 2 7
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouCleanMaterialJob.java
  39. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCampaignJob.java
  40. 4 9
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadJob.java
  41. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyCampaignReportLoadJob.java
  42. 3 5
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyCreativeReportLoadJob.java
  43. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyGroupReportLoadJob.java
  44. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyLoadFileJob.java
  45. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupJob.java
  46. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyAccountReportLoadJob.java
  47. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyAccountWarningLoadJob.java
  48. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyCampaignReportLoadJob.java
  49. 2 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyCreativeReportLoadJob.java
  50. 2 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyGroupReportLoadJob.java
  51. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMaterialsLoadJob.java
  52. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateCampaignJob.java
  53. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateCreativeJob.java
  54. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateGroupJob.java
  55. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouSuZaoLoadJob.java
  56. 57 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/WatermarkVideoJob.java
  57. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceCampaign.java
  58. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceAdvertiserDataService.java
  59. 10 10
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  60. 3 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

+ 26 - 93
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -35,9 +35,7 @@ public class DateUtils extends PropertyEditorSupport {
     public static Date getNowDate() throws ParseException {
         SimpleDateFormat dsdf = new SimpleDateFormat("yyyy-MM-dd");
         String nowDate = getNowDate("yyyy-MM-dd");
-        Date parse = dsdf.parse(nowDate);
-        return parse;
-
+        return dsdf.parse(nowDate);
     }
 
 
@@ -47,28 +45,14 @@ public class DateUtils extends PropertyEditorSupport {
         //将字符串形式的时间转化为Date类型的时间
         Date a = sdf.parse(beginDate);
         Date b = sdf.parse(nowDate);
-        //Date类的一个方法,如果a早于b返回true,否则返回false
-        if (a.before(b)) {
-            return true;
-        } else {
-            return false;
-        }
-
-		/*
-		 * 如果你不喜欢用上面这个太流氓的方法,也可以根据将Date转换成毫秒
-		if(a.getTime()-b.getTime()<0)
-			return true;
-		else
-			return false;
-		*/
+        return a.before(b);
     }
 
 
     public static String getDateByDateStr(String dateStr) throws ParseException {
         SimpleDateFormat dsdf = new SimpleDateFormat("yyyy-MM-dd");
         Date parse = dsdf.parse(dateStr);
-        String day = dsdf.format(parse);
-        return day;
+        return dsdf.format(parse);
     }
 
     public static Integer getHour(String dateStr) throws ParseException {
@@ -76,10 +60,7 @@ public class DateUtils extends PropertyEditorSupport {
         Calendar cal = Calendar.getInstance();
         Date date = sdf.parse(dateStr);
         cal.setTime(date);
-        Integer hour = cal.get(Calendar.HOUR_OF_DAY);
-        return hour;
-
-
+        return cal.get(Calendar.HOUR_OF_DAY);
     }
 
     /**
@@ -113,20 +94,6 @@ public class DateUtils extends PropertyEditorSupport {
         return cal;
     }
 
-    // ////////////////////////////////////////////////////////////////////////////
-    // getDate
-    // 各种方式获取的Date
-    // ////////////////////////////////////////////////////////////////////////////
-
-    /**
-     * 当前日期
-     *
-     * @return 系统当前时间
-     */
-    public static Date getDate() {
-        return new Date();
-    }
-
     /**
      * 字符串转换成日期
      *
@@ -147,17 +114,6 @@ public class DateUtils extends PropertyEditorSupport {
         }
         return null;
     }
-
-    /**
-     * 日期转换为字符串
-     *
-     * @return 字符串
-     */
-    public static String date2Str() {
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
-        return format.format(new Date());
-    }
-
     /**
      * 格式化时间
      *
@@ -251,8 +207,7 @@ public class DateUtils extends PropertyEditorSupport {
         Date dt = new Date();
         DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String nowTime = df.format(dt);
-        Timestamp buydate = Timestamp.valueOf(nowTime);
-        return buydate;
+        return Timestamp.valueOf(nowTime);
     }
 
     // ////////////////////////////////////////////////////////////////////////////
@@ -516,10 +471,9 @@ public class DateUtils extends PropertyEditorSupport {
      * @param src     将要转换的原始字符窜
      * @param pattern 转换的匹配格式
      * @return 如果转换成功则返回转换后的日期
-     * @throws ParseException
      * @throws
      */
-    public static Calendar parseCalendar(String src, String pattern) throws ParseException {
+    public static Calendar parseCalendar(String src, String pattern){
 
         Date date = parseDate(src, pattern);
         Calendar cal = Calendar.getInstance();
@@ -527,7 +481,7 @@ public class DateUtils extends PropertyEditorSupport {
         return cal;
     }
 
-    public static String formatAddDate(String src, String pattern, int amount) throws ParseException {
+    public static String formatAddDate(String src, String pattern, int amount) {
         Calendar cal;
         cal = parseCalendar(src, pattern);
         cal.add(Calendar.DATE, amount);
@@ -543,7 +497,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @throws ParseException
      * @throws
      */
-    public static Timestamp parseTimestamp(String src, String pattern) throws ParseException {
+    public static Timestamp parseTimestamp(String src, String pattern) {
         Date date = parseDate(src, pattern);
         return new Timestamp(date.getTime());
     }
@@ -593,13 +547,10 @@ public class DateUtils extends PropertyEditorSupport {
         SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
         Date date = sdf1.parse(createTime);
         SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        String str = sdf2.format(date);
-
-        return str;
+        return sdf2.format(date);
     }
 
     public static Map<String, Object> getStartEndTime(String createTime) throws ParseException {
-
         SimpleDateFormat smf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Date parse = smf.parse(createTime);
         Calendar calendar = Calendar.getInstance();
@@ -646,7 +597,7 @@ public class DateUtils extends PropertyEditorSupport {
      * HH:mm:ss“ * @param text String类型的时间值
      */
     @Override
-    public void setAsText(String text) throws IllegalArgumentException {
+    public void setAsText(String text) {
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
         SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         if (StringUtils.hasText(text)) {
@@ -692,13 +643,13 @@ public class DateUtils extends PropertyEditorSupport {
         String splitDate = DateUtils.addDay(endDate, -1);
         splitDate = DateUtils.addDay(splitDate, 1);
         if (DateUtils.compareDate(startDate, splitDate) >= 0) {
-            Map<String, String> map = new HashMap<String, String>();
+            Map<String, String> map = new HashMap<>();
             map.put("startDate", startDate);
             map.put("endDate", endDate);
             list.add(map);
         } else {
             while (DateUtils.compareDate(startDate, splitDate) < 0 || DateUtils.compareDate(startDate, endDate) <= 0) {
-                Map<String, String> map = new HashMap<String, String>();
+                Map<String, String> map = new HashMap<>();
                 map.put("startDate", splitDate);
                 map.put("endDate", endDate);
                 list.add(map);
@@ -713,17 +664,17 @@ public class DateUtils extends PropertyEditorSupport {
     }
 
     public static List<Map<String, String>> getDateWeekRange(String startDate, String endDate) throws ParseException {
-        List<Map<String, String>> list = new ArrayList<Map<String, String>>();
+        List<Map<String, String>> list = new ArrayList<>();
         String splitDate = DateUtils.addWeek(endDate, -1);
         splitDate = DateUtils.addDay(splitDate, 1);
         if (DateUtils.compareDate(startDate, splitDate) >= 0) {
-            Map<String, String> map = new HashMap<String, String>();
+            Map<String, String> map = new HashMap<>();
             map.put("startDate", startDate);
             map.put("endDate", endDate);
             list.add(map);
         } else {
             while (DateUtils.compareDate(startDate, splitDate) < 0 || DateUtils.compareDate(startDate, endDate) <= 0) {
-                Map<String, String> map = new HashMap<String, String>();
+                Map<String, String> map = new HashMap<>();
                 map.put("startDate", splitDate);
                 map.put("endDate", endDate);
                 list.add(map);
@@ -738,17 +689,17 @@ public class DateUtils extends PropertyEditorSupport {
     }
 
     public static List<Map<String, String>> getDateMonthRange(String startDate, String endDate) throws ParseException {
-        List<Map<String, String>> list = new ArrayList<Map<String, String>>();
+        List<Map<String, String>> list = new ArrayList<>();
         String splitDate = DateUtils.addMonth(endDate, -1);
         splitDate = DateUtils.addDay(splitDate, 1);
         if (DateUtils.compareDate(startDate, splitDate) >= 0) {
-            Map<String, String> map = new HashMap<String, String>();
+            Map<String, String> map = new HashMap<>();
             map.put("startDate", startDate);
             map.put("endDate", endDate);
             list.add(map);
         } else {
             while (DateUtils.compareDate(startDate, splitDate) < 0 || DateUtils.compareDate(startDate, endDate) <= 0) {
-                Map<String, String> map = new HashMap<String, String>();
+                Map<String, String> map = new HashMap<>();
                 map.put("startDate", splitDate);
                 map.put("endDate", endDate);
                 list.add(map);
@@ -844,11 +795,10 @@ public class DateUtils extends PropertyEditorSupport {
 
     public static Map<String, Object> getBeforeDate() {
         Date dNow = new Date();
-        Date dBefore = new Date();
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(dNow);
         calendar.add(Calendar.DAY_OF_MONTH, -1);
-        dBefore = calendar.getTime();
+        Date dBefore = calendar.getTime();
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         String defaultStartDate = sdf.format(dBefore);
         defaultStartDate = defaultStartDate + " 00:00:00";
@@ -865,7 +815,6 @@ public class DateUtils extends PropertyEditorSupport {
      * @param date   传入的初始日期
      * @param num    天数
      * @return
-     * @throws ParseException
      */
     public static String getAnotherDay(String format, String date, Integer num) {
 
@@ -914,8 +863,6 @@ public class DateUtils extends PropertyEditorSupport {
     }
 
     public static Map<String, Object> compareDate(String format, String date1, String date2) {
-
-
         DateFormat df = new SimpleDateFormat(format);
         Map<String, Object> map = new HashMap<>();
         try {
@@ -945,11 +892,9 @@ public class DateUtils extends PropertyEditorSupport {
      * @throws ParseException
      */
     public static String getYear(String format, String date) throws ParseException {
-
         SimpleDateFormat df = new SimpleDateFormat(format);
         Date parse = df.parse(date);
         return String.format("%tY", parse);
-
     }
 
     /**
@@ -975,7 +920,6 @@ public class DateUtils extends PropertyEditorSupport {
      * @throws ParseException
      */
     public static String getDay(String format, String date) throws ParseException {
-
         SimpleDateFormat df = new SimpleDateFormat(format);
         Date parse = df.parse(date);
         return String.format("%td", parse);
@@ -1016,7 +960,6 @@ public class DateUtils extends PropertyEditorSupport {
         calendar.setTime(date);
         calendar.setFirstDayOfWeek(Calendar.FRIDAY);
         calendar.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
-        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
         return calendar.getTime();
     }
 
@@ -1026,13 +969,12 @@ public class DateUtils extends PropertyEditorSupport {
      */
     public static Map<String, Integer> getYearQuarter(Date date) {
         Map<String, Integer> dateMap = new HashMap<>();
-
         Calendar calendar = new GregorianCalendar();
         calendar.setTime(date);
         int originYear = calendar.get(Calendar.YEAR);
         int originMonth = calendar.get(Calendar.MONTH);
-        int originQuarter = DateUtils.getQuarter(date); //本月所在季度(按照日期来的)
-
+        //本月所在季度(按照日期来的)
+        int originQuarter = DateUtils.getQuarter(date);
         Calendar calendar1 = new GregorianCalendar();
         calendar1.setTime(date);
         calendar1.setFirstDayOfWeek(Calendar.FRIDAY);
@@ -1054,7 +996,8 @@ public class DateUtils extends PropertyEditorSupport {
         //如果本周第一天(周五)和当前天不在一个月内,说明周跨月了
         if (fridayMonth == originMonth && thursdayMonth == originMonth) {
             dateMap.put("year", originYear);
-            dateMap.put("month", originMonth + 1);  //最后一个月是11,应该+1
+            //最后一个月是11,应该+1
+            dateMap.put("month", originMonth + 1);
             dateMap.put("quarter", originQuarter);
             return dateMap;
         } else if (fridayYear < originYear || (fridayYear == originYear && fridayMonth < originMonth)) {
@@ -1248,14 +1191,10 @@ public class DateUtils extends PropertyEditorSupport {
         startCalendar.setTime(start);
         GregorianCalendar endCalendar = new GregorianCalendar();
         endCalendar.setTime(end);
-
         int startYear = startCalendar.get(Calendar.YEAR);
         int startMonth = startCalendar.get(Calendar.MONTH) + 1;
-        int startDay = startCalendar.get(Calendar.DAY_OF_MONTH);
         int endYear = endCalendar.get(Calendar.YEAR);
         int endMonth = endCalendar.get(Calendar.MONTH) + 1;
-        int endDay = endCalendar.get(Calendar.DAY_OF_MONTH);
-
         return (endYear - startYear) * 12 + (endMonth - startMonth);
     }
 
@@ -1317,12 +1256,6 @@ public class DateUtils extends PropertyEditorSupport {
         return (int) betweenDate;
     }
 
-    public static Date addMonth(Date date) {
-        Calendar calendar = Calendar.getInstance();//日历对象
-        calendar.add(Calendar.MONTH, -1);//月份减一
-        return calendar.getTime();
-    }
-
     /**
      * 判断两个日期间隔是否大于半年
      *
@@ -1334,13 +1267,13 @@ public class DateUtils extends PropertyEditorSupport {
         long time1 = c.getTimeInMillis();
         c.setTime(Objects.requireNonNull(parseDate(endDate, SystemDateConstant.yyyy_MM_dd)));
         long time2 = c.getTimeInMillis();
-        long between_days = (time2 - time1) / (1000 * 3600 * 24);
-        int day = Integer.parseInt(String.valueOf(between_days));
+        long betweenDays = (time2 - time1) / (1000 * 3600 * 24);
+        int day = Integer.parseInt(String.valueOf(betweenDays));
         return day > 180;
     }
 
     public static List<Date> findDates(Date dBegin, Date dEnd) {
-        List<Date> lDate = new ArrayList<Date>();
+        List<Date> lDate = new ArrayList<>();
         lDate.add(dBegin);
         Calendar calBegin = Calendar.getInstance();
         // 使用给定的 Date 设置此 Calendar 的时间

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

@@ -7,6 +7,7 @@ import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
 /**
+ * DONE
  * 出价预警
  */
 public class AccountBidJob implements Job {

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

@@ -17,6 +17,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 /**
+ * DONE
  * 深度转化出价预警
  */
 public class AccountCpaBidJob implements Job {

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

@@ -1,45 +0,0 @@
-package org.jeecg.modules.ctop.job;
-
-import cn.com.ctop.common.module.utils.LoadFileUtil;
-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.Value;
-
-import java.util.Date;
-
-@Slf4j
-public class BakDataBaseJob implements Job {
-    @Value("${spring.datasource.username}")
-    private String userName;
-    @Value("${spring.datasource.password}")
-    private String password;
-    @Value("${jeecg.path.bak-database-file}")
-    private String filePath;
-
-    @Override
-    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        String currentFileName = filePath + "db-" + DateUtils.formatDate(new Date()) + ".sql";
-        String historyFileName = filePath + "db-" + DateUtils.formatDate(DateUtils.addDay(new Date(), -4)) + ".sql";
-        String command = "mysqldump jeecg-boot -h 127.0.0.1 -u" + userName + " -p" + password + " --default-character-set=utf8mb4 --result-file=" + currentFileName;
-        //1:删除历史数据
-        LoadFileUtil.delFile(historyFileName);
-        //2:导出当天数据
-        Runtime runtime = Runtime.getRuntime();
-        Process pro = null;
-        try {
-            pro = runtime.exec(command);
-            int status = pro.waitFor();
-            if (status == 0) {
-                log.info("数据备份shell脚本执行成功");
-            } else {
-                log.info("数据备份shell脚本执行失败");
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-    }
-}

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

@@ -3,7 +3,6 @@ package org.jeecg.modules.ctop.job;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
 import lombok.extern.slf4j.Slf4j;
-import org.jeecg.modules.ctop.service.ICleanMaterialService;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +12,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 /**
+ * DONE
  * 清洗素材报表
  */
 @Slf4j

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

@@ -18,6 +18,7 @@ import java.util.concurrent.Executors;
 import static org.jeecg.common.util.DateUtils.getAnotherDay;
 
 /**
+ * DONE
  * 头条预警
  *
  * @author yumeng

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

@@ -6,6 +6,9 @@ import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
+/**
+ * DONE
+ */
 public class ByteDanceRefreshTokenJob implements Job {
     @Autowired
     private IRefreshTokenService refreshTokenService;

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

@@ -17,6 +17,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 /**
+ * DONE
  * @author syh
  * 头条广告主日报数据获取任务
  * 第二天凌晨跑前一天的数据

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

@@ -24,7 +24,7 @@ import java.util.concurrent.Executors;
 public class BytedanceAdvertiserDataLoadJob implements Job {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
     @Autowired
@@ -37,10 +37,9 @@ public class BytedanceAdvertiserDataLoadJob implements Job {
         String dateString = dateFormat.format(getDate);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        executorService = Executors.newFixedThreadPool(5);
         tokens.forEach(token -> executorService.submit(() -> {
             //1:获取当日广告组数据
-            advertiserDataService.getAdvertiserCampaign(token.getAccountId() + "", "", dateString);
+            advertiserDataService.getAdvertiserCampaign(token, null, dateString);
             //2:获取当日广告计划数据
             advertiserDataService.getAdvertiserPlan(token, "", dateString, null);
             //3:获取当日创意数据

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

@@ -18,6 +18,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 /**
+ * DONE
  * @author syh
  * 头条广告主时报获取任务
  */

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

@@ -17,6 +17,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 /**
+ * DONE
  * @author syh
  * 头条创意日报数据获取任务
  * 第二天凌晨跑前一天的数据

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

@@ -18,6 +18,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 /**
+ * DONE
  * @author syh
  * 头条创意时报获取任务
  */

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

@@ -21,6 +21,7 @@ import java.util.Date;
 import java.util.List;
 
 /**
+ * DONE
  * 头条计划日报数据任务
  * @author 宋英豪
  */

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

@@ -20,6 +20,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 /**
+ * done
  * 头条计划时报数据任务
  */
 @Slf4j

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

@@ -15,6 +15,9 @@ import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
+/**
+ * DONE
+ */
 @Slf4j
 public class BytedancePlanLoadJob implements Job {
     @Autowired

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

@@ -16,6 +16,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 /**
+ * DONE
  * 头条当日计划素材获取任务
  */
 @Slf4j
@@ -36,7 +37,7 @@ public class BytedancePlanRealTimeLoadJob implements Job {
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
                 executorService = Executors.newFixedThreadPool(4);
-                String nowDate = DateUtils.date2Str();
+                String nowDate = DateUtils.formatDate();
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {
                         @Override

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

@@ -17,6 +17,9 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
+/**
+ * DONE
+ */
 @Slf4j
 public class BytedanceSameDayCreativeLoadJob implements Job {
     @Autowired

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

@@ -16,8 +16,6 @@ public class DailyFlowsJob implements Job {
     private IKuaishouInterfaceService kuaishouInterfaceService;
     @Autowired
     private ICtopOauthTokenService oauthTokenService;
-
-
     /**
      * 刷新token
      *

+ 7 - 29
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ToutiaoMaterialsLoadJob.java

@@ -23,37 +23,15 @@ public class ToutiaoMaterialsLoadJob implements Job {
     @Autowired
     private IBytedanceReportService bytedanceReportService;
 
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(8);
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                //增加接口的开始和结束日期
-                String startDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -1));
-                String endDate = startDate;
-                //获取头条token数据
-                List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-                executorService = Executors.newFixedThreadPool(8);
-                tokens.forEach(token -> {
-                    executorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            try {
-                                //获取头条素材报表数据
-                                bytedanceReportService.bytedanceMaterialReport(token,startDate,endDate);
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            } finally {
-                            }
-                        }
-                    });
-                });
-                log.info("头条素材数据同步完成,"+ "开始时间:" + startDate + ",结束时间:" + endDate);
-            }
-        };
-        thread.start();
-
+        //增加接口的开始和结束日期
+        String startDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -1));
+        //获取头条token数据
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        tokens.forEach(token -> executorService.submit(()-> bytedanceReportService.bytedanceMaterialReport(token,startDate,startDate)));
+        log.info("头条素材数据同步完成,"+ "开始时间:" + startDate + ",结束时间:" + startDate);
     }
 }

+ 4 - 0
jeecg-boot-module-system/src/main/resources/quartz.properties

@@ -6,3 +6,7 @@ org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
 org.quartz.jobStore.misfireThreshold=600000
 org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore
 
+##打开集群模式
+#org.quartz.jobStore.isClustered = true
+##调度实例失效的检查时间间隔
+#org.quartz.jobStore.clusterCheckinInterval = 20000

+ 5 - 14
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -23,7 +23,6 @@ import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.math.BigDecimal;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -42,19 +41,11 @@ public class SampleTest {
     private IReportService reportService;
     @Test
     public void testOceanEngineJob() {
-        CtopOauthToken token1 = oauthTokenService.getTokenByAccountId(1670725854459911L);
-        CtopOauthToken token2 = oauthTokenService.getTokenByAccountId(1670827164313607L);
-        CtopOauthToken token3 = oauthTokenService.getTokenByAccountId(1670801593147405L);
-        CtopOauthToken token4 = oauthTokenService.getTokenByAccountId(1670827163327501L);
-        CtopOauthToken token5 = oauthTokenService.getTokenByAccountId(1670827163853832L);
-        for(int i=0;i<100;i++){
-            Date startDate = DateUtils.addDay(new Date(),-i);
-            reportService.getAdvertiserReport(token1,startDate,startDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            reportService.getAdvertiserReport(token2,startDate,startDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            reportService.getAdvertiserReport(token3,startDate,startDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            reportService.getAdvertiserReport(token4,startDate,startDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            reportService.getAdvertiserReport(token5,startDate,startDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-        }
+        List<CtopOauthToken>tokens = oauthTokenService.selectToutiaoToken();
+        String date = DateUtils.addDay("2020-07-10",-2);
+        tokens.forEach(token -> {
+            advertiserDataService.getAdvertiserCampaign(token,null,date);
+        });
     }
 
     @Autowired

+ 1 - 2
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCleanMaterialJob.java

@@ -21,7 +21,7 @@ import java.util.concurrent.Executors;
 public class ByteDanceCleanMaterialJob {
     @Autowired
     private IByteDanceCleanMaterialReportService cleanMaterialService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(3);
 
     @XxlJob("byteDanceCleanMaterial")
     public ReturnT<String> execute(String param) throws Exception {
@@ -30,7 +30,6 @@ public class ByteDanceCleanMaterialJob {
             XxlJobLogger.log("头条素材数据获取为空");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(3);
         signatureList.forEach(signature -> executorService.submit(() -> cleanMaterialService.calculationMaterialReport(signature)));
         return ReturnT.SUCCESS;
     }

+ 4 - 6
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceHourlyAccountWarningLoadJob.java

@@ -2,7 +2,6 @@ package cn.com.ctop.job.bytedance.handler;
 
 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.toutiao.modules.report.service.IByteDanceHourlyAccountWarningService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
@@ -26,19 +25,18 @@ public class ByteDanceHourlyAccountWarningLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IByteDanceHourlyAccountWarningService byteDanceHourlyAccountWarningService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(3);
 
     @XxlJob("byteDanceHourlyAccountWarning")
     public ReturnT<String> execute(String param) throws Exception {
         XxlJobLogger.log("开始时段消耗预警定时任务");
         long startTime = System.currentTimeMillis();
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if (null == tokens || tokens.isEmpty()) {
             XxlJobLogger.log("定时获取头条数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(3);
-        String statDate = DateUtils.getDate("yyyy-MM-dd");
+        String statDate = DateUtils.formatDate();
         String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", statDate, 1);
         tokens.forEach(token -> executorService.submit(() -> byteDanceHourlyAccountWarningService.byteDanceAccountWarning(token.getAccountId(), statDate, anotherDay)));
         XxlJobLogger.log("时段消耗预警定时任务执行完毕,耗时:{} ms", System.currentTimeMillis() - startTime);

+ 1 - 3
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAdvertiserDailyReportLoadJob.java

@@ -28,8 +28,7 @@ public class BytedanceAdvertiserDailyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    static ExecutorService executorService = null;
-
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);;
 
     @XxlJob("bytedanceAdvertiserDailyReport")
     public ReturnT<String> execute(String params) throws Exception {
@@ -41,7 +40,6 @@ public class BytedanceAdvertiserDailyReportLoadJob {
             XxlJobLogger.log("定时获取头条数据异常:为获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(5);
         CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
         tokens.forEach(token -> {
             executorService.submit(() -> {

+ 2 - 3
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAdvertiserHourlyReportLoadJob.java

@@ -27,7 +27,7 @@ public class BytedanceAdvertiserHourlyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(4);;
 
     @XxlJob("bytedanceAdvertiserHourlyReport")
     public ReturnT<String> execute(String param) throws Exception {
@@ -37,11 +37,10 @@ public class BytedanceAdvertiserHourlyReportLoadJob {
         String hour = simpleDateFormat.format(getDate);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
+        if (null == tokens || tokens.isEmpty()) {
             XxlJobLogger.log("定时获取头条小时数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(4);
         tokens.forEach(token -> {
             executorService.submit(() -> {
                 if (null != hour && "00".equals(hour)) {

+ 2 - 3
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAdvertisingDataLoadJob.java

@@ -25,7 +25,7 @@ import java.util.concurrent.Executors;
 public class BytedanceAdvertisingDataLoadJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
     @Autowired
@@ -38,12 +38,11 @@ public class BytedanceAdvertisingDataLoadJob {
         String dateString = dateFormat.format(getDate);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        executorService = Executors.newFixedThreadPool(5);
         tokens.forEach(token -> {
             executorService.submit(() -> {
                 try {
                     //1:获取当日广告组数据
-                    advertiserDataService.getAdvertiserCampaign(token.getAccountId() + "", "", dateString);
+                    advertiserDataService.getAdvertiserCampaign(token, null, dateString);
                     //2:获取当日广告计划数据
                     advertiserDataService.getAdvertiserPlan(token, "", dateString, null);
                     //3:获取当日创意数据

+ 1 - 2
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCampaignDailyReportLoadJob.java

@@ -22,7 +22,7 @@ public class BytedanceCampaignDailyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
 
     @XxlJob("bytedanceCampaignDailyReport")
@@ -35,7 +35,6 @@ public class BytedanceCampaignDailyReportLoadJob {
             XxlJobLogger.log("定时获取头条数据异常:为获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(5);
         CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
         tokens.forEach(token -> {
             executorService.submit(() -> {

+ 1 - 2
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCampaignHourlyReportLoadJob.java

@@ -23,7 +23,7 @@ public class BytedanceCampaignHourlyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(4);
 
     @XxlJob("bytedanceCampaignHourlyReport")
     public ReturnT<String> execute(String param) throws Exception {
@@ -37,7 +37,6 @@ public class BytedanceCampaignHourlyReportLoadJob {
             XxlJobLogger.log("定时获取头条小时数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(4);
         tokens.forEach(token -> {
             executorService.submit(() -> {
                 if (null != hour && "00".equals(hour)) {

+ 3 - 4
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCreativeDailyReportLoadJob.java

@@ -27,19 +27,18 @@ public class BytedanceCreativeDailyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
 
     @XxlJob("bytedanceCreativeDailyReport")
     public ReturnT<String> execute(String param) throws Exception {
         Date getDate = DateUtils.addDay(new Date(), -1);
         //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if (null == tokens || tokens.isEmpty()) {
             XxlJobLogger.log("定时获取头条数据异常:为获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(5);
         tokens.forEach(token -> executorService.submit(() -> reportService.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY)));
         return ReturnT.SUCCESS;
     }

+ 4 - 5
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCreativeHourlyReportLoadJob.java

@@ -27,7 +27,7 @@ public class BytedanceCreativeHourlyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(4);
 
     @XxlJob("bytedanceCreativeHourlyReport")
     public ReturnT<String> execute(String param) throws Exception {
@@ -36,15 +36,14 @@ public class BytedanceCreativeHourlyReportLoadJob {
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
         String hour = simpleDateFormat.format(getDate);
         //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if (null == tokens || tokens.isEmpty()) {
             XxlJobLogger.log("定时获取头条小时数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(4);
         tokens.forEach(token -> {
             executorService.submit(() -> {
-                if (null != hour && "00".equals(hour)) {
+                if ("00".equals(hour)) {
                     Date finalGetDate = DateUtils.addDay(getDate, -1);
                     //获取广告创意信息数据
                     reportService.getAdvertiserCreativeReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);

+ 4 - 11
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceFlowFundJob.java

@@ -2,7 +2,6 @@ package cn.com.ctop.job.bytedance.handler;
 
 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.toutiao.modules.report.service.IBytedanceFundDailyService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
@@ -22,23 +21,17 @@ public class BytedanceFlowFundJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IBytedanceFundDailyService bytedanceFundDailyService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(4);
     @XxlJob("bytedanceFlowFund")
     public ReturnT<String> execute(String param) throws Exception {
         XxlJobLogger.log("头条账户流水数据获取开始");
         Date getDate = new Date();
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if (null == tokens || tokens.isEmpty()) {
             XxlJobLogger.log("头条账户流水数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(4);
-        tokens.forEach(token -> {
-            executorService.submit(() -> {
-                bytedanceFundDailyService.loadFundDataByPage(token, DateUtils.formatDate(getDate), DateUtils.formatDate(getDate),1);
-            });
-        });
+        tokens.forEach(token -> executorService.submit(() -> bytedanceFundDailyService.loadFundDataByPage(token, DateUtils.formatDate(getDate), DateUtils.formatDate(getDate),1)));
         XxlJobLogger.log("头条账户流水数据获取结束");
         return ReturnT.SUCCESS;
     }

+ 9 - 8
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanDailyReportLoadJob.java

@@ -31,14 +31,18 @@ public class BytedancePlanDailyReportLoadJob {
     private IReportService reportService;
     @Autowired
     private IUserAllocationService userAllocationService;
+    @Autowired
+    private IBytedancePlanDailyReportService planDailyReportService;
+
 
     @XxlJob("bytedancePlanDailyReport")
     public ReturnT<String> execute(String param) throws Exception {
         Date getDate = DateUtils.addDay(new Date(), -1);
-        Date getDate2 = DateUtils.addDay(new Date(), -2);//次留用
+        //次留用
+        Date getDate2 = DateUtils.addDay(new Date(), -2);
         //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if (null == tokens || tokens.isEmpty()) {
             XxlJobLogger.log("定时获取头条数据异常:为获取到可用的token");
             return ReturnT.FAIL;
         }
@@ -62,7 +66,7 @@ public class BytedancePlanDailyReportLoadJob {
         QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
         wrapper.eq("project_id", projectId);
         List<UserAllocation> allocations = userAllocationService.list(wrapper);
-        if (null != allocations && allocations.size() > 0) {
+        if (null != allocations && !allocations.isEmpty()) {
             allocations.forEach(allocation -> {
                 //根据accountId和时间,查询相关的日报表信息
                 QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
@@ -72,7 +76,7 @@ public class BytedancePlanDailyReportLoadJob {
                         .eq("stat_datetime", dateString)
                 ;
                 List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
+                if (null != bytedancePlanDailyReports && !bytedancePlanDailyReports.isEmpty()) {
                     bytedancePlanDailyReports.forEach(report -> {
                         String adName = report.getAdName();
                         String[] tags = adName.split("-");
@@ -103,7 +107,4 @@ public class BytedancePlanDailyReportLoadJob {
             });
         }
     }
-
-    @Autowired
-    private IBytedancePlanDailyReportService planDailyReportService;
 }

+ 3 - 5
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanHourlyReportLoadJob.java

@@ -31,7 +31,7 @@ public class BytedancePlanHourlyReportLoadJob {
     private IReportService reportService;
     @Autowired
     private IBytedancePlanDailyReportService planDailyReportService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
     //线程计数器
     static CountDownLatch countDownLatch = null;
 
@@ -43,8 +43,7 @@ public class BytedancePlanHourlyReportLoadJob {
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
         String hour = simpleDateFormat.format(getDate);
         //1:查询当日计划时报数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        executorService = Executors.newFixedThreadPool(5);
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
         countDownLatch = new CountDownLatch(tokens.size());
         tokens.forEach(token -> executorService.submit(() -> {
                 try {
@@ -66,7 +65,7 @@ public class BytedancePlanHourlyReportLoadJob {
             XxlJobLogger.log(e.getMessage());
         }
         //清洗缘多多数据渠道号
-        if (null != hour && "00".equals(hour)) {
+        if ("00".equals(hour)) {
             Date lastday = DateUtils.addDay(getDate, -1);
             planDailyReportService.cleanYddHourlyChannelCode(113, lastday);
             planDailyReportService.cleanYddHourlyChannelCode(419, lastday);
@@ -75,7 +74,6 @@ public class BytedancePlanHourlyReportLoadJob {
         planDailyReportService.cleanYddHourlyChannelCode(419, getDate);
 
         XxlJobLogger.log("头条时报数据获取结束");
-        executorService.shutdown();
         return ReturnT.SUCCESS;
     }
 }

+ 2 - 4
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanLoadJob.java

@@ -2,7 +2,6 @@ package cn.com.ctop.job.bytedance.handler;
 
 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.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
@@ -18,15 +17,14 @@ import java.util.concurrent.Executors;
 public class BytedancePlanLoadJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    static ExecutorService executorService = null;
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(4);
 
     @XxlJob("bytedancePlanLoadJob")
     public ReturnT<String> execute(String param) throws Exception {
         //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        executorService = Executors.newFixedThreadPool(4);
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
         tokens.forEach(token -> executorService.submit(() -> advertiserDataService.getAdvertiserPlan(token, "", null, null)));
         XxlJobLogger.log("头条全量计划数据获取完成");
         return ReturnT.SUCCESS;

+ 2 - 3
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanRealTimeLoadJob.java

@@ -23,7 +23,7 @@ import java.util.concurrent.Executors;
 public class BytedancePlanRealTimeLoadJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    private ExecutorService executorService = null;
+    private ExecutorService executorService = Executors.newFixedThreadPool(4);
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
 
@@ -31,8 +31,7 @@ public class BytedancePlanRealTimeLoadJob {
     public ReturnT<String> execute(String param) throws Exception {
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        executorService = Executors.newFixedThreadPool(4);
-        String nowDate = DateUtils.date2Str();
+        String nowDate = DateUtils.formatDate();
         tokens.forEach(token -> executorService.submit(() -> advertiserDataService.getAdvertiserPlan(token, "", nowDate, nowDate)));
         XxlJobLogger.log("头条全量计划数据获取完成");
         return ReturnT.SUCCESS;

+ 1 - 2
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceSameDayCreativeLoadJob.java

@@ -19,7 +19,7 @@ import java.util.concurrent.Executors;
 public class BytedanceSameDayCreativeLoadJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(6);
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
 
@@ -27,7 +27,6 @@ public class BytedanceSameDayCreativeLoadJob {
     public ReturnT<String> execute(String param) throws Exception {
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
         String getDateStr = DateUtils.formatDate(new Date());
-        executorService = Executors.newFixedThreadPool(6);
         tokens.forEach(token -> executorService.submit(() -> advertiserDataService.getAdvertiserCreative(token, getDateStr)));
         return ReturnT.SUCCESS;
     }

+ 1 - 2
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceVideoInfoLoadJob.java

@@ -17,14 +17,13 @@ import java.util.concurrent.Executors;
 public class BytedanceVideoInfoLoadJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(4);
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
 
     @XxlJob("bytedanceVideoInfo")
     public ReturnT<String> execute(String param) throws Exception {
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        executorService = Executors.newFixedThreadPool(4);
         tokens.forEach(token -> executorService.submit(() -> advertiserDataService.getMaterialList(token)));
         return ReturnT.SUCCESS;
     }

+ 2 - 7
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouCleanMaterialJob.java

@@ -16,8 +16,7 @@ import java.util.concurrent.Executors;
 public class KuaiShouCleanMaterialJob {
     @Autowired
     private IKuaiShouCleanMaterialReportService kuaiShouCleanMaterialReportService;
-
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("kuaiShouCleanMaterial")
     public ReturnT<String> execute(String param) {
@@ -26,11 +25,7 @@ public class KuaiShouCleanMaterialJob {
             XxlJobLogger.log("素材数据获取为空");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(5);
-        for (int i = 0; i < signatureList.size(); i++) {
-            String signature = signatureList.get(i);
-            executorService.submit(()-> kuaiShouCleanMaterialReportService.calculationReport(signature));
-        }
+        signatureList.forEach(signature-> executorService.submit(()-> kuaiShouCleanMaterialReportService.calculationReport(signature)));
         return ReturnT.SUCCESS;
     }
 }

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCampaignJob.java

@@ -20,12 +20,11 @@ public class KuaishouCampaignJob {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("kuaishouCampaignJob")
     public ReturnT<String> execute(String param) {
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        executorService = Executors.newFixedThreadPool(5);
         tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getCampaignList(token, null, null)));
         XxlJobLogger.log("快手物料数据同步完成");
         return ReturnT.SUCCESS;

+ 4 - 9
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadJob.java

@@ -26,7 +26,7 @@ public class KuaishouDailyAccountReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(3);
 
     @XxlJob("kuaishouDailyAccountReport")
     public ReturnT<String> execute(String param) throws Exception {
@@ -34,19 +34,14 @@ public class KuaishouDailyAccountReportLoadJob {
         Date getDate2 = DateUtils.addDay(new Date(), -2);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        if (null == tokens || tokens.size() <= 0) {
+        if (null == tokens || tokens.isEmpty()) {
             XxlJobLogger.log("定时获取快手数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-
-        executorService = Executors.newFixedThreadPool(3);
-        tokens.forEach(token ->
-                executorService.submit(() ->{
+        tokens.forEach(token -> executorService.submit(() ->{
                     kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate2);
                     kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
-                }
-                )
-        );
+        }));
         return ReturnT.SUCCESS;
     }
 }

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyCampaignReportLoadJob.java

@@ -26,7 +26,7 @@ public class KuaishouDailyCampaignReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(3);
 
     @XxlJob("kuaishouDailyCampaignReport")
     public ReturnT<String> execute(String param) throws Exception {
@@ -37,7 +37,6 @@ public class KuaishouDailyCampaignReportLoadJob {
             XxlJobLogger.log("定时获取快手数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(3);
         tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate)));
         return ReturnT.SUCCESS;
     }

+ 3 - 5
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyCreativeReportLoadJob.java

@@ -2,7 +2,6 @@ package cn.com.ctop.job.kuaishou.handler;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import com.alibaba.fastjson.JSONArray;
@@ -30,7 +29,7 @@ public class KuaishouDailyCreativeReportLoadJob {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(4);
 
     @Autowired
     private IKuaiShouCampaignService campaignService;
@@ -38,7 +37,6 @@ public class KuaishouDailyCreativeReportLoadJob {
     @XxlJob("kuaishouDailyCreativeReport")
     public ReturnT<String> execute(String param) throws Exception {
         Date getDate = DateUtils.addDay(new Date(), -1);
-        executorService = Executors.newFixedThreadPool(4);
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         if (null == tokens || tokens.size() <= 0) {
             XxlJobLogger.log("定时获取快手数据异常:未获取到可用的token");
@@ -48,12 +46,12 @@ public class KuaishouDailyCreativeReportLoadJob {
             XxlJobLogger.log("获取创意分天报表开始,accountId:{}", token.getAccountId());
             kuaishouInterfaceService.getCampaignList(token, null, null);
             try {
-                Thread.sleep(5 * 100);
+                Thread.sleep(5 * 100L);
             } catch (InterruptedException e) {
                 e.printStackTrace();
             }
             List<JSONArray> campaigns = campaignService.getJsonArrByAccount(token.getAccountId(), 50);
-            if (!Check.isNull(campaigns) && campaigns.size() > 0) {
+            if (null != campaigns && !campaigns.isEmpty()) {
                 campaigns.forEach(campaign -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, getDate, getDate, campaign)));
             }
         });

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyGroupReportLoadJob.java

@@ -26,7 +26,7 @@ public class KuaishouDailyGroupReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(3);
 
     @XxlJob("kuaishouDailyGroupReport")
     public ReturnT<String> execute(String param) throws Exception {
@@ -37,7 +37,6 @@ public class KuaishouDailyGroupReportLoadJob {
             XxlJobLogger.log("定时获取快手数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(3);
         tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getDate, getDate)));
         return ReturnT.SUCCESS;
     }

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyLoadFileJob.java

@@ -25,7 +25,7 @@ import static org.jeecg.common.util.DateUtils.getAnotherDay;
 public class KuaishouDailyLoadFileJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    private ExecutorService executorService = null;
+    private ExecutorService executorService = Executors.newFixedThreadPool(3);
     @Autowired
     private IKuaiShouDailyReportTaskService dailyReportTaskService;
 
@@ -39,7 +39,6 @@ public class KuaishouDailyLoadFileJob {
             XxlJobLogger.log("定时获取快手数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(3);
         tokens.forEach(token -> executorService.submit(() -> dailyReportTaskService.getTaskList(token.getAccountId(), token.getAccessToken(), statDate)));
         return ReturnT.SUCCESS;
     }

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupJob.java

@@ -20,12 +20,11 @@ public class KuaishouGroupJob {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(3);
 
     @XxlJob("kuaishouGroup")
     public ReturnT<String> execute(String param) throws Exception {
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        executorService = Executors.newFixedThreadPool(3);
         tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getGroupList(token, null, null)));
         XxlJobLogger.log("快手物料数据同步完成");
         return ReturnT.SUCCESS;

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyAccountReportLoadJob.java

@@ -27,7 +27,7 @@ public class KuaishouHourlyAccountReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("kuaishouHourlyAccountReport")
     public ReturnT<String> execute(String param) throws Exception {
@@ -43,7 +43,6 @@ public class KuaishouHourlyAccountReportLoadJob {
             XxlJobLogger.log("定时获取快手数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(5);
         Date finalGetDate = getDate;
         tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserReportHourly(token, finalGetDate, finalGetDate)));
         return ReturnT.SUCCESS;

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyAccountWarningLoadJob.java

@@ -26,7 +26,7 @@ public class KuaishouHourlyAccountWarningLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IAccountWarningService accountWarningService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(3);
 
     @XxlJob("kuaishouHourlyAccountWarning")
     public ReturnT<String> execute(String param) throws Exception {
@@ -39,7 +39,6 @@ public class KuaishouHourlyAccountWarningLoadJob {
         }
         String statDate = DateUtils.getDate("yyyy-MM-dd");
         String anotherDay = getAnotherDay("yyyy-MM-dd", statDate, -1);
-        executorService = Executors.newFixedThreadPool(3);
         tokens.forEach(token -> executorService.submit(() -> accountWarningService.kuaiShouAccountWarning(token.getAccountId(), statDate, anotherDay)));
         XxlJobLogger.log("异步时段消耗预警定时任务执行完毕,耗时:{} ms", System.currentTimeMillis() - l);
         return ReturnT.SUCCESS;

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyCampaignReportLoadJob.java

@@ -28,7 +28,7 @@ public class KuaishouHourlyCampaignReportLoadJob {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("kuaishouHourlyCampaignReport")
     public ReturnT<String> execute(String param) throws Exception {
@@ -44,7 +44,6 @@ public class KuaishouHourlyCampaignReportLoadJob {
             XxlJobLogger.log("定时获取快手数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(5);
         Date finalGetDate = getDate;
         tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserCampaignReportHourly(token, finalGetDate, finalGetDate)));
         return ReturnT.SUCCESS;

+ 2 - 3
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyCreativeReportLoadJob.java

@@ -28,7 +28,7 @@ public class KuaishouHourlyCreativeReportLoadJob {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(3);
 
     @XxlJob("kuaishouHourlyCreativeReport")
     public ReturnT<String> execute(String param) throws Exception {
@@ -40,11 +40,10 @@ public class KuaishouHourlyCreativeReportLoadJob {
         }
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        if (null == tokens || tokens.size() <= 0) {
+        if (null == tokens || tokens.isEmpty()) {
             XxlJobLogger.log("定时获取快手数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(3);
         Date finalGetDate = getDate;
         tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserCreativeReportHourly(token, finalGetDate, finalGetDate)));
         return ReturnT.SUCCESS;

+ 2 - 3
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyGroupReportLoadJob.java

@@ -27,7 +27,7 @@ public class KuaishouHourlyGroupReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("kuaishouHourlyGroupReport")
     public ReturnT<String> execute(String param) throws Exception {
@@ -39,11 +39,10 @@ public class KuaishouHourlyGroupReportLoadJob {
         }
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        if (null == tokens || tokens.size() <= 0) {
+        if (null == tokens || tokens.isEmpty()) {
             XxlJobLogger.log("定时获取快手数据异常:未获取到可用的token");
             return ReturnT.FAIL;
         }
-        executorService = Executors.newFixedThreadPool(5);
         Date finalGetDate = getDate;
         tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, finalGetDate, finalGetDate)));
         return ReturnT.SUCCESS;

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMaterialsLoadJob.java

@@ -21,7 +21,7 @@ public class KuaishouMaterialsLoadJob {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(8);
 
     @XxlJob("kuaishouMaterials")
     public ReturnT<String> execute(String param) throws Exception {
@@ -30,7 +30,6 @@ public class KuaishouMaterialsLoadJob {
         String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", endDate, -1);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        executorService = Executors.newFixedThreadPool(8);
         tokens.forEach(token -> executorService.submit(() -> {
             //获取全量视频素材数据
             kuaishouInterfaceService.getVideoList(token, startDate, endDate);

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateCampaignJob.java

@@ -23,7 +23,7 @@ public class KuaishouNowDateCampaignJob {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("kuaishouNowDateCampaign")
     public ReturnT<String> execute(String param) throws Exception {
@@ -33,7 +33,6 @@ public class KuaishouNowDateCampaignJob {
         SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
         Date startDate = sim.parse(anotherDay);
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        executorService = Executors.newFixedThreadPool(5);
         tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getCampaignList(token, startDate, endDate)));
         XxlJobLogger.log("快手物料数据同步完成");
         return ReturnT.SUCCESS;

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateCreativeJob.java

@@ -23,7 +23,7 @@ public class KuaishouNowDateCreativeJob {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("kuaishouNowDateCreative")
     public ReturnT<String> execute(String param) throws Exception {
@@ -32,7 +32,6 @@ public class KuaishouNowDateCreativeJob {
         SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
         Date startDate = sim.parse(anotherDay);
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        executorService = Executors.newFixedThreadPool(5);
         tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getCreativeList(token, startDate, endDate)));
         XxlJobLogger.log("快手物料数据同步完成");
         return ReturnT.SUCCESS;

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateGroupJob.java

@@ -23,7 +23,7 @@ public class KuaishouNowDateGroupJob {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("kuaishouNowDateGroup")
     public ReturnT<String> execute(String param) throws Exception {
@@ -33,7 +33,6 @@ public class KuaishouNowDateGroupJob {
         SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
         Date startDate = sim.parse(anotherDay);
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        executorService = Executors.newFixedThreadPool(5);
         tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getGroupList(token, startDate, endDate)));
         XxlJobLogger.log("快手物料数据同步完成");
         return ReturnT.SUCCESS;

+ 1 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouSuZaoLoadJob.java

@@ -20,12 +20,11 @@ public class KuaishouSuZaoLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
-    static ExecutorService executorService = null;
+    static ExecutorService executorService = Executors.newFixedThreadPool(8);
 
     @XxlJob("kuaishouSuZao")
     public ReturnT<String> execute(String param) throws Exception {
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        executorService = Executors.newFixedThreadPool(8);
         String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
         String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, 1);
         String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);

+ 57 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/WatermarkVideoJob.java

@@ -0,0 +1,57 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.entity.VideoWatermarkTask;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
+import cn.com.ctop.common.module.utils.MpsUtils;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import com.aliyuncs.mts.model.v20140618.QueryJobListResponse;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public class WatermarkVideoJob {
+    @Autowired
+    private IVideoWatermarkTaskService videoWaterMarkService;
+    @Autowired
+    private IMaterialInfoService materialInfoService;
+
+    @XxlJob("videoWatermarkJob")
+    public ReturnT<String> execute(String params) throws Exception {
+        QueryWrapper<VideoWatermarkTask> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("status", "Submitted", "Transcoding");
+        List<VideoWatermarkTask> list = videoWaterMarkService.list(queryWrapper);
+        if (list != null && !list.isEmpty()) {
+            for (VideoWatermarkTask videoWatermarkTask : list) {
+                QueryJobListResponse.Job job = MpsUtils.getJobStatus(videoWatermarkTask.getJobId());
+                if ("TranscodeSuccess".equals(job.getState())) {
+                    String url = "https://ctop-media.oss-cn-beijing.aliyuncs.com/" + job.getOutput().getOutputFile().getObject();
+                    String localPath = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
+                    LoadFileUtil.delFile(localPath);
+                    QueryWrapper<MaterialInfo> materialInfoQueryWrapper = new QueryWrapper<>();
+                    materialInfoQueryWrapper.eq("watermark_code", job.getJobId());
+                    MaterialInfo materialInfo = materialInfoService.getOne(materialInfoQueryWrapper);
+                    if (Check.isNull(materialInfo)) {
+                        videoWaterMarkService.removeById(videoWatermarkTask.getId());
+                        continue;
+                    }
+                    materialInfo.setWatermarkUrl(url);
+                    materialInfoService.saveOrUpdate(materialInfo);
+                    videoWatermarkTask.setVideoUrl(url);
+                    videoWatermarkTask.setStatus(job.getState());
+                    videoWatermarkTask.setVideoId(materialInfo.getId());
+                    videoWaterMarkService.updateById(videoWatermarkTask);
+                }
+            }
+        }
+        return ReturnT.SUCCESS;
+    }
+}

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceCampaign.java

@@ -149,7 +149,7 @@ public class ByteDanceCampaign {
         if (null != optStatus && !"".equals(optStatus.trim())) {
             this.optStatus = optStatus;
         }
-        String campaignCreateTime = dataObject.getString("campaign_create_time ");
+        String campaignCreateTime = dataObject.getString("campaign_create_time");
         if (null != campaignCreateTime && !"".equals(campaignCreateTime.trim())) {
             this.campaignCreateTime = campaignCreateTime;
         }

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceAdvertiserDataService.java

@@ -15,7 +15,7 @@ public interface IByteDanceAdvertiserDataService {
 
     Map<String, Object> getAdvertiserPlan(CtopOauthToken token, String ids, String date, String updateDate);
 
-    Map<String, Object> getAdvertiserCampaign(String accountId, String ids, String date);
+    Map<String, Object> getAdvertiserCampaign(CtopOauthToken token, String ids, String date);
 
     Map<String, Object> getAdvertiserBudget(String accountId);
 

+ 10 - 10
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -189,8 +189,8 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     }
 
     @Override
-    public Map<String, Object> getAdvertiserCampaign(String accountId, String ids, String date) {
-        getAdvertiserCampaignByPageNumber(accountId, 1, ids, date);
+    public Map<String, Object> getAdvertiserCampaign(CtopOauthToken token, String ids, String date) {
+        getAdvertiserCampaignByPageNumber(token, 1, ids, date);
         Map<String, Object> resultMap = new HashMap<>();
         resultMap.put("code", 0);
         resultMap.put("message", "获取广告組信息成功");
@@ -758,13 +758,12 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     }
 
 
-    private void getAdvertiserCampaignByPageNumber(String accountId, Integer pageNumber, String ids, String date) {
-        CtopOauthToken cTopOauthToken = tokenService.getOauthTokenByAccountId(accountId);
+    private void getAdvertiserCampaignByPageNumber(CtopOauthToken token, Integer pageNumber, String ids, String date) {
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_get");
         Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", cTopOauthToken.getAccessToken());
+        headers.put("Access-Token", token.getAccessToken());
 
         TreeMap<String, Object> params = new TreeMap<>();
         JSONObject filtering = new JSONObject();
@@ -781,26 +780,27 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             filtering.put("campaign_create_time", date);
         }
         params.put("filtering", filtering.toJSONString());
-        params.put("advertiser_id", cTopOauthToken.getAccountId());
+        params.put("advertiser_id", token.getAccountId());
         params.put("page", pageNumber + "");
         String result = HttpUtils.httpGetRequest(url, headers, params);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
 
         if (null == code || !code.equals(0)) {
-            log.error("获取广告组信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            log.error("获取广告组信息接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
             return;
         }
         JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
         if (null == data || data.isEmpty()) {
-            log.error("获取广告组信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            log.error("获取广告组信息不存在==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
             return;
         }
+        System.out.println(data.toJSONString());
         for (int i = 0; i < data.size(); i++) {
             JSONObject dataObject = data.getJSONObject(i);
-            ByteDanceCampaign campaign = new ByteDanceCampaign(dataObject, Long.parseLong(accountId));
+            ByteDanceCampaign campaign = new ByteDanceCampaign(dataObject,token.getAccountId());
             campaignService.saveOrUpdate(campaign);
         }
-        getAdvertiserCampaignByPageNumber(accountId, pageNumber + 1, ids, date);
+        getAdvertiserCampaignByPageNumber(token, pageNumber + 1, ids, date);
     }
 }

+ 3 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

@@ -16,6 +16,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.PropertyNamingStrategy;
 import com.alibaba.fastjson.serializer.SerializeConfig;
+import com.xxl.job.core.log.XxlJobLogger;
 import lombok.extern.slf4j.Slf4j;
 import lombok.var;
 import org.jeecg.common.util.DateUtils;
@@ -82,11 +83,11 @@ public class ReportServiceImpl implements IReportService {
         Integer code = getObject.getInteger("code");
         String message = getObject.getString("message");
         if (null == code || code != 0) {
-            log.error("头条广告主数据获取异常:{}", message);
+            XxlJobLogger.log("头条广告主数据获取异常:{}", message);
             return;
         }
         JSONArray dataArray = getObject.getJSONObject("data").getJSONArray("list");
-        if (null == dataArray || dataArray.size() <= 0) {
+        if (null == dataArray || dataArray.isEmpty()) {
             return;
         }