|
@@ -0,0 +1,62 @@
|
|
|
|
+package cn.com.ctop.job.live.handler;
|
|
|
|
+
|
|
|
|
+import cn.com.ctop.job.live.service.AgentTokenService;
|
|
|
|
+import cn.com.ctop.job.live.service.IKuaishouLiveCampaignReportDailyService;
|
|
|
|
+import cn.com.ctop.job.live.utils.Check;
|
|
|
|
+import com.xxl.job.core.context.XxlJobHelper;
|
|
|
|
+import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
|
+import java.util.concurrent.Executors;
|
|
|
|
+
|
|
|
|
+@Slf4j
|
|
|
|
+@Component
|
|
|
|
+public class AdCampaignReportJob {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaishouLiveCampaignReportDailyService campaignReportDailyService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private AgentTokenService tokenService;
|
|
|
|
+
|
|
|
|
+ private static ExecutorService dailyExecutorService = Executors.newFixedThreadPool(3);
|
|
|
|
+ private static ExecutorService hourExecutorService = Executors.newFixedThreadPool(3);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取广告组信息
|
|
|
|
+ * 前1天
|
|
|
|
+ *
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ @XxlJob("AdCampaignReportJob")
|
|
|
|
+ public void AdCampaignReportJob() {
|
|
|
|
+ String param = XxlJobHelper.getJobParam(); // 执行参数
|
|
|
|
+ if (Check.isNull(param)) {
|
|
|
|
+ log.error("入参为空");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ String token = tokenService.getByAccountId(Long.valueOf(param));
|
|
|
|
+ if (Check.isNull(token)) {
|
|
|
|
+ log.error("此账户未获取到相关token,accountId:{}", param);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dailyExecutorService.submit(
|
|
|
|
+ new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ try {
|
|
|
|
+ campaignReportDailyService.getKuaishouCampaignReport(Long.valueOf(param), token, 1);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.info(String.valueOf(e));
|
|
|
|
+ ;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|