浏览代码

清理历史无用定时任务

songyh 3 年之前
父节点
当前提交
cf63746b03

+ 0 - 3
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/AlarmRuleJob.java

@@ -17,9 +17,6 @@ import java.util.Map;
 @Component
 public class AlarmRuleJob {
     @Autowired
-    private IRuleGroupService ruleGroupService;
-
-    @Autowired
     private RuleAccountTemplateMapper ruleAccountTemplateMapper;
 
     String URLPREFIX = "http://api.tjyourong.com.cn/jeecg-boot/ruleGroup/checkRulesByAccountId?accountId=";

+ 1 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BaseReportVideoDailyLoadJob.java

@@ -24,6 +24,7 @@ public class BaseReportVideoDailyLoadJob {
     IBytedanceVideoReportService bytedanceVideoReportService;
     private ExecutorService executorService = Executors.newFixedThreadPool(10);
     private CountDownLatch countDownLatch;
+    //TODO --待废弃
     @XxlJob("baseReportVideoDailyLoadJob")
     public void execute() throws Exception {
         List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();

+ 1 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCheckAccountMonitoringLinkJob.java

@@ -30,6 +30,7 @@ public class ByteDanceCheckAccountMonitoringLinkJob {
     @Autowired
     private ICtopOauthTokenService oauthTokenService;
 
+    //TODO 待废弃
     @XxlJob("byteDanceCheckAccountMonitoringLinkJob")
     public void execute() throws Exception{
 

+ 1 - 1
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCleanMaterialJob.java

@@ -21,7 +21,7 @@ public class ByteDanceCleanMaterialJob {
     @Autowired
     private IBytedanceCreativeDailyReportService creativeDailyReportService;
     static ExecutorService executorService = Executors.newFixedThreadPool(3);
-
+    //TODO 待废弃
     @XxlJob("byteDanceCleanMaterial")
     public void execute() throws Exception {
         List<String> signatureList = creativeDailyReportService.getSignatureList();

+ 1 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyMaterialReportRetryJob.java

@@ -25,6 +25,7 @@ public class BytedanceDailyMaterialReportRetryJob {
     @Autowired
     private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
 
+    //TODO 待废弃
     @XxlJob("bytedanceDailyMaterialReportRetryJob")
     public void execute() throws Exception {
         XxlJobHelper.log("头条素材报表重试定时任务开始");

+ 1 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceEtlVideoJob.java

@@ -28,6 +28,7 @@ public class BytedanceEtlVideoJob {
         }
     }
 
+    //TODO 待废弃
     @XxlJob("bytedanceEtlVideoProjectJob")
     public void bytedanceEtlVideoProjectJob() throws Exception {
         Date startDate = DateUtils.addDay(new Date(),-2);

+ 1 - 68
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanDailyReportLoadJob.java

@@ -1,21 +1,16 @@
 package cn.com.ctop.job.bytedance.handler;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-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.IReportService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 
@@ -28,17 +23,10 @@ public class BytedancePlanDailyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    @Autowired
-    private IUserAllocationService userAllocationService;
-    @Autowired
-    private IBytedancePlanDailyReportService planDailyReportService;
-
 
     @XxlJob("bytedancePlanDailyReport")
     public void execute() throws Exception {
         Date getDate = DateUtils.addDay(new Date(), -1);
-        //次留用
-        Date getDate2 = DateUtils.addDay(new Date(), -2);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
         if (null == tokens || tokens.isEmpty()) {
@@ -47,63 +35,8 @@ public class BytedancePlanDailyReportLoadJob {
             return ;
         }
         tokens.forEach(token -> reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY));
-        formatZybData(215, getDate);
-        planDailyReportService.cleanChannelCodeData(112, getDate);
-        planDailyReportService.cleanChannelCodeData(113, getDate);
-        planDailyReportService.cleanChannelCodeData(222, getDate);
-        planDailyReportService.cleanYzData(151);
-        planDailyReportService.cleanChannelCodeData(235, getDate);
-        planDailyReportService.cleanChannelCodeData(270, getDate);
-
         //跑次留
+        Date getDate2 = DateUtils.addDay(new Date(), -2);
         tokens.forEach(token -> reportService.getAdvertiserPlanReport(token, getDate2, getDate2, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY));
     }
-
-    private void formatZybData(Integer projectId, Date getDate) {
-        //清洗关于作业帮数据
-        //1:查询作业帮相关的用户数据
-        QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
-        wrapper.eq("project_id", projectId);
-        List<UserAllocation> allocations = userAllocationService.list(wrapper);
-        if (null != allocations && !allocations.isEmpty()) {
-            allocations.forEach(allocation -> {
-                //根据accountId和时间,查询相关的日报表信息
-                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                String dateString = dateFormat.format(getDate) + " 00:00:00";
-                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);
-                    });
-                }
-            });
-        }
-    }
 }

+ 1 - 12
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanHourlyReportLoadJob.java

@@ -28,8 +28,6 @@ public class BytedancePlanHourlyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    @Autowired
-    private IBytedancePlanDailyReportService planDailyReportService;
     static ExecutorService executorService = Executors.newFixedThreadPool(5);
     //线程计数器
     static CountDownLatch countDownLatch = null;
@@ -46,7 +44,7 @@ public class BytedancePlanHourlyReportLoadJob {
         countDownLatch = new CountDownLatch(tokens.size());
         tokens.forEach(token -> executorService.submit(() -> {
                 try {
-                    if (null != hour && "00".equals(hour)) {
+                    if ("00".equals(hour)) {
                         Date finalGetDate = DateUtils.addDay(getDate, -1);
                         reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
                     }
@@ -63,15 +61,6 @@ public class BytedancePlanHourlyReportLoadJob {
         } catch (InterruptedException e) {
             XxlJobHelper.log(e.getMessage());
         }
-        //清洗缘多多数据渠道号
-        if ("00".equals(hour)) {
-            Date lastday = DateUtils.addDay(getDate, -1);
-            planDailyReportService.cleanYddHourlyChannelCode(113, lastday);
-            planDailyReportService.cleanYddHourlyChannelCode(419, lastday);
-        }
-        planDailyReportService.cleanYddHourlyChannelCode(113, getDate);
-        planDailyReportService.cleanYddHourlyChannelCode(419, getDate);
-
         XxlJobHelper.log("头条时报数据获取结束");
     }
 }

+ 1 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePlanRealTimeLoadJob.java

@@ -26,6 +26,7 @@ public class BytedancePlanRealTimeLoadJob {
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
 
+    //TODO 待废弃
     @XxlJob("bytedanceRealTimePlanInfo")
     public void execute() throws Exception {
         //1:查询当日数据

+ 0 - 22
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedancePlanDailyReportMapper.java

@@ -14,27 +14,5 @@ import java.util.List;
  * @Version: V1.0
  */
 public interface BytedancePlanDailyReportMapper extends BaseMapper<BytedancePlanDailyReport> {
-
     void replaceBatch(@Param(value = "reports") List<BytedancePlanDailyReport> dailyReports);
-
-    @Update("update ctop_bytedance_report_plan_daily " +
-            "set channel_code = replace(substring_index(ad_name, '-', 1), '.apk', '') " +
-            "where advertiser_id in (select account_id from ctop_user_allocation where project_id = #{projectId})")
-    void cleanYzData(@Param(value = "projectId") Integer projectId);
-
-    @Update("update ctop_bytedance_report_plan_daily " +
-            "set channel_code = replace(replace(replace(substring_index(ad_name, '-', 2), '衍生计划-', ''), '.apk',''),'-','') " +
-            "where advertiser_id in (select account_id from ctop_user_allocation where project_id = #{projectId}) " +
-            "  and channel_code = '衍生计划' ")
-    void cleanYzDataFuck(@Param(value = "projectId") Integer projectId);
-
-    @Update("update ctop_bytedance_report_plan_daily " +
-            "set channel_code = substring_index(ad_name, '-', 1) " +
-            "where advertiser_id in (select account_id from ctop_user_allocation where project_id = #{projectId}) and stat_datetime =#{date}")
-    void cleanChannelCodeData(@Param(value = "projectId") Integer projectId, @Param(value = "date") String date);
-
-    @Update("update ctop_bytedance_report_plan_hourly report left join ctop_user_allocation allocation on report.advertiser_id = allocation.account_id " +
-            "set channel_code = substring_index(ad_name,'-',2) " +
-            "where allocation.project_id = #{projectId} and allocation.system_type = 'ios' and report.stat_datetime = #{date}")
-    void cleanYddHourlyChannelCode(@Param(value = "projectId") Integer projectId, @Param(value = "date") String date);
 }

+ 0 - 6
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedancePlanDailyReportService.java

@@ -17,10 +17,4 @@ public interface IBytedancePlanDailyReportService extends IService<BytedancePlan
     void loadData(String data, String date);
 
     void replaceBatch(List<BytedancePlanDailyReport> dailyReports);
-
-    void cleanYzData(Integer projectId);
-
-    void cleanChannelCodeData(Integer projectId, Date getDate);
-
-    void cleanYddHourlyChannelCode(Integer projectId, Date getDate);
 }

+ 1 - 19
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedancePlanDailyReportServiceImpl.java

@@ -30,7 +30,7 @@ public class BytedancePlanDailyReportServiceImpl extends ServiceImpl<BytedancePl
     public void loadData(String data, String date) {
         String getData = StringUtils.replaceBlank(data);
         String[]orderDatas = getData.split("|");
-        if(null!=orderDatas&&orderDatas.length>0){
+        if(orderDatas.length>0){
             for (int i=0;i<orderDatas.length;i++) {
                 String orderData = orderDatas[i];
                 String[] orderObjects = orderData.split(",");
@@ -53,22 +53,4 @@ public class BytedancePlanDailyReportServiceImpl extends ServiceImpl<BytedancePl
     public void replaceBatch(List<BytedancePlanDailyReport> dailyReports) {
         dailyReportMapper.replaceBatch(dailyReports);
     }
-
-    @Override
-    public void cleanYzData(Integer projectId) {
-        dailyReportMapper.cleanYzData(projectId);
-        dailyReportMapper.cleanYzDataFuck(projectId);
-    }
-
-    @Override
-    public void cleanChannelCodeData(Integer projectId, Date getDate) {
-        String dateString = DateUtils.formatDate(getDate) + " 00:00:00";
-        dailyReportMapper.cleanChannelCodeData(projectId, dateString);
-    }
-
-    @Override
-    public void cleanYddHourlyChannelCode(Integer projectId, Date getDate) {
-        String dateString = DateUtils.formatDate(getDate);
-        dailyReportMapper.cleanYddHourlyChannelCode(projectId, dateString);
-    }
 }