Quellcode durchsuchen

快手报表获取

yumeng vor 1 Tag
Ursprung
Commit
f5e28840c3

+ 9 - 9
job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/data/entity/KuaishouMaterialReportDaily.java

@@ -8,7 +8,7 @@ import java.math.BigDecimal;
 /**
  * 快手素材日报表(media_kuaishou_material_report_daily)
  * 指标字段与账户日报(KuaishouAccountReportDaily)保持一致,
- * 额外保留素材报表维度字段(photo_id/pic_id 等)
+ * 素材维度统一为 material_type + material_id(视频行取 photo_id、图片行取 pic_id)
  */
 @Data
 public class KuaishouMaterialReportDaily implements Serializable {
@@ -28,9 +28,15 @@ public class KuaishouMaterialReportDaily implements Serializable {
 
 
     /**
-     * 视频素材id(视频素材行有值,其余为0)
+     * 素材类型:5-视频素材,16-图片素材(对应API view_type)
      */
-    private Long photoId = 0L;
+    private Integer materialType;
+
+
+    /**
+     * 素材id:视频行=photo_id,图片行=pic_id(API未返回ID时为0)
+     */
+    private Long materialId = 0L;
 
 
     /**
@@ -64,12 +70,6 @@ public class KuaishouMaterialReportDaily implements Serializable {
 
 
     /**
-     * 图片素材id(图片素材行有值,其余为0)
-     */
-    private Long picId = 0L;
-
-
-    /**
      * 图片素材签名
      */
     private String picSignature = "";

+ 4 - 4
job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/data/mapper/xml/KuaiShouMaterialReportMapper.xml

@@ -7,13 +7,13 @@
         (
         advertiser_id,
         stat_date,
-        photo_id,
+        material_type,
+        material_id,
         photo_signature,
         photo_url,
         cover_url,
         sticky_url,
         image_urls,
-        pic_id,
         pic_signature,
         ad_scene,
         aigc_material,
@@ -43,13 +43,13 @@
             (
             #{ad.advertiserId},
             #{ad.statDate},
-            #{ad.photoId},
+            #{ad.materialType},
+            #{ad.materialId},
             #{ad.photoSignature},
             #{ad.photoUrl},
             #{ad.coverUrl},
             #{ad.stickyUrl},
             #{ad.imageUrls},
-            #{ad.picId},
             #{ad.picSignature},
             #{ad.adScene},
             #{ad.aigcMaterial},

+ 3 - 0
job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/data/service/impl/KuaiShouMaterialReportServiceImpl.java

@@ -135,6 +135,9 @@ public class KuaiShouMaterialReportServiceImpl implements IKuaiShouMaterialRepor
                 if (aigcMaterial instanceof Boolean) {
                     detailJson.put("aigc_material", String.valueOf(aigcMaterial));
                 }
+                // 视频行取photo_id、图片行取pic_id,统一映射为material_id;素材类型随view_type入库
+                detailJson.put("material_id", VIEW_TYPE_VIDEO == viewType ? detailJson.get("photo_id") : detailJson.get("pic_id"));
+                detailJson.put("material_type", viewType);
                 KuaishouMaterialReportDaily materialReportDaily = JSONObject.toJavaObject(detailJson, KuaishouMaterialReportDaily.class);
                 materialReportDaily.setAdvertiserId(advertiserId);
                 addList.add(materialReportDaily);