Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

yumeng 4 éve
szülő
commit
34ed17f20f

+ 37 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMatDailyReportJob.java

@@ -0,0 +1,37 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
+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.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class KuaishouMatDailyReportJob {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(10);
+
+    @XxlJob("kuaishouMaterialReportByStateDate")
+    public void execute() throws Exception {
+        //增加接口的开始和结束日期
+        String endDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", endDate, -1);
+        //1:查询当日数据
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+        tokens.forEach(token -> executorService.submit(() -> {
+            kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(),token.getAccessToken(),startDate,endDate,1);
+        }));
+        XxlJobHelper.log("快手物料数据同步完成");
+    }
+
+}

+ 1 - 1
module-job-kuaishou/src/main/resources/application-dev.yml

@@ -137,7 +137,7 @@ xxl:
   job:
     accessToken:
     executor:
-      appname: module-job-bytedance
+      appname: module-job-kuaishou
       port: 9998
       ip:
       logpath: /data/applogs/xxl-job/jobhandler

+ 1 - 1
module-job-kuaishou/src/main/resources/application-jiaoyang.yml

@@ -182,4 +182,4 @@ xxl:
       logpath: /data/applogs/xxl-job/jobhandler
       logretentiondays: 30
     admin:
-      addresses: 129.28.150.229:8090/xxl-job-admin/
+      addresses: http://129.28.150.229:8090/xxl-job-admin

+ 1 - 1
module-job-kuaishou/src/main/resources/application-test.yml

@@ -155,7 +155,7 @@ xxl:
   job:
     accessToken:
     executor:
-      appname: module-job-bytedance
+      appname: module-job-kuaishou
       port: 9998
       ip:
       logpath: /data/applogs/xxl-job/jobhandler

+ 0 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java

@@ -60,7 +60,6 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
         param.put("page", page);
 
         String result = HttpUtils.httpPostRequest(url, param, headers);
-        System.err.println(result);
         JSONObject resultJson = JSONObject.parseObject(result);
         if (Check.isNull(resultJson)) {
             return;
@@ -91,12 +90,7 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
             material.setAccountId(accountId);
             addList.add(material);
         }
-        System.err.println("数据组装时间:" + (System.currentTimeMillis() - l1));
-
-        long l2 = System.currentTimeMillis();
         dailyMaterialMapper.batchReplace(addList);
-        System.err.println("数据入库时间:" + (System.currentTimeMillis() - l2));
         getMaterialReportByAccountIdAndStatDate(accountId, token, startDate, endDate, page + 1);
-
     }
 }

+ 6 - 6
module-kuaishou/src/main/resources/kuaishou_config.properties

@@ -21,11 +21,11 @@ model_video_fill_path_test=D:\\data\\model\\fill\\
 model_video_final_path_test=D:\\data\\model\\final\\
 
 ##master
-kuaishou_appid=27
-kuaishou_secret=QovprB1tNhXptgDc
-kuaishou_callback_url=http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
+#kuaishou_appid=27
+#kuaishou_secret=QovprB1tNhXptgDc
+#kuaishou_callback_url=http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
 ##jiaoyang
-#kuaishou_appid=328
-#kuaishou_secret=1iFTBiMdohkyEQQs
-#kuaishou_callback_url=http://callback.shyouteng.com.cn/kuaishou
+kuaishou_appid=328
+kuaishou_secret=1iFTBiMdohkyEQQs
+kuaishou_callback_url=http://callback.shyouteng.com.cn/kuaishou