|
@@ -435,84 +435,6 @@ public class TestController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- @GetMapping("formatYddData")
|
|
|
- public Map<String, Object> formatYddData() throws Exception {
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
- //清洗关于缘多多数据
|
|
|
- //1:查询缘多多相关的用户数据
|
|
|
- QueryWrapper<UserAllocation> yddWrapper = new QueryWrapper<>();
|
|
|
- yddWrapper.eq("project_id", 113);
|
|
|
- List<UserAllocation> yddallocations = userAllocationService.list(yddWrapper);
|
|
|
- if (null != yddallocations && yddallocations.size() > 0) {
|
|
|
- yddallocations.forEach(allocation -> {
|
|
|
- //根据accountId和时间,查询相关的日报表信息
|
|
|
- QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("advertiser_id", allocation.getAccountId())
|
|
|
- //.eq("stat_datetime",dateString)
|
|
|
- ;
|
|
|
- List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
|
|
|
- if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
|
|
|
- bytedancePlanDailyReports.forEach(report -> {
|
|
|
- String adName = report.getAdName();
|
|
|
- String[] tags = adName.split("-");
|
|
|
- report.setChannelCode(tags[0]);
|
|
|
- planDailyReportService.updateById(report);
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- //清洗关于缘多多数据
|
|
|
- //1:查询缘多多相关的用户数据
|
|
|
- QueryWrapper<UserAllocation> dsjyWrapper = new QueryWrapper<>();
|
|
|
- yddWrapper.eq("project_id", 112);
|
|
|
- List<UserAllocation> dsjyAllocations = userAllocationService.list(dsjyWrapper);
|
|
|
- if (null != dsjyAllocations && dsjyAllocations.size() > 0) {
|
|
|
- dsjyAllocations.forEach(allocation -> {
|
|
|
- //根据accountId和时间,查询相关的日报表信息
|
|
|
- QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("advertiser_id", allocation.getAccountId())
|
|
|
- //.eq("stat_datetime",dateString)
|
|
|
- ;
|
|
|
- List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
|
|
|
- if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
|
|
|
- bytedancePlanDailyReports.forEach(report -> {
|
|
|
- String adName = report.getAdName();
|
|
|
- String[] tags = adName.split("-");
|
|
|
- report.setChannelCode(tags[0]);
|
|
|
- planDailyReportService.updateById(report);
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- //清洗关于缘多多数据
|
|
|
- //1:查询缘多多相关的用户数据
|
|
|
- QueryWrapper<UserAllocation> fjyhWrapper = new QueryWrapper<>();
|
|
|
- yddWrapper.eq("project_id", 222);
|
|
|
- List<UserAllocation> fjyhAllocations = userAllocationService.list(fjyhWrapper);
|
|
|
- if (null != fjyhAllocations && fjyhAllocations.size() > 0) {
|
|
|
- fjyhAllocations.forEach(allocation -> {
|
|
|
- //根据accountId和时间,查询相关的日报表信息
|
|
|
- QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("advertiser_id", allocation.getAccountId())
|
|
|
- //.eq("stat_datetime",dateString)
|
|
|
- ;
|
|
|
- List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
|
|
|
- if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
|
|
|
- bytedancePlanDailyReports.forEach(report -> {
|
|
|
- String adName = report.getAdName();
|
|
|
- String[] tags = adName.split("-");
|
|
|
- report.setChannelCode(tags[0]);
|
|
|
- planDailyReportService.updateById(report);
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
//线程计数器
|
|
|
static CountDownLatch countDownLatch = null;
|
|
|
|
|
@@ -562,6 +484,18 @@ public class TestController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("formatYzData")
|
|
|
+ public Map<String, Object> formatYzData() {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ formatYzData(151, new Date());
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void formatYzData(int projectId, Date getDate) {
|
|
|
+ planDailyReportService.cleanYzData(projectId);
|
|
|
+ }
|
|
|
+
|
|
|
private void formatData(Integer projectId, Date finalGetDate) {
|
|
|
QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("project_id", projectId);
|
|
@@ -591,6 +525,84 @@ public class TestController {
|
|
|
@Autowired
|
|
|
private IBytedancePlanHourlyReportService planHourlyReportService;
|
|
|
|
|
|
+ @GetMapping("loadCreativeData")
|
|
|
+ public Map<String, Object> loadCreaticeData() {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
|
|
|
+ log.info("头条创意素材数据开始获取");
|
|
|
+ //查询当日数据
|
|
|
+ if (null == tokens || tokens.size() <= 0) {
|
|
|
+ log.info("定时获取头条数据异常:wei获取到可用的token");
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SERVER_ERROR);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ executorService = Executors.newFixedThreadPool(20);
|
|
|
+ countDownLatch = new CountDownLatch(tokens.size());
|
|
|
+ tokens.forEach(token -> {
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ //4: 获取广告创意信息数据
|
|
|
+ try {
|
|
|
+ advertiserDataService.getAdvertiserCreative(token, null);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ countDownLatch.await();
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ log.info("头条创意素材数据获取完成");
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("loadCreaticeReportData")
|
|
|
+ public Map<String, Object> loadCreaticeReportData() {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
|
|
|
+ for (int i = 47; i < 180; i++) {
|
|
|
+ Date getDate = DateUtils.addDay(new Date(), -i);
|
|
|
+ log.info(DateUtils.formatDate(getDate) + "头条创意日报数据开始获取");
|
|
|
+ //查询当日数据
|
|
|
+ if (null == tokens || tokens.size() <= 0) {
|
|
|
+ log.info("定时获取头条数据异常:为获取到可用的token");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ executorService = Executors.newFixedThreadPool(20);
|
|
|
+ countDownLatch = new CountDownLatch(tokens.size());
|
|
|
+ tokens.forEach(token -> {
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ //4: 获取广告创意信息数据
|
|
|
+ try {
|
|
|
+ reportService.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ countDownLatch.await();
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ log.info(DateUtils.formatDate(getDate) + "头条创意日报数据获取完成");
|
|
|
+ }
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("loadVideoData")
|
|
|
public Map<String, Object> loadVideoData() {
|
|
|
log.info("素材数据获取开始");
|