|
@@ -6,6 +6,7 @@ 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.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.alibaba.fastjson.support.hsf.HSFJSONUtils;
|
|
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;
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
@@ -13,9 +14,7 @@ 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.Arrays;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
|
@@ -30,6 +29,7 @@ public class AdUnitReportJob {
|
|
private IAdUnitReportService adUnitReportService;
|
|
private IAdUnitReportService adUnitReportService;
|
|
|
|
|
|
private static ExecutorService dailyExecutorService = Executors.newFixedThreadPool(2);
|
|
private static ExecutorService dailyExecutorService = Executors.newFixedThreadPool(2);
|
|
|
|
+ private static ExecutorService dailyFundExecutorService = Executors.newFixedThreadPool(3);
|
|
private static ExecutorService hourExecutorService = Executors.newFixedThreadPool(3);
|
|
private static ExecutorService hourExecutorService = Executors.newFixedThreadPool(3);
|
|
|
|
|
|
|
|
|
|
@@ -288,6 +288,48 @@ public class AdUnitReportJob {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ @XxlJob("kuaishouFundDailyFlowsAllAccount")
|
|
|
|
+ public void kuaishouFundDailyFlowsAllAccount() throws Exception {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<JSONObject> accountIds = adUnitReportService.getAllAccounts();
|
|
|
|
+ if (Check.isNull(accountIds)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ Map<Long, String> accessMap = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ List<JSONObject> agentTokens = tokenService.getAgentTokens();
|
|
|
|
+ if (Check.isNull(agentTokens)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ for (int i = 0; i < agentTokens.size(); i++) {
|
|
|
|
+ JSONObject jsonObject = agentTokens.get(i);
|
|
|
|
+ Long agentId = jsonObject.getLong("agentId");
|
|
|
|
+ String accessToken = jsonObject.getString("accessToken");
|
|
|
|
+ accessMap.put(agentId, accessToken);
|
|
|
|
+ }
|
|
|
|
+ String endDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
|
+ String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", endDate, -2);
|
|
|
|
+ for (int i = 0; i < accountIds.size(); i++) {
|
|
|
|
+ JSONObject jsonObject = accountIds.get(i);
|
|
|
|
+ Long agentId = jsonObject.getLong("agentId");
|
|
|
|
+ Long accountId = jsonObject.getLong("accountId");
|
|
|
|
+ String token = accessMap.get(agentId);
|
|
|
|
+ dailyFundExecutorService.submit(
|
|
|
|
+ new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ adUnitReportService.getKuaishouDailyFlows(accountId, token, startDate, endDate, 1);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 快手-账户余额
|
|
* 快手-账户余额
|
|
*
|
|
*
|