|
|
@@ -187,12 +187,54 @@ public class ConversionSyncService {
|
|
|
|
|
|
List<String> qkList = new ArrayList<>(qks);
|
|
|
Map<String, BidRecord> tencentBids = hotStore.findBidsByQks(qkList);
|
|
|
+ backfillTencentAccountIds(qkList, tencentBids);
|
|
|
Map<String, HonorBidRecord> honorBids = honorHotStore != null
|
|
|
? honorHotStore.findBidsByQks(qkList)
|
|
|
: Map.of();
|
|
|
return new BidLookup(tencentBids, honorBids);
|
|
|
}
|
|
|
|
|
|
+ private void backfillTencentAccountIds(List<String> qkList, Map<String, BidRecord> tencentBids) {
|
|
|
+ if (coldStore == null || qkList == null || qkList.isEmpty() || tencentBids == null || tencentBids.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> missingAccountQks = new ArrayList<>();
|
|
|
+ for (String qk : qkList) {
|
|
|
+ BidRecord bid = tencentBids.get(qk);
|
|
|
+ if (bid != null
|
|
|
+ && "tencent".equals(bid.getMedia())
|
|
|
+ && (bid.getAccountId() == null || bid.getAccountId().isBlank())) {
|
|
|
+ missingAccountQks.add(qk);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (missingAccountQks.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ for (BidRecord coldBid : coldStore.getBidsByQks(missingAccountQks)) {
|
|
|
+ if (coldBid == null || coldBid.getQk() == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ BidRecord hotBid = tencentBids.get(coldBid.getQk());
|
|
|
+ if (hotBid == null || hotBid.getAccountId() != null && !hotBid.getAccountId().isBlank()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (coldBid.getAccountId() == null || coldBid.getAccountId().isBlank()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ hotBid.setAccountId(coldBid.getAccountId());
|
|
|
+ log.info("[ConversionSync] 腾讯 bid accountId 回落冷库补齐 | qk={} | accountId={}",
|
|
|
+ coldBid.getQk(), coldBid.getAccountId());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("[ConversionSync] 腾讯 bid accountId 回落冷库失败 | size={} | error={}",
|
|
|
+ missingAccountQks.size(), e.getMessage(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// ─── Step 2: 组装转化记录与回传任务 ───────────────────────────────────────
|
|
|
|
|
|
private void buildRecordsAndTasks(List<PaymentInfo> payments,
|