yumeng 4 年之前
父節點
當前提交
4335588145

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouOperationRecord.java

@@ -38,4 +38,6 @@ public class KuaishouOperationRecord {
 	private String updateData;
 
 	private String statDate;
+
+	private String log;
 }

+ 61 - 89
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouOperationRecordMapper.xml

@@ -25,35 +25,31 @@
     </delete>
 
     <insert id="insertOperationRecordInfoAccount">
-        insert into
+        replace into
         ctop_kuaishou_operation_record_account
         (
-            account_id,
-            stat_date,
-            operation_time,
-            operation_type,
-            role_type,
-            object_name,
-            operation_target,
-            object_id,
-            field_name,
-            original_data,
-            update_data
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        log
         )
         values
         <foreach item="record" index="index" collection="records"  separator="," >
             (
-                #{record.accountId},
-                #{record.statDate},
-                #{record.operationTime},
-                #{record.operationType},
-                #{record.roleType},
-                #{record.objectName},
-                #{record.operationTarget},
-                #{record.objectId},
-                #{record.fieldName},
-                #{record.originalData},
-                #{record.updateData}
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.log}
             )
         </foreach>
 
@@ -71,22 +67,22 @@
         account_id = #{record.accountId}
         and
         stat_date = #{record.statDate}
-     <!--
-        and
-        object_id = #{record.objectId}
-        and
-        operation_type = #{record.operationType}
-        and
-        operation_target = #{record.operationTarget}
-        and
-        role_type = #{record.roleType}
-        and
-        operation_time = #{record.operationTime}
-        -->
+        <!--
+           and
+           object_id = #{record.objectId}
+           and
+           operation_type = #{record.operationType}
+           and
+           operation_target = #{record.operationTarget}
+           and
+           role_type = #{record.roleType}
+           and
+           operation_time = #{record.operationTime}
+           -->
     </delete>
 
     <insert id="insertOperationRecordInfoCampaign">
-        insert into
+        replace into
         ctop_kuaishou_operation_record_campaign
         (
         account_id,
@@ -97,9 +93,7 @@
         object_name,
         operation_target,
         object_id,
-        field_name,
-        original_data,
-        update_data
+        log
         )
         values
         <foreach item="record" index="index" collection="records"  separator="," >
@@ -112,9 +106,7 @@
             #{record.objectName},
             #{record.operationTarget},
             #{record.objectId},
-            #{record.fieldName},
-            #{record.originalData},
-            #{record.updateData}
+            #{record.log}
             )
         </foreach>
 
@@ -129,22 +121,22 @@
         account_id = #{record.accountId}
         and
         stat_date = #{record.statDate}
-       <!--
-        and
-        object_id = #{record.objectId}
-        and
-        operation_type = #{record.operationType}
-        and
-        operation_target = #{record.operationTarget}
-        and
-        role_type = #{record.roleType}
-        and
-        operation_time = #{record.operationTime}
-        -->
+        <!--
+         and
+         object_id = #{record.objectId}
+         and
+         operation_type = #{record.operationType}
+         and
+         operation_target = #{record.operationTarget}
+         and
+         role_type = #{record.roleType}
+         and
+         operation_time = #{record.operationTime}
+         -->
     </delete>
 
     <insert id="insertOperationRecordInfoUnit">
-        insert into
+        replace into
         ctop_kuaishou_operation_record_unit
         (
         account_id,
@@ -155,9 +147,7 @@
         object_name,
         operation_target,
         object_id,
-        field_name,
-        original_data,
-        update_data
+        log
         )
         values
         <foreach item="record" index="index" collection="records"  separator="," >
@@ -170,9 +160,7 @@
             #{record.objectName},
             #{record.operationTarget},
             #{record.objectId},
-            #{record.fieldName},
-            #{record.originalData},
-            #{record.updateData}
+            #{record.log}
             )
         </foreach>
 
@@ -204,7 +192,7 @@
     </delete>
 
     <insert id="insertOperationRecordInfoCreative">
-        insert into
+        replace into
         ctop_kuaishou_operation_record_creative
         (
         account_id,
@@ -215,9 +203,7 @@
         object_name,
         operation_target,
         object_id,
-        field_name,
-        original_data,
-        update_data
+        log
         )
         values
         <foreach item="record" index="index" collection="records"  separator="," >
@@ -230,9 +216,7 @@
             #{record.objectName},
             #{record.operationTarget},
             #{record.objectId},
-            #{record.fieldName},
-            #{record.originalData},
-            #{record.updateData}
+            #{record.log}
             )
         </foreach>
 
@@ -263,7 +247,7 @@
     </delete>
 
     <insert id="insertOperationRecordInfoVideo">
-        insert into
+        replace into
         ctop_kuaishou_operation_record_video
         (
         account_id,
@@ -274,9 +258,7 @@
         object_name,
         operation_target,
         object_id,
-        field_name,
-        original_data,
-        update_data
+        log
         )
         values
         <foreach item="record" index="index" collection="records"  separator="," >
@@ -289,9 +271,7 @@
             #{record.objectName},
             #{record.operationTarget},
             #{record.objectId},
