浏览代码

公众号计划修改

wangyunpeng 2 月之前
父节点
当前提交
aa5d00ea39

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

@@ -19,6 +19,8 @@ public class ContentPlatformGzhPlanVideo {
 
     private String video;
 
+    private String pageUrl;
+
     private Long createAccountId;
 
     private Long createTimestamp;
@@ -95,6 +97,14 @@ public class ContentPlatformGzhPlanVideo {
         this.video = video;
     }
 
+    public String getPageUrl() {
+        return pageUrl;
+    }
+
+    public void setPageUrl(String pageUrl) {
+        this.pageUrl = pageUrl;
+    }
+
     public Long getCreateAccountId() {
         return createAccountId;
     }
@@ -126,6 +136,7 @@ public class ContentPlatformGzhPlanVideo {
         sb.append(", customCover=").append(customCover);
         sb.append(", customCoverType=").append(customCoverType);
         sb.append(", video=").append(video);
+        sb.append(", pageUrl=").append(pageUrl);
         sb.append(", createAccountId=").append(createAccountId);
         sb.append(", createTimestamp=").append(createTimestamp);
         sb.append("]");

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

@@ -705,6 +705,76 @@ public class ContentPlatformGzhPlanVideoExample {
             return (Criteria) this;
         }
 
+        public Criteria andPageUrlIsNull() {
+            addCriterion("page_url is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlIsNotNull() {
+            addCriterion("page_url is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlEqualTo(String value) {
+            addCriterion("page_url =", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlNotEqualTo(String value) {
+            addCriterion("page_url <>", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlGreaterThan(String value) {
+            addCriterion("page_url >", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlGreaterThanOrEqualTo(String value) {
+            addCriterion("page_url >=", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlLessThan(String value) {
+            addCriterion("page_url <", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlLessThanOrEqualTo(String value) {
+            addCriterion("page_url <=", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlLike(String value) {
+            addCriterion("page_url like", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlNotLike(String value) {
+            addCriterion("page_url not like", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlIn(List<String> values) {
+            addCriterion("page_url in", values, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlNotIn(List<String> values) {
+            addCriterion("page_url not in", values, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlBetween(String value1, String value2) {
+            addCriterion("page_url between", value1, value2, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlNotBetween(String value1, String value2) {
+            addCriterion("page_url not between", value1, value2, "pageUrl");
+            return (Criteria) this;
+        }
+
         public Criteria andCreateAccountIdIsNull() {
             addCriterion("create_account_id is null");
             return (Criteria) this;

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

@@ -7,14 +7,12 @@ import com.tzld.piaoquan.api.common.enums.contentplatform.ContentPlatformGzhPlan
 import com.tzld.piaoquan.api.common.enums.contentplatform.PublishStageEnum;
 import com.tzld.piaoquan.api.common.enums.contentplatform.QwPlanTypeEnum;
 import com.tzld.piaoquan.api.common.exception.CommonException;
-import com.tzld.piaoquan.api.component.AdApiService;
-import com.tzld.piaoquan.api.component.AigcApiService;
-import com.tzld.piaoquan.api.component.ManagerApiService;
-import com.tzld.piaoquan.api.component.VlogApiService;
+import com.tzld.piaoquan.api.component.*;
 import com.tzld.piaoquan.api.dao.mapper.contentplatform.*;
 import com.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformPlanMapperExt;
 import com.tzld.piaoquan.api.model.bo.AdPutFlowRecordTencent;
 import com.tzld.piaoquan.api.model.bo.BucketDataParam;
+import com.tzld.piaoquan.api.model.bo.SmallPageUrlDetail;
 import com.tzld.piaoquan.api.model.config.LoginUserContext;
 import com.tzld.piaoquan.api.model.param.contentplatform.*;
 import com.tzld.piaoquan.api.model.po.contentplatform.*;
@@ -85,6 +83,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     private AdApiService adApiService;
     @Autowired
     private CgiReplyService cgiReplyService;
+    @Autowired
+    private TouLiuHttpClient touLiuHttpClient;
 
 
     @Value("${vlog.share.appType:11}")
@@ -93,6 +93,9 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     @Value("${video.min.score:0.6}")
     private Double videoMinScore;
 
+    @Value("${small_page_url}")
+    private String GET_SMALL_PAGE_URL;
+
     @Override
     public Page<GzhPlanItemVO> gzhPlanList(GzhPlanListParam param) {
         ContentPlatformAccount loginAccount = LoginUserContext.getUser();
@@ -251,11 +254,13 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         gzhPlan.setPublishStage(param.getPublishStage());
         gzhPlan.setSelectVideoType(param.getSelectVideoType());
         gzhPlan.setUpdateTimestamp(now);
-        // 更新gh_detail
         List<Long> videoIds = param.getVideoList().stream().map(GzhPlanVideoContentItemParam::getVideoId).collect(Collectors.toList());
-        updateGhDetail(account, param.getSelectVideoType(), videoIds);
-        // 更新cgi_reply_bucket_data
-        updateCgiReplyBucketData(account.getGhId(), param.getVideoList());
+        if (param.getType() == ContentPlatformGzhPlanTypeEnum.AUTO_REPLY.getVal()) {
+            // 更新gh_detail
+            updateGhDetail(account, param.getSelectVideoType(), videoIds);
+            // 更新cgi_reply_bucket_data
+            updateCgiReplyBucketData(account.getGhId(), param.getVideoList());
+        }
         if (Objects.isNull(param.getId())) {
             // 调用aigc创建发布计划
             if (PublishStageEnum.PLATFORM.getVal() == param.getPublishStage()) {
@@ -287,14 +292,16 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
             gzhPlanMapper.updateByPrimaryKeySelective(gzhPlan);
         }
         // 保存视频内容
-        saveGzhPlanVideo(param, videoIds, gzhPlan.getId(), loginAccount);
+        saveGzhPlanVideo(param, videoIds, gzhPlan.getId(), account, loginAccount);
         // 调用aigc重新拉取视频
-        if (PublishStageEnum.PLATFORM.getVal() == param.getPublishStage()) {
-            aigcApiService.refreshGzhAutoReplyMsgData(account.getGhId());
-        } else {
-            BucketDataParam bucketDataParam = new BucketDataParam();
-            bucketDataParam.setGhId(account.getGhId());
-            cgiReplyService.getRgiReplyData(bucketDataParam);
+        if (param.getType() == ContentPlatformGzhPlanTypeEnum.AUTO_REPLY.getVal()) {
+            if (PublishStageEnum.PLATFORM.getVal() == param.getPublishStage()) {
+                aigcApiService.refreshGzhAutoReplyMsgData(account.getGhId());
+            } else {
+                BucketDataParam bucketDataParam = new BucketDataParam();
+                bucketDataParam.setGhId(account.getGhId());
+                cgiReplyService.getRgiReplyData(bucketDataParam);
+            }
         }
     }
 
@@ -314,7 +321,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         }
     }
 
-    private void saveGzhPlanVideo(GzhPlanSaveParam param, List<Long> videoIds, Long id, ContentPlatformAccount loginAccount) {
+    private void saveGzhPlanVideo(GzhPlanSaveParam param, List<Long> videoIds, Long id,
+                                  ContentPlatformGzhAccount account, ContentPlatformAccount loginAccount) {
         List<ContentPlatformGzhPlanVideo> existsVideo = getGzhVideoByPlanId(id);
         List<Long> existsVideoIds = existsVideo.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
         Map<Long, ContentPlatformGzhPlanVideo> existsVideoMap = existsVideo.stream()
@@ -343,6 +351,12 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                 item.setCustomCover(vo.getCustomCover());
                 item.setCustomCoverType(vo.getCustomCoverType());
                 item.setVideo(vo.getVideo());
+                if (param.getType() == ContentPlatformGzhPlanTypeEnum.FWH_PUSH.getVal()) {
+                    String response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, String.valueOf(vo.getVideoId()), "fwhdyy",
+                            loginAccount.getChannel(), "自动", "公众号", "文章插小程序", "文字和小程序", account.getGhId());
+                    SmallPageUrlDetail smallPageUrlDetail = JSONObject.parseObject(response, SmallPageUrlDetail.class);
+                    item.setPageUrl(smallPageUrlDetail.getUrl());
+                }
                 item.setCreateAccountId(loginAccount.getId());
                 item.setCreateTimestamp(System.currentTimeMillis());
                 gzhPlanVideoMapper.insertSelective(item);

+ 1 - 9
api-module/src/main/java/com/tzld/piaoquan/api/service/strategy/impl/ThirdPartyPushMessageStrategyV1.java

@@ -183,15 +183,7 @@ public class ThirdPartyPushMessageStrategyV1 implements ReplyStrategyService {
             SmallPageUrlDetail smallPageUrlDetail = new SmallPageUrlDetail();
             if (CollectionUtils.isEmpty(cgiReplyBucketData)) {
                 // 库里不存在,调用新生成
-                String fwhChannel = contentPlatformPlanService.getGzhChannel(ghId);
-                String response;
-                if (StringUtils.isNotEmpty(fwhChannel)) {
-                    response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, videoId, "fwhdyy", fwhChannel,
-                            "自动", "公众号", "文章插小程序", "文字和小程序", ghId);
-                } else {
-                    response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, videoId, "dyyjs",
-                            channel, "自动", "公众号", "自动回复小程序", "位置" + sort, ghId);
-                }
+                String response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, videoId, "dyyjs", channel, "自动", "公众号", "自动回复小程序", "位置" + sort, ghId);
                 JSONObject jsonObject = JSON.parseObject(response);
                 if (jsonObject.getInteger("code").equals(0)) {
                     smallPageUrlDetail = jsonObject.getObject("data", SmallPageUrlDetail.class);

+ 20 - 3
api-module/src/main/resources/mapper/contentplatform/ContentPlatformGzhPlanVideoMapper.xml

@@ -11,6 +11,7 @@
     <result column="custom_cover" jdbcType="VARCHAR" property="customCover" />
     <result column="custom_cover_type" jdbcType="INTEGER" property="customCoverType" />
     <result column="video" jdbcType="VARCHAR" property="video" />
+    <result column="page_url" jdbcType="VARCHAR" property="pageUrl" />
     <result column="create_account_id" jdbcType="BIGINT" property="createAccountId" />
     <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
   </resultMap>
@@ -74,7 +75,7 @@
   </sql>
   <sql id="Base_Column_List">
     id, plan_id, video_id, title, custom_title, cover, custom_cover, custom_cover_type, 
-    video, create_account_id, create_timestamp
+    video, page_url, create_account_id, create_timestamp
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlanVideoExample" resultMap="BaseResultMap">
     select
@@ -113,11 +114,13 @@
     insert into content_platform_gzh_plan_video (id, plan_id, video_id, 
       title, custom_title, cover, 
       custom_cover, custom_cover_type, video, 
-      create_account_id, create_timestamp)
+      page_url, create_account_id, create_timestamp
+      )
     values (#{id,jdbcType=BIGINT}, #{planId,jdbcType=BIGINT}, #{videoId,jdbcType=BIGINT}, 
       #{title,jdbcType=VARCHAR}, #{customTitle,jdbcType=VARCHAR}, #{cover,jdbcType=VARCHAR}, 
       #{customCover,jdbcType=VARCHAR}, #{customCoverType,jdbcType=INTEGER}, #{video,jdbcType=VARCHAR}, 
-      #{createAccountId,jdbcType=BIGINT}, #{createTimestamp,jdbcType=BIGINT})
+      #{pageUrl,jdbcType=VARCHAR}, #{createAccountId,jdbcType=BIGINT}, #{createTimestamp,jdbcType=BIGINT}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlanVideo">
     insert into content_platform_gzh_plan_video
@@ -149,6 +152,9 @@
       <if test="video != null">
         video,
       </if>
+      <if test="pageUrl != null">
+        page_url,
+      </if>
       <if test="createAccountId != null">
         create_account_id,
       </if>
@@ -184,6 +190,9 @@
       <if test="video != null">
         #{video,jdbcType=VARCHAR},
       </if>
+      <if test="pageUrl != null">
+        #{pageUrl,jdbcType=VARCHAR},
+      </if>
       <if test="createAccountId != null">
         #{createAccountId,jdbcType=BIGINT},
       </if>
@@ -228,6 +237,9 @@
       <if test="record.video != null">
         video = #{record.video,jdbcType=VARCHAR},
       </if>
+      <if test="record.pageUrl != null">
+        page_url = #{record.pageUrl,jdbcType=VARCHAR},
+      </if>
       <if test="record.createAccountId != null">
         create_account_id = #{record.createAccountId,jdbcType=BIGINT},
       </if>
@@ -250,6 +262,7 @@
       custom_cover = #{record.customCover,jdbcType=VARCHAR},
       custom_cover_type = #{record.customCoverType,jdbcType=INTEGER},
       video = #{record.video,jdbcType=VARCHAR},
+      page_url = #{record.pageUrl,jdbcType=VARCHAR},
       create_account_id = #{record.createAccountId,jdbcType=BIGINT},
       create_timestamp = #{record.createTimestamp,jdbcType=BIGINT}
     <if test="_parameter != null">
@@ -283,6 +296,9 @@
       <if test="video != null">
         video = #{video,jdbcType=VARCHAR},
       </if>
+      <if test="pageUrl != null">
+        page_url = #{pageUrl,jdbcType=VARCHAR},
+      </if>
       <if test="createAccountId != null">
         create_account_id = #{createAccountId,jdbcType=BIGINT},
       </if>
@@ -302,6 +318,7 @@
       custom_cover = #{customCover,jdbcType=VARCHAR},
       custom_cover_type = #{customCoverType,jdbcType=INTEGER},
       video = #{video,jdbcType=VARCHAR},
+      page_url = #{pageUrl,jdbcType=VARCHAR},
       create_account_id = #{createAccountId,jdbcType=BIGINT},
       create_timestamp = #{createTimestamp,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}