|
@@ -2,11 +2,13 @@ package org.jeecg.modules.ctop.controller;
|
|
|
|
|
|
import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
|
|
import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
|
|
import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
|
|
import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
|
|
|
|
+import cn.com.ctop.bytedance.service.IReportService;
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
|
|
+import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
import cn.com.ctop.common.module.utils.ResultMapUtils;
|
|
import cn.com.ctop.common.module.utils.ResultMapUtils;
|
|
import cn.com.ctop.common.module.utils.StatusCode;
|
|
import cn.com.ctop.common.module.utils.StatusCode;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
@@ -309,6 +311,50 @@ public class TestController {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IReportService reportService;
|
|
|
|
+
|
|
|
|
+ @GetMapping("bytedanceHourReport")
|
|
|
|
+ public Map<String, Object> testReport() {
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
|
+ log.info("头条时报数据获取开始");
|
|
|
|
+ Date getDate = new Date();
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
|
|
|
|
+ String hour = simpleDateFormat.format(getDate);
|
|
|
|
+ if (null != hour && "00".equals(hour)) {
|
|
|
|
+ getDate = DateUtils.addDay(getDate, -1);
|
|
|
|
+ }
|
|
|
|
+ //1:查询当日数据
|
|
|
|
+ List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
|
|
|
|
+ if (null == tokens || tokens.size() <= 0) {
|
|
|
|
+ log.info("定时获取头条小时数据异常:未获取到可用的token");
|
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ executorService = Executors.newFixedThreadPool(4);
|
|
|
|
+ Date finalGetDate = getDate;
|
|
|
|
+ tokens.forEach(token -> {
|
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ //1: 获取广告主信息数据
|
|
|
|
+ reportService.getAdvertiserReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
|
+ //2:获取广告组信息数据
|
|
|
|
+ //reportService.getAdvertiserCampaignReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
|
+ //3:获取广告计划信息数据
|
|
|
|
+ //reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
|
+ //4: 获取广告创意信息数据
|
|
|
|
+ //reportService.getAdvertiserCreativeReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ log.info("头条时报数据获取结束");
|
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
@GetMapping("formatYddData")
|
|
@GetMapping("formatYddData")
|
|
public Map<String, Object> formatYddData() throws Exception {
|
|
public Map<String, Object> formatYddData() throws Exception {
|
|
Map<String, Object> result = new HashMap<>();
|
|
Map<String, Object> result = new HashMap<>();
|