|
@@ -673,35 +673,6 @@ public class TestController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @GetMapping(value = "/getSuZhao")
|
|
|
- public void getSuZhao() throws JobExecutionException {
|
|
|
- try {
|
|
|
- //1:查询当日数据
|
|
|
- QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("media_id", 2);
|
|
|
- queryWrapper.orderByDesc("create_time");
|
|
|
- List<CtopOauthToken> tokens = tokenService.list(queryWrapper);
|
|
|
- if (null == tokens || tokens.size() <= 0) {
|
|
|
- log.info("定时获取快手数据异常:未获取到可用的token");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- tokens.forEach(token -> {
|
|
|
- suzhaoService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- //1: 获取广告主信息数据
|
|
|
- log.info("获取素造素材:accountId:{}", token.getAccountId());
|
|
|
- kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, null, null);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/getAccountList")
|
|
@@ -742,92 +713,6 @@ public class TestController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @GetMapping(value = "/getVideo")
|
|
|
- public String getVideo(String startDate, String endDate) throws IOException {
|
|
|
- try {
|
|
|
- Thread thread = new Thread() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
- tokenQueryWrapper.eq("media_id", 2);
|
|
|
- List<CtopOauthToken> list = tokenService.list(tokenQueryWrapper);
|
|
|
- list.forEach(token -> {
|
|
|
- videoService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- try {
|
|
|
- kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, null, null);
|
|
|
- kuaishouInterfaceService.getVideoList(token, null, null);
|
|
|
- Thread.sleep(5000);
|
|
|
- /*String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
- String videoEndDate = DateUtils.addDay(nowDate, -180);
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date end = simpleDateFormat.parse(nowDate);
|
|
|
- Date start = simpleDateFormat.parse(videoEndDate);
|
|
|
- List<Date> dates = DateUtils.findDates(start, end);
|
|
|
- for (int i = 0; i < dates.size(); i++) {
|
|
|
- String formatDate = simpleDateFormat.format(dates.get(i));
|
|
|
- kuaishouInterfaceService.getImageList(token, formatDate);
|
|
|
- Thread.sleep(500);
|
|
|
- }*/
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- } finally {
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- log.info("快手物料数据同步完成");
|
|
|
- }
|
|
|
- };
|
|
|
- thread.start();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return "Success";
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @GetMapping(value = "/getVideoByAccountId")
|
|
|
- public String getVideoByAccountId(Long accountId) throws IOException {
|
|
|
- try {
|
|
|
- Thread thread = new Thread() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
- tokenQueryWrapper.eq("media_id", 2);
|
|
|
- tokenQueryWrapper.eq("account_id", accountId);
|
|
|
- CtopOauthToken one = tokenService.getOne(tokenQueryWrapper);
|
|
|
- try {
|
|
|
- kuaishouInterfaceService.getSuZaoList(one.getAccessToken(), one.getAccountId(), 1, null, null);
|
|
|
- kuaishouInterfaceService.getVideoList(one, null, null);
|
|
|
- String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
- String videoEndDate = DateUtils.addDay(nowDate, -180);
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date end = simpleDateFormat.parse(nowDate);
|
|
|
- Date start = simpleDateFormat.parse(videoEndDate);
|
|
|
- List<Date> dates = DateUtils.findDates(start, end);
|
|
|
- for (int i = 0; i < dates.size(); i++) {
|
|
|
- String formatDate = simpleDateFormat.format(dates.get(i));
|
|
|
-
|
|
|
- kuaishouInterfaceService.getImageList(one, formatDate);
|
|
|
- Thread.sleep(100);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- } finally {
|
|
|
- }
|
|
|
- log.info("快手物料数据同步完成");
|
|
|
- }
|
|
|
- };
|
|
|
- thread.start();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return "Success";
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
@GetMapping(value = "/createCutTask")
|
|
|
public String createCutTask(String startDate, String endDate) throws IOException {
|