Forráskód Böngészése

合并creative代码

syh 5 éve
szülő
commit
0f9c43ecd1

+ 1 - 323
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -13,7 +13,6 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskServ
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
-import cn.com.ctop.toutiao.modules.report.entity.BytedancePlanDailyReport;
 import cn.com.ctop.toutiao.modules.report.service.IBytedancePlanDailyReportService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedancePlanHourlyReportService;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
@@ -29,7 +28,6 @@ import org.springframework.web.bind.annotation.RestController;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -99,38 +97,28 @@ public class TestController {
 
     @GetMapping(value = "/updateCode")
     public String updateCode() {
-
         List<MaterialInfo> list = materialInfoService.list();
         for (MaterialInfo info : list) {
-
-
             QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
             imageInfoQueryWrapper.eq("video_id", String.valueOf(info.getId()));
             MaterialImageInfo updateMaterialImageInfo = new MaterialImageInfo();
             updateMaterialImageInfo.setVideoId(info.getCode());
             iMaterialImageInfoService.update(updateMaterialImageInfo, imageInfoQueryWrapper);
-
-
             QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
             tagQueryWrapper.eq("material_id", String.valueOf(info.getId()));
             MaterialTag updateTag = new MaterialTag();
             updateTag.setMaterialId(info.getCode());
             tagService.update(updateTag, tagQueryWrapper);
-
             QueryWrapper<MaterialAscription> materialAscriptionQuery = new QueryWrapper<>();
             materialAscriptionQuery.eq("material_id", String.valueOf(info.getId()));
             MaterialAscription updateMaterialAscription = new MaterialAscription();
             updateMaterialAscription.setMaterialId(info.getCode());
             ascriptionService.update(updateMaterialAscription, materialAscriptionQuery);
-
-
             QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
             parameterQueryWrapper.eq("material_id", String.valueOf(info.getId()));
             MaterialParameter updateMaterialParameter = new MaterialParameter();
             updateMaterialParameter.setMaterialId(info.getCode());
             parameterService.update(updateMaterialParameter, parameterQueryWrapper);
-
-
         }
         List<MaterialImageInfo> list1 = iMaterialImageInfoService.list();
         for (MaterialImageInfo imageInfo : list1) {
@@ -161,11 +149,8 @@ public class TestController {
 
                 }
             }
-
         }
-
         return "SUCCESS";
-
     }
 
 
