|
@@ -15,6 +15,7 @@ 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.toutiao.modules.link.service.IETLReportBytedanceVideoService;
|
|
|
import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
|
|
|
import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
|
|
|
import cn.com.ctop.toutiao.modules.report.mapper.BytedanceReportMaterialDailyMapper;
|
|
@@ -22,6 +23,7 @@ import cn.com.ctop.toutiao.modules.report.service.*;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.xxl.job.core.context.XxlJobHelper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
@@ -54,7 +56,7 @@ import static org.jeecg.common.util.DateUtils.getAnotherDay;
|
|
|
@RequestMapping("/test")
|
|
|
@Slf4j
|
|
|
public class TestController {
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private CtopOauthTokenMapper tokenMapper;
|
|
|
@Autowired
|
|
|
private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
@@ -107,7 +109,7 @@ public class TestController {
|
|
|
|
|
|
@Autowired
|
|
|
private IBindAccountAuthService bindAccountAuthService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private UserAllocationMapper allocationMapper;
|
|
|
@Autowired
|
|
|
private IBytedanceReportService bytedanceReportService;
|
|
@@ -1364,4 +1366,37 @@ public class TestController {
|
|
|
ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ private ExecutorService executor = Executors.newFixedThreadPool(10);
|
|
|
+ private CountDownLatch countDownLatch;
|
|
|
+ @Autowired
|
|
|
+ IBytedanceVideoReportService bytedanceVideoReportService;
|
|
|
+ @Autowired
|
|
|
+ IETLReportBytedanceVideoService etlReportBytedanceVideoService;
|
|
|
+ @GetMapping("execute")
|
|
|
+ public Map<String,Object> execute(String date) throws Exception {
|
|
|
+ Map<String,Object>result = new HashMap<>();
|
|
|
+ List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
|
|
|
+ countDownLatch = new CountDownLatch(tokens.size());
|
|
|
+ tokens.forEach(token -> executor.submit(() -> {
|
|
|
+ try {
|
|
|
+ bytedanceVideoReportService.pullVideoReport(token,date,date,1);
|
|
|
+ } catch (Exception e) {
|
|
|
+ XxlJobHelper.log("头条视频报表基础数据拉取异常:{}",e.getMessage());
|
|
|
+ } finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ try {
|
|
|
+ countDownLatch.await();
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if(!executorService.isShutdown()){
|
|
|
+ executorService.shutdown();
|
|
|
+ }
|
|
|
+ etlReportBytedanceVideoService.cleanETL(date);
|
|
|
+ ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|