Просмотр исходного кода

Merge branch 'master' into cooperation_video_candidate_pool_improved_lld_0509

# Conflicts:
#	api-module/src/main/java/com/tzld/piaoquan/api/model/vo/contentplatform/VideoContentItemVO.java
#	api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java
刘立冬 1 день назад
Родитель
Сommit
6d74e7ca7a

+ 1 - 1
api-module/src/main/java/com/tzld/piaoquan/api/component/ManagerApiService.java

@@ -186,7 +186,7 @@ public class ManagerApiService {
             param.put("queryText", queryText);
             param.put("configCode", "ALL");
             param.put("topN", topN);
-            param.put("simMin", 0.7);
+            param.put("simMin", 0.8);
             String post = httpPoolClient.post(url, param.toJSONString());
             JSONObject res = JSONObject.parseObject(post);
             if (res != null && "0".equals(res.getString("code"))) {

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/job/contentplatform/ContentPlatformDemandVideoJob.java

@@ -97,6 +97,7 @@ public class ContentPlatformDemandVideoJob {
                 Double uvRatio = demandItem.getDouble("uvRatio");
                 Double totalRov = demandItem.getDouble("totalRov");
                 String onlineAction = demandItem.getString("onlineAction");
+                String channelLevel3 = demandItem.getString("channelLevel3");
 
                 JSONArray matchedVideos = demandItem.getJSONArray("matchedVideos");
                 if (matchedVideos == null || matchedVideos.isEmpty()) {
@@ -132,6 +133,7 @@ public class ContentPlatformDemandVideoJob {
                     demandVideo.setUvRatio(uvRatio);
                     demandVideo.setTotalRov(totalRov);
                     demandVideo.setOnlineAction(onlineAction != null ? onlineAction : "");
+                    demandVideo.setChannelLevel3(channelLevel3 != null ? channelLevel3 : "");
                     demandVideo.setVideoId(videoItem.getLong("videoId"));
                     demandVideo.setConfigCode(videoItem.getString("configCode") != null ? videoItem.getString("configCode") : "");
                     demandVideo.setScore(videoItem.getDouble("score"));

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

@@ -432,6 +432,7 @@ public class ContentPlatformDemandVideo {
         sb.append(", onlineAction=").append(onlineAction);
         sb.append(", channelName=").append(channelName);
         sb.append(", crowdSegment=").append(crowdSegment);
+        sb.append(", channelLevel3=").append(channelLevel3);
         sb.append(", demandId=").append(demandId);
         sb.append(", crowdPackage=").append(crowdPackage);
         sb.append(", conversionTarget=").append(conversionTarget);

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

@@ -455,6 +455,76 @@ public class ContentPlatformDemandVideoExample {
             return (Criteria) this;
         }
 
+        public Criteria andChannelLevel3IsNull() {
+            addCriterion("channel_level3 is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3IsNotNull() {
+            addCriterion("channel_level3 is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3EqualTo(String value) {
+            addCriterion("channel_level3 =", value, "channelLevel3");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3NotEqualTo(String value) {
+            addCriterion("channel_level3 <>", value, "channelLevel3");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3GreaterThan(String value) {
+            addCriterion("channel_level3 >", value, "channelLevel3");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3GreaterThanOrEqualTo(String value) {
+            addCriterion("channel_level3 >=", value, "channelLevel3");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3LessThan(String value) {
+            addCriterion("channel_level3 <", value, "channelLevel3");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3LessThanOrEqualTo(String value) {
+            addCriterion("channel_level3 <=", value, "channelLevel3");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3Like(String value) {
+            addCriterion("channel_level3 like", value, "channelLevel3");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3NotLike(String value) {
+            addCriterion("channel_level3 not like", value, "channelLevel3");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3In(List<String> values) {
+            addCriterion("channel_level3 in", values, "channelLevel3");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3NotIn(List<String> values) {
+            addCriterion("channel_level3 not in", values, "channelLevel3");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3Between(String value1, String value2) {
+            addCriterion("channel_level3 between", value1, value2, "channelLevel3");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLevel3NotBetween(String value1, String value2) {
+            addCriterion("channel_level3 not between", value1, value2, "channelLevel3");
+            return (Criteria) this;
+        }
+
         public Criteria andDemandIdIsNull() {
             addCriterion("demand_id is null");
             return (Criteria) this;

+ 3 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/vo/contentplatform/VideoContentItemVO.java

@@ -96,6 +96,9 @@ public class VideoContentItemVO {
     @ApiModelProperty(value = "rov")
     private Double rov;
 
+    @ApiModelProperty(value = "搜索来源 vector-向量搜索 manager-管理后台搜索")
+    private String searchSource;
+
     @ApiModelProperty(value = "渠道类名称")
     private String channelName;
 

+ 20 - 9
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java

@@ -939,19 +939,27 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         // 调用向量搜索接口,topN 取 pageSize 的合理上限
         int topN = Math.min(pageSize, 50);
         JSONObject data = managerApiService.recallVideoWithScore(param.getTitle(), topN);
-        if (data == null) {
-            result.setTotalSize(0);
-            result.setObjs(new ArrayList<>());
-            return result;
+
+        boolean vectorEmpty = (data == null);
+        if (!vectorEmpty) {
+            JSONArray items = data.getJSONArray("items");
+            vectorEmpty = (items == null || items.isEmpty());
         }
 
-        JSONArray items = data.getJSONArray("items");
-        if (items == null || items.isEmpty()) {
-            result.setTotalSize(0);
-            result.setObjs(new ArrayList<>());
-            return result;
+        // 向量搜索为空,降级走关键词搜索
+        if (vectorEmpty) {
+            Page<VideoContentItemVO> fallbackResult = getVideoContentListByTitle(param);
+            // 标识来源为关键词搜索
+            if (fallbackResult.getObjs() != null) {
+                for (VideoContentItemVO vo : fallbackResult.getObjs()) {
+                    vo.setSearchSource("manager");
+                    vo.setExperimentId("manager_search");
+                }
+            }
+            return fallbackResult;
         }
 
+        JSONArray items = data.getJSONArray("items");
         int total = data.getIntValue("total");
         int effectiveTotalSize = Math.min(total, videoTitleSearchMaxCount);
         result.setTotalSize(effectiveTotalSize);
@@ -1009,6 +1017,9 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
             VideoContentItemVO vo = new VideoContentItemVO();
             vo.setVideoId(videoId);
             vo.setScore(item.getDouble("score"));
+            // 标识来源为向量搜索
+            vo.setSearchSource("vector");
+            vo.setExperimentId("vector_search");
             // 优先从视频详情中获取标题、封面、视频地址
             VideoDetail detail = videoDetailMap.get(videoId);
             if (detail != null) {

+ 40 - 23
api-module/src/main/resources/mapper/contentplatform/ContentPlatformDemandVideoMapper.xml

@@ -7,6 +7,7 @@
     <result column="online_action" jdbcType="VARCHAR" property="onlineAction" />
     <result column="channel_name" jdbcType="VARCHAR" property="channelName" />
     <result column="crowd_segment" jdbcType="VARCHAR" property="crowdSegment" />
+    <result column="channel_level3" jdbcType="VARCHAR" property="channelLevel3" />
     <result column="demand_id" jdbcType="VARCHAR" property="demandId" />
     <result column="crowd_package" jdbcType="VARCHAR" property="crowdPackage" />
     <result column="conversion_target" jdbcType="VARCHAR" property="conversionTarget" />
@@ -103,9 +104,9 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, dt, online_action, channel_name, crowd_segment, demand_id, crowd_package, conversion_target, 
-    partner, account, scene_value, demand_strategy, drive_dimension_time, dimension, 
-    demand_filter_sort_strategy, demand_type, demand_content_id, demand_content_title, 
+    id, dt, online_action, channel_name, crowd_segment, channel_level3, demand_id, crowd_package, 
+    conversion_target, partner, account, scene_value, demand_strategy, drive_dimension_time, 
+    dimension, demand_filter_sort_strategy, demand_type, demand_content_id, demand_content_title, 
     demand_content_topic, point_type, standard_element, category_name, crowd_count, video_count, 
     visit_uv, uv_ratio, total_rov, match_experiment_id, video_id, config_code, score, 
     sim, rov, match_text, title, cover, video, experiment_id, `status`, create_timestamp, 
@@ -146,30 +147,32 @@
   </delete>
   <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformDemandVideo">
     insert into content_platform_demand_video (id, dt, online_action, 
-      channel_name, crowd_segment, demand_id, 
-      crowd_package, conversion_target, partner, 
-      account, scene_value, demand_strategy, 
-      drive_dimension_time, dimension, demand_filter_sort_strategy, 
-      demand_type, demand_content_id, demand_content_title, 
-      demand_content_topic, point_type, standard_element, 
-      category_name, crowd_count, video_count, 
-      visit_uv, uv_ratio, total_rov, 
-      match_experiment_id, video_id, config_code, 
-      score, sim, rov, match_text, 
+      channel_name, crowd_segment, channel_level3, 
+      demand_id, crowd_package, conversion_target, 
+      partner, account, scene_value, 
+      demand_strategy, drive_dimension_time, dimension, 
+      demand_filter_sort_strategy, demand_type, demand_content_id, 
+      demand_content_title, demand_content_topic, 
+      point_type, standard_element, category_name, 
+      crowd_count, video_count, visit_uv, 
+      uv_ratio, total_rov, match_experiment_id, 
+      video_id, config_code, score, 
+      sim, rov, match_text, 
       title, cover, video, 
       experiment_id, `status`, create_timestamp, 
       update_timestamp)
     values (#{id,jdbcType=BIGINT}, #{dt,jdbcType=VARCHAR}, #{onlineAction,jdbcType=VARCHAR}, 
-      #{channelName,jdbcType=VARCHAR}, #{crowdSegment,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR}, 
-      #{crowdPackage,jdbcType=VARCHAR}, #{conversionTarget,jdbcType=VARCHAR}, #{partner,jdbcType=VARCHAR}, 
-      #{account,jdbcType=VARCHAR}, #{sceneValue,jdbcType=VARCHAR}, #{demandStrategy,jdbcType=VARCHAR}, 
-      #{driveDimensionTime,jdbcType=VARCHAR}, #{dimension,jdbcType=VARCHAR}, #{demandFilterSortStrategy,jdbcType=VARCHAR}, 
-      #{demandType,jdbcType=VARCHAR}, #{demandContentId,jdbcType=VARCHAR}, #{demandContentTitle,jdbcType=VARCHAR}, 
-      #{demandContentTopic,jdbcType=VARCHAR}, #{pointType,jdbcType=VARCHAR}, #{standardElement,jdbcType=VARCHAR}, 
-      #{categoryName,jdbcType=VARCHAR}, #{crowdCount,jdbcType=INTEGER}, #{videoCount,jdbcType=INTEGER}, 
-      #{visitUv,jdbcType=BIGINT}, #{uvRatio,jdbcType=DOUBLE}, #{totalRov,jdbcType=DOUBLE}, 
-      #{matchExperimentId,jdbcType=VARCHAR}, #{videoId,jdbcType=BIGINT}, #{configCode,jdbcType=VARCHAR}, 
-      #{score,jdbcType=DOUBLE}, #{sim,jdbcType=DOUBLE}, #{rov,jdbcType=DOUBLE}, #{matchText,jdbcType=VARCHAR}, 
+      #{channelName,jdbcType=VARCHAR}, #{crowdSegment,jdbcType=VARCHAR}, #{channelLevel3,jdbcType=VARCHAR}, 
+      #{demandId,jdbcType=VARCHAR}, #{crowdPackage,jdbcType=VARCHAR}, #{conversionTarget,jdbcType=VARCHAR}, 
+      #{partner,jdbcType=VARCHAR}, #{account,jdbcType=VARCHAR}, #{sceneValue,jdbcType=VARCHAR}, 
+      #{demandStrategy,jdbcType=VARCHAR}, #{driveDimensionTime,jdbcType=VARCHAR}, #{dimension,jdbcType=VARCHAR}, 
+      #{demandFilterSortStrategy,jdbcType=VARCHAR}, #{demandType,jdbcType=VARCHAR}, #{demandContentId,jdbcType=VARCHAR}, 
+      #{demandContentTitle,jdbcType=VARCHAR}, #{demandContentTopic,jdbcType=VARCHAR}, 
+      #{pointType,jdbcType=VARCHAR}, #{standardElement,jdbcType=VARCHAR}, #{categoryName,jdbcType=VARCHAR}, 
+      #{crowdCount,jdbcType=INTEGER}, #{videoCount,jdbcType=INTEGER}, #{visitUv,jdbcType=BIGINT}, 
+      #{uvRatio,jdbcType=DOUBLE}, #{totalRov,jdbcType=DOUBLE}, #{matchExperimentId,jdbcType=VARCHAR}, 
+      #{videoId,jdbcType=BIGINT}, #{configCode,jdbcType=VARCHAR}, #{score,jdbcType=DOUBLE}, 
+      #{sim,jdbcType=DOUBLE}, #{rov,jdbcType=DOUBLE}, #{matchText,jdbcType=VARCHAR}, 
       #{title,jdbcType=VARCHAR}, #{cover,jdbcType=VARCHAR}, #{video,jdbcType=VARCHAR}, 
       #{experimentId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTimestamp,jdbcType=BIGINT}, 
       #{updateTimestamp,jdbcType=BIGINT})
@@ -192,6 +195,9 @@
       <if test="crowdSegment != null">
         crowd_segment,
       </if>
+      <if test="channelLevel3 != null">
+        channel_level3,
+      </if>
       <if test="demandId != null">
         demand_id,
       </if>
@@ -317,6 +323,9 @@
       <if test="crowdSegment != null">
         #{crowdSegment,jdbcType=VARCHAR},
       </if>
+      <if test="channelLevel3 != null">
+        #{channelLevel3,jdbcType=VARCHAR},
+      </if>
       <if test="demandId != null">
         #{demandId,jdbcType=VARCHAR},
       </if>
@@ -451,6 +460,9 @@
       <if test="record.crowdSegment != null">
         crowd_segment = #{record.crowdSegment,jdbcType=VARCHAR},
       </if>
+      <if test="record.channelLevel3 != null">
+        channel_level3 = #{record.channelLevel3,jdbcType=VARCHAR},
+      </if>
       <if test="record.demandId != null">
         demand_id = #{record.demandId,jdbcType=VARCHAR},
       </if>
@@ -571,6 +583,7 @@
       online_action = #{record.onlineAction,jdbcType=VARCHAR},
       channel_name = #{record.channelName,jdbcType=VARCHAR},
       crowd_segment = #{record.crowdSegment,jdbcType=VARCHAR},
+      channel_level3 = #{record.channelLevel3,jdbcType=VARCHAR},
       demand_id = #{record.demandId,jdbcType=VARCHAR},
       crowd_package = #{record.crowdPackage,jdbcType=VARCHAR},
       conversion_target = #{record.conversionTarget,jdbcType=VARCHAR},
@@ -626,6 +639,9 @@
       <if test="crowdSegment != null">
         crowd_segment = #{crowdSegment,jdbcType=VARCHAR},
       </if>
+      <if test="channelLevel3 != null">
+        channel_level3 = #{channelLevel3,jdbcType=VARCHAR},
+      </if>
       <if test="demandId != null">
         demand_id = #{demandId,jdbcType=VARCHAR},
       </if>
@@ -743,6 +759,7 @@
       online_action = #{onlineAction,jdbcType=VARCHAR},
       channel_name = #{channelName,jdbcType=VARCHAR},
       crowd_segment = #{crowdSegment,jdbcType=VARCHAR},
+      channel_level3 = #{channelLevel3,jdbcType=VARCHAR},
       demand_id = #{demandId,jdbcType=VARCHAR},
       crowd_package = #{crowdPackage,jdbcType=VARCHAR},
       conversion_target = #{conversionTarget,jdbcType=VARCHAR},

+ 3 - 3
api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformDemandVideoMapperExt.xml

@@ -10,7 +10,7 @@
          demand_content_id, demand_content_title, demand_content_topic,
          crowd_count, video_count, visit_uv, uv_ratio, total_rov, online_action, match_experiment_id,
          video_id, config_code, score, sim, rov,
-         match_text, title, cover, video, experiment_id, status, create_timestamp, update_timestamp)
+         match_text, title, cover, video, experiment_id, channel_level3, status, create_timestamp, update_timestamp)
         VALUES
         <foreach collection="list" item="item" separator=",">
             (#{item.dt}, #{item.channelName}, #{item.crowdSegment}, #{item.dimension}, #{item.pointType}, #{item.standardElement},
@@ -19,7 +19,7 @@
              #{item.demandContentId}, #{item.demandContentTitle}, #{item.demandContentTopic},
              #{item.crowdCount}, #{item.videoCount}, #{item.visitUv}, #{item.uvRatio}, #{item.totalRov}, #{item.onlineAction}, #{item.matchExperimentId},
              #{item.videoId}, #{item.configCode}, #{item.score}, #{item.sim}, #{item.rov},
-             #{item.matchText}, #{item.title}, #{item.cover}, #{item.video}, #{item.experimentId}, #{item.status}, #{item.createTimestamp}, #{item.updateTimestamp})
+             #{item.matchText}, #{item.title}, #{item.cover}, #{item.video}, #{item.experimentId}, #{item.channelLevel3}, #{item.status}, #{item.createTimestamp}, #{item.updateTimestamp})
         </foreach>
     </insert>
 
@@ -34,7 +34,7 @@
                demand_content_id, demand_content_title, demand_content_topic,
                crowd_count, video_count, visit_uv, uv_ratio, total_rov, online_action, match_experiment_id,
                video_id, config_code, score, sim, rov,
-               match_text, title, cover, video, experiment_id, status, create_timestamp, update_timestamp
+               match_text, title, cover, video, experiment_id, channel_level3, status, create_timestamp, update_timestamp
         FROM content_platform_demand_video
         WHERE dt = #{dt} AND status = 1
         <if test="channelName != null and channelName != ''">

+ 2 - 2
api-module/src/main/resources/mybatis-api-contentPlatform-generator-config.xml

@@ -60,14 +60,14 @@
 <!--        <table tableName="content_platform_gzh_push_datastat" domainObjectName="ContentPlatformGzhPushDataStat" alias=""/>-->
 <!--        <table tableName="content_platform_gzh_push_datastat_total" domainObjectName="ContentPlatformGzhPushDataStatTotal" alias=""/>-->
 <!--        <table tableName="content_platform_gzh_plan" domainObjectName="ContentPlatformGzhPlan" alias=""/>-->
-        <table tableName="content_platform_gzh_plan_video" domainObjectName="ContentPlatformGzhPlanVideo" alias=""/>
+<!--        <table tableName="content_platform_gzh_plan_video" domainObjectName="ContentPlatformGzhPlanVideo" alias=""/>-->
 <!--        <table tableName="content_platform_gzh_plan_change_log" domainObjectName="ContentPlatformGzhPlanChangeLog" alias=""/>-->
 <!--        <table tableName="content_platform_qw_datastat" domainObjectName="ContentPlatformQwDataStat" alias=""/>-->
 <!--        <table tableName="content_platform_qw_datastat_total" domainObjectName="ContentPlatformQwDataStatTotal" alias=""/>-->
 <!--        <table tableName="content_platform_qw_datastat_reply_total" domainObjectName="ContentPlatformQwDataStatReplyTotal" alias=""/>-->
 <!--        <table tableName="content_platform_qw_datastat_sub_channel" domainObjectName="ContentPlatformQwDataStatSubChannel" alias=""/>-->
 <!--        <table tableName="content_platform_qw_plan" domainObjectName="ContentPlatformQwPlan" alias=""/>-->
-        <table tableName="content_platform_qw_plan_video" domainObjectName="ContentPlatformQwPlanVideo" alias=""/>
+<!--        <table tableName="content_platform_qw_plan_video" domainObjectName="ContentPlatformQwPlanVideo" alias=""/>-->
 <!--        <table tableName="content_platform_verify_code" domainObjectName="ContentPlatformVerifyCode" alias=""/>-->
 <!--        <table tableName="content_platform_video" domainObjectName="ContentPlatformVideo" alias=""/>-->
 <!--        <table tableName="content_platform_video_agg" domainObjectName="ContentPlatformVideoAgg" alias=""/>-->