@@ -376,74 +361,6 @@ public class TestController {
     @Autowired
     private ICtopOauthTokenService tokenService;
 
-    @GetMapping("loadBytedanceData")
-    public Map<String, Object> formatZybData(String date) {
-        Map<String, Object> result = new HashMap<>();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date getDate = null;
-        try {
-            getDate = simpleDateFormat.parse(date);
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
-        //1:查询当日数据
-        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("project_id", 215);
-        List<UserAllocation> allocations = userAllocationService.list(queryWrapper);
-        if (null == allocations || allocations.isEmpty()) {
-            log.info("定时获取头条数据异常:获取用户信息失败");
-        }
-        Date finalGetDate = getDate;
-
-        allocations.forEach(allocation -> {
-            //3:获取广告计划信息数据
-            CtopOauthToken token = oauthTokenMapper.selectByAccountId(allocation.getAccountId());
-            reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-        });
-
-        //清洗关于作业帮数据
-        //1:查询作业帮相关的用户数据
-        allocations.forEach(allocation -> {
-            //根据accountId和时间,查询相关的日报表信息
-            QueryWrapper<BytedancePlanDailyReport> reportQueryWrapper = new QueryWrapper<>();
-            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-            String dateString = dateFormat.format(finalGetDate) + " 00:00:00";
-            queryWrapper.eq("advertiser_id", allocation.getAccountId())
-                    .eq("stat_datetime", dateString)
-            ;
-            List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(reportQueryWrapper);
-            if (null != bytedancePlanDailyReports && !bytedancePlanDailyReports.isEmpty()) {
-                bytedancePlanDailyReports.forEach(report -> {
-                    String adName = report.getAdName();
-                    String[] tags = adName.split("-");
-                    report.setAdsense(tags[1]);
-                    report.setPlanCode(tags[2]);
-                    String materialName = tags[3];
-                    report.setMaterialName(materialName);
-                    if (materialName.contains("其他")) {
-                        report.setMaterialType("其他");
-                    } else if (materialName.contains("图片轮播")) {
-                        report.setMaterialType("图片轮播");
-                    } else if (materialName.contains("大字报")) {
-                        report.setMaterialType("大字报");
-                    } else if (materialName.contains("文字动画")) {
-                        report.setMaterialType("文字动画");
-                    } else if (materialName.contains("采访形式")) {
-                        report.setMaterialType("采访形式");
-                    } else if (materialName.contains("剧情")) {
-                        report.setMaterialType("剧情");
-                    } else if (materialName.contains("口播")) {
-                        report.setMaterialType("口播");
-                    } else {
-                        report.setMaterialType("其他");
-                    }
-                    planDailyReportService.updateById(report);
-                });
-            }
-        });
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
 
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
@@ -465,255 +382,16 @@ public class TestController {
         return result;
     }
 
-    @GetMapping("formatZybData")
-    public Map<String, Object> formatZybData() {
-        //清洗关于作业帮数据
-        //1:查询作业帮相关的用户数据
-        QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
-        wrapper.eq("project_id", 215);
-        List<UserAllocation> allocations = userAllocationService.list(wrapper);
-        if (null != allocations && allocations.size() > 0) {
-            allocations.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.isEmpty()) {
-                    bytedancePlanDailyReports.forEach(report -> {
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setAdsense(tags[1]);
-                        report.setPlanCode(tags[2]);
-                        String materialName = tags[3];
-                        report.setMaterialName(materialName);
-                        if (materialName.contains("其他")) {
-                            report.setMaterialType("其他");
-                        } else if (materialName.contains("图片轮播")) {
-                            report.setMaterialType("图片轮播");
-                        } else if (materialName.contains("大字报")) {
-                            report.setMaterialType("大字报");
-                        } else if (materialName.contains("文字动画")) {
-                            report.setMaterialType("文字动画");
-                        } else if (materialName.contains("采访形式")) {
-                            report.setMaterialType("采访形式");
-                        } else if (materialName.contains("剧情")) {
-                            report.setMaterialType("剧情");
-                        } else if (materialName.contains("口播")) {
-                            report.setMaterialType("口播");
-                        } else {
-                            report.setMaterialType("其他");
-                        }
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
-        }
-        Map<String, Object> result = new HashMap<>();
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
-
     @Autowired
     private IReportService reportService;
 
-    @GetMapping("bytedanceHourReport")
-    public Map<String, Object> bytedanceHourReport() {
-        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.isEmpty()) {
-            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() {
-                    reportService.getAdvertiserReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-                }
-            });
-        });
-        log.info("头条时报数据获取结束");
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
 
-    //线程计数器
-    static CountDownLatch countDownLatch = null;
-
-    @GetMapping("getHourLyYddData")
-    public Map<String, Object> getData() {
-        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);
-        Date finalGetDate = getDate;
-        executorService = Executors.newFixedThreadPool(10);
-        countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> {
-            //1:获取当日广告计划数据
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                        countDownLatch.countDown();
-                    }
-                }
-            });
-        });
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        log.info("头条计划时报数据获取完成");
-        Map<String, Object> result = new HashMap<>();
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
 
-    @GetMapping("formatYzData")
-    public Map<String, Object> formatYzData() {
-        Map<String, Object> result = new HashMap<>();
-        planDailyReportService.cleanYzData(151);
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
+
 
     @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() {
-                    // 获取广告创意信息数据
-                    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 = 51; i < 180; i++) {
-            Date getDate = DateUtils.addDay(new Date(), -i);
-            log.info(DateUtils.formatDate(getDate) + "头条创意日报数据开始获取");
-            //查询当日数据
-            if (null == tokens || tokens.isEmpty()) {
-                log.info("定时获取头条数据异常:为获取到可用的token");
-                continue;
-            }
-            executorService = Executors.newFixedThreadPool(10);
-            countDownLatch = new CountDownLatch(tokens.size());
-            tokens.forEach(token -> {
-                executorService.submit(new Runnable() {
-                    @Override
-                    public void run() {
-                        //获取广告创意日报信息数据
-                        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("素材数据获取开始");
-        //1:查询当日计划时报数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        executorService = Executors.newFixedThreadPool(10);
-        countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> {
-            //1:获取当日广告计划数据
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        advertiserDataService.getMaterialList(token);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                        countDownLatch.countDown();
-                    }
-                }
-            });
-        });
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        log.info("头条素材数据获取完成");
-        Map<String, Object> result = new HashMap<>();
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
 
     @GetMapping(value = "/AccountReportByAccount")
     public void AccountReportByAccount(Long accountId, String startDateStr, String endDateStr) {

+ 1 - 2
jeecg-boot-module-system/src/main/resources/application.yml

@@ -1,7 +1,6 @@
 spring:
   profiles:
-#    active: @activatedProperties@
-    active: prod
+    active: @activatedProperties@
   application:
     name: system-web
 eureka: