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

Merge branch 'master' into test

yumeng преди 5 години
родител
ревизия
9e0a2d8234
променени са 89 файла, в които са добавени 595 реда и са изтрити 499 реда
  1. 4 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/aspect/annotation/Dict.java
  2. 26 93
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  3. 1 4
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  4. 0 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActorController.java
  5. 13 37
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  6. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountBidJob.java
  7. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountCpaBidJob.java
  8. 0 45
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BakDataBaseJob.java
  9. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceCleanMaterialJob.java
  10. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceHourlyAccountWarningLoadJob.java
  11. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceRefreshTokenJob.java
  12. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserDailyReportLoadJob.java
  13. 2 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserDataLoadJob.java
  14. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserHourlyReportLoadJob.java
  15. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceCreativeDailyReportLoadJob.java
  16. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceCreativeHourlyReportLoadJob.java
  17. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanDailyReportLoadJob.java
  18. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanHourlyReportLoadJob.java
  19. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanLoadJob.java
  20. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanRealTimeLoadJob.java
  21. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceSameDayCreativeLoadJob.java
  22. 0 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/DailyFlowsJob.java
  23. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouNowDateCampaignJob.java
  24. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouNowDateCreativeJob.java
  25. 1 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouNowDateGroupJob.java
  26. 7 29
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ToutiaoMaterialsLoadJob.java
  27. 6 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/aspect/DictAspect.java
  28. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDictController.java
  29. 17 25
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDictItemController.java
  30. 10 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysDictMapper.java
  31. 7 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysDictMapper.xml
  32. 11 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysDictService.java
  33. 20 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java
  34. 10 2
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  35. 4 0
      jeecg-boot-module-system/src/main/resources/quartz.properties
  36. 5 14
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  37. 29 26
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  38. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  39. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  40. 15 7
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  41. 1 2
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCleanMaterialJob.java
  42. 4 6
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceHourlyAccountWarningLoadJob.java
  43. 1 3
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAdvertiserDailyReportLoadJob.java
  44. 2 3
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAdvertiserHourlyReportLoadJob.java
  45. 2 3
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAdvertisingDataLoadJob.java
  46. 1 2
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCampaignDailyReportLoadJob.java
  47. 1 2
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCampaignHourlyReportLoadJob.java
  48. 3 4
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCreativeDailyReportLoadJob.java
  49. 4 5
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCreativeHourlyReportLoadJob.java
  50. 4 11
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceFlowFundJob.java
  51. 9 8
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanDailyReportLoadJob.java
  52. 3 5
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanHourlyReportLoadJob.java
  53. 2 4
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanLoadJob.java
  54. 2 3
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanRealTimeLoadJob.java
  55. 1 2
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceSameDayCreativeLoadJob.java
  56. 1 2
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceVideoInfoLoadJob.java
  57. 2 7
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouCleanMaterialJob.java
  58. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCampaignJob.java
  59. 4 9
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadJob.java
  60. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyCampaignReportLoadJob.java
  61. 3 5
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyCreativeReportLoadJob.java
  62. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyGroupReportLoadJob.java
  63. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyLoadFileJob.java
  64. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupJob.java
  65. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyAccountReportLoadJob.java
  66. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyAccountWarningLoadJob.java
  67. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyCampaignReportLoadJob.java
  68. 2 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyCreativeReportLoadJob.java
  69. 2 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyGroupReportLoadJob.java
  70. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMaterialsLoadJob.java
  71. 2 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateCampaignJob.java
  72. 2 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateCreativeJob.java
  73. 2 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateGroupJob.java
  74. 1 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouSuZaoLoadJob.java
  75. 57 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/WatermarkVideoJob.java
  76. 18 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  77. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouVideoGet.java
  78. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouAdvertiserBaseInfoService.java
  79. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/ISyncPullMaterialService.java
  80. 33 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouAdvertiserBaseInfoServiceImpl.java
  81. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java
  82. 54 14
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  83. 90 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/SyncPullMaterialServiceImpl.java
  84. 21 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/controller/BytedanceAudienceTemplateController.java
  85. 1 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCampaignController.java
  86. 7 6
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceCampaign.java
  87. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceAdvertiserDataService.java
  88. 10 10
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  89. 3 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

+ 4 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/aspect/annotation/Dict.java

@@ -39,4 +39,8 @@ public @interface Dict {
      * @return 返回类型: String
      */
     String dictTable() default "";
+
+    String extendsKey() default "";
+
+    String extendsValue() default "";
 }

