ソースを参照

Merge branch 'branch_1.2'

lining 1 年間 前
親
コミット
d8cb15d6ad

+ 18 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/controller/BytedanceController.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.job.bytedance.controller;
 
+import cn.com.ctop.job.bytedance.data.entity.AdvertiserAccount;
 import cn.com.ctop.job.bytedance.data.enums.AccountTypeEnum;
 import cn.com.ctop.job.bytedance.data.service.*;
 import cn.com.ctop.job.bytedance.data.utils.Check;
@@ -101,4 +102,21 @@ public class BytedanceController {
 
     }
 
+    @GetMapping("/generateFlowDetailsReport")
+    public void generateFlowDetailsReport(String startDate, String endDate) {
+        List<AdvertiserAccount> adAccount = byteDanceFlowDetailsReportService.getAdAccount();
+        adAccount.forEach(advertiserAccount -> {
+            dailyRetrExecutorService.submit(new Runnable() {
+
+                @Override
+                public void run() {
+                    if(!Check.isNull(advertiserAccount.getAccessToken())){
+                        byteDanceFlowDetailsReportService.getBytedanceFlowDetailsDailyReport(advertiserAccount.getAdvertiserId(), advertiserAccount.getAccessToken(), AccountTypeEnum.AD.getValue(), startDate, endDate, 1);
+                    }
+                }
+            });
+
+        });
+    }
+
 }

+ 16 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AdvertiserAccount.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.job.bytedance.data.entity;
+
+import lombok.Data;
+
+/**
+ * @author lining
+ * @ClassName AdvertiserAccount
+ * @description: TODO
+ * @date 2025年04月27日
+ * @version: 1.0
+ */
+@Data
+public class AdvertiserAccount {
+    private Long advertiserId;
+    private String accessToken;
+}

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.job.bytedance.data.mapper;
 
+import cn.com.ctop.job.bytedance.data.entity.AdvertiserAccount;
 import cn.com.ctop.job.bytedance.data.entity.ByteDanceFlowDetailsReportDaily;
 import org.apache.ibatis.annotations.Param;
 
@@ -14,5 +15,7 @@ import java.util.List;
  */
 public interface ByteDanceFlowDetailsReportMapper {
 
+    List<AdvertiserAccount> getAdAccount();
+
     void replaceDanceFlowDetailsReportDailies(@Param("list") List<ByteDanceFlowDetailsReportDaily> dailyList);
 }

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

@@ -1,6 +1,17 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="cn.com.ctop.job.bytedance.data.mapper.ByteDanceFlowDetailsReportMapper">
+
+    <select id="getAdAccount" resultType="cn.com.ctop.job.bytedance.data.entity.AdvertiserAccount">
+        select
+            tb1.advertiser_id as advertiserId,
+            tb2.access_token as accessToken
+        from
+            deepthink.bytedance_advertiser_list tb1
+                left join deepthink.bytedance_auth_list tb2 on
+                tb1.admin_advertiser_id = tb2.admin_advertiser_id
+    </select>
+
     <insert id="replaceDanceFlowDetailsReportDailies">
         replace into bytedance_flow_details_report_daily (
             advertiser_id,

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

@@ -1,5 +1,9 @@
 package cn.com.ctop.job.bytedance.data.service;
 
+import cn.com.ctop.job.bytedance.data.entity.AdvertiserAccount;
+
+import java.util.List;
+
 /**
  * @author lining
  * @ClassName IByteDanceFlowDetailsReportService
@@ -8,6 +12,6 @@ package cn.com.ctop.job.bytedance.data.service;
  * @version: 1.0
  */
 public interface IByteDanceFlowDetailsReportService {
-
+    List<AdvertiserAccount> getAdAccount();
     void getBytedanceFlowDetailsDailyReport(Long advertiserId, String accessToken, String transactionType, String startDate, String endDate, Integer page);
 }

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.job.bytedance.data.service.impl;
 
+import cn.com.ctop.job.bytedance.data.entity.AdvertiserAccount;
 import cn.com.ctop.job.bytedance.data.entity.ByteDanceFlowDetailsReportDaily;
 import cn.com.ctop.job.bytedance.data.mapper.ByteDanceFlowDetailsReportMapper;
 import cn.com.ctop.job.bytedance.data.service.IByteDanceFlowDetailsReportService;
@@ -32,6 +33,11 @@ public class ByteDanceFlowDetailsReportServiceImpl implements IByteDanceFlowDeta
     private ByteDanceFlowDetailsReportMapper byteDanceFlowDetailsReportMapper;
 
     @Override
+    public List<AdvertiserAccount> getAdAccount() {
+        return byteDanceFlowDetailsReportMapper.getAdAccount();
+    }
+
+    @Override
     public void getBytedanceFlowDetailsDailyReport(Long advertiserId, String accessToken, String accountType, String startDate, String endDate, Integer page) {
         String url = "https://ad.oceanengine.com/open_api/2/advertiser/fund/daily_stat/";
         Map<String, Object> paramsMap = new HashMap<>();