yumeng 1 месяц назад
Родитель
Сommit
fab509b8f6

+ 106 - 1
src/main/java/com/adx/tencent/AppConfiguration.java

@@ -14,6 +14,8 @@ import com.adx.tencent.honor.client.HonorClient;
 import com.adx.tencent.honor.service.HonorColdWorker;
 import com.adx.tencent.honor.service.HonorColdWorker;
 import com.adx.tencent.honor.service.HonorPlacement;
 import com.adx.tencent.honor.service.HonorPlacement;
 import com.adx.tencent.honor.service.HonorRetryService;
 import com.adx.tencent.honor.service.HonorRetryService;
+import com.adx.tencent.honor.service.HonorTagEventProfileResolver;
+import com.adx.tencent.honor.service.HonorTagEventProfileSyncService;
 import com.adx.tencent.honor.service.HonorTagEventResolver;
 import com.adx.tencent.honor.service.HonorTagEventResolver;
 import com.adx.tencent.honor.service.HonorTagEventSyncService;
 import com.adx.tencent.honor.service.HonorTagEventSyncService;
 import com.adx.tencent.honor.store.HonorColdStore;
 import com.adx.tencent.honor.store.HonorColdStore;
@@ -22,6 +24,8 @@ import com.adx.tencent.kuaishou.client.KuaishouClient;
 import com.adx.tencent.kuaishou.service.KuaishouColdWorker;
 import com.adx.tencent.kuaishou.service.KuaishouColdWorker;
 import com.adx.tencent.kuaishou.service.KuaishouPlacement;
 import com.adx.tencent.kuaishou.service.KuaishouPlacement;
 import com.adx.tencent.kuaishou.service.KuaishouRetryService;
 import com.adx.tencent.kuaishou.service.KuaishouRetryService;
+import com.adx.tencent.kuaishou.service.KuaishouTagEventProfileResolver;
+import com.adx.tencent.kuaishou.service.KuaishouTagEventProfileSyncService;
 import com.adx.tencent.kuaishou.service.KuaishouTagEventResolver;
 import com.adx.tencent.kuaishou.service.KuaishouTagEventResolver;
 import com.adx.tencent.kuaishou.service.KuaishouTagEventSyncService;
 import com.adx.tencent.kuaishou.service.KuaishouTagEventSyncService;
 import com.adx.tencent.kuaishou.store.KuaishouColdStore;
 import com.adx.tencent.kuaishou.store.KuaishouColdStore;
@@ -32,6 +36,8 @@ import com.adx.tencent.rta.RtaOrderSyncService;
 import com.adx.tencent.rta.RtaOrderStore;
 import com.adx.tencent.rta.RtaOrderStore;
 import com.adx.tencent.tagsync.AccountTagEventResolver;
 import com.adx.tencent.tagsync.AccountTagEventResolver;
 import com.adx.tencent.tagsync.AccountTagEventSyncService;
 import com.adx.tencent.tagsync.AccountTagEventSyncService;
+import com.adx.tencent.tagsync.TagEventProfileResolver;
+import com.adx.tencent.tagsync.TagEventProfileSyncService;
 import com.adx.tencent.tagsync.TagEventResolver;
 import com.adx.tencent.tagsync.TagEventResolver;
 import com.adx.tencent.tagsync.TagEventSyncService;
 import com.adx.tencent.tagsync.TagEventSyncService;
 import com.adx.tencent.tencent.TencentClient;
 import com.adx.tencent.tencent.TencentClient;
@@ -41,6 +47,8 @@ import com.adx.tencent.vivo.service.VivoAdvertiserSyncService;
 import com.adx.tencent.vivo.service.VivoColdWorker;
 import com.adx.tencent.vivo.service.VivoColdWorker;
 import com.adx.tencent.vivo.service.VivoPlacement;
 import com.adx.tencent.vivo.service.VivoPlacement;
 import com.adx.tencent.vivo.service.VivoRetryService;
 import com.adx.tencent.vivo.service.VivoRetryService;
+import com.adx.tencent.vivo.service.VivoTagEventProfileResolver;
+import com.adx.tencent.vivo.service.VivoTagEventProfileSyncService;
 import com.adx.tencent.vivo.service.VivoTagEventResolver;
 import com.adx.tencent.vivo.service.VivoTagEventResolver;
 import com.adx.tencent.vivo.service.VivoTagEventSyncService;
 import com.adx.tencent.vivo.service.VivoTagEventSyncService;
 import com.adx.tencent.vivo.store.VivoColdStore;
 import com.adx.tencent.vivo.store.VivoColdStore;
@@ -49,9 +57,11 @@ import com.adx.tencent.oppo.client.OppoClient;
 import com.adx.tencent.oppo.store.OppoColdStore;
 import com.adx.tencent.oppo.store.OppoColdStore;
 import com.adx.tencent.oppo.store.OppoHotStore;
 import com.adx.tencent.oppo.store.OppoHotStore;
 import com.adx.tencent.oppo.service.OppoTagEventResolver;
 import com.adx.tencent.oppo.service.OppoTagEventResolver;
+import com.adx.tencent.oppo.service.OppoTagEventProfileResolver;
 import com.adx.tencent.oppo.service.OppoAuthService;
 import com.adx.tencent.oppo.service.OppoAuthService;
 import com.adx.tencent.oppo.service.OppoRetryService;
 import com.adx.tencent.oppo.service.OppoRetryService;
 import com.adx.tencent.oppo.service.OppoTagEventSyncService;
 import com.adx.tencent.oppo.service.OppoTagEventSyncService;
+import com.adx.tencent.oppo.service.OppoTagEventProfileSyncService;
 import com.adx.tencent.oppo.service.OppoColdWorker;
 import com.adx.tencent.oppo.service.OppoColdWorker;
 import com.adx.tencent.storage.RedisHotStore;
 import com.adx.tencent.storage.RedisHotStore;
 import com.adx.tencent.storage.RedisLock;
 import com.adx.tencent.storage.RedisLock;
@@ -232,12 +242,27 @@ public class AppConfiguration {
     }
     }
 
 
     @Bean
     @Bean
+    public OppoTagEventProfileResolver oppoTagEventProfileResolver(StringRedisTemplate redis,
+                                                                   @Nullable OppoColdStore coldStore) {
+        if (coldStore == null) return null;
+        return new OppoTagEventProfileResolver(redis, coldStore, props.getOppoTagEventSyncRedisPrefix());
+    }
+
+    @Bean
     public OppoTagEventSyncService oppoTagEventSyncService(@Nullable OppoColdStore coldStore, StringRedisTemplate redis) {
     public OppoTagEventSyncService oppoTagEventSyncService(@Nullable OppoColdStore coldStore, StringRedisTemplate redis) {
         if (coldStore == null) return null;
         if (coldStore == null) return null;
         return new OppoTagEventSyncService(coldStore, redis, props.getOppoTagEventSyncRedisPrefix(), props.getOppoTagEventSyncInterval().multipliedBy(3));
         return new OppoTagEventSyncService(coldStore, redis, props.getOppoTagEventSyncRedisPrefix(), props.getOppoTagEventSyncInterval().multipliedBy(3));
     }
     }
 
 
     @Bean
     @Bean
