|
@@ -967,54 +967,4 @@ public class TestController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- @Autowired
|
|
|
- public IBytedanceInterfaceService bytedanceInterfaceService;
|
|
|
-
|
|
|
- @GetMapping(value = "/searchLog")
|
|
|
- public Result searchLog(@Param("accountId")Long accountId, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("operationTarget")Integer operationTarget) {
|
|
|
- Result result = new Result();
|
|
|
-
|
|
|
- if(accountId == null){
|
|
|
- //1:查询当日数据
|
|
|
- QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("media_id", 1);
|
|
|
- queryWrapper.orderByDesc("create_time");
|
|
|
- List<CtopOauthToken> tokens = tokenService.list(queryWrapper);
|
|
|
- if (null == tokens || tokens.size() <= 0) {
|
|
|
- log.error("定时获取快手操作记录数据异常:未获取到可用的token");
|
|
|
- result.setSuccess(false);
|
|
|
- result.setMessage("定时获取快手操作记录数据异常:未获取到可用的toke");
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- executorService = Executors.newFixedThreadPool(8);
|
|
|
- tokens.forEach(token -> {
|
|
|
- executorService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- log.info("获取操作记录开始:accountId:{},startDate:{},endDate:{}", token.getAccountId(), startDate, endDate);
|
|
|
- bytedanceInterfaceService.searchLog(token.getAccountId(), token, operationTarget,startDate, endDate);
|
|
|
- log.info("获取快手操作记录结束:accountId:{},startDate:{},endDate:{}", token.getAccountId(), startDate, endDate);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- }else{
|
|
|
- QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("account_id", accountId);
|
|
|
- CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(accountId));
|
|
|
- if (null == token) {
|
|
|
- log.error("定时获取头条操作记录数据异常:未获取到可用的token");
|
|
|
- result.setSuccess(false);
|
|
|
- result.setMessage("定时获取头条操作记录数据异常:未获取到可用的toke");
|
|
|
- return result;
|
|
|
- }
|
|
|
- log.info("获取快手操作记录开始:accountId:{},startDate:{},endDate:{}", token.getAccountId(), startDate, endDate);
|
|
|
- bytedanceInterfaceService.searchLog(accountId, token, operationTarget,startDate, endDate);
|
|
|
- log.info("获取快手操作记录结束:accountId:{},startDate:{},endDate:{}", token.getAccountId(), startDate, endDate);
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
}
|