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

新增检查合作公众号推送rootSourceId是否存在接口

wangyunpeng 1 день назад
Родитель
Сommit
4ea5194a65

+ 7 - 0
api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformPlanController.java

@@ -147,4 +147,11 @@ public class ContentPlatformPlanController {
         videoJob.calContentPlatformVideoDatastatAggRecommendRateJob(dateStr);
         videoJob.calContentPlatformVideoDatastatAggRecommendRateJob(dateStr);
         return CommonResponse.success();
         return CommonResponse.success();
     }
     }
+
+    @ApiOperation(value = "公众号推送-检查rootSourceId是否存在", hidden = true)
+    @JwtIgnore
+    @GetMapping("/gzhPush/checkExistRootSourceId")
+    public CommonResponse<Boolean> gzhPushCheckExistRootSourceId(String rootSourceId) {
+        return CommonResponse.success(planService.gzhPushCheckExistRootSourceId(rootSourceId));
+    }
 }
 }

+ 1 - 0
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.java

@@ -132,4 +132,5 @@ public interface ContentPlatformPlanMapperExt {
                                               @Param("status") Integer status,
                                               @Param("status") Integer status,
                                               @Param("now") Long now);
                                               @Param("now") Long now);
 
 
+    List<ContentPlatformGzhPlanVideo> getGzhPushPlanVideoByRootSourceId(@Param("rootSourceId") String rootSourceId, @Param("planType") Integer planType);
 }
 }

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

@@ -25,6 +25,10 @@ public class ContentPlatformGzhPlanVideo {
 
 
     private String pageUrl;
     private String pageUrl;
 
 
+    private String rootSourceId;
+
+    private Integer status;
+
     private Long createAccountId;
     private Long createAccountId;
 
 
     private Long createTimestamp;
     private Long createTimestamp;
@@ -125,6 +129,22 @@ public class ContentPlatformGzhPlanVideo {
         this.pageUrl = pageUrl;
         this.pageUrl = pageUrl;
     }
     }
 
 
