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

Merge #24 into master from pingkang

selectdb_group_commit

* pingkang: (1 commits)
  selectdb_group_commit

Signed-off-by: 1129979389@qq.com <accounts_6361eaad7b63b44dd7833e63@mail.teambition.com>
Merged-by: 1129979389@qq.com <accounts_6361eaad7b63b44dd7833e63@mail.teambition.com>

CR-link: https://codeup.aliyun.com/60c06368dbbed34fe0f0c263/job/hr_job-bytedance/change/24
huangpingkang 1 год назад
Родитель
Сommit
1b9c48b6dd
18 измененных файлов с 68 добавлено и 85 удалено
  1. 1 1
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/AdminAdvertiserListMapper.java
  2. 1 1
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/ByteDanceFlowDetailsReportMapper.java
  3. 2 2
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceAccountReportMapper.java
  4. 9 9
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceCdpProjectMapper.java
  5. 1 1
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceMiniAppMapper.java
  6. 2 2
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceProductReportMapper.java
  7. 3 3
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedancePromoterReportMapper.java
  8. 4 4
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceXingTuMapper.java
  9. 0 1
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/ReportsAdPushMapper.java
  10. 2 2
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/AdminAdvertiserListMapper.xml
  11. 0 1
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceCdpProjectListMapper.xml
  12. 2 2
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceProductReportMapper.xml
  13. 2 2
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedancePromoterReportMapper.xml
  14. 4 4
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceXingTuMapper.xml
  15. 12 24
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceAccountReportServiceImpl.java
  16. 5 1
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceCdpProjectServiceImpl.java
  17. 12 25
      job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedancePromoterReportServiceImpl.java
  18. 6 0
      job-bytedance/src/main/resources/application.yml

+ 1 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/AdminAdvertiserListMapper.java

@@ -14,6 +14,6 @@ public interface AdminAdvertiserListMapper {
 
     void batchUpdateAdvertiserName(@Param("infos") List<JSONObject> infos);
 
-    //TODO 修改为从selectdb读取 @DS("selectdb")
+    @DS("selectdb")
     List<JSONObject> getAdvertiserInfosByAdminIds();
 }

+ 1 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/ByteDanceFlowDetailsReportMapper.java

@@ -19,6 +19,6 @@ public interface ByteDanceFlowDetailsReportMapper {
     List<AdvertiserAccount> getAdAccount();
 
     void replaceDanceFlowDetailsReportDailies(@Param("list") List<ByteDanceFlowDetailsReportDaily> dailyList);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     void replaceDanceFlowDetailsReportDailiesSD(@Param("list") List<ByteDanceFlowDetailsReportDaily> dailyList);
 }

+ 2 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceAccountReportMapper.java

