|
@@ -14,7 +14,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.*;
|
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
|
import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
|
|
|
import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
|
|
|
-import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
|
|
|
+import cn.com.ctop.kuaishou.modules.report.service.*;
|
|
|
import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
|
|
|
import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
|
|
|
import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
|
|
@@ -128,10 +128,12 @@ public class TestController {
|
|
|
|
|
|
@Autowired
|
|
|
private IEtlKuaiShouNewlyService newlyService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouReportDailyGroupService reportDailyGroupService;
|
|
|
|
|
|
|
|
|
@GetMapping("/cleanNewlyData")
|
|
|
- public void cleanNewlyData(String date) {
|
|
|
+ public void cleanNewlyData() {
|
|
|
Date endDate = new Date();
|
|
|
List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
for (int i = 0; i < 7; i++) {
|
|
@@ -150,7 +152,8 @@ public class TestController {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@GetMapping("/getVideoByProjectId")
|
|
|
public String getVideoByProjectId(Long projectId) {
|
|
@@ -451,26 +454,6 @@ public class TestController {
|
|
|
|
|
|
}
|
|
|
|
|
|
- @GetMapping(value = "/getGroupReport")
|
|
|
- public void getGroupReport() throws ParseException {
|
|
|
- List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date parse1 = simpleDateFormat.parse("2020-09-12");
|
|
|
- Date parse2 = simpleDateFormat.parse("2020-09-17");
|
|
|
- for (CtopOauthToken token : tokens) {
|
|
|
-
|
|
|
- suzhaoService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- //1: 获取广告主信息数据
|
|
|
- kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, parse1, parse2);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
@GetMapping(value = "/syncDouyinMusicAsc")
|
|
|
public String syncDouyinMusicAsc() {
|
|
@@ -700,43 +683,6 @@ public class TestController {
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
- @GetMapping(value = "/getAccountList")
|
|
|
- public void getAccountList(String startDate, String endDate) throws JobExecutionException {
|
|
|
- Thread thread = new Thread() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- 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, start, end);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- };
|
|
|
- thread.start();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
@GetMapping(value = "/createCutTask")
|
|
|
public String createCutTask(String startDate, String endDate) throws IOException {
|
|
@@ -760,13 +706,6 @@ public class TestController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /* @GetMapping(value = "/getToken")
|
|
|
- public String getToken(Long accountId, String token, String refreshToken, Integer agentType) {
|
|
|
- oauthTokenService.getKuaiShouRefreshToken(accountId, token, refreshToken, agentType);
|
|
|
- return "Success";
|
|
|
- }*/
|
|
|
-
|
|
|
-
|
|
|
@GetMapping(value = "/getAccountReport")
|
|
|
public String getAccountReport(Long accountId, String startDate, String endDate) throws ParseException {
|
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
@@ -777,34 +716,11 @@ public class TestController {
|
|
|
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Date date1 = sim.parse(startDate);
|
|
|
Date date2 = sim.parse(endDate);
|
|
|
- kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
|
|
|
+ // kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
|
|
|
return "Success";
|
|
|
}
|
|
|
|
|
|
|
|
|
- @GetMapping(value = "/getAccountReportList")
|
|
|
- public String getAccountReportList(String startDate, String endDate) {
|
|
|
- Result<String> result = new Result<>();
|
|
|
- try {
|
|
|
- SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date date1 = sim.parse(startDate);
|
|
|
- Date date2 = sim.parse(endDate);
|
|
|
- QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
- tokenQueryWrapper.eq("media_id", 2);
|
|
|
- List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
|
|
|
- if (!Check.isNull(ctopOauthTokens)) {
|
|
|
- for (CtopOauthToken token : ctopOauthTokens) {
|
|
|
- kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- result.setSuccess(false);
|
|
|
- }
|
|
|
- return "success";
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@GetMapping(value = "/updateCode")
|
|
|
public String updateCode() {
|
|
|
List<MaterialInfo> list = materialInfoService.list();
|
|
@@ -941,38 +857,6 @@ public class TestController {
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
- @GetMapping(value = "/getGroupData")
|
|
|
- public String getGroupData() {
|
|
|
-
|
|
|
-
|
|
|
- Date endDate = new Date();
|
|
|
- QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
- tokenQueryWrapper.eq("media_id", 2);
|
|
|
- List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
|
|
|
- for (CtopOauthToken token : ctopOauthTokens) {
|
|
|
-
|
|
|
- for (int i = 0; i < 7; i++) {
|
|
|
- Date getStartDate = DateUtils.addDay(endDate, -i);
|
|
|
- //3:获取广告组信息数据
|
|
|
- kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, getStartDate, getStartDate);
|
|
|
- }
|
|
|
- for (int i = 0; i < 6; i++) {
|
|
|
- Date getStartDate = new Date();
|
|
|
- Date getEndDate = new Date();
|
|
|
- if (i == 0) {
|
|
|
- getStartDate = DateUtils.addDay(endDate, -175 + i * 30);
|
|
|
- getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
|
|
|
- } else {
|
|
|
- getStartDate = DateUtils.addDay(endDate, -180 + i * 30);
|
|
|
- getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
|
|
|
- }
|
|
|
- //3:获取广告组信息数据
|
|
|
- kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getStartDate, getEndDate);
|
|
|
- }
|
|
|
- }
|
|
|
- return "Success";
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
@GetMapping(value = "/gerCreative")
|
|
|
public void gerCreative() {
|
|
@@ -1063,13 +947,6 @@ public class TestController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IBytedancePlanDailyReportService planDailyReportService;
|
|
|
- @Autowired
|
|
|
- private ICtopOauthTokenService tokenService;
|
|
|
-
|
|
|
-
|
|
|
@Autowired
|
|
|
private IByteDanceAdvertiserDataService advertiserDataService;
|
|
|
|
|
@@ -1098,38 +975,6 @@ public class TestController {
|
|
|
private IBytedancePlanHourlyReportService planHourlyReportService;
|
|
|
|
|
|
|
|
|
- @GetMapping(value = "/AccountReportByAccount")
|
|
|
- public void AccountReportByAccount(Long accountId, String startDateStr, String endDateStr) {
|
|
|
- QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
|
- oauthTokenQueryWrapper.eq("media_id", 2);
|
|
|
- oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
|
- oauthTokenQueryWrapper.last("limit 1");
|
|
|
- CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
- executorService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- try {
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date startDate = null;
|
|
|
- Date endDate = null;
|
|
|
- try {
|
|
|
- startDate = simpleDateFormat.parse(startDateStr);
|
|
|
- endDate = simpleDateFormat.parse(endDateStr);
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- kuaishouInterfaceService.getAdvertiserReportDaily(token, startDate, endDate);
|
|
|
-
|
|
|
- Thread.sleep(1 * 200);
|
|
|
- // kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@GetMapping(value = "/getAllCreativeList")
|
|
|
public void getAllCreativeList() {
|
|
|
|
|
@@ -1188,27 +1033,7 @@ public class TestController {
|
|
|
|
|
|
}
|
|
|
|
|
|
- @GetMapping(value = "/KuaishouDailyAccountReportLoadJob")
|
|
|
- public void KuaishouDailyAccountReportLoadJob() {
|
|
|
- Date getDate = DateUtils.addDay(new Date(), -2);
|
|
|
- //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);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
@Autowired
|
|
|
private IBytedanceEffectVideoInfoService effectVideoInfoService;
|
|
@@ -1405,13 +1230,6 @@ public class TestController {
|
|
|
IBytedanceVideoReportService bytedanceVideoReportService;
|
|
|
@Autowired
|
|
|
IETLReportBytedanceVideoService etlReportBytedanceVideoService;
|
|
|
- @GetMapping("execute")
|
|
|
- public Map<String,Object> execute(Long accountId) throws Exception {
|
|
|
- Map<String,Object>result = new HashMap<>();
|
|
|
- CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
|
- kuaishouInterfaceService.getGroupList(token,new Date(),new Date());
|
|
|
- kuaishouInterfaceService.getAdvertiserGroupReportDaily(token,new Date(),new Date());
|
|
|
- ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
|
|
|
- return result;
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
}
|