Pārlūkot izejas kodu

定时任务调整

yumeng 3 gadi atpakaļ
vecāks
revīzija
39f4a20bf6

+ 34 - 9
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouEtlVideoJob.java

@@ -5,12 +5,15 @@ import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoServic
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAccountMaterialReportDailyService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouVideoEtlInfoService;
 import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.Date;
+import java.util.List;
 
+@Slf4j
 @Component
 public class KuaishouEtlVideoJob {
     @Autowired
@@ -21,9 +24,12 @@ public class KuaishouEtlVideoJob {
     private IEtlKuaishouAccountMaterialReportDailyService materialReportDailyService;
     @Autowired
     private IEtlKuaishouVideoInfoService videoEtlInfoService;
+    @Autowired
+    private IEtlKuaishouAccountMaterialReportDailyService etlKuaishouAccountMaterialReportDailyService;
 
     /**
      * 快手爆款有效视频数据清洗
+     *
      * @throws Exception
      */
     @XxlJob("kuaishouEtlVideoJob")
@@ -37,6 +43,7 @@ public class KuaishouEtlVideoJob {
 
     /**
      * 快手视频基础信息表清洗
+     *
      * @throws Exception
      */
     @XxlJob("kuaishouEtlVideoBaseInfoJob")
@@ -49,20 +56,38 @@ public class KuaishouEtlVideoJob {
      * 清洗快手视频归属信息表
      */
     @XxlJob("etlFinalKuaishouVideoInfo")
-    public void etlKuaishouVideoInfo(){
+    public void etlKuaishouVideoInfo() {
         Date startDate = DateUtils.addDay(new Date(), -2);
-        for(int i=0;i<=2;i++){
-            videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
+        for (int i = 0; i <= 2; i++) {
+            videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate, i)));
+        }
+    }
+
+
+    @XxlJob("cleanKuaishouMaterialReport")
+    public void cleanKuaishouMaterialReport() {
+        for (int i = 1; i <= 2; i++) {
+            String date = DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
+            log.info("开始,{}号素材报表清洗", date);
+            List<Long> accountList = etlKuaishouAccountMaterialReportDailyService.getAccountListByDate(date);
+            for (int j = 0; j < accountList.size(); j++) {
+                Long accountId = accountList.get(j);
+                etlKuaishouAccountMaterialReportDailyService.cleanVideoInfo(accountId, date);
+            }
+
+
         }
     }
 
+
+
     /**
      * 快手清洗素材账户报表信息
      */
     @XxlJob("etlKuaishouAccountMaterialReportInfo")
-    public void etlKuaishouAccountMaterialReportInfo(){
-        for(int i=1;i<=2;i++){
-            materialReportDailyService.etlKuaishouAccountMaterialReportInfo(DateUtils.formatDate(DateUtils.addDay(new Date(),-i)));
+    public void etlKuaishouAccountMaterialReportInfo() {
+        for (int i = 1; i <= 2; i++) {
+            materialReportDailyService.etlKuaishouAccountMaterialReportInfo(DateUtils.formatDate(DateUtils.addDay(new Date(), -i)));
         }
     }
 
@@ -70,7 +95,7 @@ public class KuaishouEtlVideoJob {
      * 清洗快手视频报表公司相关数据
      */
     @XxlJob("etlKuaishouReportCompanyInfo")
-    public void etlKuaishouReportCompanyInfo(){
+    public void etlKuaishouReportCompanyInfo() {
         materialReportDailyService.etlKuaishouReportCompanyInfo();
     }
 
@@ -79,7 +104,7 @@ public class KuaishouEtlVideoJob {
      */
     //TODO 待删除
     @XxlJob("etlKuaishouVideoReportStateDate")
-    public void etlKuaishouVideoReportStateDate(){
+    public void etlKuaishouVideoReportStateDate() {
         materialReportDailyService.etlKuaishouVideoReportStateDate();
     }
 
@@ -87,7 +112,7 @@ public class KuaishouEtlVideoJob {
      * 清洗快手视频类型(真人/剪辑)
      */
     @XxlJob("etlKuaishouVideoType")
-    public void etlKuaishouVideoType(){
+    public void etlKuaishouVideoType() {
         materialReportDailyService.etlKuaishouVideoType();
     }
 

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouAccountMaterialReportDailyServiceImpl.java

@@ -89,7 +89,6 @@ public class EtlKuaishouAccountMaterialReportDailyServiceImpl extends ServiceImp
     @Override
     public void cleanVideoInfo(Long accountId, String statDate) {
         accountEtlExecutorService.submit(() -> {
-            log.info("开始:{},账户数据清洗",accountId);
             JSONObject projectJson = projectService.getProjectByAccountId(accountId);
             Long projectId = projectJson.getLong("projectId");
             String projectName = projectJson.getString("projectName");