|
@@ -13,9 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
-import java.util.concurrent.CountDownLatch;
|
|
|
-import java.util.concurrent.ExecutorService;
|
|
|
-import java.util.concurrent.Executors;
|
|
|
|
|
|
@Slf4j
|
|
|
public class KuaishouDailyReportTaskJob implements Job {
|
|
@@ -24,8 +21,6 @@ public class KuaishouDailyReportTaskJob implements Job {
|
|
|
@Autowired
|
|
|
private IKuaiShouHistoryReportTaskService reportTaskService;
|
|
|
|
|
|
- private static ExecutorService executorService = Executors.newFixedThreadPool(3);
|
|
|
- private static CountDownLatch countDownLatch = null;
|
|
|
@Override
|
|
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
|
|
log.info("快手获取日报数据任务执行开始");
|
|
@@ -37,26 +32,8 @@ public class KuaishouDailyReportTaskJob implements Job {
|
|
|
return;
|
|
|
}
|
|
|
String getDateStr = DateUtils.formatDate(getDate);
|
|
|
- countDownLatch = new CountDownLatch(tokens.size());
|
|
|
for (CtopOauthToken token : tokens) {
|
|
|
- executorService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- //创建任务
|
|
|
- try {
|
|
|
- reportTaskService.createTask(token.getAccountId(), token.getAccessToken(), getDateStr, getDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- } finally {
|
|
|
- countDownLatch.countDown();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- try {
|
|
|
- countDownLatch.await();
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
+ reportTaskService.createTask(token.getAccountId(), token.getAccessToken(), getDateStr, getDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
|
|
|
}
|
|
|
Long end = System.currentTimeMillis();
|
|
|
log.info("快手获取日报数据任务执行结束,执行耗时:{}秒", (end - start) / 1000);
|