소스 검색

ExternalChannel 增加视频ID

wangyunpeng 1 개월 전
부모
커밋
1d32063ac4

+ 18 - 0
api-module/src/main/java/com/tzld/piaoquan/api/component/AdApiService.java

@@ -143,4 +143,22 @@ public class AdApiService {
         }
         }
         return null;
         return null;
     }
     }
+
+    /**
+     * 根据RootSourceId 获取 tencentFlow videoId
+     */
+    public Long getVideoIdByRootSourceId(String rootSourceId) {
+        try {
+            String url = adApiHost + "/put/flow/getByRootSourceId/tencent?rootSourceId=" + rootSourceId;
+            String response = httpPoolClient.get(url);
+            JSONObject res = JSONObject.parseObject(response);
+            if (res.getInteger("code") == 0 && res.get("data") != null) {
+                JSONObject data = res.getJSONObject("data");
+                return data.getLong("videoId");
+            }
+        } catch (Exception e) {
+            log.error("获取人群包信息失败, rootSourceId={}", rootSourceId, e);
+        }
+        return null;
+    }
 }
 }

+ 18 - 0
api-module/src/main/java/com/tzld/piaoquan/api/component/RecommendApiService.java

@@ -54,6 +54,7 @@ public class RecommendApiService {
         }
         }
         return null;
         return null;
     }
     }
+
     /**
     /**
      * 根据rootSourceId获取合作方文章信息
      * 根据rootSourceId获取合作方文章信息
      */
      */
@@ -71,6 +72,23 @@ public class RecommendApiService {
         return null;
         return null;
     }
     }
 
 
+    /**
+     * 根据rootSourceId获取视频ID信息
+     */
+    public Long getVideoIdByRootSourceId(String rootSourceId) {
+        try {
+            String url = recommendApiHost + "/article/getVideoIdByRootSourceId?rootSourceId=" + rootSourceId;
+            String response = httpPoolClient.get(url);
+            JSONObject res = JSONObject.parseObject(response);
+            if (res.getInteger("code") == 0 && res.getLong("data") != null) {
+                return res.getLong("data");
+            }
+        } catch (Exception e) {
+            log.error("获取文章信息失败, rootSourceId={}", rootSourceId, e);
+        }
+        return null;
+    }
+
     /**
     /**
      * 检查rootSourceId是否存在
      * 检查rootSourceId是否存在
      */
      */

+ 32 - 0
api-module/src/main/java/com/tzld/piaoquan/api/job/ExternalChannelProcessJob.java