+    public OppoTagEventProfileSyncService oppoTagEventProfileSyncService(@Nullable OppoColdStore coldStore,
+                                                                         StringRedisTemplate redis) {
+        if (coldStore == null) return null;
+        return new OppoTagEventProfileSyncService(coldStore, redis,
+                props.getOppoTagEventSyncRedisPrefix(), props.getOppoTagEventSyncInterval().multipliedBy(3));
+    }
+
+    @Bean
     public OppoColdWorker oppoColdWorker(@Nullable OppoHotStore hotStore, @Nullable OppoColdStore coldStore, ObjectMapper mapper) {
     public OppoColdWorker oppoColdWorker(@Nullable OppoHotStore hotStore, @Nullable OppoColdStore coldStore, ObjectMapper mapper) {
         if (hotStore == null || coldStore == null) return null;
         if (hotStore == null || coldStore == null) return null;
         return new OppoColdWorker(hotStore, coldStore,
         return new OppoColdWorker(hotStore, coldStore,
@@ -616,6 +641,13 @@ public class AppConfiguration {
     }
     }
 
 
     @Bean
     @Bean
+    public TagEventProfileResolver tagEventProfileResolver(@Nullable TiDBColdStore coldStore,
+                                                           StringRedisTemplate redisTemplate) {
+        if (coldStore == null) return null;
+        return new TagEventProfileResolver(redisTemplate, coldStore, props.getTagEventSyncRedisPrefix());
+    }
+
+    @Bean
     public AccountTagEventResolver accountTagEventResolver(@Nullable TiDBColdStore coldStore,
     public AccountTagEventResolver accountTagEventResolver(@Nullable TiDBColdStore coldStore,
                                                            StringRedisTemplate redisTemplate) {
                                                            StringRedisTemplate redisTemplate) {
         if (coldStore == null) return null;
         if (coldStore == null) return null;
@@ -630,6 +662,13 @@ public class AppConfiguration {
     }
     }
 
 
     @Bean
     @Bean
+    public HonorTagEventProfileResolver honorTagEventProfileResolver(@Nullable HonorColdStore honorColdStore,
+                                                                     StringRedisTemplate redisTemplate) {
+        if (honorColdStore == null) return null;
+        return new HonorTagEventProfileResolver(redisTemplate, honorColdStore, props.getHonorTagEventSyncRedisPrefix());
+    }
+
+    @Bean
     public KuaishouTagEventResolver kuaishouTagEventResolver(@Nullable KuaishouColdStore kuaishouColdStore,
     public KuaishouTagEventResolver kuaishouTagEventResolver(@Nullable KuaishouColdStore kuaishouColdStore,
                                                              StringRedisTemplate redisTemplate) {
                                                              StringRedisTemplate redisTemplate) {
         if (kuaishouColdStore == null) return null;
         if (kuaishouColdStore == null) return null;
@@ -637,6 +676,13 @@ public class AppConfiguration {
     }
     }
 
 
     @Bean
     @Bean
+    public KuaishouTagEventProfileResolver kuaishouTagEventProfileResolver(@Nullable KuaishouColdStore kuaishouColdStore,
+                                                                           StringRedisTemplate redisTemplate) {
+        if (kuaishouColdStore == null) return null;
+        return new KuaishouTagEventProfileResolver(redisTemplate, kuaishouColdStore, props.getKuaishouTagEventSyncRedisPrefix());
+    }
+
+    @Bean
     public VivoTagEventResolver vivoTagEventResolver(@Nullable VivoColdStore vivoColdStore,
     public VivoTagEventResolver vivoTagEventResolver(@Nullable VivoColdStore vivoColdStore,
                                                      StringRedisTemplate redisTemplate) {
                                                      StringRedisTemplate redisTemplate) {
         if (vivoColdStore == null) return null;
         if (vivoColdStore == null) return null;
@@ -644,16 +690,28 @@ public class AppConfiguration {
     }
     }
 
 
     @Bean
     @Bean
+    public VivoTagEventProfileResolver vivoTagEventProfileResolver(@Nullable VivoColdStore vivoColdStore,
+                                                                   StringRedisTemplate redisTemplate) {
+        if (vivoColdStore == null) return null;
+        return new VivoTagEventProfileResolver(redisTemplate, vivoColdStore, props.getVivoTagEventSyncRedisPrefix());
+    }
+
+    @Bean
     public ConversionSyncService conversionSyncService(ConversionClient baiduClient,
     public ConversionSyncService conversionSyncService(ConversionClient baiduClient,
                                                          RedisHotStore hotStore,
                                                          RedisHotStore hotStore,
                                                          TencentClient tencentClient,
                                                          TencentClient tencentClient,
                                                          @Nullable TiDBColdStore coldStore,
                                                          @Nullable TiDBColdStore coldStore,
                                                          @Nullable TagEventResolver tagEventResolver,
                                                          @Nullable TagEventResolver tagEventResolver,
+                                                         @Nullable TagEventProfileResolver tagEventProfileResolver,
                                                          @Nullable AccountTagEventResolver accountTagEventResolver,
                                                          @Nullable AccountTagEventResolver accountTagEventResolver,
                                                          @Nullable HonorTagEventResolver honorTagEventResolver,
                                                          @Nullable HonorTagEventResolver honorTagEventResolver,
+                                                         @Nullable HonorTagEventProfileResolver honorTagEventProfileResolver,
                                                          @Nullable KuaishouTagEventResolver kuaishouTagEventResolver,
                                                          @Nullable KuaishouTagEventResolver kuaishouTagEventResolver,
+                                                         @Nullable KuaishouTagEventProfileResolver kuaishouTagEventProfileResolver,
                                                          @Nullable VivoTagEventResolver vivoTagEventResolver,
                                                          @Nullable VivoTagEventResolver vivoTagEventResolver,
+                                                         @Nullable VivoTagEventProfileResolver vivoTagEventProfileResolver,
                                                          @Nullable OppoTagEventResolver oppoTagEventResolver,
                                                          @Nullable OppoTagEventResolver oppoTagEventResolver,
+                                                         @Nullable OppoTagEventProfileResolver oppoTagEventProfileResolver,
                                                          @Nullable HonorHotStore honorHotStore,
                                                          @Nullable HonorHotStore honorHotStore,
                                                          @Nullable HonorColdStore honorColdStore,
                                                          @Nullable HonorColdStore honorColdStore,
                                                          @Nullable KuaishouHotStore kuaishouHotStore,
                                                          @Nullable KuaishouHotStore kuaishouHotStore,
@@ -668,7 +726,9 @@ public class AppConfiguration {
                                                          @Nullable OppoClient oppoClient) {
                                                          @Nullable OppoClient oppoClient) {
         if (coldStore == null) return null;
         if (coldStore == null) return null;
         return new ConversionSyncService(baiduClient, hotStore, tencentClient, coldStore, tagEventResolver,
         return new ConversionSyncService(baiduClient, hotStore, tencentClient, coldStore, tagEventResolver,
-                accountTagEventResolver, honorTagEventResolver, kuaishouTagEventResolver, vivoTagEventResolver, oppoTagEventResolver,
+                tagEventProfileResolver, accountTagEventResolver, honorTagEventResolver, honorTagEventProfileResolver,
+                kuaishouTagEventResolver, kuaishouTagEventProfileResolver,
+                vivoTagEventResolver, vivoTagEventProfileResolver, oppoTagEventResolver, oppoTagEventProfileResolver,
                 honorHotStore, honorColdStore, kuaishouHotStore, kuaishouColdStore, vivoHotStore, vivoColdStore,
                 honorHotStore, honorColdStore, kuaishouHotStore, kuaishouColdStore, vivoHotStore, vivoColdStore,
                 oppoHotStore, oppoColdStore, honorClient, kuaishouClient, vivoClient, oppoClient, props);
                 oppoHotStore, oppoColdStore, honorClient, kuaishouClient, vivoClient, oppoClient, props);
     }
     }
@@ -713,6 +773,15 @@ public class AppConfiguration {
     }
     }
 
 
     @Bean
     @Bean
+    public TagEventProfileSyncService tagEventProfileSyncService(@Nullable TiDBColdStore coldStore,
+                                                                 StringRedisTemplate redisTemplate) {
+        if (coldStore == null) return null;
+        Duration ttl = props.getTagEventSyncInterval().multipliedBy(3);
+        return new TagEventProfileSyncService(coldStore, redisTemplate,
+                props.getTagEventSyncRedisPrefix(), ttl);
+    }
+
+    @Bean
     public AccountTagEventSyncService accountTagEventSyncService(@Nullable TiDBColdStore coldStore,
     public AccountTagEventSyncService accountTagEventSyncService(@Nullable TiDBColdStore coldStore,
                                                                  StringRedisTemplate redisTemplate) {
                                                                  StringRedisTemplate redisTemplate) {
         if (coldStore == null) return null;
         if (coldStore == null) return null;
@@ -731,6 +800,15 @@ public class AppConfiguration {
     }
     }
 
 
     @Bean
     @Bean
+    public HonorTagEventProfileSyncService honorTagEventProfileSyncService(@Nullable HonorColdStore honorColdStore,
+                                                                           StringRedisTemplate redisTemplate) {
+        if (honorColdStore == null) return null;
+        Duration ttl = props.getHonorTagEventSyncInterval().multipliedBy(3);
+        return new HonorTagEventProfileSyncService(honorColdStore, redisTemplate,
+                props.getHonorTagEventSyncRedisPrefix(), ttl);
+    }
+
+    @Bean
     public KuaishouTagEventSyncService kuaishouTagEventSyncService(@Nullable KuaishouColdStore kuaishouColdStore,
     public KuaishouTagEventSyncService kuaishouTagEventSyncService(@Nullable KuaishouColdStore kuaishouColdStore,
                                                                    StringRedisTemplate redisTemplate) {
                                                                    StringRedisTemplate redisTemplate) {
         if (kuaishouColdStore == null) return null;
         if (kuaishouColdStore == null) return null;
@@ -740,6 +818,15 @@ public class AppConfiguration {
     }
     }
 
 
     @Bean
     @Bean
+    public KuaishouTagEventProfileSyncService kuaishouTagEventProfileSyncService(@Nullable KuaishouColdStore kuaishouColdStore,
+                                                                                 StringRedisTemplate redisTemplate) {
+        if (kuaishouColdStore == null) return null;
+        Duration ttl = props.getKuaishouTagEventSyncInterval().multipliedBy(3);
+        return new KuaishouTagEventProfileSyncService(kuaishouColdStore, redisTemplate,
+                props.getKuaishouTagEventSyncRedisPrefix(), ttl);
+    }
+
+    @Bean
     public VivoTagEventSyncService vivoTagEventSyncService(@Nullable VivoColdStore vivoColdStore,
     public VivoTagEventSyncService vivoTagEventSyncService(@Nullable VivoColdStore vivoColdStore,
                                                            StringRedisTemplate redisTemplate) {
                                                            StringRedisTemplate redisTemplate) {
         if (vivoColdStore == null) return null;
         if (vivoColdStore == null) return null;
@@ -749,6 +836,15 @@ public class AppConfiguration {
     }
     }
 
 
     @Bean
     @Bean
+    public VivoTagEventProfileSyncService vivoTagEventProfileSyncService(@Nullable VivoColdStore vivoColdStore,
+                                                                         StringRedisTemplate redisTemplate) {
+        if (vivoColdStore == null) return null;
+        Duration ttl = props.getVivoTagEventSyncInterval().multipliedBy(3);
+        return new VivoTagEventProfileSyncService(vivoColdStore, redisTemplate,
+                props.getVivoTagEventSyncRedisPrefix(), ttl);
+    }
+
+    @Bean
     public RtaOrderSyncService rtaOrderSyncService(@Nullable RtaOrderStore rtaOrderStore,
     public RtaOrderSyncService rtaOrderSyncService(@Nullable RtaOrderStore rtaOrderStore,
                                                    StringRedisTemplate redisTemplate) {
                                                    StringRedisTemplate redisTemplate) {
         if (rtaOrderStore == null) return null;
         if (rtaOrderStore == null) return null;
@@ -875,6 +971,7 @@ public class AppConfiguration {
         @Autowired(required = false) private ConversionSyncRunner conversionSyncRunner;
         @Autowired(required = false) private ConversionSyncRunner conversionSyncRunner;
         @Autowired(required = false) private RetryService retryService;
         @Autowired(required = false) private RetryService retryService;
         @Autowired(required = false) private TagEventSyncService tagEventSyncService;
         @Autowired(required = false) private TagEventSyncService tagEventSyncService;
+        @Autowired(required = false) private TagEventProfileSyncService tagEventProfileSyncService;
         @Autowired(required = false) private AccountTagEventSyncService accountTagEventSyncService;
         @Autowired(required = false) private AccountTagEventSyncService accountTagEventSyncService;
         @Autowired(required = false) private RtaOrderSyncService rtaOrderSyncService;
         @Autowired(required = false) private RtaOrderSyncService rtaOrderSyncService;
         @Autowired(required = false) private LeaderElection leaderElection;
         @Autowired(required = false) private LeaderElection leaderElection;
@@ -1100,6 +1197,14 @@ public class AppConfiguration {
                 } catch (Exception e) {
                 } catch (Exception e) {
                     taskLog.error("[TagEventSync] error: {}", e.getMessage(), e);
                     taskLog.error("[TagEventSync] error: {}", e.getMessage(), e);
                 }
                 }
+                try {
+                    if (tagEventProfileSyncService != null) {
+                        int n = tagEventProfileSyncService.syncOnce();
+                        taskLog.info("[TagEventProfileSync] done: synced={}", n);
+                    }
+                } catch (Exception e) {
+                    taskLog.error("[TagEventProfileSync] error: {}", e.getMessage(), e);
+                }
                 sleepResponsive(intervalMs, jobStop);
                 sleepResponsive(intervalMs, jobStop);
             }
             }
             taskLog.info("[TagEventSync] task stopped");
             taskLog.info("[TagEventSync] task stopped");

+ 35 - 8
src/main/java/com/adx/tencent/conversionsync/ConversionSyncService.java

@@ -8,6 +8,7 @@ import com.adx.tencent.config.AppProperties;
 import com.adx.tencent.honor.client.HonorClient;
 import com.adx.tencent.honor.client.HonorClient;
 import com.adx.tencent.honor.model.HonorBidRecord;
 import com.adx.tencent.honor.model.HonorBidRecord;
 import com.adx.tencent.honor.model.HonorMediaCallbackRecord;
 import com.adx.tencent.honor.model.HonorMediaCallbackRecord;
+import com.adx.tencent.honor.service.HonorTagEventProfileResolver;
 import com.adx.tencent.honor.service.HonorTagEventResolver;
 import com.adx.tencent.honor.service.HonorTagEventResolver;
 import com.adx.tencent.honor.store.HonorColdStore;
 import com.adx.tencent.honor.store.HonorColdStore;
 import com.adx.tencent.honor.store.HonorHotStore;
 import com.adx.tencent.honor.store.HonorHotStore;
@@ -15,6 +16,7 @@ import com.adx.tencent.kuaishou.client.KuaishouClient;
 import com.adx.tencent.kuaishou.model.KuaishouBidRecord;
 import com.adx.tencent.kuaishou.model.KuaishouBidRecord;
 import com.adx.tencent.kuaishou.model.KuaishouMediaCallbackRecord;
 import com.adx.tencent.kuaishou.model.KuaishouMediaCallbackRecord;
 import com.adx.tencent.kuaishou.model.KuaishouTagEventRecord;
 import com.adx.tencent.kuaishou.model.KuaishouTagEventRecord;
+import com.adx.tencent.kuaishou.service.KuaishouTagEventProfileResolver;
 import com.adx.tencent.kuaishou.service.KuaishouTagEventResolver;
 import com.adx.tencent.kuaishou.service.KuaishouTagEventResolver;
 import com.adx.tencent.kuaishou.store.KuaishouColdStore;
 import com.adx.tencent.kuaishou.store.KuaishouColdStore;
 import com.adx.tencent.kuaishou.store.KuaishouHotStore;
 import com.adx.tencent.kuaishou.store.KuaishouHotStore;
@@ -26,12 +28,14 @@ import com.adx.tencent.storage.model.MediaCallbackRecord;
 import com.adx.tencent.storage.model.AccountTagEventRecord;
 import com.adx.tencent.storage.model.AccountTagEventRecord;
 import com.adx.tencent.storage.model.TencentTagEventProfileRecord;
 import com.adx.tencent.storage.model.TencentTagEventProfileRecord;
 import com.adx.tencent.tagsync.AccountTagEventResolver;
 import com.adx.tencent.tagsync.AccountTagEventResolver;
+import com.adx.tencent.tagsync.TagEventProfileResolver;
 import com.adx.tencent.tagsync.TagEventResolver;
 import com.adx.tencent.tagsync.TagEventResolver;
 import com.adx.tencent.tencent.TencentClient;
 import com.adx.tencent.tencent.TencentClient;
 import com.adx.tencent.vivo.client.VivoClient;
 import com.adx.tencent.vivo.client.VivoClient;
 import com.adx.tencent.vivo.model.VivoBidRecord;
 import com.adx.tencent.vivo.model.VivoBidRecord;
 import com.adx.tencent.vivo.model.VivoMediaCallbackRecord;
 import com.adx.tencent.vivo.model.VivoMediaCallbackRecord;
 import com.adx.tencent.vivo.model.VivoTagEventRecord;
 import com.adx.tencent.vivo.model.VivoTagEventRecord;
+import com.adx.tencent.vivo.service.VivoTagEventProfileResolver;
 import com.adx.tencent.vivo.service.VivoTagEventResolver;
 import com.adx.tencent.vivo.service.VivoTagEventResolver;
 import com.adx.tencent.vivo.store.VivoColdStore;
 import com.adx.tencent.vivo.store.VivoColdStore;
 import com.adx.tencent.vivo.store.VivoHotStore;
 import com.adx.tencent.vivo.store.VivoHotStore;
@@ -39,6 +43,7 @@ import com.adx.tencent.oppo.client.OppoClient;
 import com.adx.tencent.oppo.model.OppoBidRecord;
 import com.adx.tencent.oppo.model.OppoBidRecord;
 import com.adx.tencent.oppo.model.OppoMediaCallbackRecord;
 import com.adx.tencent.oppo.model.OppoMediaCallbackRecord;
 import com.adx.tencent.oppo.model.OppoTagEventRecord;
 import com.adx.tencent.oppo.model.OppoTagEventRecord;
+import com.adx.tencent.oppo.service.OppoTagEventProfileResolver;
 import com.adx.tencent.oppo.service.OppoTagEventResolver;
 import com.adx.tencent.oppo.service.OppoTagEventResolver;
 import com.adx.tencent.oppo.store.OppoHotStore;
 import com.adx.tencent.oppo.store.OppoHotStore;
 import com.adx.tencent.oppo.store.OppoColdStore;
 import com.adx.tencent.oppo.store.OppoColdStore;
@@ -105,11 +110,16 @@ public class ConversionSyncService {
     private final VivoClient vivoClient;
     private final VivoClient vivoClient;
     private final OppoClient oppoClient;
     private final OppoClient oppoClient;
     private final TagEventResolver tagEventResolver;
     private final TagEventResolver tagEventResolver;
+    private final TagEventProfileResolver tagEventProfileResolver;
     private final AccountTagEventResolver accountTagEventResolver;
     private final AccountTagEventResolver accountTagEventResolver;
     private final HonorTagEventResolver honorTagEventResolver;
     private final HonorTagEventResolver honorTagEventResolver;
+    private final HonorTagEventProfileResolver honorTagEventProfileResolver;
     private final KuaishouTagEventResolver kuaishouTagEventResolver;
     private final KuaishouTagEventResolver kuaishouTagEventResolver;
+    private final KuaishouTagEventProfileResolver kuaishouTagEventProfileResolver;
     private final VivoTagEventResolver vivoTagEventResolver;
     private final VivoTagEventResolver vivoTagEventResolver;
+    private final VivoTagEventProfileResolver vivoTagEventProfileResolver;
     private final OppoTagEventResolver oppoTagEventResolver;
     private final OppoTagEventResolver oppoTagEventResolver;
+    private final OppoTagEventProfileResolver oppoTagEventProfileResolver;
     private final ExecutorService realtimeExecutor;
     private final ExecutorService realtimeExecutor;
     private final ExecutorService backfillExecutor;
     private final ExecutorService backfillExecutor;
 
 
@@ -123,11 +133,16 @@ public class ConversionSyncService {
                                  TencentClient tencentClient,
                                  TencentClient tencentClient,
                                  TiDBColdStore coldStore,
                                  TiDBColdStore coldStore,
                                  TagEventResolver tagEventResolver,
                                  TagEventResolver tagEventResolver,
+                                 TagEventProfileResolver tagEventProfileResolver,
                                  AccountTagEventResolver accountTagEventResolver,
                                  AccountTagEventResolver accountTagEventResolver,
                                  HonorTagEventResolver honorTagEventResolver,
                                  HonorTagEventResolver honorTagEventResolver,
+                                 HonorTagEventProfileResolver honorTagEventProfileResolver,
                                  KuaishouTagEventResolver kuaishouTagEventResolver,
                                  KuaishouTagEventResolver kuaishouTagEventResolver,
+                                 KuaishouTagEventProfileResolver kuaishouTagEventProfileResolver,
                                  VivoTagEventResolver vivoTagEventResolver,
                                  VivoTagEventResolver vivoTagEventResolver,
+                                 VivoTagEventProfileResolver vivoTagEventProfileResolver,
                                  OppoTagEventResolver oppoTagEventResolver,
                                  OppoTagEventResolver oppoTagEventResolver,
+                                 OppoTagEventProfileResolver oppoTagEventProfileResolver,
                                  HonorHotStore honorHotStore,
                                  HonorHotStore honorHotStore,
                                  HonorColdStore honorColdStore,
                                  HonorColdStore honorColdStore,
                                  KuaishouHotStore kuaishouHotStore,
                                  KuaishouHotStore kuaishouHotStore,
@@ -146,11 +161,16 @@ public class ConversionSyncService {
         this.tencentClient = tencentClient;
         this.tencentClient = tencentClient;
         this.coldStore = coldStore;
         this.coldStore = coldStore;
         this.tagEventResolver = tagEventResolver;
         this.tagEventResolver = tagEventResolver;
+        this.tagEventProfileResolver = tagEventProfileResolver;
         this.accountTagEventResolver = accountTagEventResolver;
         this.accountTagEventResolver = accountTagEventResolver;
         this.honorTagEventResolver = honorTagEventResolver;
         this.honorTagEventResolver = honorTagEventResolver;
+        this.honorTagEventProfileResolver = honorTagEventProfileResolver;
         this.kuaishouTagEventResolver = kuaishouTagEventResolver;
         this.kuaishouTagEventResolver = kuaishouTagEventResolver;
+        this.kuaishouTagEventProfileResolver = kuaishouTagEventProfileResolver;
         this.vivoTagEventResolver = vivoTagEventResolver;
         this.vivoTagEventResolver = vivoTagEventResolver;
+        this.vivoTagEventProfileResolver = vivoTagEventProfileResolver;
         this.oppoTagEventResolver = oppoTagEventResolver;
         this.oppoTagEventResolver = oppoTagEventResolver;
+        this.oppoTagEventProfileResolver = oppoTagEventProfileResolver;
         this.honorHotStore = honorHotStore;
         this.honorHotStore = honorHotStore;
         this.honorColdStore = honorColdStore;
         this.honorColdStore = honorColdStore;
         this.kuaishouHotStore = kuaishouHotStore;
         this.kuaishouHotStore = kuaishouHotStore;
@@ -456,8 +476,9 @@ public class ConversionSyncService {
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                 return null;
                 return null;
             }
             }
-            TencentTagEventProfileRecord profileMapping = coldStore.getTagEventProfile(
-                    bid.getTagId(), callbackProfile, payment.getAct());
+            TencentTagEventProfileRecord profileMapping = tagEventProfileResolver != null
+                    ? tagEventProfileResolver.resolve(bid.getTagId(), callbackProfile, payment.getAct())
+                    : coldStore.getTagEventProfile(bid.getTagId(), callbackProfile, payment.getAct());
             if (profileMapping == null
             if (profileMapping == null
                     || profileMapping.getTencentActionType() == null
                     || profileMapping.getTencentActionType() == null
                     || profileMapping.getTencentActionType().isBlank()) {
                     || profileMapping.getTencentActionType().isBlank()) {
@@ -538,8 +559,9 @@ public class ConversionSyncService {
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                 return null;
                 return null;
             }
             }
-            com.adx.tencent.honor.model.HonorTagEventRecord profileEvent =
-                    honorColdStore.getTagEventProfile(bid.getTagId(), callbackProfile, payment.getAct());
+            com.adx.tencent.honor.model.HonorTagEventRecord profileEvent = honorTagEventProfileResolver != null
+                    ? honorTagEventProfileResolver.resolve(bid.getTagId(), callbackProfile, payment.getAct())
+                    : honorColdStore.getTagEventProfile(bid.getTagId(), callbackProfile, payment.getAct());
             if (profileEvent == null) {
             if (profileEvent == null) {
                 log.info("[ConversionSync] 荣耀 profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
                 log.info("[ConversionSync] 荣耀 profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
@@ -596,7 +618,9 @@ public class ConversionSyncService {
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                 return List.of();
                 return List.of();
             }
             }
-            tagEvents = kuaishouColdStore.getTagEventProfiles(bid.getTagId(), callbackProfile, payment.getAct());
+            tagEvents = kuaishouTagEventProfileResolver != null
+                    ? kuaishouTagEventProfileResolver.resolve(bid.getTagId(), callbackProfile, payment.getAct())
+                    : kuaishouColdStore.getTagEventProfiles(bid.getTagId(), callbackProfile, payment.getAct());
             if (tagEvents.isEmpty()) {
             if (tagEvents.isEmpty()) {
                 log.info("[ConversionSync] 快手 profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
                 log.info("[ConversionSync] 快手 profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
@@ -636,7 +660,9 @@ public class ConversionSyncService {
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                 return List.of();
                 return List.of();
             }
             }
-            tagEvents = vivoColdStore.getTagEventProfiles(bid.getTagId(), callbackProfile, payment.getAct());
+            tagEvents = vivoTagEventProfileResolver != null
+                    ? vivoTagEventProfileResolver.resolve(bid.getTagId(), callbackProfile, payment.getAct())
+                    : vivoColdStore.getTagEventProfiles(bid.getTagId(), callbackProfile, payment.getAct());
             if (tagEvents.isEmpty()) {
             if (tagEvents.isEmpty()) {
                 log.info("[ConversionSync] vivo profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
                 log.info("[ConversionSync] vivo profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
@@ -672,8 +698,9 @@ public class ConversionSyncService {
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                 return null;
                 return null;
             }
             }
-            OppoTagEventRecord profileEvent = oppoColdStore.getTagEventProfile(
-                    bid.getTagId(), callbackProfile, payment.getAct());
+            OppoTagEventRecord profileEvent = oppoTagEventProfileResolver != null
+                    ? oppoTagEventProfileResolver.resolve(bid.getTagId(), callbackProfile, payment.getAct())
+                    : oppoColdStore.getTagEventProfile(bid.getTagId(), callbackProfile, payment.getAct());
             if (profileEvent == null) {
             if (profileEvent == null) {
                 log.info("[ConversionSync] OPPO profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
                 log.info("[ConversionSync] OPPO profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
                         payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());

+ 3 - 0
src/main/java/com/adx/tencent/honor/model/HonorTagEventRecord.java

@@ -2,11 +2,14 @@ package com.adx.tencent.honor.model;
 
 
 public class HonorTagEventRecord {
 public class HonorTagEventRecord {
     private String tagId;
     private String tagId;
+    private String callbackProfile;
     private int baiduAct;
     private int baiduAct;
     private int conversionId;
     private int conversionId;
 
 
     public String getTagId() { return tagId; }
     public String getTagId() { return tagId; }
     public void setTagId(String v) { this.tagId = v; }
     public void setTagId(String v) { this.tagId = v; }
+    public String getCallbackProfile() { return callbackProfile; }
+    public void setCallbackProfile(String v) { this.callbackProfile = v; }
     public int getBaiduAct() { return baiduAct; }
     public int getBaiduAct() { return baiduAct; }
     public void setBaiduAct(int v) { this.baiduAct = v; }
     public void setBaiduAct(int v) { this.baiduAct = v; }
     public int getConversionId() { return conversionId; }
     public int getConversionId() { return conversionId; }

+ 8 - 0
src/main/java/com/adx/tencent/honor/service/HonorBackgroundTasks.java

@@ -23,6 +23,7 @@ public class HonorBackgroundTasks implements ApplicationRunner {
     @Autowired(required = false) private HonorColdWorker honorColdWorker;
     @Autowired(required = false) private HonorColdWorker honorColdWorker;
     @Autowired(required = false) private HonorRetryService honorRetryService;
     @Autowired(required = false) private HonorRetryService honorRetryService;
     @Autowired(required = false) private HonorTagEventSyncService honorTagEventSyncService;
     @Autowired(required = false) private HonorTagEventSyncService honorTagEventSyncService;
+    @Autowired(required = false) private HonorTagEventProfileSyncService honorTagEventProfileSyncService;
     @Autowired(required = false) @Nullable private LeaderElection leaderElection;
     @Autowired(required = false) @Nullable private LeaderElection leaderElection;
 
 
     private final AtomicBoolean stopped = new AtomicBoolean(false);
     private final AtomicBoolean stopped = new AtomicBoolean(false);
@@ -96,6 +97,13 @@ public class HonorBackgroundTasks implements ApplicationRunner {
             } catch (Exception e) {
             } catch (Exception e) {
                 log.error("honor tag event sync: {}", e.getMessage(), e);
                 log.error("honor tag event sync: {}", e.getMessage(), e);
             }
             }
+            try {
+                if (honorTagEventProfileSyncService != null) {
+                    honorTagEventProfileSyncService.syncOnce();
+                }
+            } catch (Exception e) {
+                log.error("honor tag event profile sync: {}", e.getMessage(), e);
+            }
             sleepResponsive(intervalMs, stopSignal);
             sleepResponsive(intervalMs, stopSignal);
         }
         }
     }
     }

+ 28 - 3
src/main/java/com/adx/tencent/honor/store/HonorColdStore.java

@@ -250,7 +250,7 @@ public class HonorColdStore {
     public HonorTagEventRecord getTagEventProfile(String tagId, String callbackProfile, int baiduAct) {
     public HonorTagEventRecord getTagEventProfile(String tagId, String callbackProfile, int baiduAct) {
         if (tagId == null || tagId.isBlank() || callbackProfile == null || callbackProfile.isBlank()) return null;
         if (tagId == null || tagId.isBlank() || callbackProfile == null || callbackProfile.isBlank()) return null;
         String sql = """
         String sql = """
-                SELECT tag_id, baidu_act, conversion_id
+                SELECT tag_id, callback_profile, baidu_act, conversion_id
                 FROM honor_tag_event_profile
                 FROM honor_tag_event_profile
                 WHERE tag_id = ? AND callback_profile = ? AND baidu_act = ? AND enabled = 1
                 WHERE tag_id = ? AND callback_profile = ? AND baidu_act = ? AND enabled = 1
                 """;
                 """;
@@ -263,8 +263,9 @@ public class HonorColdStore {
                 if (!rs.next()) return null;
                 if (!rs.next()) return null;
                 HonorTagEventRecord record = new HonorTagEventRecord();
                 HonorTagEventRecord record = new HonorTagEventRecord();
                 record.setTagId(rs.getString(1));
                 record.setTagId(rs.getString(1));
-                record.setBaiduAct(rs.getInt(2));
-                record.setConversionId(rs.getInt(3));
+                record.setCallbackProfile(rs.getString(2));
+                record.setBaiduAct(rs.getInt(3));
+                record.setConversionId(rs.getInt(4));
                 return record;
                 return record;
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
@@ -278,4 +279,28 @@ public class HonorColdStore {
             return mapper.selectAll();
             return mapper.selectAll();
         }
         }
     }
     }
+
+    public List<HonorTagEventRecord> listAllTagEventProfiles() {
+        String sql = """
+                SELECT tag_id, callback_profile, baidu_act, conversion_id
+                FROM honor_tag_event_profile
+                WHERE enabled = 1
+                """;
+        try (SqlSession session = sqlSessionFactory.openSession(true);
+             var ps = session.getConnection().prepareStatement(sql);
+             var rs = ps.executeQuery()) {
+            List<HonorTagEventRecord> records = new ArrayList<>();
+            while (rs.next()) {
+                HonorTagEventRecord record = new HonorTagEventRecord();
+                record.setTagId(rs.getString(1));
+                record.setCallbackProfile(rs.getString(2));
+                record.setBaiduAct(rs.getInt(3));
+                record.setConversionId(rs.getInt(4));
+                records.add(record);
+            }
+            return records;
+        } catch (Exception e) {
+            return List.of();
+        }
+    }
 }
 }

+ 19 - 2
src/main/java/com/adx/tencent/httpapi/TrackingController.java

@@ -24,6 +24,7 @@ import java.nio.charset.StandardCharsets;
 import java.time.Instant;
 import java.time.Instant;
 import java.util.*;
 import java.util.*;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
 
 
 /**
 /**
  * 腾讯监测链接接收端点。
  * 腾讯监测链接接收端点。
@@ -147,7 +148,7 @@ public class TrackingController {
         log.info("[腾讯][曝光][入参] traceId={} ip={} params={}", traceId, clientIp(request), params);
         log.info("[腾讯][曝光][入参] traceId={} ip={} params={}", traceId, clientIp(request), params);
 
 
         Map<String, Object> bidRequest = mediaBidRequest(request, "tencent", traceId, params, tencentPlacement);
         Map<String, Object> bidRequest = mediaBidRequest(request, "tencent", traceId, params, tencentPlacement);
-        NormalizedBidResponse response = adxClient.requestBid("tencent", traceId, bidRequest);
+        NormalizedBidResponse response = requestTencentBidWithTiming("曝光", traceId, bidRequest);
         if (response == null) {
         if (response == null) {
             log.warn("[腾讯][曝光][百度结果] traceId={} empty=true", traceId);
             log.warn("[腾讯][曝光][百度结果] traceId={} empty=true", traceId);
             throw new ResponseStatusException(HttpStatus.BAD_GATEWAY, "empty baidu ADX response");
             throw new ResponseStatusException(HttpStatus.BAD_GATEWAY, "empty baidu ADX response");
@@ -273,7 +274,7 @@ public class TrackingController {
         if (record == null) {
         if (record == null) {
             // 未找到,临时发起竞价请求
             // 未找到,临时发起竞价请求
             Map<String, Object> bidRequest = mediaBidRequest(request, "tencent", traceId, params, tencentPlacement);
             Map<String, Object> bidRequest = mediaBidRequest(request, "tencent", traceId, params, tencentPlacement);
-            NormalizedBidResponse resp = adxClient.requestBid("tencent", traceId, bidRequest);
+            NormalizedBidResponse resp = requestTencentBidWithTiming("点击", traceId, bidRequest);
             if (resp == null) {
             if (resp == null) {
                 log.warn("[腾讯][点击][百度结果] traceId={} empty=true", traceId);
                 log.warn("[腾讯][点击][百度结果] traceId={} empty=true", traceId);
                 throw new ResponseStatusException(HttpStatus.BAD_GATEWAY, "empty baidu ADX response");
                 throw new ResponseStatusException(HttpStatus.BAD_GATEWAY, "empty baidu ADX response");
@@ -316,6 +317,22 @@ public class TrackingController {
         return Map.of("qk", nvl(record.getQk()), "traceId", traceId);
         return Map.of("qk", nvl(record.getQk()), "traceId", traceId);
     }
     }
 
 
+    private NormalizedBidResponse requestTencentBidWithTiming(String phase,
+                                                              String traceId,
+                                                              Map<String, Object> bidRequest) throws Exception {
+        long startNanos = System.nanoTime();
+        boolean success = false;
+        try {
+            NormalizedBidResponse response = adxClient.requestBid("tencent", traceId, bidRequest);
+            success = response != null;
+            return response;
+        } finally {
+            long costMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNanos);
+            log.info("[腾讯][{}][百度竞价耗时] traceId={} costMs={} success={}",
+                    phase, traceId, costMs, success);
+        }
+    }
+
     private void markTrackingVersion(Map<String, String> params, String trackingVersion, int deductionRate) {
     private void markTrackingVersion(Map<String, String> params, String trackingVersion, int deductionRate) {
         boolean isNewLink = !"v1".equalsIgnoreCase(trackingVersion);
         boolean isNewLink = !"v1".equalsIgnoreCase(trackingVersion);
         params.put(BidRecord.NEW_LINK_FLAG_KEY, Boolean.toString(isNewLink));
         params.put(BidRecord.NEW_LINK_FLAG_KEY, Boolean.toString(isNewLink));

+ 3 - 0
src/main/java/com/adx/tencent/kuaishou/model/KuaishouTagEventRecord.java

@@ -2,11 +2,14 @@ package com.adx.tencent.kuaishou.model;
 
 
 public class KuaishouTagEventRecord {
 public class KuaishouTagEventRecord {
     private String tagId;
     private String tagId;
+    private String callbackProfile;
     private int baiduAct;
     private int baiduAct;
     private int eventType;
     private int eventType;
 
 
     public String getTagId() { return tagId; }
     public String getTagId() { return tagId; }
     public void setTagId(String v) { this.tagId = v; }
     public void setTagId(String v) { this.tagId = v; }
+    public String getCallbackProfile() { return callbackProfile; }
+    public void setCallbackProfile(String v) { this.callbackProfile = v; }
     public int getBaiduAct() { return baiduAct; }
     public int getBaiduAct() { return baiduAct; }
     public void setBaiduAct(int v) { this.baiduAct = v; }
     public void setBaiduAct(int v) { this.baiduAct = v; }
     public int getEventType() { return eventType; }
     public int getEventType() { return eventType; }

+ 8 - 0
src/main/java/com/adx/tencent/kuaishou/service/KuaishouBackgroundTasks.java

@@ -23,6 +23,7 @@ public class KuaishouBackgroundTasks implements ApplicationRunner {
     @Autowired(required = false) private KuaishouColdWorker kuaishouColdWorker;
     @Autowired(required = false) private KuaishouColdWorker kuaishouColdWorker;
     @Autowired(required = false) private KuaishouRetryService kuaishouRetryService;
     @Autowired(required = false) private KuaishouRetryService kuaishouRetryService;
     @Autowired(required = false) private KuaishouTagEventSyncService kuaishouTagEventSyncService;
     @Autowired(required = false) private KuaishouTagEventSyncService kuaishouTagEventSyncService;
+    @Autowired(required = false) private KuaishouTagEventProfileSyncService kuaishouTagEventProfileSyncService;
     @Autowired(required = false) @Nullable private LeaderElection leaderElection;
     @Autowired(required = false) @Nullable private LeaderElection leaderElection;
 
 
     private final AtomicBoolean stopped = new AtomicBoolean(false);
     private final AtomicBoolean stopped = new AtomicBoolean(false);
@@ -96,6 +97,13 @@ public class KuaishouBackgroundTasks implements ApplicationRunner {
             } catch (Exception e) {
             } catch (Exception e) {
                 log.error("kuaishou tag event sync: {}", e.getMessage(), e);
                 log.error("kuaishou tag event sync: {}", e.getMessage(), e);
             }
             }
+            try {
+                if (kuaishouTagEventProfileSyncService != null) {
+                    kuaishouTagEventProfileSyncService.syncOnce();
+                }
+            } catch (Exception e) {
+                log.error("kuaishou tag event profile sync: {}", e.getMessage(), e);
+            }
             sleepResponsive(intervalMs, stopSignal);
             sleepResponsive(intervalMs, stopSignal);
         }
         }
     }
     }

+ 29 - 3
src/main/java/com/adx/tencent/kuaishou/store/KuaishouColdStore.java

@@ -222,7 +222,7 @@ public class KuaishouColdStore {
     public List<KuaishouTagEventRecord> getTagEventProfiles(String tagId, String callbackProfile, int baiduAct) {
     public List<KuaishouTagEventRecord> getTagEventProfiles(String tagId, String callbackProfile, int baiduAct) {
         if (tagId == null || tagId.isBlank() || callbackProfile == null || callbackProfile.isBlank()) return List.of();
         if (tagId == null || tagId.isBlank() || callbackProfile == null || callbackProfile.isBlank()) return List.of();
         String sql = """
         String sql = """
-                SELECT tag_id, baidu_act, event_type
+                SELECT tag_id, callback_profile, baidu_act, event_type
                 FROM kuaishou_tag_event_profile
                 FROM kuaishou_tag_event_profile
                 WHERE tag_id = ? AND callback_profile = ? AND baidu_act = ? AND enabled = 1
                 WHERE tag_id = ? AND callback_profile = ? AND baidu_act = ? AND enabled = 1
                 ORDER BY event_type ASC
                 ORDER BY event_type ASC
@@ -237,8 +237,9 @@ public class KuaishouColdStore {
                 while (rs.next()) {
                 while (rs.next()) {
                     KuaishouTagEventRecord record = new KuaishouTagEventRecord();
                     KuaishouTagEventRecord record = new KuaishouTagEventRecord();
                     record.setTagId(rs.getString(1));
                     record.setTagId(rs.getString(1));
-                    record.setBaiduAct(rs.getInt(2));
-                    record.setEventType(rs.getInt(3));
+                    record.setCallbackProfile(rs.getString(2));
+                    record.setBaiduAct(rs.getInt(3));
+                    record.setEventType(rs.getInt(4));
                     records.add(record);
                     records.add(record);
                 }
                 }
                 return records;
                 return records;
@@ -253,4 +254,29 @@ public class KuaishouColdStore {
             return session.getMapper(KuaishouTagEventMapper.class).selectAll();
             return session.getMapper(KuaishouTagEventMapper.class).selectAll();
         }
         }
     }
     }
+
+    public List<KuaishouTagEventRecord> listAllTagEventProfiles() {
+        String sql = """
+                SELECT tag_id, callback_profile, baidu_act, event_type
+                FROM kuaishou_tag_event_profile
+                WHERE enabled = 1
+                ORDER BY tag_id ASC, callback_profile ASC, baidu_act ASC, event_type ASC
+                """;
+        try (SqlSession session = sqlSessionFactory.openSession(true);
+             var ps = session.getConnection().prepareStatement(sql);
+             var rs = ps.executeQuery()) {
+            List<KuaishouTagEventRecord> records = new ArrayList<>();
+            while (rs.next()) {
+                KuaishouTagEventRecord record = new KuaishouTagEventRecord();
+                record.setTagId(rs.getString(1));
+                record.setCallbackProfile(rs.getString(2));
+                record.setBaiduAct(rs.getInt(3));
+                record.setEventType(rs.getInt(4));
+                records.add(record);
+            }
+            return records;
+        } catch (Exception e) {
+            return List.of();
+        }
+    }
 }
 }

+ 2 - 2
src/main/java/com/adx/tencent/oppo/model/OppoTagEventRecord.java

@@ -1,5 +1,5 @@
 package com.adx.tencent.oppo.model;
 package com.adx.tencent.oppo.model;
 public class OppoTagEventRecord {
 public class OppoTagEventRecord {
-    private String tagId; private int baiduAct, dataType;
-    public String getTagId(){return tagId;} public void setTagId(String v){tagId=v;} public int getBaiduAct(){return baiduAct;} public void setBaiduAct(int v){baiduAct=v;} public int getDataType(){return dataType;} public void setDataType(int v){dataType=v;}
+    private String tagId; private String callbackProfile; private int baiduAct, dataType;
+    public String getTagId(){return tagId;} public void setTagId(String v){tagId=v;} public String getCallbackProfile(){return callbackProfile;} public void setCallbackProfile(String v){callbackProfile=v;} public int getBaiduAct(){return baiduAct;} public void setBaiduAct(int v){baiduAct=v;} public int getDataType(){return dataType;} public void setDataType(int v){dataType=v;}
 }
 }

+ 8 - 0
src/main/java/com/adx/tencent/oppo/service/OppoBackgroundTasks.java

@@ -22,6 +22,7 @@ public class OppoBackgroundTasks implements ApplicationRunner {
     @Autowired(required = false) private OppoColdWorker worker;
     @Autowired(required = false) private OppoColdWorker worker;
     @Autowired(required = false) private OppoRetryService retryService;
     @Autowired(required = false) private OppoRetryService retryService;
     @Autowired(required = false) private OppoTagEventSyncService tagSync;
     @Autowired(required = false) private OppoTagEventSyncService tagSync;
+    @Autowired(required = false) private OppoTagEventProfileSyncService tagProfileSync;
     @Autowired(required = false) @Nullable private LeaderElection leaderElection;
     @Autowired(required = false) @Nullable private LeaderElection leaderElection;
 
 
     private final AtomicBoolean stopped = new AtomicBoolean();
     private final AtomicBoolean stopped = new AtomicBoolean();
@@ -95,6 +96,13 @@ public class OppoBackgroundTasks implements ApplicationRunner {
             } catch (Exception e) {
             } catch (Exception e) {
                 log.error("oppo tag event sync: {}", e.getMessage(), e);
                 log.error("oppo tag event sync: {}", e.getMessage(), e);
             }
             }
+            try {
+                if (tagProfileSync != null) {
+                    tagProfileSync.syncOnce();
+                }
+            } catch (Exception e) {
+                log.error("oppo tag event profile sync: {}", e.getMessage(), e);
+            }
             sleepResponsive(intervalMs, stopSignal);
             sleepResponsive(intervalMs, stopSignal);
         }
         }
     }
     }

Разница между файлами не показана из-за своего большого размера
+ 18 - 3
src/main/java/com/adx/tencent/oppo/store/OppoColdStore.java


+ 27 - 0
src/main/java/com/adx/tencent/storage/TiDBColdStore.java

@@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory;
 import java.sql.Statement;
 import java.sql.Statement;
 import java.sql.Timestamp;
 import java.sql.Timestamp;
 import java.time.Instant;
 import java.time.Instant;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -512,6 +513,32 @@ public class TiDBColdStore {
         }
         }
     }
     }
 
 
+    public List<TencentTagEventProfileRecord> listAllTagEventProfiles() {
+        String sql = """
+                SELECT tag_id, callback_profile, baidu_act, tencent_action_type, tencent_custom_action
+                FROM tencent_tag_event_profile
+                WHERE enabled = 1
+                """;
+        try (SqlSession session = sqlSessionFactory.openSession(true);
+             var ps = session.getConnection().prepareStatement(sql);
+             var rs = ps.executeQuery()) {
+            List<TencentTagEventProfileRecord> records = new ArrayList<>();
+            while (rs.next()) {
+                TencentTagEventProfileRecord record = new TencentTagEventProfileRecord();
+                record.setTagId(rs.getString(1));
+                record.setCallbackProfile(rs.getString(2));
+                record.setBaiduAct(rs.getInt(3));
+                record.setTencentActionType(rs.getString(4));
+                record.setTencentCustomAction(rs.getString(5));
+                records.add(record);
+            }
+            return records;
+        } catch (Exception e) {
+            log.warn("[TiDBColdStore] 查询 tencent_tag_event_profile 全量失败 | error={}", e.getMessage());
+            return List.of();
+        }
+    }
+
     // ─── 查询:腾讯账户级广告位回传方式配置 ───────────────────────────────────
     // ─── 查询:腾讯账户级广告位回传方式配置 ───────────────────────────────────
 
 
     public List<AccountTagEventRecord> listAllAccountTagEvents() {
     public List<AccountTagEventRecord> listAllAccountTagEvents() {

+ 4 - 0
src/main/java/com/adx/tencent/storage/model/TagEventRecord.java

@@ -9,12 +9,16 @@ package com.adx.tencent.storage.model;
 public class TagEventRecord {
 public class TagEventRecord {
 
 
     private String tagId;
     private String tagId;
+    private String callbackProfile;
     private int baiduAct;
     private int baiduAct;
     private String tencentActionType;
     private String tencentActionType;
 
 
     public String getTagId() { return tagId; }
     public String getTagId() { return tagId; }
     public void setTagId(String v) { this.tagId = v; }
     public void setTagId(String v) { this.tagId = v; }
 
 
+    public String getCallbackProfile() { return callbackProfile; }
+    public void setCallbackProfile(String v) { this.callbackProfile = v; }
+
     public int getBaiduAct() { return baiduAct; }
     public int getBaiduAct() { return baiduAct; }
     public void setBaiduAct(int v) { this.baiduAct = v; }
     public void setBaiduAct(int v) { this.baiduAct = v; }
 
 

+ 3 - 0
src/main/java/com/adx/tencent/vivo/model/VivoTagEventRecord.java

@@ -2,11 +2,14 @@ package com.adx.tencent.vivo.model;
 
 
 public class VivoTagEventRecord {
 public class VivoTagEventRecord {
     private String tagId;
     private String tagId;
+    private String callbackProfile;
     private int baiduAct;
     private int baiduAct;
     private String eventType;
     private String eventType;
 
 
     public String getTagId() { return tagId; }
     public String getTagId() { return tagId; }
     public void setTagId(String v) { this.tagId = v; }
     public void setTagId(String v) { this.tagId = v; }
+    public String getCallbackProfile() { return callbackProfile; }
+    public void setCallbackProfile(String v) { this.callbackProfile = v; }
     public int getBaiduAct() { return baiduAct; }
     public int getBaiduAct() { return baiduAct; }
     public void setBaiduAct(int v) { this.baiduAct = v; }
     public void setBaiduAct(int v) { this.baiduAct = v; }
     public String getEventType() { return eventType; }
     public String getEventType() { return eventType; }

+ 8 - 0
src/main/java/com/adx/tencent/vivo/service/VivoBackgroundTasks.java

@@ -24,6 +24,7 @@ public class VivoBackgroundTasks implements ApplicationRunner {
     @Autowired(required = false) private VivoAuthService vivoAuthService;
     @Autowired(required = false) private VivoAuthService vivoAuthService;
     @Autowired(required = false) private VivoRetryService vivoRetryService;
     @Autowired(required = false) private VivoRetryService vivoRetryService;
     @Autowired(required = false) private VivoTagEventSyncService vivoTagEventSyncService;
     @Autowired(required = false) private VivoTagEventSyncService vivoTagEventSyncService;
+    @Autowired(required = false) private VivoTagEventProfileSyncService vivoTagEventProfileSyncService;
     @Autowired(required = false) private VivoAdvertiserSyncService vivoAdvertiserSyncService;
     @Autowired(required = false) private VivoAdvertiserSyncService vivoAdvertiserSyncService;
     @Autowired(required = false) @Nullable private LeaderElection leaderElection;
     @Autowired(required = false) @Nullable private LeaderElection leaderElection;
 
 
@@ -138,6 +139,13 @@ public class VivoBackgroundTasks implements ApplicationRunner {
             } catch (Exception e) {
             } catch (Exception e) {
                 log.error("vivo tag event sync: {}", e.getMessage(), e);
                 log.error("vivo tag event sync: {}", e.getMessage(), e);
             }
             }
+            try {
+                if (vivoTagEventProfileSyncService != null) {
+                    vivoTagEventProfileSyncService.syncOnce();
+                }
+            } catch (Exception e) {
+                log.error("vivo tag event profile sync: {}", e.getMessage(), e);
+            }
             sleepResponsive(intervalMs, stopSignal);
             sleepResponsive(intervalMs, stopSignal);
         }
         }
     }
     }

+ 29 - 3
src/main/java/com/adx/tencent/vivo/store/VivoColdStore.java

@@ -300,7 +300,7 @@ public class VivoColdStore {
     public List<VivoTagEventRecord> getTagEventProfiles(String tagId, String callbackProfile, int baiduAct) {
     public List<VivoTagEventRecord> getTagEventProfiles(String tagId, String callbackProfile, int baiduAct) {
         if (tagId == null || tagId.isBlank() || callbackProfile == null || callbackProfile.isBlank()) return List.of();
         if (tagId == null || tagId.isBlank() || callbackProfile == null || callbackProfile.isBlank()) return List.of();
         String sql = """
         String sql = """
-                SELECT tag_id, baidu_act, event_type
+                SELECT tag_id, callback_profile, baidu_act, event_type
                 FROM vivo_tag_event_profile
                 FROM vivo_tag_event_profile
                 WHERE tag_id = ? AND callback_profile = ? AND baidu_act = ? AND enabled = 1
                 WHERE tag_id = ? AND callback_profile = ? AND baidu_act = ? AND enabled = 1
                 ORDER BY event_type ASC
                 ORDER BY event_type ASC
@@ -315,8 +315,9 @@ public class VivoColdStore {
                 while (rs.next()) {
                 while (rs.next()) {
                     VivoTagEventRecord record = new VivoTagEventRecord();
                     VivoTagEventRecord record = new VivoTagEventRecord();
                     record.setTagId(rs.getString(1));
                     record.setTagId(rs.getString(1));
-                    record.setBaiduAct(rs.getInt(2));
-                    record.setEventType(rs.getString(3));
+                    record.setCallbackProfile(rs.getString(2));
+                    record.setBaiduAct(rs.getInt(3));
+                    record.setEventType(rs.getString(4));
                     records.add(record);
                     records.add(record);
                 }
                 }
                 return records;
                 return records;
@@ -332,6 +333,31 @@ public class VivoColdStore {
         }
         }
     }
     }
 
 
+    public List<VivoTagEventRecord> listAllTagEventProfiles() {
+        String sql = """
+                SELECT tag_id, callback_profile, baidu_act, event_type
+                FROM vivo_tag_event_profile
+                WHERE enabled = 1
+                ORDER BY tag_id ASC, callback_profile ASC, baidu_act ASC, event_type ASC
+                """;
+        try (SqlSession session = sqlSessionFactory.openSession(true);
+             var ps = session.getConnection().prepareStatement(sql);
+             var rs = ps.executeQuery()) {
+            List<VivoTagEventRecord> records = new ArrayList<>();
+            while (rs.next()) {
+                VivoTagEventRecord record = new VivoTagEventRecord();
+                record.setTagId(rs.getString(1));
+                record.setCallbackProfile(rs.getString(2));
+                record.setBaiduAct(rs.getInt(3));
+                record.setEventType(rs.getString(4));
+                records.add(record);
+            }
+            return records;
+        } catch (Exception e) {
+            return List.of();
+        }
+    }
+
     public VivoTokenRecord getToken(String accountId) {
     public VivoTokenRecord getToken(String accountId) {
         if (accountId == null || accountId.isBlank()) return null;
         if (accountId == null || accountId.isBlank()) return null;
         try (SqlSession session = sqlSessionFactory.openSession(true)) {
         try (SqlSession session = sqlSessionFactory.openSession(true)) {