瀏覽代碼

头条账户报表

hcst_sunzhen 4 年之前
父節點
當前提交
1ef32aab42

+ 15 - 9
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceOperationRecordMapper.xml

@@ -3,10 +3,11 @@
 <mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.BytedanceOperationRecordMapper">
 
     <select id="insertOperationRecordCampaign">
-        insert into
+        replace into
         ctop_bytedance_operation_record_campaign
         (
             account_id,
+            stat_date,
             object_id,
             object_type,
             content_title,
@@ -18,9 +19,10 @@
             operation_target
         )
         values
-        <foreach collection="records" item="report" separator=",">
+        <foreach collection="records" item="record" separator=",">
             (
             #{record.accountId},
+            #{record.statDate},
             #{record.objectId},
             #{record.objectType},
             #{record.contentTitle},
@@ -28,17 +30,18 @@
             #{record.operationCreateTime},
             #{record.contentLog},
             #{record.operator},
-            #{record.type},
+            #{record.optIp},
             #{record.operationTarget}
             )
         </foreach>
     </select>
 
     <select id="insertOperationRecordPlan">
-        insert into
+        replace into
         ctop_bytedance_operation_record_plan
         (
             account_id,
+            stat_date,
             object_id,
             object_type,
             content_title,
@@ -50,9 +53,10 @@
             operation_target
         )
         values
-        <foreach collection="records" item="report" separator=",">
+        <foreach collection="records" item="record" separator=",">
             (
             #{record.accountId},
+            #{record.statDate},
             #{record.objectId},
             #{record.objectType},
             #{record.contentTitle},
@@ -60,17 +64,18 @@
             #{record.operationCreateTime},
             #{record.contentLog},
             #{record.operator},
-            #{record.type},
+            #{record.optIp},
             #{record.operationTarget}
             )
         </foreach>
     </select>
 
     <select id="insertOperationRecordCreative">
-        insert into
+        replace into
         ctop_bytedance_operation_record_creative
         (
         account_id,
+        stat_date,
         object_id,
         object_type,
         content_title,
@@ -82,9 +87,10 @@
         operation_target
         )
         values
-        <foreach collection="records" item="report" separator=",">
+        <foreach collection="records" item="record" separator=",">
             (
             #{record.accountId},
+            #{record.statDate},
             #{record.objectId},
             #{record.objectType},
             #{record.contentTitle},
@@ -92,7 +98,7 @@
             #{record.operationCreateTime},
             #{record.contentLog},
             #{record.operator},
-            #{record.type},
+            #{record.optIp},
             #{record.operationTarget}
             )
         </foreach>

+ 4 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceInterfaceServiceImpl.java

@@ -115,7 +115,7 @@ public class BytedanceInterfaceServiceImpl implements IBytedanceInterfaceService
 
         JSONObject json = HttpUtils.bytedanceGetRequest(access_token, open_api_domain + path, JSONObject.parseObject(JSONObject.toJSONString(data)));
         if (json == null) {
-            log.error("头条日志查询返回为空,请求有误:" + JSONObject.toJSONString(data));
+            log.error("头条日志查询返回为空,请求有误:" + JSONObject.toJSONString(data) + ";;;返回值为:"+ json);
             return ;
         }
 
@@ -142,7 +142,7 @@ public class BytedanceInterfaceServiceImpl implements IBytedanceInterfaceService
                 record.setOperationCreateTime(logJson.getDate("create_time"));
                 record.setStatDate(DateUtils.formatDate(logJson.getDate("create_time")));
                 record.setOperator(logJson.getString("operator"));
-                record.setOptIp(logJson.getString("opt_id"));
+                record.setOptIp(logJson.getString("opt_ip"));
                 record.setOperationTarget(operationType);
 
                 records.add(record);
@@ -157,9 +157,10 @@ public class BytedanceInterfaceServiceImpl implements IBytedanceInterfaceService
                 logSearchByPage(page+1, pageSize, token, accountId, objectId, operationType, startTime, endTime);
             }
         }else{
-            log.error("头条日志查询返回为空,请求有误:" + JSONObject.toJSONString(data),";;;返回值为:"+ json);
+            log.error("头条日志查询返回为空,请求有误:" + JSONObject.toJSONString(data)+";;;返回值为:"+ json);
             return ;
         }
+        //return 200;
     }
 
     private void insertLog(Integer operationTarget, List<ByteDanceOperationRecord> records){