+ 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 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -114,15 +114,13 @@ public class ShiroConfig {
         //oauth接口
         filterChainDefinitionMap.put("/auth/**", "anon");
         filterChainDefinitionMap.put("/ctop/syncdata/**", "anon");
+        filterChainDefinitionMap.put("/sys/dictItem/list", "anon");
         //头条接口
         filterChainDefinitionMap.put("/bytedance", "anon");
-        filterChainDefinitionMap.put("/toutiao/dictitem/list", "anon");
         filterChainDefinitionMap.put("/toutiao/loadAllData", "anon");
         filterChainDefinitionMap.put("/toutiao/loadSingleData", "anon");
         filterChainDefinitionMap.put("/kuaishou/getReport/historyData", "anon");
         filterChainDefinitionMap.put("/toutiao/advertiser/**", "anon");
-        filterChainDefinitionMap.put("/toutiao/industry/list", "anon");
-        filterChainDefinitionMap.put("/template/bytedance/industry/list", "anon");
         filterChainDefinitionMap.put("/template/convert/list", "anon");
         filterChainDefinitionMap.put("/template/convert/list/url", "anon");
         //文件上传接口
@@ -144,7 +142,6 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/graphql/video", "anon");
         filterChainDefinitionMap.put("/ks/web/test", "anon");
         filterChainDefinitionMap.put("/ureport/**", "anon");
-        //filterChainDefinitionMap.put("/ctop/performance/show/**", "anon");
         filterChainDefinitionMap.put("/job/test/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt

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

@@ -65,7 +65,6 @@ public class ActorController {
         QueryWrapper<Actor> queryWrapper = QueryGenerator.initQueryWrapper(actor, req.getParameterMap());
         Page<Actor> page = new Page<>(pageNo, pageSize);
         IPage<Actor> pageList = actorService.page(page, queryWrapper);
-
         result.setSuccess(true);
         result.setResult(pageList);
         return result;
@@ -77,7 +76,6 @@ public class ActorController {
                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                         HttpServletRequest req) {
         Result<IPage<ActorPhoto>> result = new Result<>();
-
         QueryWrapper<ActorPhoto> queryWrapper = QueryGenerator.initQueryWrapper(actorPhoto, req.getParameterMap());
         Page<ActorPhoto> page = new Page<>(pageNo, pageSize);
         IPage<ActorPhoto> pageList = actorPhotoService.page(page, queryWrapper);
@@ -92,7 +90,6 @@ public class ActorController {
                                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                             HttpServletRequest req) {
         Result<IPage<ActorComment>> result = new Result<>();
-
         QueryWrapper<ActorComment> queryWrapper = QueryGenerator.initQueryWrapper(actorComment, req.getParameterMap());
         Page<ActorComment> page = new Page<>(pageNo, pageSize);
         IPage<ActorComment> pageList = actorCommentService.page(page, queryWrapper);

+ 13 - 37
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -41,8 +41,17 @@ import static org.jeecg.common.util.DateUtils.getAnotherDay;
 @Slf4j
 public class TestController {
     @Autowired
+    private CtopOauthTokenMapper tokenMapper;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    private IMaterialCutFrameService cutFrameService;
+    @Autowired
+    IKuaiShouVideoGetService videoGetService;
+    @Autowired
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
-
     @Autowired
     private CtopOauthTokenMapper oauthTokenMapper;
     @Autowired
@@ -63,6 +72,7 @@ public class TestController {
     static ExecutorService videoService = Executors.newFixedThreadPool(5);
     static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
 
+
     @GetMapping(value = "/t")
     public String test() {
         Result<String> result = new Result<>();
@@ -83,26 +93,10 @@ public class TestController {
     }
 
 
-    @Autowired
-    private CtopOauthTokenMapper tokenMapper;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-
-
-    @Autowired
-    private ICtopOauthTokenService oauthTokenService;
-
-    @Autowired
-    private IMaterialCutFrameService cutFrameService;
-    @Autowired
-    IKuaiShouVideoGetService videoGetService;
-
 
     @GetMapping(value = "/getSuZhao")
     public void getSuZhao() throws JobExecutionException {
-
         try {
-
             //1:查询当日数据
             QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("media_id", 2);
@@ -113,9 +107,8 @@ public class TestController {
                 return;
             }
 
-            executorService = Executors.newFixedThreadPool(8);
             tokens.forEach(token -> {
-                executorService.submit(new Runnable() {
+                suzhaoService.submit(new Runnable() {
                     @Override
                     public void run() {
                         //1: 获取广告主信息数据
@@ -172,19 +165,15 @@ public class TestController {
 
     @GetMapping(value = "/getVideo")
     public String getVideo(String startDate, String endDate) throws IOException {
-
         try {
-
             Thread thread = new Thread() {
                 @Override
                 public void run() {
                     QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
                     tokenQueryWrapper.eq("media_id", 2);
                     List<CtopOauthToken> list = tokenService.list(tokenQueryWrapper);
-
-                    executorService = Executors.newFixedThreadPool(8);
                     list.forEach(token -> {
-                        executorService.submit(new Runnable() {
+                        videoService.submit(new Runnable() {
                             @Override
                             public void run() {
                                 try {
@@ -223,9 +212,7 @@ public class TestController {
 
     @GetMapping(value = "/getVideoByAccountId")
     public String getVideoByAccountId(Long accountId) throws IOException {
-
         try {
-
             Thread thread = new Thread() {
                 @Override
                 public void run() {
@@ -252,8 +239,6 @@ public class TestController {
                         e.printStackTrace();
                     } finally {
                     }
-
-
                     log.info("快手物料数据同步完成");
                 }
             };
@@ -267,7 +252,6 @@ public class TestController {
 
     @GetMapping(value = "/createCutTask")
     public String createCutTask(String startDate, String endDate) throws IOException {
-
         List<MaterialInfo> materialInfos = materialInfoService.getListByDate(startDate, endDate);
         if (!Check.isNull(materialInfos)) {
             for (MaterialInfo materialInfo : materialInfos) {
@@ -281,11 +265,8 @@ public class TestController {
                         cutFrameService.getCutFrame(materialInfo.getUrl(), code, materialParameter.getSecond(), materialParameter.getHeight(), materialParameter.getWidth());
 
                     }
-
                 }
-
             }
-
         }
         return "Success";
     }
@@ -320,7 +301,6 @@ public class TestController {
             SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
             Date date1 = sim.parse(startDate);
             Date date2 = sim.parse(endDate);
-
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
             List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
@@ -328,7 +308,6 @@ public class TestController {
                 for (CtopOauthToken token : ctopOauthTokens) {
                     kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
                 }
-
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -372,14 +351,12 @@ public class TestController {
             parameterService.update(updateMaterialParameter, parameterQueryWrapper);
         }
 
-
         List<String> codeList = iMaterialImageInfoService.getCodeList();
         if (!Check.isNull(codeList)) {
             for (int i = 0; i < codeList.size(); i++) {
                 String code = codeList.get(i);
                 QueryWrapper<MaterialImageInfo> materialImageInfoQueryWrapper = new QueryWrapper<>();
                 materialImageInfoQueryWrapper.eq("code", code);
-
                 List<MaterialImageInfo> list2 = iMaterialImageInfoService.list(materialImageInfoQueryWrapper);
                 if (list2.size() > 1) {
                     for (int j = 0; j < list2.size(); j++) {
@@ -389,7 +366,6 @@ public class TestController {
                         MaterialImageInfo materialImageInfo = list2.get(j);
                         iMaterialImageInfoService.removeById(String.valueOf(materialImageInfo.getId()));
                     }
-
                 }
             }
         }

+ 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
      *

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

@@ -35,7 +35,7 @@ public class KuaishouNowDateCampaignJob implements Job {
             @Override
             public void run() {
                 //1:查询当日数据
-                Date endDate  = DateUtils.getDate();
+                Date endDate  = new Date();
                 String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
                 SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
                 Date startDate = sim.parse(anotherDay);

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

@@ -35,7 +35,7 @@ public class KuaishouNowDateCreativeJob implements Job {
             @Override
             public void run() {
                 //1:查询当日数据
-                Date endDate  = DateUtils.getDate();
+                Date endDate  = new Date();
                 String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
                 SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
                 Date startDate = sim.parse(anotherDay);

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

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
@@ -12,7 +11,6 @@ import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
@@ -37,7 +35,7 @@ public class KuaishouNowDateGroupJob implements Job {
             @Override
             public void run() {
                 //1:查询当日数据
-                Date endDate  = DateUtils.getDate();
+                Date endDate  = new Date();
                 String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
                 SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
                 Date startDate = sim.parse(anotherDay);

+ 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);
     }
 }

+ 6 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/aspect/DictAspect.java

@@ -102,9 +102,11 @@ public class DictAspect {
                             String code = field.getAnnotation(Dict.class).dicCode();
                             String text = field.getAnnotation(Dict.class).dicText();
                             String table = field.getAnnotation(Dict.class).dictTable();
+                            String extendsKey = field.getAnnotation(Dict.class).extendsKey();
+                            String extendsValue = field.getAnnotation(Dict.class).extendsValue();
                             String key = String.valueOf(item.get(field.getName()));
                             //翻译字典值对应的txt
-                            String textValue = translateDictValue(code, text, table, key);
+                            String textValue = translateDictValue(code, text, table, key,extendsKey,extendsValue);
 
                             log.debug(" 字典Val : "+ textValue);
                             log.debug(" __翻译字典字段__ "+field.getName() + CommonConstant.DICT_TEXT_SUFFIX+": "+ textValue);
@@ -132,7 +134,7 @@ public class DictAspect {
      * @param key
      * @return
      */
-    private String translateDictValue(String code, String text, String table, String key) {
+    private String translateDictValue(String code, String text, String table, String key,String extendsKey,String extendsValue) {
     	if(oConvertUtils.isEmpty(key)) {
     		return null;
     	}
@@ -145,9 +147,9 @@ public class DictAspect {
                 continue; //跳过循环
             }
             if (!StringUtils.isEmpty(table)){
-                tmpValue= dictService.queryTableDictTextByKey(table,text,code,k.trim());
+                tmpValue= dictService.queryTableDictTextByKey(table,text,code,k.trim(),extendsKey,extendsValue);
             }else {
-                tmpValue = dictService.queryDictTextByKey(code, k.trim());
+                tmpValue = dictService.queryDictTextByKey(code, k.trim(),extendsKey,extendsValue);
             }
 
             if (tmpValue != null) {

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDictController.java

@@ -167,7 +167,7 @@ public class SysDictController {
 		Result<String> result = new Result<String>();
 		String text = null;
 		try {
-			text = sysDictService.queryDictTextByKey(dictCode, key);
+			text = sysDictService.queryDictTextByKey(dictCode, key,null,null);
 			 result.setSuccess(true);
 			 result.setResult(text);
 		} catch (Exception e) {
@@ -380,7 +380,7 @@ public class SysDictController {
 					result.error500("字典Code格式不正确!");
 					return result;
 				}
-				String text = sysDictService.queryTableDictTextByKey(params[0], params[1], params[2], key);
+				String text = sysDictService.queryTableDictTextByKey(params[0], params[1], params[2], key,null,null);
 				result.setSuccess(true);
 				result.setResult(text);
 				log.info(result.toString());

+ 17 - 25
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDictItemController.java

@@ -1,30 +1,22 @@
 package org.jeecg.modules.system.controller;
 
 
-import java.util.Arrays;
-import java.util.Date;
-
-import javax.servlet.http.HttpServletRequest;
-
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CacheConstant;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.system.entity.SysDictItem;
 import org.jeecg.modules.system.service.ISysDictItemService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-
-import lombok.extern.slf4j.Slf4j;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+import java.util.Date;
 
 /**
  * <p>
@@ -41,7 +33,7 @@ public class SysDictItemController {
 
 	@Autowired
 	private ISysDictItemService sysDictItemService;
-	
+
 	/**
 	 * @功能:查询字典数据
 	 * @param sysDictItem
@@ -50,19 +42,19 @@ public class SysDictItemController {
 	 * @param req
 	 * @return
 	 */
-	@RequestMapping(value = "/list", method = RequestMethod.GET)
+	@GetMapping(value = "/list")
 	public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
-		Result<IPage<SysDictItem>> result = new Result<IPage<SysDictItem>>();
+		Result<IPage<SysDictItem>> result = new Result<>();
 		QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
 		queryWrapper.orderByAsc("sort_order");
-		Page<SysDictItem> page = new Page<SysDictItem>(pageNo, pageSize);
+		Page<SysDictItem> page = new Page<>(pageNo, pageSize);
 		IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;
 	}
-	
+
 	/**
 	 * @功能:新增
 	 * @param sysDictItem
@@ -82,7 +74,7 @@ public class SysDictItemController {
 		}
 		return result;
 	}
-	
+
 	/**
 	 * @功能:编辑
 	 * @param sysDictItem
@@ -105,7 +97,7 @@ public class SysDictItemController {
 		}
 		return result;
 	}
-	
+
 	/**
 	 * @功能:删除字典数据
 	 * @param id
@@ -126,7 +118,7 @@ public class SysDictItemController {
 		}
 		return result;
 	}
-	
+
 	/**
 	 * @功能:批量删除字典数据
 	 * @param ids
@@ -144,5 +136,5 @@ public class SysDictItemController {
 		}
 		return result;
 	}
-	
+
 }

+ 10 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysDictMapper.java

@@ -1,13 +1,13 @@
 package org.jeecg.modules.system.mapper;
 
-import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.common.system.vo.DictModel;
 import org.jeecg.modules.system.entity.SysDict;
 import org.jeecg.modules.system.model.DuplicateCheckVo;
 import org.jeecg.modules.system.model.TreeSelectModel;
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import java.util.List;
 
 /**
  * <p>
@@ -18,36 +18,36 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @since 2018-12-28
  */
 public interface SysDictMapper extends BaseMapper<SysDict> {
-	
+
 	/**
 	  *  重复检查SQL
 	 * @return
 	 */
 	public Long duplicateCheckCountSql(DuplicateCheckVo duplicateCheckVo);
 	public Long duplicateCheckCountSqlNoDataId(DuplicateCheckVo duplicateCheckVo);
-	
+
 	public List<DictModel> queryDictItemsByCode(@Param("code") String code);
 	public List<DictModel> queryTableDictItemsByCode(@Param("table") String table,@Param("text") String text,@Param("code") String code);
 	public List<DictModel> queryTableDictItemsByCodeAndFilter(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("filterSql") String filterSql);
 
 
-	public String queryDictTextByKey(@Param("code") String code,@Param("key") String key);
+	String queryDictTextByKey(@Param("code") String code,@Param("key") String key,@Param(value = "extendsKey") String extendsKey,@Param(value = "extendsValue") String extendsValue);
+
+	String queryTableDictTextByKey(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("key") String key,@Param(value = "extendsKey") String extendsKey,@Param(value = "extendsValue") String extendsValue);
 
-	public String queryTableDictTextByKey(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("key") String key);
 
-	
 	/**
 	 * 查询所有部门 作为字典信息 id -->value,departName -->text
 	 * @return
 	 */
 	public List<DictModel> queryAllDepartBackDictModel();
-	
+
 	/**
 	 * 查询所有用户  作为字典信息 username -->value,realname -->text
 	 * @return
 	 */
 	public List<DictModel> queryAllUserBackDictModel();
-	
+
 	/**
 	 * 通过关键字查询出字典表
 	 * @param table
@@ -56,7 +56,7 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
 	 * @param keyword
 	 * @return
 	 */
-	public List<DictModel> queryTableDictItems(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("keyword") String keyword); 
+	public List<DictModel> queryTableDictItems(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("keyword") String keyword);
 
 	/**
 	  * 根据表名、显示字段名、存储字段名 查询树

+ 7 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysDictMapper.xml

@@ -12,9 +12,12 @@
 
     <!-- 通过字典code获取字典数据 -->
     <select id="queryDictTextByKey" parameterType="String" resultType="String">
-		   select s.item_text from sys_dict_item s 
+		   select s.item_text from sys_dict_item s
 		   where s.dict_id = (select id from sys_dict where dict_code = #{code})
 		   and s.item_value = #{key}
+		   <if test="extendsKey!=null and extendsValue!=null">
+			   and s.${extendsKey} = #{extendsValue}
+		   </if>
 	</select>
 
 
@@ -33,6 +36,9 @@
     <!--通过查询指定table的 text code key 获取字典值-->
     <select id="queryTableDictTextByKey" parameterType="String" resultType="String">
 		   select ${text} as 'text' from ${table} where ${code}= #{key}
+		   <if test="extendsKey != null and extendsValue != null">
+			   and ${extendsKey} = #{extendsValue}
+		   </if>
 	</select>
 
     <!-- 重复校验 sql语句 -->

+ 11 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysDictService.java

@@ -1,14 +1,13 @@
 package org.jeecg.modules.system.service;
 
-import java.util.List;
-import java.util.Map;
-
+import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.system.vo.DictModel;
 import org.jeecg.modules.system.entity.SysDict;
-import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.system.entity.SysDictItem;
 import org.jeecg.modules.system.model.TreeSelectModel;
 
+import java.util.List;
+
 /**
  * <p>
  * 字典表 服务类
@@ -19,14 +18,14 @@ import org.jeecg.modules.system.model.TreeSelectModel;
  */
 public interface ISysDictService extends IService<SysDict> {
 
-    public List<DictModel> queryDictItemsByCode(String code);
+    List<DictModel> queryDictItemsByCode(String code);
 
     List<DictModel> queryTableDictItemsByCode(String table, String text, String code);
 
-	public List<DictModel> queryTableDictItemsByCodeAndFilter(String table, String text, String code, String filterSql);
-    public String queryDictTextByKey(String code, String key);
+	List<DictModel> queryTableDictItemsByCodeAndFilter(String table, String text, String code, String filterSql);
+    String queryDictTextByKey(String code, String key,String extendsKey,String extendsValue);
 
-    String queryTableDictTextByKey(String table, String text, String code, String key);
+    String queryTableDictTextByKey(String table, String text, String code, String key,String extendsKey,String extendsValue);
 
     /**
      * 根据字典类型删除关联表中其对应的数据
@@ -40,19 +39,19 @@ public interface ISysDictService extends IService<SysDict> {
      * 添加一对多
      */
     public void saveMain(SysDict sysDict, List<SysDictItem> sysDictItemList);
-    
+
     /**
 	 * 查询所有部门 作为字典信息 id -->value,departName -->text
 	 * @return
 	 */
 	public List<DictModel> queryAllDepartBackDictModel();
-	
+
 	/**
 	 * 查询所有用户  作为字典信息 username -->value,realname -->text
 	 * @return
 	 */
 	public List<DictModel> queryAllUserBackDictModel();
-	
+
 	/**
 	 * 通过关键字查询字典表
 	 * @param table
@@ -62,7 +61,7 @@ public interface ISysDictService extends IService<SysDict> {
 	 * @return
 	 */
 	public List<DictModel> queryTableDictItems(String table, String text, String code,String keyword);
-	
+
 	/**
 	  * 根据表名、显示字段名、存储字段名 查询树
 	 * @param table

+ 20 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java

@@ -1,8 +1,7 @@
 package org.jeecg.modules.system.service.impl;
 
-import java.util.List;
-
-
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.constant.CacheConstant;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.vo.DictModel;
@@ -10,7 +9,6 @@ import org.jeecg.modules.system.entity.SysDict;
 import org.jeecg.modules.system.entity.SysDictItem;
 import org.jeecg.modules.system.mapper.SysDictItemMapper;
 import org.jeecg.modules.system.mapper.SysDictMapper;
-
 import org.jeecg.modules.system.model.TreeSelectModel;
 import org.jeecg.modules.system.service.ISysDictService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,9 +16,7 @@ import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
-import lombok.extern.slf4j.Slf4j;
+import java.util.List;
 
 /**
  * <p>
@@ -60,9 +56,15 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
 
 	@Override
 	@Cacheable(value = CacheConstant.DICT_CACHE)
-	public String queryDictTextByKey(String code, String key) {
+	public String queryDictTextByKey(String code, String key,String extendsKey,String extendsValue) {
 		log.info("无缓存dictText的时候调用这里!");
-		return sysDictMapper.queryDictTextByKey(code, key);
+		if(null == extendsKey||extendsKey.trim().equals("")){
+			extendsKey = null;
+		}
+		if(null == extendsValue||extendsValue.trim().equals("")){
+			extendsValue = null;
+		}
+		return sysDictMapper.queryDictTextByKey(code, key,extendsKey,extendsValue);
 	}
 
 	/**
@@ -96,9 +98,15 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
 	 */
 	@Override
 	@Cacheable(value = "dictTableCache")
-	public String queryTableDictTextByKey(String table,String text,String code, String key) {
+	public String queryTableDictTextByKey(String table,String text,String code, String key,String extendsKey,String extendsValue) {
 		log.info("无缓存dictTable的时候调用这里!");
-		return sysDictMapper.queryTableDictTextByKey(table,text,code,key);
+		if(null == extendsKey||extendsKey.trim().equals("")){
+			extendsKey = null;
+		}
+		if(null == extendsValue||extendsValue.trim().equals("")){
+			extendsValue = null;
+		}
+		return sysDictMapper.queryTableDictTextByKey(table,text,code,key,extendsKey,extendsValue);
 	}
 
     /**
@@ -132,7 +140,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
 	public List<DictModel> queryAllUserBackDictModel() {
 		return baseMapper.queryAllUserBackDictModel();
 	}
-	
+
 	@Override
 	public List<DictModel> queryTableDictItems(String table, String text, String code, String keyword) {
 		return baseMapper.queryTableDictItems(table, text, code, "%"+keyword+"%");

+ 10 - 2
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -56,7 +56,11 @@ spring:
   autoconfigure:
     exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
   datasource:
-    url: jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+#    url: jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+#    username: hcst
+#    password: test@20190531
+#    driver-class-name: com.mysql.jdbc.Driver
+    url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
     username: hcst
     password: test@20190531
     driver-class-name: com.mysql.jdbc.Driver
@@ -95,7 +99,11 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+#          url: jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+#          username: hcst
+#          password: test@20190531
+#          driver-class-name: com.mysql.jdbc.Driver、
+          url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: hcst
           password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver

+ 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

+ 29 - 26
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java

@@ -62,31 +62,33 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
         param.put("refresh_token", refreshToken);
         String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
         JSONObject resultObject = JSONObject.parseObject(result);
-        XxlJobLogger.log("头条刷新token入参,token:{},refreshToken:{},返回信息:{}", token, refreshToken, resultObject);
-        Integer code = resultObject.getInteger("code");
-        if (code == 0) {
-            JSONObject data = resultObject.getJSONObject("data");
-            CtopOauthToken updateRefreshToken = new CtopOauthToken();
-            updateRefreshToken.setAccessToken(data.getString("access_token"));
-            updateRefreshToken.setRefreshToken(data.getString("refresh_token"));
-            Date now = new Date();
-            Integer refreshTokenExpiresIn = data.getInteger("refresh_token_expires_in");
-            Integer expiresIn = data.getInteger("expires_in");
-            updateRefreshToken.setRefreshTokenExpiresIn(addSecond(now, refreshTokenExpiresIn));
-            updateRefreshToken.setAccessTokenExpiresIn(addSecond(now, expiresIn));
-            QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("access_token", token);
-            queryWrapper.eq("media_id", 1);
-            int i = cTopOauthTokenMapper.update(updateRefreshToken, queryWrapper);
-            if (i > 0) {
-                XxlJobLogger.log("头条刷新token成功:token:{}", token);
+        if (!Check.isNull(resultObject)) {
+            XxlJobLogger.log("头条刷新token入参,token:{},refreshToken:{},返回信息:{}", token, refreshToken, resultObject);
+            Integer code = resultObject.getInteger("code");
+            if (code == 0) {
+                JSONObject data = resultObject.getJSONObject("data");
+                CtopOauthToken updateRefreshToken = new CtopOauthToken();
+                updateRefreshToken.setAccessToken(data.getString("access_token"));
+                updateRefreshToken.setRefreshToken(data.getString("refresh_token"));
+                Date now = new Date();
+                Integer refreshTokenExpiresIn = data.getInteger("refresh_token_expires_in");
+                Integer expiresIn = data.getInteger("expires_in");
+                updateRefreshToken.setRefreshTokenExpiresIn(addSecond(now, refreshTokenExpiresIn));
+                updateRefreshToken.setAccessTokenExpiresIn(addSecond(now, expiresIn));
+                QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("access_token", token);
+                queryWrapper.eq("media_id", 1);
+                int i = cTopOauthTokenMapper.update(updateRefreshToken, queryWrapper);
+                if (i > 0) {
+                    XxlJobLogger.log("头条刷新token成功:token:{}", token);
+                }
+                resultMap.put("message", "token刷新成功");
+                resultMap.put("code", 0);
+            } else {
+                resultMap.put("message", "token刷新失败");
+                resultMap.put("token", token);
+                resultMap.put("code", 0);
             }
-            resultMap.put("message", "token刷新成功");
-            resultMap.put("code", 0);
-        } else {
-            resultMap.put("message", "token刷新失败");
-            resultMap.put("token", token);
-            resultMap.put("code", 0);
         }
         return resultMap;
     }
@@ -212,10 +214,11 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
         calendar.add(Calendar.SECOND, seconds);
         return calendar.getTime();
     }
+
     @Override
     public List<CtopOauthToken> getByProjectId(long projectId) {
-        QueryWrapper<CtopOauthToken>queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("project_id",projectId).eq("account_status",0);
+        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("project_id", projectId).eq("account_status", 0);
         return this.list(queryWrapper);
     }
 

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java

@@ -78,6 +78,8 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
                     sendMessageService.sendFeishuMessage(userId,feishuMessage);
                 }
 
+            }else{
+                log.info("头条上传素材f返回结果为空,返回信息:{},accountId:{}", jsonObject, accountId);
             }
 
 

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -129,7 +129,7 @@ public class KuaishouInterfaceConstant {
     /**
      * 修改广告计划预算
      */
-    public static final String UPDATE_CAMPAIGN_BUDGET = "/rest/openapi/v1/campaign/update/";
+    public static final String UPDATE_CAMPAIGN_BUDGET = "/rest/openapi/v2/campaign/update";
 
     /**
      * 修改广告组预算

+ 15 - 7
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java

@@ -7,13 +7,12 @@ import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.enums.MaterialEnum;
 import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
-import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.manage.modules.material.service.IMaterialUploadImageService;
 import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
 import com.alibaba.fastjson.JSONArray;
@@ -61,10 +60,6 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
     @Autowired
     private IMaterialParameterService materialParameterService;
     @Autowired
-    private MaterialParameterMapper parameterMapper;
-    @Autowired
-    private IKuaiShouVideoGetService kuaiShouVideoGetService;
-    @Autowired
     private IMaterialUploadImageService materialUploadImageService;
     @Autowired
     private ISendMessageService sendMessageService;
@@ -72,6 +67,8 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
     private IMessageTemplate messageTemplate;
     @Autowired
     private IUserAllocationService userAllocationService;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
 
 
     /**
@@ -175,7 +172,6 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                     Long accountId = accountArray.getLong(i);
                     QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
                     tokenQueryWrapper.eq("account_id", accountId);
-                    tokenQueryWrapper.eq("media_id", mediaId);
                     tokenQueryWrapper.orderByDesc("create_time");
                     tokenQueryWrapper.last("limit 1");
                     CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(tokenQueryWrapper);
@@ -228,6 +224,18 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                                             kuaiShouVideoGetService.saveOrUpdate(videoGet);*/
                                             materialUploadImageService.uploadImage(signature, accountId, ctopOauthToken.getAccessToken());
 
+                                            Thread thread = new Thread() {
+                                                @Override
+                                                public void run() {
+                                                    try {
+                                                        Thread.sleep(2 * 1000L);
+                                                        kuaishouInterfaceService.getVideoInfo(ctopOauthToken.getAccessToken(), ctopOauthToken.getAccountId(), dataJson.getString("photo_id"));
+                                                    } catch (InterruptedException e) {
+                                                        e.printStackTrace();
+                                                    }
+                                                }
+                                            };
+                                            thread.start();
                                         }
                                         log.info("快手素材同步完成,accountId:{},code:{},返回信息:{}", accountId, materialInfo.getCode(), resultJson);
                                     } else {

+ 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);

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

@@ -23,17 +23,16 @@ 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 {
         //1:查询当日数据
-        Date endDate = DateUtils.getDate();
+        Date endDate = new Date();
         String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
         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;

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

@@ -23,16 +23,15 @@ 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 {
-        Date endDate = DateUtils.getDate();
+        Date endDate = new Date();
         String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
         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;

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

@@ -23,17 +23,16 @@ 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 {
         //1:查询当日数据
-        Date endDate = DateUtils.getDate();
+        Date endDate = new Date();
         String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
         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;
+    }
+}

+ 18 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -84,6 +84,10 @@ public class BatchController {
     private IKuaishouPopulationService populationService;
     @Autowired
     private KuaiShouGroupMapper groupMapper;
+    @Autowired
+    private ISyncPullMaterialService syncPullMaterialService;
+    @Autowired
+    private IKuaiShouAdvertiserBaseInfoService KuaiShouAdvertiserBaseInfoService;
 
 
     /**
@@ -151,7 +155,7 @@ public class BatchController {
             Thread thread2 = new Thread() {
                 @Override
                 public void run() {
-                    iKuaishouInterfaceService.getVideoList(oauthToken, startDate, nowDate);
+                    syncPullMaterialService.getSyncVideoList(accountId, nowDate, nowDate);
 
                 }
             };
@@ -160,8 +164,7 @@ public class BatchController {
             Thread thread3 = new Thread() {
                 @Override
                 public void run() {
-
-                    iKuaishouInterfaceService.getSuZaoList(oauthToken.getAccessToken(), oauthToken.getAccountId(), 1, startDate, endDate);
+                    syncPullMaterialService.getSyncSuZaoList(accountId, nowDate, endDate);
                 }
             };
             thread3.start();
@@ -1113,7 +1116,19 @@ public class BatchController {
                                                         @RequestParam(name = "endDate", defaultValue = "") String endDate, HttpServletRequest req) {
         Result<IPage<KuaiShouVideoGet>> result = new Result<>();
         try {
+
+            Long accountId = kuaiShouVideoGet.getAccountId();
+            kuaiShouVideoGet.setAccountId(null);
+            if (Check.isNull(accountId)) {
+                throw new Exception("账户id不能为空");
+            }
             QueryWrapper<KuaiShouVideoGet> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouVideoGet, req.getParameterMap());
+            KuaiShouAdvertiserBaseInfo baseInfo = KuaiShouAdvertiserBaseInfoService.getBaseInfo(accountId);
+            if (!Check.isNull(baseInfo)) {
+                queryWrapper.eq("user_id", baseInfo.getUserId());
+            } else {
+                queryWrapper.eq("account_id", accountId);
+            }
             if (!Check.isNull(startDate) && !Check.isNull(endDate)) {
                 queryWrapper.between("stat_date", startDate, endDate);
             }

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouVideoGet.java

@@ -97,4 +97,5 @@ public class KuaiShouVideoGet {
 
     private Integer channelType;
     private Integer status;
+    private Long userId;
 }

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouAdvertiserBaseInfoService.java

@@ -3,6 +3,8 @@ package cn.com.ctop.kuaishou.modules.batch.service;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * 快手-广告主基本信息
  *
@@ -12,4 +14,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IKuaiShouAdvertiserBaseInfoService extends IService<KuaiShouAdvertiserBaseInfo> {
 
+    KuaiShouAdvertiserBaseInfo getBaseInfo(Long accountId);
+
+    List<KuaiShouAdvertiserBaseInfo> getAccountIdList(String userId);
 }

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/ISyncPullMaterialService.java

@@ -0,0 +1,7 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+public interface ISyncPullMaterialService {
+    void getSyncVideoList(Long accountId, String startDate, String endDate);
+
+    void getSyncSuZaoList(Long accountId, String nowDate, String endDate);
+}

+ 33 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouAdvertiserBaseInfoServiceImpl.java

@@ -3,11 +3,13 @@ package cn.com.ctop.kuaishou.modules.batch.service.impl;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAdvertiserBaseInfoMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAdvertiserBaseInfoService;
-
-
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * 快手-广告主基本信息
  *
@@ -17,5 +19,34 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class KuaiShouAdvertiserBaseInfoServiceImpl extends ServiceImpl<KuaiShouAdvertiserBaseInfoMapper, KuaiShouAdvertiserBaseInfo> implements IKuaiShouAdvertiserBaseInfoService {
+    @Autowired
+    private KuaiShouAdvertiserBaseInfoMapper advertiserBaseInfoMapper;
+
+    /**
+     * 根据accountId获取对象
+     *
+     * @param accountId
+     * @return
+     */
+    @Override
+    public KuaiShouAdvertiserBaseInfo getBaseInfo(Long accountId) {
+        QueryWrapper<KuaiShouAdvertiserBaseInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.last("limit 1");
+        return advertiserBaseInfoMapper.selectOne(queryWrapper);
+    }
 
+    /**
+     * 获取账户列表
+     *
+     * @param userId
+     * @return
+     */
+    @Override
+    public List<KuaiShouAdvertiserBaseInfo> getAccountIdList(String userId) {
+        QueryWrapper<KuaiShouAdvertiserBaseInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("user_id", userId);
+        queryWrapper.groupBy("account_id");
+        return advertiserBaseInfoMapper.selectList(queryWrapper);
+    }
 }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java

@@ -89,7 +89,7 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
                 log.error("修改广告计划预算返回结果为空,advertiserId:{},campaignId:{}", advertiserId, campaignId);
                 returnMap.put("code", -1);
                 returnMap.put("success", false);
-                returnMap.put("message", "修改广告预算返回结果为空");
+                returnMap.put("message", "修改广告计划预算返回结果为空");
             }
 
         } catch (Exception e) {

+ 54 - 14
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -132,6 +132,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private IKuaishouPopulationService populationService;
     @Autowired
     private IKuaiShouGroupService getKuaiShouGroupService;
+    @Autowired
+    private IKuaiShouAdvertiserBaseInfoService KuaiShouAdvertiserBaseInfoService;
 
 
     @Override
@@ -186,6 +188,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         getVideoListByPage(token, startDate, endDate, 1);
     }
 
+
+
+
     private void getVideoListByPage(CtopOauthToken token, String startDate, String endDate, int page) {
         try {
             log.info("获取视频数据,accountId:{}", token.getAccountId());
@@ -214,6 +219,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 log.info("快手视频列表信息为空=》accountId:{}", token.getAccountId());
                 return;
             }
+            KuaiShouAdvertiserBaseInfo baseInfo = KuaiShouAdvertiserBaseInfoService.getBaseInfo(token.getAccountId());
+            Long userId = null;
+            if (!Check.isNull(baseInfo)) {
+                userId = Long.valueOf(baseInfo.getUserId());
+            }
             for (int i = 0; i < details.size(); i++) {
                 var detailJson = details.getJSONObject(i);
                 KuaiShouVideoGet byId = kuaiShouVideoGetService.getById(token.getAccountId() + detailJson.getString("photo_id"));
@@ -230,6 +240,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 if (!Check.isNull(type)) {
                     kuaiShouVideoGet.setMaterialType(type);
                 }
+
+                kuaiShouVideoGet.setUserId(userId);
                 kuaiShouVideoGetService.saveOrUpdate(kuaiShouVideoGet);
 
                 Thread thread = new Thread() {
@@ -1380,17 +1392,17 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
      * 获取视频信息数据
      *
      * @param accessToken
-     * @param advertiserId
+     * @param accountId
      * @param photoId
      */
     @Override
-    public void getVideoInfo(String accessToken, Long advertiserId, String photoId) {
+    public void getVideoInfo(String accessToken, Long accountId, String photoId) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_GET;
         Map<String, String> headers = new HashMap<String, String>();
         headers.put("Content-Type", " application/json");
         headers.put("Access-Token", accessToken);
         JSONObject param = new JSONObject();
-        param.put("advertiser_id", advertiserId);
+        param.put("advertiser_id", accountId);
         JSONArray photosArray = new JSONArray();
         photosArray.add(photoId);
         param.put("photo_ids", photosArray);
@@ -1402,27 +1414,49 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 if (code == 0) {
                     JSONArray dataArray = resultJson.getJSONArray("data");
                     if (!Check.isNull(dataArray)) {
+                        KuaiShouAdvertiserBaseInfo baseInfo = KuaiShouAdvertiserBaseInfoService.getBaseInfo(accountId);
+                        Long userId = null;
+                        if (!Check.isNull(baseInfo)) {
+                            userId = Long.valueOf(baseInfo.getUserId());
+                        }
                         for (int i = 0; i < dataArray.size(); i++) {
                             JSONObject detailJson = dataArray.getJSONObject(i);
                             if (!Check.isNull(detailJson)) {
-                                KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
-                                videoGet.setId(detailJson.getString("photo_id"));
-                                videoGet.setAccountId(advertiserId);
-                                videoGet.setWidth(detailJson.getInteger("width"));
-                                videoGet.setHeight(detailJson.getInteger("height"));
-                                videoGet.setUrl(detailJson.getString("url"));
-                                videoGet.setCoverUrl(detailJson.getString("creative_name"));
-                                videoGet.setPhotoId(detailJson.getString("photo_id"));
-                                kuaiShouVideoGetService.saveOrUpdate(videoGet);
+
+                                KuaiShouVideoGet byId = kuaiShouVideoGetService.getById(accountId + photoId);
+                                if (!Check.isNull(byId)) {
+                                    continue;
+                                }
+                                var kuaiShouVideoGet = JSONObject.toJavaObject(detailJson, KuaiShouVideoGet.class);
+                                kuaiShouVideoGet.setId(accountId + photoId);
+
+                                kuaiShouVideoGet.setAccountId(accountId);
+                                kuaiShouVideoGet.setStatDate(detailJson.getDate("upload_time"));
+                                kuaiShouVideoGet.setUpdateTime(new Date());
+                                Integer type = MaterialEnum.getTypeBySize(kuaiShouVideoGet.getWidth(), kuaiShouVideoGet.getHeight());
+                                if (!Check.isNull(type)) {
+                                    kuaiShouVideoGet.setMaterialType(type);
+                                }
+
+                                kuaiShouVideoGet.setUserId(userId);
+                                kuaiShouVideoGetService.saveOrUpdate(kuaiShouVideoGet);
+
+                                Thread thread = new Thread() {
+                                    @Override
+                                    public void run() {
+                                        videoGetService.getKeyFrame(accessToken, accountId, kuaiShouVideoGet.getSignature(), kuaiShouVideoGet.getPhotoId());
+                                    }
+                                };
+                                thread.start();
                             }
                         }
                     }
                 } else {
-                    log.error("获取广告视频信息返回结果异常,advertiserId:{},异常信息:{}", advertiserId, resultJson);
+                    log.error("获取广告视频信息返回结果异常,advertiserId:{},异常信息:{}", accountId, resultJson);
                 }
 
             } else {
-                log.error("获取广告视频信息返回结果异常,advertiserId:{},异常信息:{}", advertiserId, resultJson);
+                log.error("获取广告视频信息返回结果异常,advertiserId:{},异常信息:{}", accountId, resultJson);
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -2888,6 +2922,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             if (Check.isNull(details)) {
                 return;
             }
+            KuaiShouAdvertiserBaseInfo baseInfo = KuaiShouAdvertiserBaseInfoService.getBaseInfo(accountId);
+            Long userId = null;
+            if (!Check.isNull(baseInfo)) {
+                userId = Long.valueOf(baseInfo.getUserId());
+            }
             for (int i = 0; i < details.size(); i++) {
                 JSONObject jsonObject = details.getJSONObject(i);
                 if (!Check.isNull(jsonObject)) {
@@ -2904,6 +2943,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     kuaiShouVideoGet.setSignature(md5);
                     kuaiShouVideoGet.setStatDate(jsonObject.getDate("sync_date"));
                     kuaiShouVideoGet.setChannelType(1);
+                    kuaiShouVideoGet.setUserId(userId);
                     Integer type = MaterialEnum.getTypeBySize(kuaiShouVideoGet.getWidth(), kuaiShouVideoGet.getHeight());
                     if (!Check.isNull(type)) {
                         kuaiShouVideoGet.setMaterialType(type);

+ 90 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/SyncPullMaterialServiceImpl.java

@@ -0,0 +1,90 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+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.entity.KuaiShouAdvertiserBaseInfo;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAdvertiserBaseInfoService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.service.ISyncPullMaterialService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 异步获取素材信息
+ */
+
+@Service
+public class SyncPullMaterialServiceImpl implements ISyncPullMaterialService {
+    @Autowired
+    private IKuaiShouAdvertiserBaseInfoService KuaiShouAdvertiserBaseInfoService;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    private IKuaishouInterfaceService iKuaishouInterfaceService;
+    static ExecutorService videoExecutorService = Executors.newFixedThreadPool(10);
+    static ExecutorService suZhaoExecutorService = Executors.newFixedThreadPool(10);
+
+
+    /**
+     * 获取一户多开所有视频信息
+     *
+     * @param accountId
+     * @param startDate
+     * @param endDate
+     */
+    @Override
+    public void getSyncVideoList(Long accountId, String startDate, String endDate) {
+        KuaiShouAdvertiserBaseInfo baseInfo = KuaiShouAdvertiserBaseInfoService.getBaseInfo(accountId);
+        if (!Check.isNull(baseInfo)) {
+            List<KuaiShouAdvertiserBaseInfo> baseInfoList = KuaiShouAdvertiserBaseInfoService.getAccountIdList(baseInfo.getUserId());
+            if (!Check.isNull(baseInfoList)) {
+                for (KuaiShouAdvertiserBaseInfo advertiserBaseInfo : baseInfoList) {
+                    CtopOauthToken token = oauthTokenService.getTokenByAccountId(advertiserBaseInfo.getAccountId());
+                    if (!Check.isNull(token)) {
+                        videoExecutorService.submit(new Runnable() {
+                            @Override
+                            public void run() {
+                                iKuaishouInterfaceService.getVideoList(token, startDate, endDate);
+                            }
+                        });
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取素造素材
+     *
+     * @param accountId
+     * @param startDate
+     * @param endDate
+     */
+    @Override
+    public void getSyncSuZaoList(Long accountId, String startDate, String endDate) {
+
+        KuaiShouAdvertiserBaseInfo baseInfo = KuaiShouAdvertiserBaseInfoService.getBaseInfo(accountId);
+        if (!Check.isNull(baseInfo)) {
+            List<KuaiShouAdvertiserBaseInfo> baseInfoList = KuaiShouAdvertiserBaseInfoService.getAccountIdList(baseInfo.getUserId());
+            if (!Check.isNull(baseInfoList)) {
+                for (KuaiShouAdvertiserBaseInfo advertiserBaseInfo : baseInfoList) {
+                    CtopOauthToken token = oauthTokenService.getTokenByAccountId(advertiserBaseInfo.getAccountId());
+                    if (!Check.isNull(token)) {
+                        suZhaoExecutorService.submit(new Runnable() {
+                            @Override
+                            public void run() {
+                                iKuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, startDate, endDate);
+                            }
+                        });
+                    }
+                }
+            }
+        }
+
+    }
+}

+ 21 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/controller/BytedanceAudienceTemplateController.java

@@ -0,0 +1,21 @@
+package cn.com.ctop.toutiao.modules.batch.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.Map;
+
+@RestController
+@RequestMapping("ctop/audience/template")
+public class BytedanceAudienceTemplateController {
+    @PostMapping("create")
+    public Map<String,Object> createAudiencePackageTemplate(HttpServletRequest request, JSONObject data){
+        Map<String,Object> result = new HashMap<>();
+
+        return result;
+    }
+}

+ 1 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCampaignController.java

@@ -50,6 +50,7 @@ public class ByteDanceCampaignController {
                                                           HttpServletRequest req) {
         Result<IPage<ByteDanceCampaign>> result = new Result<>();
         QueryWrapper<ByteDanceCampaign> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCampaign, req.getParameterMap());
+        queryWrapper.orderByDesc("campaign_create_time");
         Page<ByteDanceCampaign> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceCampaign> pageList = byteDanceCampaignService.page(page, queryWrapper);
         result.setSuccess(true);

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

@@ -9,6 +9,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
+import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.math.BigDecimal;
@@ -34,7 +35,6 @@ public class ByteDanceCampaign {
     @TableId
     @ApiModelProperty(value = "今日头条广告组id")
     private Long id;
-
     private Long accountId;
     /**
      * 广告组名称
@@ -51,14 +51,15 @@ public class ByteDanceCampaign {
     /**
      * 广告组预算类型
      */
-    @Excel(name = "广告组预算类型", width = 15)
-    @ApiModelProperty(value = "广告组预算类型")
+    @Dict(dicCode = "item_value", dictTable = "sys_dict_item", dicText = "item_text",extendsKey = "dict_id",extendsValue = "6512a5e70b99f6499dc3164b95e06395")
     private String budgetMode;
     /**
      * 广告组推广目的
      */
-    @Excel(name = "广告组推广目的", width = 15)
-    @ApiModelProperty(value = "广告组推广目的")
+    /**
+     * extendsValue在此处为固定值,切忌胡乱修改
+     */
+    @Dict(dicCode = "item_value", dictTable = "sys_dict_item", dicText = "item_text",extendsKey = "dict_id",extendsValue = "181afbae847dd3bc7e27795d89538c9c")
     private String landingType;
     /**
      * 广告组时间戳,用于更新时提交,服务端判断是否基于最新信息修改
@@ -149,7 +150,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;
         }