@@ -55,6 +55,9 @@ public class ExternalChannelProcessJob {
     @Autowired
     @Autowired
     private ContentPlatformQwPlanMapper qwPlanMapper;
     private ContentPlatformQwPlanMapper qwPlanMapper;
 
 
+    @Autowired
+    private ContentPlatformQwPlanVideoMapper qwPlanVideoMapper;
+
     @Autowired
     @Autowired
     private ContentPlatformGzhPlanVideoMapper gzhPlanVideoMapper;
     private ContentPlatformGzhPlanVideoMapper gzhPlanVideoMapper;
 
 
@@ -503,6 +506,9 @@ public class ExternalChannelProcessJob {
                 if (packageIds != null && !packageIds.isEmpty()) {
                 if (packageIds != null && !packageIds.isEmpty()) {
                     record.setPackageId(JSONObject.toJSONString(packageIds.get(0)));
                     record.setPackageId(JSONObject.toJSONString(packageIds.get(0)));
                 }
                 }
+                // 通过 ad_put_flow_record 获取视频ID
+                Long videoId = adApiService.getVideoIdByRootSourceId(rootSourceId);
+                record.setVideoId(videoId);
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             log.error("获取小程序投流信息异常, id={}, rootSourceId={}", recordId, rootSourceId, e);
             log.error("获取小程序投流信息异常, id={}, rootSourceId={}", recordId, rootSourceId, e);
@@ -538,6 +544,7 @@ public class ExternalChannelProcessJob {
             if (!CollectionUtils.isEmpty(bucketDataList)) {
             if (!CollectionUtils.isEmpty(bucketDataList)) {
                 String ghId = bucketDataList.get(0).getGhId();
                 String ghId = bucketDataList.get(0).getGhId();
                 record.setAccountId(ghId);
                 record.setAccountId(ghId);
+                record.setVideoId(bucketDataList.get(0).getMiniVideoId());
 
 
                 // 查询content_platform_gzh_account获取合作方
                 // 查询content_platform_gzh_account获取合作方
                 ContentPlatformGzhAccountExample accountExample = new ContentPlatformGzhAccountExample();
                 ContentPlatformGzhAccountExample accountExample = new ContentPlatformGzhAccountExample();
@@ -580,6 +587,12 @@ public class ExternalChannelProcessJob {
             if (!CollectionUtils.isEmpty(planList)) {
             if (!CollectionUtils.isEmpty(planList)) {
                 ContentPlatformQwPlan plan = planList.get(0);
                 ContentPlatformQwPlan plan = planList.get(0);
                 record.setPartnerId(String.valueOf(plan.getCreateAccountId()));
                 record.setPartnerId(String.valueOf(plan.getCreateAccountId()));
+                ContentPlatformQwPlanVideoExample videoExample = new ContentPlatformQwPlanVideoExample();
+                videoExample.createCriteria().andPlanIdEqualTo(plan.getId());
+                List<ContentPlatformQwPlanVideo> videoList = qwPlanVideoMapper.selectByExample(videoExample);
+                if (!CollectionUtils.isEmpty(videoList)) {
+                    record.setVideoId(videoList.get(0).getVideoId());
+                }
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             log.error("获取群/企微合作信息异常, id={}, rootSourceId={}", recordId, rootSourceId, e);
             log.error("获取群/企微合作信息异常, id={}, rootSourceId={}", recordId, rootSourceId, e);
@@ -615,6 +628,7 @@ public class ExternalChannelProcessJob {
             if (!CollectionUtils.isEmpty(bucketDataList)) {
             if (!CollectionUtils.isEmpty(bucketDataList)) {
                 CgiReplyBucketData bucketData = bucketDataList.get(0);
                 CgiReplyBucketData bucketData = bucketDataList.get(0);
                 record.setAccountId(bucketData.getGhId());
                 record.setAccountId(bucketData.getGhId());
+                record.setVideoId(bucketData.getMiniVideoId());
 
 
                 // 投流即转 rootSourceId 查询 creativeId
                 // 投流即转 rootSourceId 查询 creativeId
                 String creativeId = aigcApiService.getCreativeIdByRootSourceIdAndGhId(rootSourceId, bucketData.getGhId());
                 String creativeId = aigcApiService.getCreativeIdByRootSourceIdAndGhId(rootSourceId, bucketData.getGhId());
@@ -663,6 +677,7 @@ public class ExternalChannelProcessJob {
             if (!CollectionUtils.isEmpty(videoList)) {
             if (!CollectionUtils.isEmpty(videoList)) {
                 ContentPlatformGzhPlanVideo video = videoList.get(0);
                 ContentPlatformGzhPlanVideo video = videoList.get(0);
                 record.setPartnerId(String.valueOf(video.getCreateAccountId()));
                 record.setPartnerId(String.valueOf(video.getCreateAccountId()));
+                record.setVideoId(video.getVideoId());
 
 
                 // 关联content_platform_gzh_plan获取公众号
                 // 关联content_platform_gzh_plan获取公众号
                 ContentPlatformGzhPlan plan = gzhPlanMapper.selectByPrimaryKey(video.getPlanId());
                 ContentPlatformGzhPlan plan = gzhPlanMapper.selectByPrimaryKey(video.getPlanId());
@@ -710,6 +725,11 @@ public class ExternalChannelProcessJob {
                     record.setArticleId(contentId);
                     record.setArticleId(contentId);
                     record.setAccountId(article.getString("ghId"));
                     record.setAccountId(article.getString("ghId"));
                 }
                 }
+                // 通过 long_articles_root_source_id 获取视频ID
+                Long videoId = recommendApiService.getVideoIdByRootSourceId(rootSourceId);
+                if (videoId != null) {
+                    record.setVideoId(videoId);
+                }
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             log.error("获取服务号投流-Daily信息异常, id={}, rootSourceId={}", recordId, rootSourceId, e);
             log.error("获取服务号投流-Daily信息异常, id={}, rootSourceId={}", recordId, rootSourceId, e);
@@ -744,6 +764,7 @@ public class ExternalChannelProcessJob {
             if (!CollectionUtils.isEmpty(bucketDataList)) {
             if (!CollectionUtils.isEmpty(bucketDataList)) {
                 CgiReplyBucketData bucketData = bucketDataList.get(0);
                 CgiReplyBucketData bucketData = bucketDataList.get(0);
                 record.setAccountId(bucketData.getGhId());
                 record.setAccountId(bucketData.getGhId());
+                record.setVideoId(bucketData.getMiniVideoId());
 
 
                 // 投流即转 rootSourceId 查询 creativeId
                 // 投流即转 rootSourceId 查询 creativeId
                 String creativeId = aigcApiService.getCreativeIdByRootSourceIdAndGhId(rootSourceId, bucketData.getGhId());
                 String creativeId = aigcApiService.getCreativeIdByRootSourceIdAndGhId(rootSourceId, bucketData.getGhId());
@@ -793,6 +814,7 @@ public class ExternalChannelProcessJob {
                 ContentPlatformGzhPlanVideo video = videoList.get(0);
                 ContentPlatformGzhPlanVideo video = videoList.get(0);
                 record.setPartnerId(String.valueOf(video.getCreateAccountId()));
                 record.setPartnerId(String.valueOf(video.getCreateAccountId()));
                 record.setArticleId(String.valueOf(video.getVideoId()));
                 record.setArticleId(String.valueOf(video.getVideoId()));
+                record.setVideoId(video.getVideoId());
 
 
                 // 关联content_platform_gzh_plan获取公众号
                 // 关联content_platform_gzh_plan获取公众号
                 ContentPlatformGzhPlan plan = gzhPlanMapper.selectByPrimaryKey(video.getPlanId());
                 ContentPlatformGzhPlan plan = gzhPlanMapper.selectByPrimaryKey(video.getPlanId());
@@ -841,6 +863,11 @@ public class ExternalChannelProcessJob {
                     record.setArticleId(contentId);
                     record.setArticleId(contentId);
                     record.setAccountId(article.getString("ghId"));
                     record.setAccountId(article.getString("ghId"));
                 }
                 }
+                // 通过 long_articles_root_source_id 获取视频ID
+                Long videoId = recommendApiService.getVideoIdByRootSourceId(rootSourceId);
+                if (videoId != null) {
+                    record.setVideoId(videoId);
+                }
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             log.error("获取公众号买号信息异常, id={}, rootSourceId={}", recordId, rootSourceId, e);
             log.error("获取公众号买号信息异常, id={}, rootSourceId={}", recordId, rootSourceId, e);
@@ -875,6 +902,11 @@ public class ExternalChannelProcessJob {
                     record.setArticleId(contentId);
                     record.setArticleId(contentId);
                     record.setAccountId(article.getString("ghId"));
                     record.setAccountId(article.getString("ghId"));
                 }
                 }
+                // 通过 long_articles_root_source_id 获取视频ID
+                Long videoId = recommendApiService.getVideoIdByRootSourceId(rootSourceId);
+                if (videoId != null) {
+                    record.setVideoId(videoId);
+                }
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             log.error("获取公众号代运营-Daily信息异常, id={}, rootSourceId={}", recordId, rootSourceId, e);
             log.error("获取公众号代运营-Daily信息异常, id={}, rootSourceId={}", recordId, rootSourceId, e);

+ 11 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ExternalChannel.java

@@ -19,6 +19,8 @@ public class ExternalChannel {
 
 
     private String cardId;
     private String cardId;
 
 
+    private Long videoId;
+
     private String packageId;
     private String packageId;
 
 
     private Integer status;
     private Integer status;
@@ -93,6 +95,14 @@ public class ExternalChannel {
         this.cardId = cardId;
         this.cardId = cardId;
     }
     }
 
 
+    public Long getVideoId() {
+        return videoId;
+    }
+
+    public void setVideoId(Long videoId) {
+        this.videoId = videoId;
+    }
+
     public String getPackageId() {
     public String getPackageId() {
         return packageId;
         return packageId;
     }
     }
@@ -147,6 +157,7 @@ public class ExternalChannel {
         sb.append(", creativeId=").append(creativeId);
         sb.append(", creativeId=").append(creativeId);
         sb.append(", articleId=").append(articleId);
         sb.append(", articleId=").append(articleId);
         sb.append(", cardId=").append(cardId);
         sb.append(", cardId=").append(cardId);
+        sb.append(", videoId=").append(videoId);
         sb.append(", packageId=").append(packageId);
         sb.append(", packageId=").append(packageId);
         sb.append(", status=").append(status);
         sb.append(", status=").append(status);
         sb.append(", isDelete=").append(isDelete);
         sb.append(", isDelete=").append(isDelete);

+ 60 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ExternalChannelExample.java

@@ -666,6 +666,66 @@ public class ExternalChannelExample {
             return (Criteria) this;
             return (Criteria) this;
         }
         }
 
 
+        public Criteria andVideoIdIsNull() {
+            addCriterion("video_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIsNotNull() {
+            addCriterion("video_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdEqualTo(Long value) {
+            addCriterion("video_id =", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotEqualTo(Long value) {
+            addCriterion("video_id <>", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdGreaterThan(Long value) {
+            addCriterion("video_id >", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("video_id >=", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdLessThan(Long value) {
+            addCriterion("video_id <", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdLessThanOrEqualTo(Long value) {
+            addCriterion("video_id <=", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIn(List<Long> values) {
+            addCriterion("video_id in", values, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotIn(List<Long> values) {
+            addCriterion("video_id not in", values, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdBetween(Long value1, Long value2) {
+            addCriterion("video_id between", value1, value2, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotBetween(Long value1, Long value2) {
+            addCriterion("video_id not between", value1, value2, "videoId");
+            return (Criteria) this;
+        }
+
         public Criteria andPackageIdIsNull() {
         public Criteria andPackageIdIsNull() {
             addCriterion("package_id is null");
             addCriterion("package_id is null");
             return (Criteria) this;
             return (Criteria) this;

+ 22 - 7
api-module/src/main/resources/mapper/contentplatform/ExternalChannelMapper.xml

@@ -10,6 +10,7 @@
     <result column="creative_id" jdbcType="VARCHAR" property="creativeId" />
     <result column="creative_id" jdbcType="VARCHAR" property="creativeId" />
     <result column="article_id" jdbcType="VARCHAR" property="articleId" />
     <result column="article_id" jdbcType="VARCHAR" property="articleId" />
     <result column="card_id" jdbcType="VARCHAR" property="cardId" />
     <result column="card_id" jdbcType="VARCHAR" property="cardId" />
+    <result column="video_id" jdbcType="BIGINT" property="videoId" />
     <result column="package_id" jdbcType="VARCHAR" property="packageId" />
     <result column="package_id" jdbcType="VARCHAR" property="packageId" />
     <result column="status" jdbcType="INTEGER" property="status" />
     <result column="status" jdbcType="INTEGER" property="status" />
     <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
     <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
@@ -76,7 +77,7 @@
   </sql>
   </sql>
   <sql id="Base_Column_List">
   <sql id="Base_Column_List">
     id, root_source_id, channel, partner_id, account_id, creative_id, article_id, card_id, 
     id, root_source_id, channel, partner_id, account_id, creative_id, article_id, card_id, 
-    package_id, `status`, is_delete, create_time, update_time
+    video_id, package_id, `status`, is_delete, create_time, update_time
   </sql>
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ExternalChannelExample" resultMap="BaseResultMap">
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ExternalChannelExample" resultMap="BaseResultMap">
     select
     select
@@ -114,14 +115,14 @@
   <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ExternalChannel">
   <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ExternalChannel">
     insert into external_channel (id, root_source_id, channel, 
     insert into external_channel (id, root_source_id, channel, 
       partner_id, account_id, creative_id, 
       partner_id, account_id, creative_id, 
-      article_id, card_id, package_id, 
-      `status`, is_delete, create_time, 
-      update_time)
+      article_id, card_id, video_id, 
+      package_id, `status`, is_delete, 
+      create_time, update_time)
     values (#{id,jdbcType=BIGINT}, #{rootSourceId,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR}, 
     values (#{id,jdbcType=BIGINT}, #{rootSourceId,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR}, 
       #{partnerId,jdbcType=VARCHAR}, #{accountId,jdbcType=VARCHAR}, #{creativeId,jdbcType=VARCHAR}, 
       #{partnerId,jdbcType=VARCHAR}, #{accountId,jdbcType=VARCHAR}, #{creativeId,jdbcType=VARCHAR}, 
-      #{articleId,jdbcType=VARCHAR}, #{cardId,jdbcType=VARCHAR}, #{packageId,jdbcType=VARCHAR}, 
-      #{status,jdbcType=INTEGER}, #{isDelete,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
-      #{updateTime,jdbcType=TIMESTAMP})
+      #{articleId,jdbcType=VARCHAR}, #{cardId,jdbcType=VARCHAR}, #{videoId,jdbcType=BIGINT}, 
+      #{packageId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{isDelete,jdbcType=INTEGER}, 
+      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
   </insert>
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ExternalChannel">
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ExternalChannel">
     insert into external_channel
     insert into external_channel
@@ -150,6 +151,9 @@
       <if test="cardId != null">
       <if test="cardId != null">
         card_id,
         card_id,
       </if>
       </if>
+      <if test="videoId != null">
+        video_id,
+      </if>
       <if test="packageId != null">
       <if test="packageId != null">
         package_id,
         package_id,
       </if>
       </if>
@@ -191,6 +195,9 @@
       <if test="cardId != null">
       <if test="cardId != null">
         #{cardId,jdbcType=VARCHAR},
         #{cardId,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="videoId != null">
+        #{videoId,jdbcType=BIGINT},
+      </if>
       <if test="packageId != null">
       <if test="packageId != null">
         #{packageId,jdbcType=VARCHAR},
         #{packageId,jdbcType=VARCHAR},
       </if>
       </if>
@@ -241,6 +248,9 @@
       <if test="record.cardId != null">
       <if test="record.cardId != null">
         card_id = #{record.cardId,jdbcType=VARCHAR},
         card_id = #{record.cardId,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="record.videoId != null">
+        video_id = #{record.videoId,jdbcType=BIGINT},
+      </if>
       <if test="record.packageId != null">
       <if test="record.packageId != null">
         package_id = #{record.packageId,jdbcType=VARCHAR},
         package_id = #{record.packageId,jdbcType=VARCHAR},
       </if>
       </if>
@@ -271,6 +281,7 @@
       creative_id = #{record.creativeId,jdbcType=VARCHAR},
       creative_id = #{record.creativeId,jdbcType=VARCHAR},
       article_id = #{record.articleId,jdbcType=VARCHAR},
       article_id = #{record.articleId,jdbcType=VARCHAR},
       card_id = #{record.cardId,jdbcType=VARCHAR},
       card_id = #{record.cardId,jdbcType=VARCHAR},
+      video_id = #{record.videoId,jdbcType=BIGINT},
       package_id = #{record.packageId,jdbcType=VARCHAR},
       package_id = #{record.packageId,jdbcType=VARCHAR},
       `status` = #{record.status,jdbcType=INTEGER},
       `status` = #{record.status,jdbcType=INTEGER},
       is_delete = #{record.isDelete,jdbcType=INTEGER},
       is_delete = #{record.isDelete,jdbcType=INTEGER},
@@ -304,6 +315,9 @@
       <if test="cardId != null">
       <if test="cardId != null">
         card_id = #{cardId,jdbcType=VARCHAR},
         card_id = #{cardId,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="videoId != null">
+        video_id = #{videoId,jdbcType=BIGINT},
+      </if>
       <if test="packageId != null">
       <if test="packageId != null">
         package_id = #{packageId,jdbcType=VARCHAR},
         package_id = #{packageId,jdbcType=VARCHAR},
       </if>
       </if>
@@ -331,6 +345,7 @@
       creative_id = #{creativeId,jdbcType=VARCHAR},
       creative_id = #{creativeId,jdbcType=VARCHAR},
       article_id = #{articleId,jdbcType=VARCHAR},
       article_id = #{articleId,jdbcType=VARCHAR},
       card_id = #{cardId,jdbcType=VARCHAR},
       card_id = #{cardId,jdbcType=VARCHAR},
+      video_id = #{videoId,jdbcType=BIGINT},
       package_id = #{packageId,jdbcType=VARCHAR},
       package_id = #{packageId,jdbcType=VARCHAR},
       `status` = #{status,jdbcType=INTEGER},
       `status` = #{status,jdbcType=INTEGER},
       is_delete = #{isDelete,jdbcType=INTEGER},
       is_delete = #{isDelete,jdbcType=INTEGER},