|
@@ -1,50 +0,0 @@
|
|
|
-package cn.com.ctop.job.kuaishou.handler;
|
|
|
-
|
|
|
-import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
-import com.xxl.job.core.biz.model.ReturnT;
|
|
|
-import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
-import com.xxl.job.core.log.XxlJobLogger;
|
|
|
-import org.jeecg.common.util.DateUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.concurrent.ExecutorService;
|
|
|
-import java.util.concurrent.Executors;
|
|
|
-
|
|
|
-/**
|
|
|
- * 快手获取操作记录定时任务
|
|
|
- *
|
|
|
- * @author sunzhen
|
|
|
- */
|
|
|
-@Component
|
|
|
-public class KuaishouDailyAccountReportLoadJob {
|
|
|
- @Autowired
|
|
|
- private ICtopOauthTokenService tokenService;
|
|
|
- @Autowired
|
|
|
- private IKuaishouInterfaceService2 kuaishouInterfaceService2;
|
|
|
- static ExecutorService executorService = Executors.newFixedThreadPool(3);
|
|
|
-
|
|
|
- @XxlJob("kuaishouOperationReport")
|
|
|
- public ReturnT<String> execute(String param) throws Exception {
|
|
|
- Date getDate = DateUtils.addDay(new Date(), -1);
|
|
|
- Date getDate2 = DateUtils.addDay(new Date(), -2);
|
|
|
- //1:查询当日数据
|
|
|
- List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
- if (null == tokens || tokens.isEmpty()) {
|
|
|
- XxlJobLogger.log("定时获取快手数据异常:未获取到可用的token");
|
|
|
- return ReturnT.FAIL;
|
|
|
- }
|
|
|
- tokens.forEach(token -> executorService.submit(() ->{
|
|
|
- kuaishouInterfaceService2
|
|
|
- kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }));
|
|
|
- return ReturnT.SUCCESS;
|
|
|
- }
|
|
|
-}
|