Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

ZHAOXIAN 1 год назад
Родитель
Сommit
c570d3c955

+ 2 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceAccountReportServiceImpl.java

@@ -243,6 +243,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
                     errorInfo.setEndDate(endDate);
                     errorInfo.setDataDimension("account");
                     errorInfo.setDataType("hour");
+                    errorInfo.setMsg(result.getString("message"));
                     accountReportMapper.replaceErrorInfo(errorInfo);
                 }
                 return;
@@ -333,6 +334,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
                     errorInfo.setEndDate(endDate);
                     errorInfo.setDataDimension("account");
                     errorInfo.setDataType("daily");
+                    errorInfo.setMsg(result.getString("message"));
                     accountReportMapper.replaceErrorInfo(errorInfo);
                 }
                 return;

+ 19 - 9
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedancePromoterReportServiceImpl.java

@@ -93,8 +93,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
                 promoterReportMapper.replacePromoterReportHour(hours);
                 try {
                     promoterReportMapper.replacePromoterReportHourSD(hours);
-                }catch (Exception e) {
-                    log.error("",e);
+                } catch (Exception e) {
+                    log.error("", e);
                 }
             }
             if (hours.size() >= 100) {
@@ -177,8 +177,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
                 promoterReportMapper.replacePromoterReportDailies(promoterReportDailies);
                 try {
                     promoterReportMapper.replacePromoterReportDailiesSD(promoterReportDailies);
-                }catch (Exception e) {
-                    log.error("",e);
+                } catch (Exception e) {
+                    log.error("", e);
                 }
                 log.info("账户ID:{},广告日报(最细粒度)数据请求成功", advertiserId);
             }
@@ -283,7 +283,7 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
                 promoterReportMapper.replacePromoterReportHour(hours);
                 try {
                     promoterReportMapper.replacePromoterReportHourSD(hours);
-                }catch (Exception e) {
+                } catch (Exception e) {
                     e.printStackTrace();
                 }
             }
@@ -320,7 +320,10 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             Map<String, String> headers = new HashMap<>();
             headers.put("Access-Token", accessToken);
             headers.put("Content-Type", "application/json");
+            long urlStartTime = System.currentTimeMillis();
             String s = HttpUtils.httpGet(url, paramsMap, headers);
+            long urlEndTime = System.currentTimeMillis();
+            log.info("urlTime:{}", urlEndTime - urlStartTime);
             JSONObject result = JSONObject.parseObject(s);
             if (Check.isNull(result)) {
                 log.info("账户id:{},广告日报(最细粒度)请求结果返回为空", advertiserId);
@@ -371,25 +374,32 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
                     errorInfo.setEndDate(endDate);
                     errorInfo.setDataDimension("promoter");
                     errorInfo.setDataType("daily");
+                    errorInfo.setMsg(result.getString("message"));
                     promoterReportMapper.replaceErrorInfo(errorInfo);
                 }
                 return;
             }
             if (!Check.isNull(promoterReportDailies)) {
+                long tidbStartTime = System.currentTimeMillis();
                 promoterReportMapper.replacePromoterReportDailies(promoterReportDailies);
+                long tidbEndTime = System.currentTimeMillis();
+                log.info("tidb入库时间:{}", tidbEndTime - tidbStartTime);
                 try {
+                    long selectDbStartTime = System.currentTimeMillis();
                     promoterReportMapper.replacePromoterReportDailiesSD(promoterReportDailies);
-                }catch (Exception e) {
-                    log.error("",e);
+                    long selectDbEnsTime = System.currentTimeMillis();
+                    log.info("selectDb入库时间:{}", selectDbEnsTime - selectDbStartTime);
+                } catch (Exception e) {
+                    log.error("", e);
                 }
                 log.info("账户ID:{},广告日报(最细粒度)数据请求成功", advertiserId);
             }
             if (promoterReportDailies.size() >= 100) {
-                try {
+          /*      try {
                     Thread.sleep(200L);
                 } catch (InterruptedException e) {
                     throw new RuntimeException(e);
-                }
+                }*/
                 getBytedancePromoterDaily(advertiserId, accessToken, startDate, endDate, page + 1, 1);
             } else {
                 log.info("账户ID:{},开始日期:{},结束日期:{},广告日报(最细粒度)数据请求成功", advertiserId, startDate, endDate);

+ 1 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePromoterReportJob.java

@@ -34,7 +34,7 @@ public class BytedancePromoterReportJob {
     @Autowired
     private IChannelService channelService;
 
-    private static ExecutorService dailyExecutorService = Executors.newFixedThreadPool(4);
+    private static ExecutorService dailyExecutorService = Executors.newFixedThreadPool(10);
     private static ExecutorService hourExecutorService = Executors.newFixedThreadPool(4);
 
     private static ExecutorService dailyRetrExecutorService = Executors.newFixedThreadPool(2);