yumeng 2 лет назад
Родитель
Сommit
a3b9c174ce

+ 1 - 1
job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/data/service/IAdUnitReportService.java

@@ -26,7 +26,7 @@ public interface IAdUnitReportService{
 
     void crowdAnalysisReport(Long advertiserId, String accessToken, String date,  List<Long> campaignIds,List<Long> unitIds, List<String> reportDims,Integer page);
 
-    void getKuaishouDailyFlows(Long advertiserId, String accessToken,int page);
+    void getKuaishouDailyFlows(Long advertiserId, String accessToken,String startDate,String endDate,int page);
 
     void getKuaishouDailyFundGet(Long advertiserId,String accessToken);
 }

+ 4 - 2
job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/data/service/impl/AdUnitReportServiceImpl.java

@@ -450,7 +450,7 @@ public class AdUnitReportServiceImpl implements IAdUnitReportService {
      * @param page
      */
     @Override
-    public void getKuaishouDailyFlows(Long advertiserId, String accessToken, int page) {
+    public void getKuaishouDailyFlows(Long advertiserId, String accessToken, String startDate,String endDate,int page) {
         log.info("获取账户流水========,账户id:{},page--{}", advertiserId, page);
         Integer page_size = 500;
         String url = postUrl + KuaishouConstant.FUND_DAILY_FLOWS;
@@ -460,6 +460,8 @@ public class AdUnitReportServiceImpl implements IAdUnitReportService {
         param.put("advertiser_id", advertiserId);
         param.put("page_size", page_size);
         param.put("page", page);
+        param.put("start_date", "2022-12-01");
+        param.put("end_date", "2023-01-04");
         String result = HttpUtils.httpPostRequest(url, param, headers);
         JSONObject resultJson = JSONObject.parseObject(result);
         Integer code = resultJson.getInteger("code");
@@ -488,7 +490,7 @@ public class AdUnitReportServiceImpl implements IAdUnitReportService {
             toGet = false;
         }
         if (toGet) {
-            getKuaishouDailyFlows(advertiserId, accessToken, page + 1);
+            getKuaishouDailyFlows(advertiserId, accessToken, startDate,endDate,page + 1);
         } else {
             log.info("账户流水========获取完成:accountId:{}", advertiserId);
         }

+ 5 - 1
job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/AdUnitReportJob.java

@@ -277,11 +277,15 @@ public class AdUnitReportJob {
             log.error("此账户未获取到相关token,accountId:{}", param);
             return;
         }
+
+        String endDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", endDate, -2);
+
         dailyExecutorService.submit(
                 new Runnable() {
                     @Override
                     public void run() {
-                        adUnitReportService.getKuaishouDailyFlows(Long.valueOf(param), token, 1);
+                        adUnitReportService.getKuaishouDailyFlows(Long.valueOf(param), token,startDate, endDate,1);
                     }
                 });
     }