Преглед на файлове

修改爆款数据清洗逻辑

syh преди 4 години
родител
ревизия
c75d653e07

+ 5 - 4
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -389,11 +389,12 @@ public class SampleTest {
     private IKuaishouVideoEtlInfoService kuaishouVideoEtlInfoService;
     @Test
     public void etlKuaishouData(){
-        String dateString = "2020-01-01";
+        String dateString = "2020-08-29";
         Date startDate = DateUtils.parseDate(dateString,"yyyy-MM-dd");
-        for(int i=0;i<=365;i++){
+        for(int i=0;i<=185;i++){
             Date getDate = DateUtils.addDay(startDate,i);
             kuaishouVideoEtlInfoService.etlKuaishouVideoInfo(getDate);
+//            bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
         }
     }
 
@@ -401,9 +402,9 @@ public class SampleTest {
     private IBytedanceVideoEtlInfoService bytedanceVideoEtlInfoService;
     @Test
     public void etlBytedanceData(){
-        String dateString = "2020-01-01";
+        String dateString = "2020-03-01";
         Date startDate = DateUtils.parseDate(dateString,"yyyy-MM-dd");
-        for(int i=0;i<=365;i++){
+        for(int i=0;i<=310;i++){
             Date getDate = DateUtils.addDay(startDate,i);
             bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
             kuaishouVideoEtlInfoService.etlKuaishouVideoInfo(getDate);

+ 11 - 11
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouVideoEtlInfoServiceImpl.java

@@ -39,7 +39,7 @@ public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEt
     private KuaishouVideoEtlInfoMapper kuaishouVideoEtlInfoMapper;
     @Autowired
     private IKuaiShouReportDailyMaterialService dailyMaterialService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(50);
+    static ExecutorService executorService = Executors.newFixedThreadPool(100);
     @Override
     public void etlKuaishouVideoInfo(Date getDate) {
         String date = DateUtils.formatDate(getDate);
@@ -98,13 +98,13 @@ public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEt
                                 }
                             }
                             //计算投放总天数
-                            if(days == 7){
+                            if(days <= 7){
                                 etlInfo.setSingleWeekCost(nowData.getCharge());
                             }
-                            if(days == 14){
+                            if(days <= 14){
                                 etlInfo.setTwoWeekCost(nowData.getCharge());
                             }
-                            if(days == 28){
+                            if(days <= 28){
                                 etlInfo.setFourWeekCost(nowData.getCharge());
                             }
                             //计算是否有效,爆款
@@ -115,8 +115,8 @@ public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEt
                             }
                             if(totalCost.compareTo(new BigDecimal("100000"))>0){
                                 //此刻成为爆款
-                                etlInfo.setEffectDate(date);
-                                etlInfo.setEffectDayNum(days);
+                                etlInfo.setFaddishDate(date);
+                                etlInfo.setFaddishDayNum(days);
                             }
                             etlInfo.setCreateTime(new Date());
                             etlInfo.setUpdateTime(new Date());
@@ -131,13 +131,13 @@ public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEt
                             etlInfo.setUpdateTime(new Date());
                             BigDecimal totalCost = etlInfo.getTotalCost();
                             //计算投放总天数
-                            if(days == 7){
+                            if(days <= 7){
                                 etlInfo.setSingleWeekCost(nowData.getCharge());
                             }
-                            if(days == 14){
+                            if(days <= 14){
                                 etlInfo.setTwoWeekCost(nowData.getCharge());
                             }
-                            if(days == 28){
+                            if(days <= 28){
                                 etlInfo.setFourWeekCost(nowData.getCharge());
                             }
                             if(null == etlInfo.getEffectDayNum()){
@@ -150,8 +150,8 @@ public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEt
                             if(null == etlInfo.getFaddishDayNum()){
                                 if(totalCost.compareTo(new BigDecimal("100000"))>0){
                                     //此刻成为爆款
-                                    etlInfo.setEffectDate(date);
-                                    etlInfo.setEffectDayNum(days);
+                                    etlInfo.setFaddishDate(date);
+                                    etlInfo.setFaddishDayNum(days);
                                 }
                             }
                             this.updateById(etlInfo);

+ 11 - 11
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceVideoEtlInfoServiceImpl.java

@@ -35,7 +35,7 @@ public class BytedanceVideoEtlInfoServiceImpl extends ServiceImpl<BytedanceVideo
     private IBytedanceReportMaterialDailyService materialDailyService;
     @Autowired
     private UserAllocationMapper userAllocationMapper;
-    static ExecutorService executorService = Executors.newFixedThreadPool(50);
+    static ExecutorService executorService = Executors.newFixedThreadPool(100);
     @Autowired
     private IMaterialAscriptionService materialAscriptionService;
     @Override
@@ -95,13 +95,13 @@ public class BytedanceVideoEtlInfoServiceImpl extends ServiceImpl<BytedanceVideo
                                 }
                             }
                             //计算投放总天数
-                            if(days == 7){
+                            if(days <= 7){
                                 etlInfo.setSingleWeekCost(nowData.getTotalCost());
                             }
-                            if(days == 14){
+                            if(days <= 14){
                                 etlInfo.setTwoWeekCost(nowData.getTotalCost());
                             }
-                            if(days == 28){
+                            if(days <= 28){
                                 etlInfo.setFourWeekCost(nowData.getTotalCost());
                             }
                             //计算是否有效,爆款
@@ -112,8 +112,8 @@ public class BytedanceVideoEtlInfoServiceImpl extends ServiceImpl<BytedanceVideo
                             }
                             if(totalCost.compareTo(new BigDecimal("100000"))>0){
                                 //此刻成为爆款
-                                etlInfo.setEffectDate(date);
-                                etlInfo.setEffectDayNum(days);
+                                etlInfo.setFaddishDate(date);
+                                etlInfo.setFaddishDayNum(days);
                             }
                             etlInfo.setCreateTime(new Date());
                             etlInfo.setUpdateTime(new Date());
@@ -128,13 +128,13 @@ public class BytedanceVideoEtlInfoServiceImpl extends ServiceImpl<BytedanceVideo
                             etlInfo.setConvertNum(nowData.getConvertNum());
                             etlInfo.setUpdateTime(new Date());
                             //计算投放总天数
-                            if(days == 7){
+                            if(days <= 7){
                                 etlInfo.setSingleWeekCost(nowData.getTotalCost());
                             }
-                            if(days == 14){
+                            if(days <= 14){
                                 etlInfo.setTwoWeekCost(nowData.getTotalCost());
                             }
-                            if(days == 28){
+                            if(days <= 28){
                                 etlInfo.setFourWeekCost(nowData.getTotalCost());
                             }
                             if(null == etlInfo.getEffectDayNum()){
@@ -147,8 +147,8 @@ public class BytedanceVideoEtlInfoServiceImpl extends ServiceImpl<BytedanceVideo
                             if(null == etlInfo.getFaddishDayNum()){
                                 if(totalCost.compareTo(new BigDecimal("100000"))>0){
                                     //此刻成为爆款
-                                    etlInfo.setEffectDate(date);
-                                    etlInfo.setEffectDayNum(days);
+                                    etlInfo.setFaddishDate(date);
+                                    etlInfo.setFaddishDayNum(days);
                                 }
                             }
                             this.updateById(etlInfo);