Pārlūkot izejas kodu

修改定时任务多线程执行

syh 4 gadi atpakaļ
vecāks
revīzija
fec51462a6

+ 8 - 8
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -100,16 +100,16 @@ spring:
 #          username: data
 #          password: hcst@2021
 #          driver-class-name: com.mysql.jdbc.Driver
-        master:
-          url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
-          username: hcst
-          password: hcst@2020
-          driver-class-name: com.mysql.jdbc.Driver
 #        master:
-#          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-#          username: data
-#          password: hcst@2021
+#          url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
+#          username: hcst
+#          password: hcst@2020
 #          driver-class-name: com.mysql.jdbc.Driver
+        master:
+          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: data
+          password: hcst@2021
+          driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:
     database: 0

+ 6 - 7
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -11,6 +11,7 @@ import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouNewCreateCampaign;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoService;
+import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.service.*;
 import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
 import cn.com.ctop.oa.modules.service.IWechatNoListService;
@@ -28,6 +29,7 @@ import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import javax.annotation.Resource;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -41,7 +43,7 @@ import static org.jeecg.common.util.DateUtils.getAnotherDay;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("dev")
+@ActiveProfiles("wps")
 @Slf4j
 public class SampleTest {
     @Autowired
@@ -550,14 +552,11 @@ public class SampleTest {
 
     @Autowired
     private IEtlKuaishouVideoInfoService videoEtlInfoService;
-
+    @Resource
+    private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
     @Test
     public void etlKuaishouVideoInfo() {
-        Date startDate = DateUtils.parseDate("2021-03-01", "yyyy-MM-dd");
-        for (int i = 0; i < 365; i++) {
-//            dailyService.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
-            videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate, i)));
-        }
+        etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate());
     }
 
 }

+ 6 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadEtlJob.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.job.kuaishou.handler;
 
+import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAccountMaterialReportDailyService;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountDailyService;
 import com.xxl.job.core.context.XxlJobHelper;
@@ -8,6 +9,8 @@ import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
+
 /**
  * 账户维度-盯盘每日数据
  *
@@ -20,6 +23,8 @@ public class KuaishouDailyAccountReportLoadEtlJob {
     private IEtlKuaishouReportAccountDailyService iEtlKuaishouReportAccountDailyService;
     @Autowired
     private IEtlKuaishouAccountMaterialReportDailyService etlKuaishouAccountMaterialReportDailyService;
+    @Resource
+    private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
 
     @XxlJob("kuaishouDailyAccountReportLoadEtl")
     public void execute() throws Exception {
@@ -38,7 +43,7 @@ public class KuaishouDailyAccountReportLoadEtlJob {
     @XxlJob("etlKuaishouAccountMaterialReportDailyData")
     public void etlKuaishouAccountMaterialReportDailyData() throws Exception {
         try {
-            etlKuaishouAccountMaterialReportDailyService.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate());
+            etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate());
             XxlJobHelper.log("queryEveryDayDataForAccount success");
         } catch (Exception e) {
             XxlJobHelper.log(e.getMessage());

+ 1 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouAccountMaterialReportDailyMapper.xml

@@ -106,8 +106,7 @@ group by m.account_id,m.signature
         play_3s_count)
         values
         <foreach collection="records" item="record" separator=",">
-            (
-            #{record.companyId} ,
+            (#{record.companyId} ,
             #{record.companyName} ,
             #{record.projectId} ,
             #{record.projectName} ,