Browse Source

修改缘多多数据清洗逻辑代码

syh 5 years ago
parent
commit
585bf323a2

+ 10 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanHourlyReportLoadJob.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.job;
 
+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.service.ICtopOauthTokenService;
@@ -64,9 +65,17 @@ public class BytedancePlanHourlyReportLoadJob implements Job {
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
-        //清洗玫瑰相亲渠道号数据
+        //清洗缘多多数据渠道号
+        if (null != hour && "00".equals(hour)) {
+            Date lastday = DateUtils.addDay(getDate, -1);
+            planDailyReportService.cleanYddHourlyChannelCode(113, lastday);
+        }
+        planDailyReportService.cleanYddHourlyChannelCode(113, getDate);
 
         log.info("头条计划时报数据获取完成");
         executorService.shutdown();
     }
+
+    @Autowired
+    private IBytedancePlanDailyReportService planDailyReportService;
 }

+ 5 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedancePlanDailyReportMapper.java

@@ -32,4 +32,9 @@ public interface BytedancePlanDailyReportMapper extends BaseMapper<BytedancePlan
             "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);
 }

+ 2 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedancePlanDailyReportService.java

@@ -21,4 +21,6 @@ public interface IBytedancePlanDailyReportService extends IService<BytedancePlan
     void cleanYzData(Integer projectId);
 
     void cleanChannelCodeData(Integer projectId, Date getDate);
+
+    void cleanYddHourlyChannelCode(Integer projectId, Date getDate);
 }

+ 6 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedancePlanDailyReportServiceImpl.java

@@ -62,4 +62,10 @@ public class BytedancePlanDailyReportServiceImpl extends ServiceImpl<BytedancePl
         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);
+    }
 }