|
@@ -94,28 +94,36 @@ public class TestController {
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/getAccountList")
|
|
@GetMapping(value = "/getAccountList")
|
|
- public void getAccountList() throws JobExecutionException {
|
|
|
|
|
|
+ public void getAccountList(String startDate, String endDate) throws JobExecutionException {
|
|
Thread thread = new Thread() {
|
|
Thread thread = new Thread() {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
- Date getDate = DateUtils.addDay(new Date(), -1);
|
|
|
|
- //1:查询当日数据
|
|
|
|
- List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
|
- if (null == tokens || tokens.size() <= 0) {
|
|
|
|
- log.info("定时获取快手数据异常:未获取到可用的token");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ try {
|
|
|
|
+ Date start = sim.parse(startDate);
|
|
|
|
+ Date end = sim.parse(endDate);
|
|
|
|
+ //1:查询当日数据
|
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
|
+ if (null == tokens || tokens.size() <= 0) {
|
|
|
|
+ log.info("定时获取快手数据异常:未获取到可用的token");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
- executorService = Executors.newFixedThreadPool(3);
|
|
|
|
- tokens.forEach(token -> {
|
|
|
|
- executorService.submit(new Runnable() {
|
|
|
|
- @Override
|
|
|
|
- public void run() {
|
|
|
|
- //1: 获取广告主信息数据
|
|
|
|
- kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
|
|
|
|
- }
|
|
|
|
|
|
+ executorService = Executors.newFixedThreadPool(3);
|
|
|
|
+ tokens.forEach(token -> {
|
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ //1: 获取广告主信息数据
|
|
|
|
+ kuaishouInterfaceService.getAdvertiserReportDaily(token, start, end);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
});
|
|
});
|
|
- });
|
|
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
};
|
|
};
|
|
thread.start();
|
|
thread.start();
|