Browse Source

数据报表调整

yumeng 4 years ago
parent
commit
8f77e96747

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java

@@ -273,7 +273,7 @@ public interface IKuaishouInterfaceService {
      * @param startDate
      * @param startDate
      * @param endDate
      * @param endDate
      */
      */
-    void getAdvertiserReportDaily(CtopOauthToken token, Date startDate, Date endDate);
+    void getAdvertiserReportDaily(CtopOauthToken token, Date startDate, Date endDate, String reportDims);
 
 
     /**
     /**
      * 获取计划分天报表
      * 获取计划分天报表

+ 11 - 8
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -271,12 +271,12 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
 
 
 
     @Override
     @Override
-    public void getAdvertiserReportDaily(CtopOauthToken token, Date startDate, Date endDate) {
-        getAccountDailyReportByPage(token, startDate, endDate, 1);
+    public void getAdvertiserReportDaily(CtopOauthToken token, Date startDate, Date endDate, String reportDims) {
+        getAccountDailyReportByPage(token, startDate, endDate, 1, reportDims);
     }
     }
 
 
 
 
-    private void getAccountDailyReportByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
+    private void getAccountDailyReportByPage(CtopOauthToken token, Date startDate, Date endDate, int page, String reportDims) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ACCOUNT_REPORT;
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ACCOUNT_REPORT;
         Map<String, String> headers = new HashMap<>();
         Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", "application/json");
         headers.put("Content-Type", "application/json");
@@ -289,11 +289,13 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         if (!Check.isNull(endDate)) {
         if (!Check.isNull(endDate)) {
             param.put("end_date", DateUtils.formatDate(endDate));
             param.put("end_date", DateUtils.formatDate(endDate));
         }
         }
-
+        if (!Check.isNull(reportDims)) {
+            param.put("report_dims", reportDims);
+        }
 
 
         param.put("advertiser_id", token.getAccountId());
         param.put("advertiser_id", token.getAccountId());
         param.put("temporal_granularity", "DAILY");
         param.put("temporal_granularity", "DAILY");
-        param.put("page_size", 500);
+        param.put("page_size", 2000);
         param.put("page", page);
         param.put("page", page);
         String result = HttpUtils.httpPostRequest(url, param, headers);
         String result = HttpUtils.httpPostRequest(url, param, headers);
         JSONObject resultJson = JSONObject.parseObject(result);
         JSONObject resultJson = JSONObject.parseObject(result);
@@ -309,6 +311,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             return;
             return;
         }
         }
 
 
+        List<>
         for (int i = 0; i < details.size(); i++) {
         for (int i = 0; i < details.size(); i++) {
             JSONObject detailJson = details.getJSONObject(i);
             JSONObject detailJson = details.getJSONObject(i);
             if (!Check.isNull(detailJson)) {
             if (!Check.isNull(detailJson)) {
@@ -316,12 +319,12 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 detailJson.put("photo_comment", detailJson.getString("comment"));
                 detailJson.put("photo_comment", detailJson.getString("comment"));
                 detailJson.put("photo_like", detailJson.getString("like"));
                 detailJson.put("photo_like", detailJson.getString("like"));
                 detailJson.put("photo_show", detailJson.getString("show"));
                 detailJson.put("photo_show", detailJson.getString("show"));
-                var KuaishouReportDailyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportDailyAccount.class);
+                KuaishouReportDailyAccount KuaishouReportDailyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportDailyAccount.class);
                 KuaishouReportDailyAccount.setAccountId(token.getAccountId());
                 KuaishouReportDailyAccount.setAccountId(token.getAccountId());
-                dailyAccountMapper.insertSelective(KuaishouReportDailyAccount);
+          //      dailyAccountMapper.insertSelective(KuaishouReportDailyAccount);
             }
             }
         }
         }
-        getAccountDailyReportByPage(token, startDate, endDate, page + 1);
+        getAccountDailyReportByPage(token, startDate, endDate, page + 1, reportDims);
     }
     }