|
@@ -166,4 +166,88 @@ public class KuaishouAccountReportDailyServiceImpl extends ServiceImpl<KuaishouA
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void liveComponentReport(Long accountId, String token, String beginDate, String endDate) {
|
|
|
+ String url = postUrl + KuaishouConstant.LIVE_COMPONENT_REPORT;
|
|
|
+ Map<String, String> headers = new HashMap<>();
|
|
|
+ headers.put("Access-Token", token);
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("advertiser_id", accountId);
|
|
|
+// param.put("temporal_granularity", "HOURLY");
|
|
|
+ param.put("start_date", beginDate);
|
|
|
+ param.put("end_date", endDate);
|
|
|
+ param.put("page", 1);
|
|
|
+ param.put("page_size", 2000);
|
|
|
+ JSONObject search_param = new JSONObject();
|
|
|
+
|
|
|
+ String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
|
+ JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
+ System.out.println("---直播间组件报表----------------" + param);
|
|
|
+ System.out.println("");
|
|
|
+ System.err.println(resultJson);
|
|
|
+ Integer code = resultJson.getInteger("code");
|
|
|
+ if (null == code || code != 0) {
|
|
|
+ String message = resultJson.getString("message");
|
|
|
+ log.error("直播间组件报表异常:{},accountId:{}", message, accountId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject data = resultJson.getJSONObject("data");
|
|
|
+ JSONArray details = data.getJSONArray("details");
|
|
|
+
|
|
|
+ /* if (!Check.isNull(details)) {
|
|
|
+ for (int i = 0; i < details.size(); i++) {
|
|
|
+ JSONObject jsonObject = details.getJSONObject(i);
|
|
|
+ jsonObject.put("start_date", DateUtils.tempToDate(jsonObject.getLong("live_start_time"), "yyyy-MM-dd HH:mm:ss"));
|
|
|
+ jsonObject.put("end_date", DateUtils.tempToDate(jsonObject.getLong("live_end_time"), "yyyy-MM-dd HH:mm:ss"));
|
|
|
+ }
|
|
|
+
|
|
|
+ System.out.println("-------------------直播间" + param);
|
|
|
+ System.out.println("");
|
|
|
+ System.err.println(details);
|
|
|
+
|
|
|
+ }*/
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void liveUserReport(Long accountId, String token, String beginDate, String endDate) {
|
|
|
+ String url = postUrl + KuaishouConstant.LIVE_USER_REPORT;
|
|
|
+ Map<String, String> headers = new HashMap<>();
|
|
|
+ headers.put("Access-Token", token);
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("advertiser_id", accountId);
|
|
|
+// param.put("temporal_granularity", "HOURLY");
|
|
|
+ param.put("start_date", beginDate);
|
|
|
+ param.put("end_date", endDate);
|
|
|
+ param.put("page", 1);
|
|
|
+ param.put("page_size", 2000);
|
|
|
+ JSONObject search_param = new JSONObject();
|
|
|
+ String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
|
+ JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
+ System.out.println("-------------------直播间" + param);
|
|
|
+ System.out.println("");
|
|
|
+ System.err.println(resultJson);
|
|
|
+ Integer code = resultJson.getInteger("code");
|
|
|
+ if (null == code || code != 0) {
|
|
|
+ String message = resultJson.getString("message");
|
|
|
+ log.error("直播间报表异常:{},accountId:{}", message, accountId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject data = resultJson.getJSONObject("data");
|
|
|
+ JSONArray details = data.getJSONArray("details");
|
|
|
+ if (!Check.isNull(details)) {
|
|
|
+ for (int i = 0; i < details.size(); i++) {
|
|
|
+ JSONObject jsonObject = details.getJSONObject(i);
|
|
|
+ jsonObject.put("start_date", DateUtils.tempToDate(jsonObject.getLong("live_start_time"), "yyyy-MM-dd HH:mm:ss"));
|
|
|
+ jsonObject.put("end_date", DateUtils.tempToDate(jsonObject.getLong("live_end_time"), "yyyy-MM-dd HH:mm:ss"));
|
|
|
+ jsonObject.put("charge", jsonObject.getBigDecimal("ad_live_follow").multiply(jsonObject.getBigDecimal("ad_live_follow_cost")));
|
|
|
+ }
|
|
|
+
|
|
|
+ System.err.println("-------------------直播间整理数据\n" + details);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|