|
@@ -1,6 +1,7 @@
|
|
|
package cn.com.ctop.job.bytedance.handler;
|
|
package cn.com.ctop.job.bytedance.handler;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+import cn.com.ctop.job.bytedance.data.service.IBytedanceProductReportService;
|
|
|
import cn.com.ctop.job.bytedance.data.service.IBytedancePromoterReportService;
|
|
import cn.com.ctop.job.bytedance.data.service.IBytedancePromoterReportService;
|
|
|
import cn.com.ctop.job.bytedance.data.service.IChannelService;
|
|
import cn.com.ctop.job.bytedance.data.service.IChannelService;
|
|
|
import cn.com.ctop.job.bytedance.data.utils.Check;
|
|
import cn.com.ctop.job.bytedance.data.utils.Check;
|
|
@@ -26,6 +27,9 @@ import java.util.concurrent.Executors;
|
|
|
@Component
|
|
@Component
|
|
|
public class BytedancePromoterReportJob {
|
|
public class BytedancePromoterReportJob {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
|
+ private IBytedanceProductReportService productReportService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
private IBytedancePromoterReportService promoterReportService;
|
|
private IBytedancePromoterReportService promoterReportService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IChannelService channelService;
|
|
private IChannelService channelService;
|
|
@@ -36,6 +40,10 @@ public class BytedancePromoterReportJob {
|
|
|
private static ExecutorService dailyRetrExecutorService = Executors.newFixedThreadPool(2);
|
|
private static ExecutorService dailyRetrExecutorService = Executors.newFixedThreadPool(2);
|
|
|
private static ExecutorService hourRetrExecutorService = Executors.newFixedThreadPool(2);
|
|
private static ExecutorService hourRetrExecutorService = Executors.newFixedThreadPool(2);
|
|
|
|
|
|
|
|
|
|
+ private static ExecutorService productDailyExecutor = Executors.newFixedThreadPool(2);
|
|
|
|
|
+ private static ExecutorService productDailyRetrExecutor = Executors.newFixedThreadPool(2);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@XxlJob("promoterReport")
|
|
@XxlJob("promoterReport")
|
|
|
public void promoterReport() throws Exception {
|
|
public void promoterReport() throws Exception {
|
|
|
List<JSONObject> accountList = promoterReportService.getAccountList();
|
|
List<JSONObject> accountList = promoterReportService.getAccountList();
|
|
@@ -57,7 +65,7 @@ public class BytedancePromoterReportJob {
|
|
|
@Override
|
|
@Override
|
|
|
public void run() {
|
|
public void run() {
|
|
|
if (!Check.isNull(accessToken)) {
|
|
if (!Check.isNull(accessToken)) {
|
|
|
- promoterReportService.getBytedanceRetryPromoterHourReport(id, advertiserId, accessToken, startDate, endDate, 1,isSend);
|
|
|
|
|
|
|
+ promoterReportService.getBytedanceRetryPromoterHourReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -67,15 +75,22 @@ public class BytedancePromoterReportJob {
|
|
|
@Override
|
|
@Override
|
|
|
public void run() {
|
|
public void run() {
|
|
|
if (!Check.isNull(accessToken)) {
|
|
if (!Check.isNull(accessToken)) {
|
|
|
- promoterReportService.getBytedancePromoterRetryDailyReport(id, advertiserId, accessToken, startDate, endDate, 1,isSend);
|
|
|
|
|
|
|
+ promoterReportService.getBytedancePromoterRetryDailyReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ } else if ("product".equals(dataDimension)) {
|
|
|
|
|
+ productDailyRetrExecutor.submit(new Runnable() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ if (!Check.isNull(accessToken)) {
|
|
|
|
|
+ productReportService.getBytedanceProductDailyReport(advertiserId, accessToken, startDate, endDate, 1, id, null, isSend);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -96,7 +111,7 @@ public class BytedancePromoterReportJob {
|
|
|
JSONObject jsonObject = channelList.get(i);
|
|
JSONObject jsonObject = channelList.get(i);
|
|
|
String channelAccountId = jsonObject.getString("channelAccountId");
|
|
String channelAccountId = jsonObject.getString("channelAccountId");
|
|
|
String secretKey = jsonObject.getString("secretKey");
|
|
String secretKey = jsonObject.getString("secretKey");
|
|
|
- String startDate = DateUtils.getNowAddDate("yyyy-MM-dd",-1);
|
|
|
|
|
|
|
+ String startDate = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
|
|
|
String endDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
String endDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
channelService.getPromotionIdList(startDate, endDate, channelAccountId, secretKey, 0);
|
|
channelService.getPromotionIdList(startDate, endDate, channelAccountId, secretKey, 0);
|
|
|
}
|
|
}
|
|
@@ -118,15 +133,14 @@ public class BytedancePromoterReportJob {
|
|
|
String accessToken = s[1];
|
|
String accessToken = s[1];
|
|
|
|
|
|
|
|
hourExecutorService.submit(new Runnable() {
|
|
hourExecutorService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
|
|
- public void run() {
|
|
|
|
|
- promoterReportService.getBytedancePromoterHour(advertiserId, accessToken, date, date, 1, 1);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ promoterReportService.getBytedancePromoterHour(advertiserId, accessToken, date, date, 1, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
@XxlJob("yesReportPromoterReport")
|
|
@XxlJob("yesReportPromoterReport")
|
|
|
public void yesReportPromoterReport() throws Exception {
|
|
public void yesReportPromoterReport() throws Exception {
|
|
|
String param = XxlJobHelper.getJobParam(); // 执行参数
|
|
String param = XxlJobHelper.getJobParam(); // 执行参数
|
|
@@ -149,5 +163,27 @@ public class BytedancePromoterReportJob {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @XxlJob("productReport")
|
|
|
|
|
+ public void productReport() throws Exception {
|
|
|
|
|
+ String param = XxlJobHelper.getJobParam(); // 执行参数
|
|
|
|
|
+ if (Check.isNull(param)) {
|
|
|
|
|
+ log.error("入参为空");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
|
|
+ String data = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
|
|
|
|
|
+ String[] s = param.split("_");
|
|
|
|
|
+ Long advertiserId = Long.valueOf(s[0]);
|
|
|
|
|
+ String accessToken = s[1];
|
|
|
|
|
+
|
|
|
|
|
+ productDailyExecutor.submit(new Runnable() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ productReportService.getBytedanceProductDailyReport(advertiserId, accessToken, data, data, 1, null, 1, null);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|