|
@@ -1,13 +1,10 @@
|
|
|
package cn.com.ctop.job.kuaishou.handler;
|
|
package cn.com.ctop.job.kuaishou.handler;
|
|
|
|
|
|
|
|
import cn.com.ctop.job.kuaishou.data.service.IAdUnitReportService;
|
|
import cn.com.ctop.job.kuaishou.data.service.IAdUnitReportService;
|
|
|
-import cn.com.ctop.job.kuaishou.data.service.IKuaishouMaterialVideoReportDailyService;
|
|
|
|
|
-import cn.com.ctop.job.kuaishou.data.service.IKuaishouMaterialVideoReportHourlyService;
|
|
|
|
|
import cn.com.ctop.job.kuaishou.data.service.IKuaishouUnitAudienceAgeReportDailyService;
|
|
import cn.com.ctop.job.kuaishou.data.service.IKuaishouUnitAudienceAgeReportDailyService;
|
|
|
import cn.com.ctop.job.kuaishou.data.service.IOauthTokenService;
|
|
import cn.com.ctop.job.kuaishou.data.service.IOauthTokenService;
|
|
|
import cn.com.ctop.job.kuaishou.data.utils.Check;
|
|
import cn.com.ctop.job.kuaishou.data.utils.Check;
|
|
|
import cn.com.ctop.job.kuaishou.data.utils.DateUtils;
|
|
import cn.com.ctop.job.kuaishou.data.utils.DateUtils;
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
import com.xxl.job.core.context.XxlJobHelper;
|
|
import com.xxl.job.core.context.XxlJobHelper;
|
|
@@ -16,8 +13,8 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Executors;
|
|
@@ -26,281 +23,277 @@ import java.util.concurrent.Executors;
|
|
|
@Component
|
|
@Component
|
|
|
public class AdUnitReportJob {
|
|
public class AdUnitReportJob {
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IOauthTokenService tokenService;
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IOauthTokenService tokenService;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IAdUnitReportService adUnitReportService;
|
|
|
|
|
-
|
|
|
|
|
- private static ExecutorService dailyExecutorService = Executors.newFixedThreadPool(3);
|
|
|
|
|
- private static ExecutorService hourExecutorService = Executors.newFixedThreadPool(3);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取广告组信息
|
|
|
|
|
- * 前一天
|
|
|
|
|
- *
|
|
|
|
|
- * @throws Exception
|
|
|
|
|
- */
|
|
|
|
|
- @XxlJob("AdUnitListReportJob")
|
|
|
|
|
- public void AdUnitListReportJob(){
|
|
|
|
|
- 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;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 前一天 时间
|
|
|
|
|
- String endTime = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
|
|
- String startTime = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.getNowDate("yyyy-MM-dd"), -1);
|
|
|
|
|
- dailyExecutorService.submit(
|
|
|
|
|
- new Runnable() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void run() {
|
|
|
|
|
- try {
|
|
|
|
|
- adUnitReportService.getAdUnitReport(Long.valueOf(param),token, startTime, endTime, 1);
|
|
|
|
|
- }catch (Exception e){
|
|
|
|
|
- log.info(String.valueOf(e));;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IAdUnitReportService adUnitReportService;
|
|
|
|
|
|
|
|
|
|
+ private static ExecutorService dailyExecutorService = Executors.newFixedThreadPool(3);
|
|
|
|
|
+ private static ExecutorService hourExecutorService = Executors.newFixedThreadPool(3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取广告组信息
|
|
|
|
|
+ * 前一天
|
|
|
|
|
+ *
|
|
|
|
|
+ * @throws Exception
|
|
|
|
|
+ */
|
|
|
|
|
+ @XxlJob("AdUnitListReportJob")
|
|
|
|
|
+ public void AdUnitListReportJob() {
|
|
|
|
|
+ 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;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 快手广告计划信息
|
|
|
|
|
- * 前一天
|
|
|
|
|
- *
|
|
|
|
|
- * @throws Exception
|
|
|
|
|
- */
|
|
|
|
|
- @XxlJob("KuaishouCampaignListJob")
|
|
|
|
|
- public void KuaishouCampaignListJob(){
|
|
|
|
|
- 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;
|
|
|
|
|
|
|
+ // 前一天 时间
|
|
|
|
|
+ String endTime = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
|
|
+ String startTime = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.getNowDate("yyyy-MM-dd"), -1);
|
|
|
|
|
+ dailyExecutorService.submit(
|
|
|
|
|
+ new Runnable() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ adUnitReportService.getAdUnitReport(Long.valueOf(param), token, startTime, endTime, 1);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.info(String.valueOf(e));
|
|
|
|
|
+ ;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 前一天 时间
|
|
|
|
|
- String endTime = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
|
|
- String startTime = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.getNowDate("yyyy-MM-dd"), -1);
|
|
|
|
|
- dailyExecutorService.submit(
|
|
|
|
|
- new Runnable() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void run() {
|
|
|
|
|
- try {
|
|
|
|
|
- adUnitReportService.getAdPlanReport(Long.valueOf(param),token, startTime, endTime, 1);
|
|
|
|
|
- }catch (Exception e){
|
|
|
|
|
- log.info(String.valueOf(e));;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 代理商t-1数据获取
|
|
|
|
|
- *
|
|
|
|
|
- * @throws
|
|
|
|
|
- */
|
|
|
|
|
- @XxlJob("kuaiShouAgentReportJob")
|
|
|
|
|
- public void kuaiShouAgentReportJob() throws Exception {
|
|
|
|
|
- adUnitReportService.getAgentReport();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 快手广告计划信息
|
|
|
|
|
+ * 前一天
|
|
|
|
|
+ *
|
|
|
|
|
+ * @throws Exception
|
|
|
|
|
+ */
|
|
|
|
|
+ @XxlJob("KuaishouCampaignListJob")
|
|
|
|
|
+ public void KuaishouCampaignListJob() {
|
|
|
|
|
+ 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;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 快手-账户日报-adScene(按广告场景)
|
|
|
|
|
- * DAILY 天
|
|
|
|
|
- * @throws Exception
|
|
|
|
|
- */
|
|
|
|
|
- @XxlJob("KuaishouAccountAdSceneDailyReportJob")
|
|
|
|
|
- public void KuaishouAccountAdSceneDailyReportJob() throws Exception {
|
|
|
|
|
- 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;
|
|
|
|
|
|
|
+ // 前一天 时间
|
|
|
|
|
+ String endTime = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
|
|
+ String startTime = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.getNowDate("yyyy-MM-dd"), -1);
|
|
|
|
|
+ dailyExecutorService.submit(
|
|
|
|
|
+ new Runnable() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ adUnitReportService.getAdPlanReport(Long.valueOf(param), token, startTime, endTime, 1);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.info(String.valueOf(e));
|
|
|
|
|
+ ;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String date = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.getNowDate("yyyy-MM-dd"), -1);
|
|
|
|
|
- //广告场景
|
|
|
|
|
- List<String> reportDims = Arrays.asList("adScene");
|
|
|
|
|
- dailyExecutorService.submit(
|
|
|
|
|
- new Runnable() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void run() {
|
|
|
|
|
- adUnitReportService.getKuaishouAccountAdSceneDaily(Long.valueOf(param), token, date, date, 1,"DAILY",reportDims);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 代理商t-1数据获取
|
|
|
|
|
+ *
|
|
|
|
|
+ * @throws
|
|
|
|
|
+ */
|
|
|
|
|
+ @XxlJob("kuaiShouAgentReportJob")
|
|
|
|
|
+ public void kuaiShouAgentReportJob() throws Exception {
|
|
|
|
|
+ adUnitReportService.getAgentReport();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 快手-账户日报-adScene(按广告场景)
|
|
|
|
|
+ * DAILY 天
|
|
|
|
|
+ *
|
|
|
|
|
+ * @throws Exception
|
|
|
|
|
+ */
|
|
|
|
|
+ @XxlJob("KuaishouAccountAdSceneDailyReportJob")
|
|
|
|
|
+ public void KuaishouAccountAdSceneDailyReportJob() throws Exception {
|
|
|
|
|
+ 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;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 快手-人群报表
|
|
|
|
|
- * @throws Exception
|
|
|
|
|
- */
|
|
|
|
|
- @XxlJob("KuaishouAudienceReportJob")
|
|
|
|
|
- public void KuaishouAudienceReportJob() throws Exception {
|
|
|
|
|
- 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;
|
|
|
|
|
|
|
+ String date = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.getNowDate("yyyy-MM-dd"), -1);
|
|
|
|
|
+ //广告场景
|
|
|
|
|
+ List<String> reportDims = Arrays.asList("adScene");
|
|
|
|
|
+ dailyExecutorService.submit(
|
|
|
|
|
+ new Runnable() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ adUnitReportService.getKuaishouAccountAdSceneDaily(Long.valueOf(param), token, date, date, 1, "DAILY", reportDims);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String date = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.getNowDate("yyyy-MM-dd"), -1);
|
|
|
|
|
- //广告计划 ID 集
|
|
|
|
|
- List<Long> campaignIds = Arrays.asList();
|
|
|
|
|
- //广告组 ID 集
|
|
|
|
|
- List<Long> unitIds = Arrays.asList();
|
|
|
|
|
- //人群报表类型
|
|
|
|
|
- List<String> reportDimsProvince = Arrays.asList("province");
|
|
|
|
|
- List<String> reportDimsCity = Arrays.asList("city");
|
|
|
|
|
- List<String> reportDimsGender = Arrays.asList("gender");
|
|
|
|
|
- List<String> reportAge = Arrays.asList("ageSegment");
|
|
|
|
|
- dailyExecutorService.submit(
|
|
|
|
|
- new Runnable() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void run() {
|
|
|
|
|
- adUnitReportService.crowdAnalysisReport(Long.valueOf(param), token, date, campaignIds, unitIds,reportDimsProvince,1);
|
|
|
|
|
- adUnitReportService.crowdAnalysisReport(Long.valueOf(param), token, date, campaignIds, unitIds,reportDimsCity,1);
|
|
|
|
|
- adUnitReportService.crowdAnalysisReport(Long.valueOf(param), token, date, campaignIds, unitIds,reportDimsGender,1);
|
|
|
|
|
- adUnitReportService.crowdAnalysisReport(Long.valueOf(param), token, date, campaignIds, unitIds,reportAge,1);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 快手-人群报表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @throws Exception
|
|
|
|
|
+ */
|
|
|
|
|
+ @XxlJob("KuaishouAudienceReportJob")
|
|
|
|
|
+ public void KuaishouAudienceReportJob() throws Exception {
|
|
|
|
|
+ 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;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 快手-账户流水
|
|
|
|
|
- * 默认是当天
|
|
|
|
|
- * @throws Exception
|
|
|
|
|
- */
|
|
|
|
|
- @XxlJob("kuaishouFundDailyFlowsJob")
|
|
|
|
|
- public void kuaishouFundDailyFlowsJob() throws Exception {
|
|
|
|
|
- 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;
|
|
|
|
|
|
|
+ String date = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.getNowDate("yyyy-MM-dd"), -1);
|
|
|
|
|
+ //广告计划 ID 集
|
|
|
|
|
+ List<Long> campaignIds = Arrays.asList();
|
|
|
|
|
+ //广告组 ID 集
|
|
|
|
|
+ List<Long> unitIds = Arrays.asList();
|
|
|
|
|
+ //人群报表类型
|
|
|
|
|
+ List<String> reportDimsProvince = Arrays.asList("province");
|
|
|
|
|
+ List<String> reportDimsCity = Arrays.asList("city");
|
|
|
|
|
+ List<String> reportDimsGender = Arrays.asList("gender");
|
|
|
|
|
+ List<String> reportAge = Arrays.asList("ageSegment");
|
|
|
|
|
+ dailyExecutorService.submit(
|
|
|
|
|
+ new Runnable() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ adUnitReportService.crowdAnalysisReport(Long.valueOf(param), token, date, campaignIds, unitIds, reportDimsProvince, 1);
|
|
|
|
|
+ adUnitReportService.crowdAnalysisReport(Long.valueOf(param), token, date, campaignIds, unitIds, reportDimsCity, 1);
|
|
|
|
|
+ adUnitReportService.crowdAnalysisReport(Long.valueOf(param), token, date, campaignIds, unitIds, reportDimsGender, 1);
|
|
|
|
|
+ adUnitReportService.crowdAnalysisReport(Long.valueOf(param), token, date, campaignIds, unitIds, reportAge, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- dailyExecutorService.submit(
|
|
|
|
|
- new Runnable() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void run() {
|
|
|
|
|
- adUnitReportService.getKuaishouDailyFlows(Long.valueOf(param), token,1);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 快手-账户流水
|
|
|
|
|
+ * 默认是当天
|
|
|
|
|
+ *
|
|
|
|
|
+ * @throws Exception
|
|
|
|
|
+ */
|
|
|
|
|
+ @XxlJob("kuaishouFundDailyFlowsJob")
|
|
|
|
|
+ public void kuaishouFundDailyFlowsJob() throws Exception {
|
|
|
|
|
+ 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() {
|
|
|
|
|
+ adUnitReportService.getKuaishouDailyFlows(Long.valueOf(param), token, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 快手-账户余额
|
|
|
|
|
- *
|
|
|
|
|
- * @throws Exception
|
|
|
|
|
- */
|
|
|
|
|
- @XxlJob("kuaishouFundGetBalanceJob")
|
|
|
|
|
- public void kuaishouFundGetBalanceJob() throws Exception {
|
|
|
|
|
- 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;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 快手-账户余额
|
|
|
|
|
+ *
|
|
|
|
|
+ * @throws Exception
|
|
|
|
|
+ */
|
|
|
|
|
+ @XxlJob("kuaishouFundGetBalanceJob")
|
|
|
|
|
+ public void kuaishouFundGetBalanceJob() throws Exception {
|
|
|
|
|
+ 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() {
|
|
|
|
|
+ adUnitReportService.getKuaishouDailyFundGet(Long.valueOf(param), token);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- dailyExecutorService.submit(
|
|
|
|
|
- new Runnable() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void run() {
|
|
|
|
|
- adUnitReportService.getKuaishouDailyFundGet(Long.valueOf(param), token);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IKuaishouUnitAudienceAgeReportDailyService unitReportDailyService;
|
|
|
|
|
|
|
|
|
|
- private static ExecutorService unitExecutorService = Executors.newFixedThreadPool(5);
|
|
|
|
|
- /**
|
|
|
|
|
- * 快手-广告组人群报表(年龄,性别,城市,省级)
|
|
|
|
|
- */
|
|
|
|
|
- @XxlJob("KuaishouUnitAudienceReportJob")
|
|
|
|
|
- public void KuaishouUnitAudienceReportJob() throws Exception {
|
|
|
|
|
- String param = XxlJobHelper.getJobParam(); // 执行参数
|
|
|
|
|
- if (Check.isNull(param)) {
|
|
|
|
|
- log.error("入参为空");
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- Long accountId = Long.valueOf(param);
|
|
|
|
|
- String token = tokenService.getByAccountId(accountId);
|
|
|
|
|
- if (Check.isNull(token)) {
|
|
|
|
|
- log.error("此账户未获取到相关token,accountId:{}", param);
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- String date = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.getNowDate("yyyy-MM-dd"), -1);
|
|
|
|
|
- //广告计划 ID 集
|
|
|
|
|
- List<JSONObject> campaignArray = unitReportDailyService.selectPlanIdsByAccountIdAndTime(accountId, date);
|
|
|
|
|
- if (Check.isNull(campaignArray)) {
|
|
|
|
|
- log.error("未查询到计划ID");
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- //广告组 ID 集
|
|
|
|
|
- for (JSONObject obj : campaignArray) {
|
|
|
|
|
- Long campaignId = obj.getLong("campaignId");
|
|
|
|
|
- List<Long> unitIds = unitReportDailyService.selectUnitIdsByAccountIdAndTime(accountId, campaignId, date);
|
|
|
|
|
- if (Check.isNull(unitIds)) {
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- if (unitIds.size() > 59) {
|
|
|
|
|
- List<List<Long>> unitIdArray = Lists.partition(unitIds, 59);
|
|
|
|
|
- for (List<Long> list : unitIdArray) {
|
|
|
|
|
- unitReportDailyService.standardCrowdAnalysisReport(accountId, token, date, campaignId, list);
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IKuaishouUnitAudienceAgeReportDailyService unitReportDailyService;
|
|
|
|
|
+
|
|
|
|
|
+ private static ExecutorService unitExecutorService = Executors.newFixedThreadPool(5);
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 快手-广告组人群报表(年龄,性别,城市,省级)
|
|
|
|
|
+ */
|
|
|
|
|
+ @XxlJob("KuaishouUnitAudienceReportJob")
|
|
|
|
|
+ public void KuaishouUnitAudienceReportJob() throws Exception {
|
|
|
|
|
+ List<JSONObject> tokens = tokenService.getByProjectId(458L); //淘特项目
|
|
|
|
|
+ String date = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.getNowDate("yyyy-MM-dd"), -1);
|
|
|
|
|
+ Date enDate = DateUtils.addDay(DateUtils.getNowDate(), -1);
|
|
|
|
|
+ for (JSONObject t : tokens) {
|
|
|
|
|
+ Long accountId = t.getLong("accountId");
|
|
|
|
|
+ String token = t.getString("accessToken");
|
|
|
|
|
+ if (Check.isNull(token)) {
|
|
|
|
|
+ log.error("此账户未获取到相关token,accountId:{}", accountId);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ //过期跳过
|
|
|
|
|
+ if (enDate.after(t.getDate("accessTokenExpiresIn"))) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ //广告计划 ID 集
|
|
|
|
|
+ List<JSONObject> campaignArray = unitReportDailyService.selectPlanIdsByAccountIdAndTime(accountId, date);
|
|
|
|
|
+ if (Check.isNull(campaignArray)) {
|
|
|
|
|
+ log.error("未查询到计划ID");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ //广告组 ID 集
|
|
|
|
|
+ for (JSONObject obj : campaignArray) {
|
|
|
|
|
+ Long campaignId = obj.getLong("campaignId");
|
|
|
|
|
+ List<Long> unitIds = unitReportDailyService.selectUnitIdsByAccountIdAndTime(accountId, campaignId, date);
|
|
|
|
|
+ if (Check.isNull(unitIds)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (unitIds.size() > 59) {
|
|
|
|
|
+ List<List<Long>> unitIdArray = Lists.partition(unitIds, 59);
|
|
|
|
|
+ for (List<Long> list : unitIdArray) {
|
|
|
|
|
+ unitReportDailyService.standardCrowdAnalysisReport(accountId, token, date, campaignId, list);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ unitReportDailyService.standardCrowdAnalysisReport(accountId, token, date, campaignId, unitIds);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- unitReportDailyService.standardCrowdAnalysisReport(accountId, token, date, campaignId, unitIds);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|