-            #{record.fieldName},
-            #{record.originalData},
-            #{record.updateData}
+            #{record.log}
             )
         </foreach>
 
@@ -323,7 +303,7 @@
     </delete>
 
     <insert id="insertOperationRecordInfoApp">
-        insert into
+        replace into
         ctop_kuaishou_operation_record_app
         (
         account_id,
@@ -334,9 +314,7 @@
         object_name,
         operation_target,
         object_id,
-        field_name,
-        original_data,
-        update_data
+        log
         )
         values
         <foreach item="record" index="index" collection="records"  separator="," >
@@ -349,9 +327,7 @@
             #{record.objectName},
             #{record.operationTarget},
             #{record.objectId},
-            #{record.fieldName},
-            #{record.originalData},
-            #{record.updateData}
+            #{record.log}
             )
         </foreach>
 
@@ -382,7 +358,7 @@
     </delete>
 
     <insert id="insertOperationRecordInfoPackage">
-        insert into
+        replace into
         ctop_kuaishou_operation_record_package
         (
         account_id,
@@ -393,9 +369,7 @@
         object_name,
         operation_target,
         object_id,
-        field_name,
-        original_data,
-        update_data
+        log
         )
         values
         <foreach item="record" index="index" collection="records"  separator="," >
@@ -408,9 +382,7 @@
             #{record.objectName},
             #{record.operationTarget},
             #{record.objectId},
-            #{record.fieldName},
-            #{record.originalData},
-            #{record.updateData}
+            #{record.log}
             )
         </foreach>
 

+ 35 - 32
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl2.java

@@ -73,38 +73,41 @@ public class KuaishouInterfaceServiceImpl2 implements IKuaishouInterfaceService2
                             String objectId = dataJson.getString("object_id");
                             String objectName = dataJson.getString("object_name");
 
-                            if (page == 1 && i==0) { //如果页数为1,删除原来的数据
-                                KuaishouOperationRecord recordDelete = new KuaishouOperationRecord();
-                                recordDelete.setStatDate(startDate);//按天删除记录
-                                recordDelete.setAccountId(advertiserId);
-                                //recordDelete.setOperationTime(operationTime);
-                                //recordDelete.setOperationType(operationType);
-                                //recordDelete.setRoleType(roleType);
-                                //recordDelete.setObjectName(objectName);
-                                //recordDelete.setOperationTarget(operationTarget);
-                                //recordDelete.setObjectId(objectId);
-                                operationRecordDelete(recordDelete,operationTarget);
-                            }
-
-                            JSONArray contentLogArray =  dataJson.getJSONArray("content_log");
-                            int jsize =  contentLogArray.size();
-                            for(int j=0; j<jsize;j++){
-                                JSONObject log = contentLogArray.getJSONObject(j);
-                                KuaishouOperationRecord record = new KuaishouOperationRecord();
-                                record.setAccountId(advertiserId);
-                                record.setStatDate(startDate);
-                                record.setOperationTime(operationTime);
-                                record.setOperationType(operationType);
-                                record.setRoleType(roleType);
-                                record.setObjectName(objectName);
-                                record.setOperationTarget(operationTarget);
-                                record.setObjectId(objectId);
-                                record.setFieldName(log.getString("field_name"));
-                                record.setOriginalData(log.getString("original_data"));
-                                record.setUpdateData(log.getString("update_data"));
-
-                                recordList.add(record);
-                            }
+                            //if (page == 1 && i==0) { //如果页数为1,删除原来的数据
+                            //    KuaishouOperationRecord recordDelete = new KuaishouOperationRecord();
+                            //    recordDelete.setStatDate(startDate);//按天删除记录
+                            //    recordDelete.setAccountId(advertiserId);
+                            //    //recordDelete.setOperationTime(operationTime);
+                            //    //recordDelete.setOperationType(operationType);
+                            //    //recordDelete.setRoleType(roleType);
+                            //    //recordDelete.setObjectName(objectName);
+                            //    //recordDelete.setOperationTarget(operationTarget);
+                            //    //recordDelete.setObjectId(objectId);
+                            //    operationRecordDelete(recordDelete,operationTarget);
+                            //}
+
+                            String contentLogArrayString =  dataJson.getString("content_log");
+
+                            //int jsize =  contentLogArray.size();
+                            //for(int j=0; j<jsize;j++){
+                            //    JSONObject log = contentLogArray.getJSONObject(j);
+
+                            KuaishouOperationRecord record = new KuaishouOperationRecord();
+                            record.setAccountId(advertiserId);
+                            record.setStatDate(startDate);
+                            record.setOperationTime(operationTime);
+                            record.setOperationType(operationType);
+                            record.setRoleType(roleType);
+                            record.setObjectName(objectName);
+                            record.setOperationTarget(operationTarget);
+                            record.setObjectId(objectId);
+                            record.setLog(contentLogArrayString);
+                            //record.setFieldName(log.getString("field_name"));
+                            //record.setOriginalData(log.getString("original_data"));
+                            //record.setUpdateData(log.getString("update_data"));
+
+                            recordList.add(record);
+                            //}
                         }
                     }
                     if(recordList !=null && recordList.size()!=0){