+    public String getRootSourceId() {
+        return rootSourceId;
+    }
+
+    public void setRootSourceId(String rootSourceId) {
+        this.rootSourceId = rootSourceId;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
     public Long getCreateAccountId() {
     public Long getCreateAccountId() {
         return createAccountId;
         return createAccountId;
     }
     }
@@ -159,6 +179,8 @@ public class ContentPlatformGzhPlanVideo {
         sb.append(", customCoverType=").append(customCoverType);
         sb.append(", customCoverType=").append(customCoverType);
         sb.append(", video=").append(video);
         sb.append(", video=").append(video);
         sb.append(", pageUrl=").append(pageUrl);
         sb.append(", pageUrl=").append(pageUrl);
+        sb.append(", rootSourceId=").append(rootSourceId);
+        sb.append(", status=").append(status);
         sb.append(", createAccountId=").append(createAccountId);
         sb.append(", createAccountId=").append(createAccountId);
         sb.append(", createTimestamp=").append(createTimestamp);
         sb.append(", createTimestamp=").append(createTimestamp);
         sb.append("]");
         sb.append("]");

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

@@ -895,6 +895,136 @@ public class ContentPlatformGzhPlanVideoExample {
             return (Criteria) this;
             return (Criteria) this;
         }
         }
 
 
+        public Criteria andRootSourceIdIsNull() {
+            addCriterion("root_source_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdIsNotNull() {
+            addCriterion("root_source_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdEqualTo(String value) {
+            addCriterion("root_source_id =", value, "rootSourceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdNotEqualTo(String value) {
+            addCriterion("root_source_id <>", value, "rootSourceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdGreaterThan(String value) {
+            addCriterion("root_source_id >", value, "rootSourceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdGreaterThanOrEqualTo(String value) {
+            addCriterion("root_source_id >=", value, "rootSourceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdLessThan(String value) {
+            addCriterion("root_source_id <", value, "rootSourceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdLessThanOrEqualTo(String value) {
+            addCriterion("root_source_id <=", value, "rootSourceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdLike(String value) {
+            addCriterion("root_source_id like", value, "rootSourceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdNotLike(String value) {
+            addCriterion("root_source_id not like", value, "rootSourceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdIn(List<String> values) {
+            addCriterion("root_source_id in", values, "rootSourceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdNotIn(List<String> values) {
+            addCriterion("root_source_id not in", values, "rootSourceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdBetween(String value1, String value2) {
+            addCriterion("root_source_id between", value1, value2, "rootSourceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootSourceIdNotBetween(String value1, String value2) {
+            addCriterion("root_source_id not between", value1, value2, "rootSourceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusIsNull() {
+            addCriterion("`status` is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusIsNotNull() {
+            addCriterion("`status` is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusEqualTo(Integer value) {
+            addCriterion("`status` =", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotEqualTo(Integer value) {
+            addCriterion("`status` <>", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusGreaterThan(Integer value) {
+            addCriterion("`status` >", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
+            addCriterion("`status` >=", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusLessThan(Integer value) {
+            addCriterion("`status` <", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusLessThanOrEqualTo(Integer value) {
+            addCriterion("`status` <=", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusIn(List<Integer> values) {
+            addCriterion("`status` in", values, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotIn(List<Integer> values) {
+            addCriterion("`status` not in", values, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusBetween(Integer value1, Integer value2) {
+            addCriterion("`status` between", value1, value2, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotBetween(Integer value1, Integer value2) {
+            addCriterion("`status` not between", value1, value2, "status");
+            return (Criteria) this;
+        }
+
         public Criteria andCreateAccountIdIsNull() {
         public Criteria andCreateAccountIdIsNull() {
             addCriterion("create_account_id is null");
             addCriterion("create_account_id is null");
             return (Criteria) this;
             return (Criteria) this;

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformPlanService.java

@@ -87,4 +87,6 @@ public interface ContentPlatformPlanService {
     String getGzhChannel(String ghId);
     String getGzhChannel(String ghId);
 
 
     void saveQwPlanVideo(QwPlanSaveVideoParam videoParam, Long planId, Long loginAccountId);
     void saveQwPlanVideo(QwPlanSaveVideoParam videoParam, Long planId, Long loginAccountId);
+
+    Boolean gzhPushCheckExistRootSourceId(String rootSourceId);
 }
 }

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

@@ -36,6 +36,7 @@ import com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketData;
 import com.tzld.piaoquan.growth.common.model.po.GhDetail;
 import com.tzld.piaoquan.growth.common.model.po.GhDetail;
 import com.tzld.piaoquan.growth.common.service.MessageAttachmentService;
 import com.tzld.piaoquan.growth.common.service.MessageAttachmentService;
 import com.tzld.piaoquan.growth.common.utils.MessageUtil;
 import com.tzld.piaoquan.growth.common.utils.MessageUtil;
+import com.tzld.piaoquan.growth.common.utils.RedisUtils;
 import com.tzld.piaoquan.growth.common.utils.page.Page;
 import com.tzld.piaoquan.growth.common.utils.page.Page;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.CollectionUtils;
@@ -99,6 +100,9 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     @Autowired
     @Autowired
     private VideoMultiService videoMultiService;
     private VideoMultiService videoMultiService;
 
 
+    @Autowired
+    private RedisUtils redisUtils;
+
 
 
     @Value("${vlog.share.appType:11}")
     @Value("${vlog.share.appType:11}")
     private String shareAppType;
     private String shareAppType;
@@ -370,6 +374,12 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                 item.setCustomCoverType(vo.getCustomCoverType());
                 item.setCustomCoverType(vo.getCustomCoverType());
                 // 上报多标题封面
                 // 上报多标题封面
                 item.setPageUrl(setMultiTitleCoverPagePath(item));
                 item.setPageUrl(setMultiTitleCoverPagePath(item));
+                if (StringUtils.hasText(item.getPageUrl())) {
+                    String rootSourceId = MessageUtil.getRootSourceId(item.getPageUrl());
+                    if (StringUtils.hasText(rootSourceId)) {
+                        item.setRootSourceId(rootSourceId);
+                    }
+                }
                 gzhPlanVideoMapper.updateByPrimaryKey(item);
                 gzhPlanVideoMapper.updateByPrimaryKey(item);
             } else {
             } else {
                 ContentPlatformGzhPlanVideo item = new ContentPlatformGzhPlanVideo();
                 ContentPlatformGzhPlanVideo item = new ContentPlatformGzhPlanVideo();
@@ -396,6 +406,12 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                 }
                 }
                 // 上报多标题封面
                 // 上报多标题封面
                 item.setPageUrl(setMultiTitleCoverPagePath(item));
                 item.setPageUrl(setMultiTitleCoverPagePath(item));
+                if (StringUtils.hasText(item.getPageUrl())) {
+                    String rootSourceId = MessageUtil.getRootSourceId(item.getPageUrl());
+                    if (StringUtils.hasText(rootSourceId)) {
+                        item.setRootSourceId(rootSourceId);
+                    }
+                }
                 item.setCreateAccountId(loginAccount.getId());
                 item.setCreateAccountId(loginAccount.getId());
                 item.setCreateTimestamp(System.currentTimeMillis());
                 item.setCreateTimestamp(System.currentTimeMillis());
                 gzhPlanVideoMapper.insert(item);
                 gzhPlanVideoMapper.insert(item);
@@ -1042,4 +1058,18 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         }
         }
     }
     }
 
 
+    @Override
+    public Boolean gzhPushCheckExistRootSourceId(String rootSourceId) {
+        String redisKey = "check_gzh_push_exist_root_source_id_" + rootSourceId;
+        String value = redisUtils.get(redisKey);
+        if (org.apache.commons.lang3.StringUtils.isNotEmpty(value)) {
+            return Boolean.parseBoolean(value);
+        }
+        List<ContentPlatformGzhPlanVideo> list = planMapperExt.getGzhPushPlanVideoByRootSourceId(rootSourceId, ContentPlatformGzhPlanTypeEnum.GZH_PUSH.getVal());
+        boolean exists = !org.springframework.util.CollectionUtils.isEmpty(list);
+        // 缓存1小时
+        redisUtils.set(redisKey, String.valueOf(exists), 60 * 60);
+        return exists;
+    }
+
 }
 }

+ 1 - 1
api-module/src/main/java/com/tzld/piaoquan/api/service/impl/CgiReplyServiceImpl.java

@@ -278,7 +278,7 @@ public class CgiReplyServiceImpl implements CgiReplyService {
 
 
     @Override
     @Override
     public Boolean checkExistRootSourceId(String rootSourceId) {
     public Boolean checkExistRootSourceId(String rootSourceId) {
-        String redisKey = "check_exist_root_source_id_" + rootSourceId;
+        String redisKey = "check_reply_exist_root_source_id_" + rootSourceId;
         String value = redisUtils.get(redisKey);
         String value = redisUtils.get(redisKey);
         if (StringUtils.isNotEmpty(value)) {
         if (StringUtils.isNotEmpty(value)) {
             return Boolean.parseBoolean(value);
             return Boolean.parseBoolean(value);

+ 36 - 5
api-module/src/main/resources/mapper/contentplatform/ContentPlatformGzhPlanVideoMapper.xml

@@ -14,6 +14,8 @@
     <result column="custom_cover_type" jdbcType="INTEGER" property="customCoverType" />
     <result column="custom_cover_type" jdbcType="INTEGER" property="customCoverType" />
     <result column="video" jdbcType="VARCHAR" property="video" />
     <result column="video" jdbcType="VARCHAR" property="video" />
     <result column="page_url" jdbcType="VARCHAR" property="pageUrl" />
     <result column="page_url" jdbcType="VARCHAR" property="pageUrl" />
+    <result column="root_source_id" jdbcType="VARCHAR" property="rootSourceId" />
+    <result column="status" jdbcType="INTEGER" property="status" />
     <result column="create_account_id" jdbcType="BIGINT" property="createAccountId" />
     <result column="create_account_id" jdbcType="BIGINT" property="createAccountId" />
     <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
     <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
   </resultMap>
   </resultMap>
@@ -77,7 +79,8 @@
   </sql>
   </sql>
   <sql id="Base_Column_List">
   <sql id="Base_Column_List">
     id, plan_id, video_id, title, custom_title_id, custom_title, cover, custom_cover_id, 
     id, plan_id, video_id, title, custom_title_id, custom_title, cover, custom_cover_id, 
-    custom_cover, custom_cover_type, video, page_url, create_account_id, create_timestamp
+    custom_cover, custom_cover_type, video, page_url, root_source_id, `status`, create_account_id, 
+    create_timestamp
   </sql>
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlanVideoExample" resultMap="BaseResultMap">
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlanVideoExample" resultMap="BaseResultMap">
     select
     select
@@ -117,14 +120,14 @@
       title, custom_title_id, custom_title, 
       title, custom_title_id, custom_title, 
       cover, custom_cover_id, custom_cover, 
       cover, custom_cover_id, custom_cover, 
       custom_cover_type, video, page_url, 
       custom_cover_type, video, page_url, 
-      create_account_id, create_timestamp
-      )
+      root_source_id, `status`, create_account_id, 
+      create_timestamp)
     values (#{id,jdbcType=BIGINT}, #{planId,jdbcType=BIGINT}, #{videoId,jdbcType=BIGINT}, 
     values (#{id,jdbcType=BIGINT}, #{planId,jdbcType=BIGINT}, #{videoId,jdbcType=BIGINT}, 
       #{title,jdbcType=VARCHAR}, #{customTitleId,jdbcType=BIGINT}, #{customTitle,jdbcType=VARCHAR}, 
       #{title,jdbcType=VARCHAR}, #{customTitleId,jdbcType=BIGINT}, #{customTitle,jdbcType=VARCHAR}, 
       #{cover,jdbcType=VARCHAR}, #{customCoverId,jdbcType=BIGINT}, #{customCover,jdbcType=VARCHAR}, 
       #{cover,jdbcType=VARCHAR}, #{customCoverId,jdbcType=BIGINT}, #{customCover,jdbcType=VARCHAR}, 
       #{customCoverType,jdbcType=INTEGER}, #{video,jdbcType=VARCHAR}, #{pageUrl,jdbcType=VARCHAR}, 
       #{customCoverType,jdbcType=INTEGER}, #{video,jdbcType=VARCHAR}, #{pageUrl,jdbcType=VARCHAR}, 
-      #{createAccountId,jdbcType=BIGINT}, #{createTimestamp,jdbcType=BIGINT}
-      )
+      #{rootSourceId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createAccountId,jdbcType=BIGINT}, 
+      #{createTimestamp,jdbcType=BIGINT})
   </insert>
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlanVideo">
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlanVideo">
     insert into content_platform_gzh_plan_video
     insert into content_platform_gzh_plan_video
@@ -165,6 +168,12 @@
       <if test="pageUrl != null">
       <if test="pageUrl != null">
         page_url,
         page_url,
       </if>
       </if>
+      <if test="rootSourceId != null">
+        root_source_id,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
       <if test="createAccountId != null">
       <if test="createAccountId != null">
         create_account_id,
         create_account_id,
       </if>
       </if>
@@ -209,6 +218,12 @@
       <if test="pageUrl != null">
       <if test="pageUrl != null">
         #{pageUrl,jdbcType=VARCHAR},
         #{pageUrl,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="rootSourceId != null">
+        #{rootSourceId,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
       <if test="createAccountId != null">
       <if test="createAccountId != null">
         #{createAccountId,jdbcType=BIGINT},
         #{createAccountId,jdbcType=BIGINT},
       </if>
       </if>
@@ -262,6 +277,12 @@
       <if test="record.pageUrl != null">
       <if test="record.pageUrl != null">
         page_url = #{record.pageUrl,jdbcType=VARCHAR},
         page_url = #{record.pageUrl,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="record.rootSourceId != null">
+        root_source_id = #{record.rootSourceId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.status != null">
+        `status` = #{record.status,jdbcType=INTEGER},
+      </if>
       <if test="record.createAccountId != null">
       <if test="record.createAccountId != null">
         create_account_id = #{record.createAccountId,jdbcType=BIGINT},
         create_account_id = #{record.createAccountId,jdbcType=BIGINT},
       </if>
       </if>
@@ -287,6 +308,8 @@
       custom_cover_type = #{record.customCoverType,jdbcType=INTEGER},
       custom_cover_type = #{record.customCoverType,jdbcType=INTEGER},
       video = #{record.video,jdbcType=VARCHAR},
       video = #{record.video,jdbcType=VARCHAR},
       page_url = #{record.pageUrl,jdbcType=VARCHAR},
       page_url = #{record.pageUrl,jdbcType=VARCHAR},
+      root_source_id = #{record.rootSourceId,jdbcType=VARCHAR},
+      `status` = #{record.status,jdbcType=INTEGER},
       create_account_id = #{record.createAccountId,jdbcType=BIGINT},
       create_account_id = #{record.createAccountId,jdbcType=BIGINT},
       create_timestamp = #{record.createTimestamp,jdbcType=BIGINT}
       create_timestamp = #{record.createTimestamp,jdbcType=BIGINT}
     <if test="_parameter != null">
     <if test="_parameter != null">
@@ -329,6 +352,12 @@
       <if test="pageUrl != null">
       <if test="pageUrl != null">
         page_url = #{pageUrl,jdbcType=VARCHAR},
         page_url = #{pageUrl,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="rootSourceId != null">
+        root_source_id = #{rootSourceId,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=INTEGER},
+      </if>
       <if test="createAccountId != null">
       <if test="createAccountId != null">
         create_account_id = #{createAccountId,jdbcType=BIGINT},
         create_account_id = #{createAccountId,jdbcType=BIGINT},
       </if>
       </if>
@@ -351,6 +380,8 @@
       custom_cover_type = #{customCoverType,jdbcType=INTEGER},
       custom_cover_type = #{customCoverType,jdbcType=INTEGER},
       video = #{video,jdbcType=VARCHAR},
       video = #{video,jdbcType=VARCHAR},
       page_url = #{pageUrl,jdbcType=VARCHAR},
       page_url = #{pageUrl,jdbcType=VARCHAR},
+      root_source_id = #{rootSourceId,jdbcType=VARCHAR},
+      `status` = #{status,jdbcType=INTEGER},
       create_account_id = #{createAccountId,jdbcType=BIGINT},
       create_account_id = #{createAccountId,jdbcType=BIGINT},
       create_timestamp = #{createTimestamp,jdbcType=BIGINT}
       create_timestamp = #{createTimestamp,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}

+ 9 - 0
api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.xml

@@ -406,5 +406,14 @@
         where video_id = #{videoId}
         where video_id = #{videoId}
     </update>
     </update>
 
 
+    <select id="getGzhPushPlanVideoByRootSourceId"
+            resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlanVideo">
+        select cpgpv.*
+        from content_platform_gzh_plan_video cpgpv
+        join content_platform_gzh_plan cpgp on cpgp.id = cpgpv.plan_id
+        where cpgp.root_source_id = #{rootSourceId}
+          and cpgp.type = #{planType}
+          and cpgp.status = 1
+    </select>
 
 
 </mapper>
 </mapper>