@@ -10,11 +10,11 @@ import java.util.List;
 
 public interface BytedanceAccountReportMapper {
     void replaceAccountReportHour(@Param("list") List<BytedanceAdvertiserReportHour> hours);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     void replaceAccountReportHourSD(@Param("list") List<BytedanceAdvertiserReportHour> hours);
 
     void replaceAccountReportDaily(@Param("list") List<BytedanceAdvertiserReportDaily> dailyList);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     void replaceAccountReportDailySD(@Param("list") List<BytedanceAdvertiserReportDaily> dailyList);
 
     void replaceErrorInfo(BytedanceErrorLog errorInfo);

+ 9 - 9
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceCdpProjectMapper.java

@@ -16,11 +16,11 @@ import java.util.List;
 public interface BytedanceCdpProjectMapper {
 
     int replaceBytedanceCdpProjectList(@Param("projectList") List<BytedanceCdpProject> projectList);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     int replaceBytedanceCdpProjectListSD(@Param("projectList") List<BytedanceCdpProject> projectList);
 
     int replaceBytedancePromotionList(@Param("list") JSONArray array);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     int replaceBytedancePromotionListSD(@Param("list") JSONArray array);
 
     void insertErrorAdvertiserId(@Param("advertiserId") Long advertiserId, @Param("type") String type);
@@ -28,7 +28,7 @@ public interface BytedanceCdpProjectMapper {
     int replaceBytedanceByteAppInfo(@Param("list") JSONArray list, @Param("advertiserId") Long advertiserId);
 
     int replaceBytedanceByteAppLinkInfo(@Param("list") JSONArray list);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     int replaceBytedanceByteAppLinkInfoSD(@Param("list") JSONArray list);
 
     List<Long> queryAllAdverIdList(@Param("mediaType") String mediaType);
@@ -37,29 +37,29 @@ public interface BytedanceCdpProjectMapper {
 
     List<Long> queryTTErrApps();
 
-    //TODO 修改为从selectdb读取 @DS("selectdb")
+    @DS("selectdb")
     List<Long> queryPageAdvertiserIds();
 
     boolean delErrApps(@Param("type") String type);
 
     boolean delTTErrApps();
 
-    //TODO 修改为从selectdb读取 @DS("selectdb")
+    @DS("selectdb")
     List<Long> queryAdvertiserIds(@Param("db") String db, @Param("date") String date);
 
     int replaceBytedanceWxAppInfo(@Param("list") JSONArray list, @Param("advertiserId") Long advertiserId);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     int replaceBytedanceWxAppInfoSD(@Param("list") JSONArray list, @Param("advertiserId") Long advertiserId);
 
-    //TODO 修改为从selectdb读取 @DS("selectdb")
+    @DS("selectdb")
     List<Long> queryMediaAdverIds(@Param("date") String date, @Param("mediaType") String mediaType);
 
     int replaceAdqDynamicCreateives(@Param("list") JSONArray list, @Param("advertiserId") Long advertiserId);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     int replaceAdqDynamicCreateivesSD(@Param("list") JSONArray list, @Param("advertiserId") Long advertiserId);
 
     int replaceAdqDynamicPages(@Param("list") JSONArray list, @Param("advertiserId") Long advertiserId);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     int replaceAdqDynamicPagesSD(@Param("list") JSONArray list, @Param("advertiserId") Long advertiserId);
 
     List<Long> queryADQAdverIds(String date);

+ 1 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceMiniAppMapper.java

@@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 
 public interface BytedanceMiniAppMapper {
-    //TODO 修改为从selectdb读取 @DS("selectdb")
+    @DS("selectdb")
     List<String> getEcpmKeys(@Param("startDate") Integer startDate,
                              @Param("endDate") Integer endDate,
                              @Param("startTime") String startTime,

+ 2 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceProductReportMapper.java

@@ -9,11 +9,11 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 
 public interface BytedanceProductReportMapper {
-    //TODO 修改为从selectdb读取 @DS("selectdb")
+    @DS("selectdb")
     List<JSONObject> queryCostAccount(@Param("advertiserId") Long advertiserId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
     void replaceProductReportDailies(List<BytedanceProductReportDaily> reports);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     void replaceProductReportDailiesSD(List<BytedanceProductReportDaily> reports);
 
     void deleteProductReportDailies(@Param("advertiserId") Long advertiserId,@Param("startDate") Integer startDate,@Param("endDate")  Integer endDate);

+ 3 - 3
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedancePromoterReportMapper.java

@@ -14,18 +14,18 @@ public interface BytedancePromoterReportMapper {
     List<JSONObject> getAccountList();
 
     void replacePromoterReportHour(@Param("list") List<BytedancePromoterReportHour> hours);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     void replacePromoterReportHourSD(@Param("list") List<BytedancePromoterReportHour> hours);
 
     void deleteInfoByErrorId(@Param("errorId") Long errorId);
 
     void replacePromoterReportDailies(@Param("list") List<BytedancePromoterReportDaily> promoterReportDailies);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     void replacePromoterReportDailiesSD(@Param("list") List<BytedancePromoterReportDaily> promoterReportDailies);
 
     void replaceErrorInfo(BytedanceErrorLog errorInfo);
 
-    //TODO 修改为从selectdb读取 @DS("selectdb")
+    @DS("selectdb")
     List<JSONObject> getListBydate(@Param("date") Integer date);
 
     List<JSONObject> getAllList();

+ 4 - 4
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceXingTuMapper.java

@@ -13,10 +13,10 @@ import java.util.List;
 public interface BytedanceXingTuMapper {
     List<JSONObject> queryXingTuAccount(@Param("advertiserId") Long advertiserId);
 
-    //TODO 修改为从selectdb读取 @DS("selectdb")
+    @DS("selectdb")
     List<JSONObject> queryXingTuActiveTask(@Param("advertiserId") Long advertiserId);
 
-    //TODO 修改为从selectdb读取 @DS("selectdb")
+    @DS("selectdb")
     List<JSONObject> queryXingTuReportTask(@Param("advertiserId") Long advertiserId);
 
     List<JSONObject> queryXingTuRetryJob();
@@ -30,11 +30,11 @@ public interface BytedanceXingTuMapper {
     void updateTaskInfoSD(BytedanceXingTuTask task);
 
     void insertReport(List<BytedanceXingTuReport> reports);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     void insertReportSD(List<BytedanceXingTuReport> reports);
 
     void insertReportDaily(List<BytedanceXingTuReportDaily> dailyReports);
-    @DS("selectdb")
+    @DS("selectdb_group_commit")
     void insertReportDailySD(List<BytedanceXingTuReportDaily> dailyReports);
 
     @DS("selectdb")

+ 0 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/ReportsAdPushMapper.java

@@ -7,7 +7,6 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 import java.util.Map;
 
-//TODO 修改为从selectdb读取
 
 @DS("selectdb")
 public interface ReportsAdPushMapper {

+ 2 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/AdminAdvertiserListMapper.xml

@@ -47,8 +47,8 @@
                     WHERE stat_time_day >= 20250601
                       AND stat_time_day &lt;= 20250603
                     GROUP BY advertiser_id) t1
-                       LEFT JOIN deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
-                       LEFT JOIN deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id) t
+                       LEFT JOIN tidb.deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
+                       LEFT JOIN tidb.deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id) t
         WHERE t.advertiserId IS NOT NULL
 
     </select>

+ 0 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceCdpProjectListMapper.xml

@@ -377,7 +377,6 @@
         SELECT DISTINCT advertiser_id
         FROM media_api.${db}
         where stat_time_day = #{date}
-        order by create_time
     </select>
 
     <select id="queryMediaAdverIds" resultType="Long">

+ 2 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceProductReportMapper.xml

@@ -11,8 +11,8 @@
             </if>
             group by 1
         ) t1
-        LEFT JOIN deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
-        LEFT JOIN deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id
+        LEFT JOIN tidb.deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
+        LEFT JOIN tidb.deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id
     </select>
 
     <insert id="replaceProductReportDailies">

+ 2 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedancePromoterReportMapper.xml

@@ -20,8 +20,8 @@
               FROM media_api.bytedance_promoter_report_hour
               WHERE stat_time_day = date_format(CURDATE() - INTERVAL 1 DAY, '%Y%m%d')
               GROUP BY advertiser_id) t1
-                 LEFT JOIN deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
-                 LEFT JOIN deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id
+                 LEFT JOIN tidb.deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
+                 LEFT JOIN tidb.deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id
     </select>
     <select id="getAllList" resultType="com.alibaba.fastjson.JSONObject">
 

+ 4 - 4
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceXingTuMapper.xml

@@ -207,9 +207,9 @@
     <select id="queryXingTuActiveTask" resultType="com.alibaba.fastjson.JSONObject">
         select t.advertiser_id,challenge_task_id task_id,access_token
         from media_api.bytedance_xingtu_task_list t
-        join deepthink.bytedance_xingtu_advertiser_list x
+        join tidb.deepthink.bytedance_xingtu_advertiser_list x
         on t.advertiser_id = x.advertiser_id
-        join deepthink.bytedance_auth_list a
+        join tidb.deepthink.bytedance_auth_list a
         on x.admin_advertiser_id = a.admin_advertiser_id
         where (t.om_task_status is null or t.om_task_status not in (6,7,8))
         <if test="advertiserId != null">
@@ -220,9 +220,9 @@
     <select id="queryXingTuReportTask" resultType="com.alibaba.fastjson.JSONObject">
         select t.advertiser_id,challenge_task_id task_id,access_token
         from media_api.bytedance_xingtu_task_list t
-        join deepthink.bytedance_xingtu_advertiser_list x
+        join tidb.deepthink.bytedance_xingtu_advertiser_list x
         on t.advertiser_id = x.advertiser_id
-        join deepthink.bytedance_auth_list a
+        join tidb.deepthink.bytedance_auth_list a
         on x.admin_advertiser_id = a.admin_advertiser_id
         where (t.om_task_status not in (1,2,4) or t.om_task_status is null)
         and (t.end_time is null or t.end_time >= unix_timestamp(date_add(now(),Interval -65 day)))

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

@@ -26,13 +26,13 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     @Autowired
     private BytedanceAccountReportMapper accountReportMapper;
 
-    private static final int MAX_BATCH_SIZE = 5000;
+    /*private static final int MAX_BATCH_SIZE = 5000;
     private static final long MAX_WAIT_TIME_MS = 2 * 60 * 1000;
 
     private final List<BytedanceAdvertiserReportHour> advertiserReportHourBuffer = Collections.synchronizedList(new ArrayList<>());
     private final List<BytedanceAdvertiserReportDaily> advertiserReportDailyBuffer = Collections.synchronizedList(new ArrayList<>());
     private long advertiserReportHourLastFlushTime = System.currentTimeMillis();
-    private long advertiserReportDailyLastFlushTime = System.currentTimeMillis();
+    private long advertiserReportDailyLastFlushTime = System.currentTimeMillis();*/
 
 
     @Override
@@ -87,11 +87,8 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
             }
             if (!Check.isNull(hours)) {
                 accountReportMapper.replaceAccountReportHour(hours);
-                try {
-                    advertiserReportHourBuffer.addAll(hours);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
+                accountReportMapper.replaceAccountReportHourSD(hours);
+                //advertiserReportHourBuffer.addAll(hours);
             }
             if (hours.size() >= 100) {
                 try {
@@ -162,11 +159,8 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
             }
             if (!Check.isNull(dailyList)) {
                 accountReportMapper.replaceAccountReportDaily(dailyList);
-                try {
-                    advertiserReportDailyBuffer.addAll(dailyList);
-                } catch (Exception e) {
-                    log.error("replaceAccountReportDailySD", e);
-                }
+                accountReportMapper.replaceAccountReportDailySD(dailyList);
+                //advertiserReportDailyBuffer.addAll(dailyList);
             }
             if (dailyList.size() >= 100) {
                 try {
@@ -259,11 +253,8 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
             }
             if (!Check.isNull(hours)) {
                 accountReportMapper.replaceAccountReportHour(hours);
-                try {
-                    advertiserReportHourBuffer.addAll(hours);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
+                accountReportMapper.replaceAccountReportHourSD(hours);
+                //advertiserReportHourBuffer.addAll(hours);
             }
             if (hours.size() >= 100) {
                 try {
@@ -350,11 +341,8 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
             }
             if (!Check.isNull(dailyList)) {
                 accountReportMapper.replaceAccountReportDaily(dailyList);
-                try {
-                    advertiserReportDailyBuffer.addAll(dailyList);
-                } catch (Exception e) {
-                    log.error("replaceAccountReportDailySD", e);
-                }
+                accountReportMapper.replaceAccountReportDailySD(dailyList);
+                //advertiserReportDailyBuffer.addAll(dailyList);
             }
             if (dailyList.size() >= 100) {
                 try {
@@ -371,7 +359,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
         }
     }
 
-    @Scheduled(fixedRate = 12000) // 每30秒检查一次
+    /*@Scheduled(fixedRate = 12000) // 每30秒检查一次
     public void flushIfNeeded() {
         log.info("开始执行账户报表定时批处理任务....");
         synchronized (advertiserReportHourBuffer) {
@@ -448,6 +436,6 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
                 }
             }
         }
-    }
+    }*/
 
 }

+ 5 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceCdpProjectServiceImpl.java

@@ -680,7 +680,11 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
                             object.put("mini_program_id", wechatMiniProgramSpec.getString("mini_program_id"));
                             object.put("mini_program_path", wechatMiniProgramSpec.getString("mini_program_path"));
                         }
-                        JSONObject officialSpec = pageSpec.getJSONObject("wechat_canvas_spec");
+                        JSONObject wechatCanvasSpec = pageSpec.getJSONObject("wechat_canvas_spec");
+                        if (!Check.isNull(wechatCanvasSpec)) {
+                            object.put("page_id", wechatCanvasSpec.getLong("page_id"));
+                        }
+                        JSONObject officialSpec = pageSpec.getJSONObject("official_spec");
                         if (!Check.isNull(officialSpec)) {
                             object.put("page_id", officialSpec.getLong("page_id"));
                         }

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

@@ -27,12 +27,12 @@ import java.util.*;
 public class BytedancePromoterReportServiceImpl implements IBytedancePromoterReportService {
     @Autowired
     private BytedancePromoterReportMapper promoterReportMapper;
-    private static final int MAX_BATCH_SIZE = 10000;
+    /*private static final int MAX_BATCH_SIZE = 10000;
     private static final long MAX_WAIT_TIME_MS = 2 * 60 * 1000;
     private final List<BytedancePromoterReportHour> promoterReportHourBuffer = Collections.synchronizedList(new ArrayList<>());
     private final List<BytedancePromoterReportDaily> promoterReportDailyBuffer = Collections.synchronizedList(new ArrayList<>());
     private long promoterReportHourLastFlushTime = System.currentTimeMillis();
-    private long promoterReportDailyLastFlushTime = System.currentTimeMillis();
+    private long promoterReportDailyLastFlushTime = System.currentTimeMillis();*/
 
 
     @Override
@@ -100,11 +100,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             }
             if (!Check.isNull(hours)) {
                 promoterReportMapper.replacePromoterReportHour(hours);
-                try {
-                    promoterReportHourBuffer.addAll(hours);
-                } catch (Exception e) {
-                    log.error("", e);
-                }
+                promoterReportMapper.replacePromoterReportHourSD(hours);
+                //promoterReportHourBuffer.addAll(hours);
             }
             if (hours.size() >= 100) {
                 try {
@@ -184,12 +181,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             }
             if (!Check.isNull(promoterReportDailies)) {
                 promoterReportMapper.replacePromoterReportDailies(promoterReportDailies);
-                try {
-                    promoterReportDailyBuffer.addAll(promoterReportDailies);
-
-                } catch (Exception e) {
-                    log.error("", e);
-                }
+                promoterReportMapper.replacePromoterReportDailiesSD(promoterReportDailies);
+                //promoterReportDailyBuffer.addAll(promoterReportDailies);
                 log.info("账户ID:{},广告日报(最细粒度)数据请求成功", advertiserId);
             }
             if (promoterReportDailies.size() >= 100) {
@@ -291,11 +284,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             }
             if (!Check.isNull(hours)) {
                 promoterReportMapper.replacePromoterReportHour(hours);
-                try {
-                    promoterReportHourBuffer.addAll(hours);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
+                promoterReportMapper.replacePromoterReportHourSD(hours);
+                //promoterReportHourBuffer.addAll(hours);
             }
             if (hours.size() >= 100) {
                 try {
@@ -388,11 +378,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             }
             if (!Check.isNull(promoterReportDailies)) {
                 promoterReportMapper.replacePromoterReportDailies(promoterReportDailies);
-                try {
-                    promoterReportDailyBuffer.addAll(promoterReportDailies);
-                } catch (Exception e) {
-                    log.error("", e);
-                }
+                promoterReportMapper.replacePromoterReportDailiesSD(promoterReportDailies);
+                //promoterReportDailyBuffer.addAll(promoterReportDailies);
                 log.info("账户ID:{},广告日报(最细粒度)数据请求成功", advertiserId);
             }
             if (promoterReportDailies.size() >= 100) {
@@ -419,7 +406,7 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
         return promoterReportMapper.getAllList();
     }
 
-    @Scheduled(fixedRate = 11000) // 每30秒检查一次
+    /*@Scheduled(fixedRate = 11000) // 每30秒检查一次
     public void flushIfNeeded() {
         log.info("开始执行广告报表定时批处理任务....");
         synchronized (promoterReportHourBuffer) {
@@ -498,7 +485,7 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
                 }
             }
         }
-    }
+    }*/
 
 
 }

+ 6 - 0
job-bytedance/src/main/resources/application.yml

@@ -93,6 +93,12 @@ spring:
           username: data
           password: hr@2025..
           driver-class-name: com.mysql.jdbc.Driver
+        selectdb_group_commit:
+          ## 注意此selectdb数据源不支持列更新,insert into 对于未指定列会被置为null,类似tidb replace into
+          url: jdbc:mysql://selectdb-cn-vym4at1qw04.selectdbfe.rds.aliyuncs.com:9030/media_api?characterEncoding=UTF-8&useUnicode=true&useSSL=false&useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=500&sessionVariables=group_commit=async_mode,enable_nereids_planner=false
+          username: data
+          password: hr@2025..
+          driver-class-name: com.mysql.jdbc.Driver
 
   # redis 配置
   redis: