소스 검색

账户报表调试

zhaoxian 2 년 전
부모
커밋
c52ac0a242

+ 0 - 1
job-live/src/main/java/cn/com/ctop/job/live/handler/AdAccountReportJob.java

@@ -64,7 +64,6 @@ public class AdAccountReportJob {
     @XxlJob("AdAccountHourReportJob")
     @XxlJob("AdAccountHourReportJob")
     public void adAccountHourReportJob() {
     public void adAccountHourReportJob() {
         String param = XxlJobHelper.getJobParam(); // 执行参数
         String param = XxlJobHelper.getJobParam(); // 执行参数
-        log.info("账户入参,accountId:{}", param);
         if (Check.isNull(param)) {
         if (Check.isNull(param)) {
             log.error("入参为空");
             log.error("入参为空");
             return;
             return;

+ 1 - 1
job-live/src/main/java/cn/com/ctop/job/live/service/IKuaishouLiveAccountReportDailyService.java

@@ -10,7 +10,7 @@ import cn.com.ctop.job.live.utils.Result;
  */
  */
 public interface IKuaishouLiveAccountReportDailyService {
 public interface IKuaishouLiveAccountReportDailyService {
 
 
-    Result<Object> getKuaishouAccountReport(Long accountId, String token);
+    void getKuaishouAccountReport(Long accountId, String token);
 
 
     void getKuaishouAccountHourReport(Long accountId, String token);
     void getKuaishouAccountHourReport(Long accountId, String token);
 }
 }

+ 29 - 8
job-live/src/main/java/cn/com/ctop/job/live/service/impl/KuaishouLiveAccountReportDailyServiceImpl.java

@@ -34,8 +34,16 @@ public class KuaishouLiveAccountReportDailyServiceImpl implements IKuaishouLiveA
     private KuaishouLiveAccountReportDailyMapper mapper;
     private KuaishouLiveAccountReportDailyMapper mapper;
 
 
     @Override
     @Override
-    public Result<Object> getKuaishouAccountReport(Long accountId, String token) {
-        log.info("调用接口---getKuaishouAccountReport(获取直播账户报表)---账户:{}", accountId);
+    public void getKuaishouAccountReport(Long accountId, String token) {
+        try {
+            getAccountReport(accountId, token, 1);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void getAccountReport(Long accountId, String token, int pageNum) {
+        log.info("------getKuaishouAccountReport(获取直播账户日报)---账户:{},---page:{}", accountId, pageNum);
         Result<Object> result = new Result<>();
         Result<Object> result = new Result<>();
         Map<String, Object> param = new HashMap<String, Object>();
         Map<String, Object> param = new HashMap<String, Object>();
         param.put("advertiser_id", accountId);
         param.put("advertiser_id", accountId);
@@ -47,8 +55,8 @@ public class KuaishouLiveAccountReportDailyServiceImpl implements IKuaishouLiveA
         params.put("view_type", 1);
         params.put("view_type", 1);
         params.put("group_type", 1);
         params.put("group_type", 1);
         JSONObject pageInfo = new JSONObject();
         JSONObject pageInfo = new JSONObject();
-        pageInfo.put("page", 1);
-        pageInfo.put("page_size", 2000);
+        pageInfo.put("page", pageNum);
+        pageInfo.put("page_size", 500);
         param.put("page_info", pageInfo);
         param.put("page_info", pageInfo);
         param.put("param", params);
         param.put("param", params);
         JSONObject apiResult = APIUtil.getApiResult(KuaishouAPIConstant.REPORT_LIST, token, param);
         JSONObject apiResult = APIUtil.getApiResult(KuaishouAPIConstant.REPORT_LIST, token, param);
@@ -66,15 +74,25 @@ public class KuaishouLiveAccountReportDailyServiceImpl implements IKuaishouLiveA
             if (!Check.isNull(list)) {
             if (!Check.isNull(list)) {
                 mapper.replaceBatch(list);
                 mapper.replaceBatch(list);
             }
             }
+            if (data.size() == 500) {
+                getAccountReportHour(accountId, token, pageNum + 1);
+            }
         } else {
         } else {
             log.error("获取直播账户报表,账户{},{}", accountId, apiResult.toJSONString());
             log.error("获取直播账户报表,账户{},{}", accountId, apiResult.toJSONString());
         }
         }
-        return result.success("success");
     }
     }
 
 
     @Override
     @Override
     public void getKuaishouAccountHourReport(Long accountId, String token) {
     public void getKuaishouAccountHourReport(Long accountId, String token) {
-        log.info("调用接口---getKuaishouAccountHourReport(获取直播账户时报报表)---账户:{}", accountId);
+        try {
+            getAccountReportHour(accountId, token, 1);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void getAccountReportHour(Long accountId, String token, int pageNum) {
+        log.info("------getKuaishouAccountHourReport(获取直播账户时报)---账户:{},---page:{}", accountId, pageNum);
         Result<Object> result = new Result<>();
         Result<Object> result = new Result<>();
         Map<String, Object> param = new HashMap<String, Object>();
         Map<String, Object> param = new HashMap<String, Object>();
         param.put("advertiser_id", accountId);
         param.put("advertiser_id", accountId);
@@ -88,8 +106,8 @@ public class KuaishouLiveAccountReportDailyServiceImpl implements IKuaishouLiveA
         params.put("view_type", 1);
         params.put("view_type", 1);
         params.put("group_type", 2);
         params.put("group_type", 2);
         JSONObject pageInfo = new JSONObject();
         JSONObject pageInfo = new JSONObject();
-        pageInfo.put("page", 1);
-        pageInfo.put("page_size", 2000);
+        pageInfo.put("page", pageNum);
+        pageInfo.put("page_size", 500);
         param.put("page_info", pageInfo);
         param.put("page_info", pageInfo);
         param.put("param", params);
         param.put("param", params);
         JSONObject apiResult = APIUtil.getApiResult(KuaishouAPIConstant.REPORT_LIST, token, param);
         JSONObject apiResult = APIUtil.getApiResult(KuaishouAPIConstant.REPORT_LIST, token, param);
@@ -108,6 +126,9 @@ public class KuaishouLiveAccountReportDailyServiceImpl implements IKuaishouLiveA
             if (!Check.isNull(list)) {
             if (!Check.isNull(list)) {
                 mapper.replaceBatchHour(list);
                 mapper.replaceBatchHour(list);
             }
             }
+            if (data.size() == 500) {
+                getAccountReportHour(accountId, token, pageNum + 1);
+            }
         } else {
         } else {
             log.error("获取直播账户报表,账户{},{}", accountId, apiResult.toJSONString());
             log.error("获取直播账户报表,账户{},{}", accountId, apiResult.toJSONString());
         }
         }