|
@@ -17,102 +17,106 @@ import java.util.concurrent.Executors;
|
|
|
@Slf4j
|
|
|
@Component
|
|
|
public class AccountReportlJob {
|
|
|
- @Autowired private IOauthTokenService tokenService;
|
|
|
- @Autowired private IKuaishouAccountReportDailyService kuaishouAccountReportDailyService;
|
|
|
- @Autowired private IKuaishouAccountReportHourlyService kuaishouAccountReportHourlyService;
|
|
|
- private static ExecutorService dailyExecutorService = Executors.newFixedThreadPool(3);
|
|
|
- private static ExecutorService hourExecutorService = Executors.newFixedThreadPool(3);
|
|
|
+ @Autowired
|
|
|
+ private IOauthTokenService tokenService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouAccountReportDailyService kuaishouAccountReportDailyService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouAccountReportHourlyService kuaishouAccountReportHourlyService;
|
|
|
+ private static ExecutorService dailyExecutorService = Executors.newFixedThreadPool(3);
|
|
|
+ private static ExecutorService hourExecutorService = Executors.newFixedThreadPool(3);
|
|
|
|
|
|
- /**
|
|
|
- * 获取前天~昨天账户日报
|
|
|
- *
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- @XxlJob("accountDailyReport")
|
|
|
- public void accountDailyReport() 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("accountDailyReport")
|
|
|
+ public void accountDailyReport() 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 nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
+ String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
|
|
|
+ String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -2);
|
|
|
+ dailyExecutorService.submit(
|
|
|
+ new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ kuaishouAccountReportDailyService.getAdvertiserReportDaily(Long.valueOf(param), token, startDate, endDate, 1);
|
|
|
+ } catch (Exception exception) {
|
|
|
+ exception.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
- String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
|
|
|
- String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -2);
|
|
|
- dailyExecutorService.submit(
|
|
|
- new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- try {
|
|
|
- kuaishouAccountReportDailyService.getAdvertiserReportDaily(Long.valueOf(param), token, startDate, endDate, 1);
|
|
|
- } catch (Exception exception) {
|
|
|
- exception.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 获取当天账户时报
|
|
|
+ *
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @XxlJob("accountNowDateHourReport")
|
|
|
+ public void accountNowDateHourReport() 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("accountNowDateHourReport")
|
|
|
- public void accountNowDateHourReport() 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 nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
+ hourExecutorService.submit(
|
|
|
+ new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ kuaishouAccountReportHourlyService.getAdvertiserReportHour(
|
|
|
+ Long.valueOf(param), token, nowDate, nowDate, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
- hourExecutorService.submit(
|
|
|
- new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- kuaishouAccountReportHourlyService.getAdvertiserReportHour(
|
|
|
- Long.valueOf(param), token, nowDate, nowDate, 1);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 获取昨天账户时报
|
|
|
+ *
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @XxlJob("accountYesterdayHourReport")
|
|
|
+ public void accountYesterdayHourReport() 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("accountYesterdayHourReport")
|
|
|
- public void accountYesterdayHourReport() throws Exception {
|
|
|
- String param = XxlJobHelper.getJobParam(); // 执行参数
|
|
|
- if (Check.isNull(param)) {
|
|
|
- log.error("入参为空");
|
|
|
- return;
|
|
|
+ String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
+ String start = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -2);
|
|
|
+ String end = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
|
|
|
+ hourExecutorService.submit(
|
|
|
+ new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ kuaishouAccountReportHourlyService.getAdvertiserReportHour(
|
|
|
+ Long.valueOf(param), token, start, end, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- String token = tokenService.getByAccountId(Long.valueOf(param));
|
|
|
- if (Check.isNull(token)) {
|
|
|
- log.error("此账户未获取到相关token,accountId:{}", param);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
- String yesterda = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
|
|
|
- hourExecutorService.submit(
|
|
|
- new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- kuaishouAccountReportHourlyService.getAdvertiserReportHour(
|
|
|
- Long.valueOf(param), token, yesterda, yesterda, 1);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
}
|