yumeng 4 лет назад
Родитель
Сommit
34ea4bbc57

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

@@ -88,6 +88,17 @@ public class TestController {
     static ExecutorService suzhaoService = Executors.newFixedThreadPool(10);
     static ExecutorService suzhaoService = Executors.newFixedThreadPool(10);
 
 
 
 
+    @GetMapping(value = "/dailyReport")
+    public void dailyReport() {
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("定时获取快手数据异常:未获取到可用的token");
+        }
+        for (CtopOauthToken token : tokens) {
+            dailyReportTaskService.getTaskList(token.getAccountId(), token.getAccessToken(), "2020-09-20");
+        }
+    }
+
     @GetMapping(value = "/getMd5")
     @GetMapping(value = "/getMd5")
     public void getMd5() {
     public void getMd5() {
         kuaiShouHistoryReportTaskService.getMd5(null, null);
         kuaiShouHistoryReportTaskService.getMd5(null, null);

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

@@ -98,7 +98,7 @@ public class SampleTest {
         queryWrapper.eq("media_id", 2);
         queryWrapper.eq("media_id", 2);
         List<CtopOauthToken> list = oauthTokenService.list(queryWrapper);
         List<CtopOauthToken> list = oauthTokenService.list(queryWrapper);
          for (CtopOauthToken token : list) {
          for (CtopOauthToken token : list) {
-        kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-17", "2020-09-19", "history");
+        kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-20", "2020-09-20", "daily");
 
 
          }
          }
 
 

+ 0 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml

@@ -117,8 +117,6 @@
         <if test="statDate != null and statDate != '' ">
         <if test="statDate != null and statDate != '' ">
             and stat_date = #{statDate}
             and stat_date = #{statDate}
         </if>
         </if>
-        and  stat_date &gt;= '2020-09-17'
-        and stat_date &lt;= '2020-09-19'
         group by photo_id
         group by photo_id
     </select>
     </select>
 
 

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

@@ -140,7 +140,7 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
                     XxlJobLogger.log("下载结束,accountId:{}", task.getAccountId());
                     XxlJobLogger.log("下载结束,accountId:{}", task.getAccountId());
                 } else if (task.getViewType() == 5) {
                 } else if (task.getViewType() == 5) {
                     kuaishouReportDailyMaterialMapper.loadMaterialDailyReport(task.getAccountId(), localPath);
                     kuaishouReportDailyMaterialMapper.loadMaterialDailyReport(task.getAccountId(), localPath);
-                   /* Thread thread = new Thread() {
+                    Thread thread = new Thread() {
                         @Override
                         @Override
                         public void run() {
                         public void run() {
                             try {
                             try {
@@ -153,7 +153,7 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
                         }
                         }
 
 
                     };
                     };
-                    thread.start();*/
+                    thread.start();
 
 
 
 
                 }
                 }

+ 10 - 11
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java

@@ -110,7 +110,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                             dailyReportTask.setTaskName(taskName);
                             dailyReportTask.setTaskName(taskName);
                             dailyReportTaskService.save(dailyReportTask);
                             dailyReportTaskService.save(dailyReportTask);
                         } else {
                         } else {
-                            log.error("快手历史报表请求失败,accountId:{},返回数据:{}", accountId, resultJson);
+                            log.error("快手分天报表请求失败,accountId:{},返回数据:{}", accountId, resultJson);
                         }
                         }
                     }
                     }
                 }
                 }
@@ -237,7 +237,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                 } else if (task.getViewType() == 5) {
                 } else if (task.getViewType() == 5) {
                     kuaishouReportDailyMaterialMapper.loadMaterialDailyReport(task.getAccountId(), localPath);
                     kuaishouReportDailyMaterialMapper.loadMaterialDailyReport(task.getAccountId(), localPath);
 
 
-                   /* Thread thread = new Thread() {
+                    Thread thread = new Thread() {
                         @Override
                         @Override
                         public void run() {
                         public void run() {
                             try {
                             try {
@@ -250,7 +250,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                         }
                         }
 
 
                     };
                     };
-                    thread.start();*/
+                    thread.start();
                 }
                 }
 
 
 
 
@@ -281,17 +281,16 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
 
     private void getDailyTypeList() {
     private void getDailyTypeList() {
         dailyTypeList = new ArrayList<>();
         dailyTypeList = new ArrayList<>();
-        dailyTypeList.add(5);
-
         dailyTypeList.add(2);
         dailyTypeList.add(2);
         dailyTypeList.add(3);
         dailyTypeList.add(3);
         dailyTypeList.add(4);
         dailyTypeList.add(4);
-
+        dailyTypeList.add(5);
         dailyTypeList.add(10);
         dailyTypeList.add(10);
     }
     }
 
 
 
 
-    static ExecutorService executorService = Executors.newFixedThreadPool(50);
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(30);
 
 
     @Autowired
     @Autowired
     private ICtopOauthTokenService oauthTokenService;
     private ICtopOauthTokenService oauthTokenService;
@@ -299,7 +298,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
     @Override
     @Override
     public void getMd5(String statDate, Long accountId) {
     public void getMd5(String statDate, Long accountId) {
 
 
-       /* executorService.submit(new Runnable() {
+        executorService.submit(new Runnable() {
             @Override
             @Override
             public void run() {
             public void run() {
                 List<KuaiShouReportDailyMaterialVo> photoList = kuaishouReportDailyMaterialMapper.getPhotoList(accountId, statDate);
                 List<KuaiShouReportDailyMaterialVo> photoList = kuaishouReportDailyMaterialMapper.getPhotoList(accountId, statDate);
@@ -324,9 +323,9 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                     }
                     }
                 }
                 }
             }
             }
-        });*/
+        });
 
 
-        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+       /* QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("media_id", 2);
         queryWrapper.eq("media_id", 2);
         List<CtopOauthToken> list = oauthTokenService.list(queryWrapper);
         List<CtopOauthToken> list = oauthTokenService.list(queryWrapper);
         for (CtopOauthToken token : list) {
         for (CtopOauthToken token : list) {
@@ -357,7 +356,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
             }
             }
 
 
 
 
-        }
+        }*/
 
 
 
 
     }
     }