Quellcode durchsuchen

公众号计划修改

wangyunpeng vor 2 Monaten
Ursprung
Commit
311a2859a1

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

@@ -47,6 +47,13 @@ public class ContentPlatformPlanController {
         return CommonResponse.success();
     }
 
+    @ApiOperation(value = "公众号计划 平台发布开关修改")
+    @PostMapping("/gzh/updateStagePublishStatus")
+    public CommonResponse<Void> gzhUpdateStagePublishStatus(@RequestBody GzhPlanStagePublishStatusUpdateParam param) {
+        planService.gzhUpdateStagePublishStatus(param.getId());
+        return CommonResponse.success();
+    }
+
     @ApiOperation(value = "发布内容视频列表")
     @PostMapping("/videoContentList")
     public CommonResponse<Page<VideoContentItemVO>> getVideoContentList(@RequestBody VideoContentListParam param) {

+ 1 - 2
api-module/src/main/java/com/tzld/piaoquan/api/model/param/contentplatform/GzhPlanSaveParam.java

@@ -1,6 +1,5 @@
 package com.tzld.piaoquan.api.model.param.contentplatform;
 
-import com.tzld.piaoquan.api.model.vo.contentplatform.GzhPlanVideoContentItemVO;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -28,5 +27,5 @@ public class GzhPlanSaveParam {
     private Integer selectVideoType;
 
     @ApiModelProperty(value = "视频列表")
-    private List<GzhPlanVideoContentItemVO> videoList;
+    private List<GzhPlanVideoContentItemParam> videoList;
 }

+ 14 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/param/contentplatform/GzhPlanStagePublishStatusUpdateParam.java

@@ -0,0 +1,14 @@
+package com.tzld.piaoquan.api.model.param.contentplatform;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class GzhPlanStagePublishStatusUpdateParam {
+
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    @ApiModelProperty(value = "平台发布开关 0-关闭 1-开启")
+    private Integer stagePublishStatus;
+}

+ 32 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/param/contentplatform/GzhPlanVideoContentItemParam.java

@@ -0,0 +1,32 @@
+package com.tzld.piaoquan.api.model.param.contentplatform;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class GzhPlanVideoContentItemParam {
+
+    @ApiModelProperty(value = "id")
+    private Long videoId;
+
+    @ApiModelProperty(value = "标题")
+    private String title;
+
+    @ApiModelProperty(value = "自定义标题")
+    private String customTitle;
+
+    @ApiModelProperty(value = "封面")
+    private String cover;
+
+    @ApiModelProperty(value = "自定义封面")
+    private String customCover;
+
+    @ApiModelProperty(value = "自定义封面类型 1视频桢 2自己上传")
+    private Integer customCoverType;
+
+    @ApiModelProperty(value = "视频url")
+    private String video;
+
+    @ApiModelProperty(value = "传播效率")
+    private Double score;
+}

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

@@ -17,6 +17,8 @@ public class ContentPlatformGzhPlan {
 
     private Integer status;
 
+    private Integer stagePublishStatus;
+
     private Long createAccountId;
 
     private Long createTimestamp;
@@ -87,6 +89,14 @@ public class ContentPlatformGzhPlan {
         this.status = status;
     }
 
+    public Integer getStagePublishStatus() {
+        return stagePublishStatus;
+    }
+
+    public void setStagePublishStatus(Integer stagePublishStatus) {
+        this.stagePublishStatus = stagePublishStatus;
+    }
+
     public Long getCreateAccountId() {
         return createAccountId;
     }
@@ -125,6 +135,7 @@ public class ContentPlatformGzhPlan {
         sb.append(", externalId=").append(externalId);
         sb.append(", selectVideoType=").append(selectVideoType);
         sb.append(", status=").append(status);
+        sb.append(", stagePublishStatus=").append(stagePublishStatus);
         sb.append(", createAccountId=").append(createAccountId);
         sb.append(", createTimestamp=").append(createTimestamp);
         sb.append(", updateTimestamp=").append(updateTimestamp);

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

@@ -605,6 +605,66 @@ public class ContentPlatformGzhPlanExample {
             return (Criteria) this;
         }
 
+        public Criteria andStagePublishStatusIsNull() {
+            addCriterion("stage_publish_status is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStagePublishStatusIsNotNull() {
+            addCriterion("stage_publish_status is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStagePublishStatusEqualTo(Integer value) {
+            addCriterion("stage_publish_status =", value, "stagePublishStatus");
+            return (Criteria) this;
+        }
+
+        public Criteria andStagePublishStatusNotEqualTo(Integer value) {
+            addCriterion("stage_publish_status <>", value, "stagePublishStatus");
+            return (Criteria) this;
+        }
+
+        public Criteria andStagePublishStatusGreaterThan(Integer value) {
+            addCriterion("stage_publish_status >", value, "stagePublishStatus");
+            return (Criteria) this;
+        }
+
+        public Criteria andStagePublishStatusGreaterThanOrEqualTo(Integer value) {
+            addCriterion("stage_publish_status >=", value, "stagePublishStatus");
+            return (Criteria) this;
+        }
+
+        public Criteria andStagePublishStatusLessThan(Integer value) {
+            addCriterion("stage_publish_status <", value, "stagePublishStatus");
+            return (Criteria) this;
+        }
+
+        public Criteria andStagePublishStatusLessThanOrEqualTo(Integer value) {
+            addCriterion("stage_publish_status <=", value, "stagePublishStatus");
+            return (Criteria) this;
+        }
+
+        public Criteria andStagePublishStatusIn(List<Integer> values) {
+            addCriterion("stage_publish_status in", values, "stagePublishStatus");
+            return (Criteria) this;
+        }
+
+        public Criteria andStagePublishStatusNotIn(List<Integer> values) {
+            addCriterion("stage_publish_status not in", values, "stagePublishStatus");
+            return (Criteria) this;
+        }
+
+        public Criteria andStagePublishStatusBetween(Integer value1, Integer value2) {
+            addCriterion("stage_publish_status between", value1, value2, "stagePublishStatus");
+            return (Criteria) this;
+        }
+
+        public Criteria andStagePublishStatusNotBetween(Integer value1, Integer value2) {
+            addCriterion("stage_publish_status not between", value1, value2, "stagePublishStatus");
+            return (Criteria) this;
+        }
+
         public Criteria andCreateAccountIdIsNull() {
             addCriterion("create_account_id is null");
             return (Criteria) this;

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

@@ -40,4 +40,7 @@ public class GzhPlanItemVO {
 
     @ApiModelProperty(value = "视频选取方式 0-手动选取 1-自动选取")
     private Integer selectVideoType;
+
+    @ApiModelProperty(value = "平台发布开关 0-关闭 1-开启")
+    private Integer stagePublishStatus;
 }

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

@@ -29,4 +29,7 @@ public class GzhPlanVideoContentItemVO {
 
     @ApiModelProperty(value = "传播效率")
     private Double score;
+
+    @ApiModelProperty(value = "推送链接")
+    private String pageUrl;
 }

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

@@ -67,4 +67,6 @@ public interface ContentPlatformPlanService {
     void gzhPlanImport(List<String> channels);
 
     void qwPlanImport(List<String> channels);
+
+    void gzhUpdateStagePublishStatus(Long id);
 }

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

@@ -146,6 +146,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                     videoItemVO.setCustomCover(video.getCustomCover());
                     videoItemVO.setCustomCoverType(video.getCustomCoverType());
                     videoItemVO.setVideo(video.getVideo());
+                    videoItemVO.setPageUrl(null);
                     videoVOList.add(videoItemVO);
                 }
                 planItemVO.setVideoList(videoVOList);
@@ -178,6 +179,12 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         }
     }
 
+
+    @Override
+    public void gzhUpdateStagePublishStatus(Long id) {
+
+    }
+
     @Override
     public void qwPlanDelete(Long id) {
         ContentPlatformQwPlan plan = qwPlanMapper.selectByPrimaryKey(id);
@@ -215,7 +222,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         gzhPlan.setSelectVideoType(param.getSelectVideoType());
         gzhPlan.setUpdateTimestamp(now);
         // 更新gh_detail
-        List<Long> videoIds = param.getVideoList().stream().map(GzhPlanVideoContentItemVO::getVideoId).collect(Collectors.toList());
+        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());
@@ -223,6 +230,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
             // 调用aigc创建发布计划
             if (PublishStageEnum.PLATFORM.getVal() == param.getPublishStage()) {
                 String externalId = aigcApiService.createPublishPlan(account.getExternalId(), account.getName(), loginAccount.getChannel());
+                gzhPlan.setStagePublishStatus(1);
                 gzhPlan.setExternalId(externalId);
             }
             gzhPlan.setCreateAccountId(loginAccount.getId());
@@ -232,13 +240,16 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
             ContentPlatformGzhPlan oldPlan = gzhPlanMapper.selectByPrimaryKey(param.getId());
             if (PublishStageEnum.USER.getVal() == param.getPublishStage()) {
                 if (StringUtils.hasText(oldPlan.getExternalId())) {
+                    gzhPlan.setStagePublishStatus(0);
                     aigcApiService.changePublishPlanStatus(oldPlan.getExternalId(), 0);
                 }
             } else {
                 if (StringUtils.hasText(oldPlan.getExternalId())) {
+                    gzhPlan.setStagePublishStatus(1);
                     aigcApiService.changePublishPlanStatus(oldPlan.getExternalId(), 1);
                 } else {
                     String externalId = aigcApiService.createPublishPlan(account.getExternalId(), account.getName(), loginAccount.getChannel());
+                    gzhPlan.setStagePublishStatus(1);
                     gzhPlan.setExternalId(externalId);
                 }
             }
@@ -246,13 +257,13 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
             gzhPlanMapper.updateByPrimaryKeySelective(gzhPlan);
         }
         // 保存视频内容
-        saveGzhPlanVideo(param, videoIds, gzhPlan.getId(), loginAccount.getId());
+        saveGzhPlanVideo(param, videoIds, gzhPlan.getId(), loginAccount);
         // 调用aigc重新拉取视频
         aigcApiService.refreshGzhAutoReplyMsgData(account.getGhId());
     }
 
-    private void updateCgiReplyBucketData(String ghId, List<GzhPlanVideoContentItemVO> videoList) {
-        for (GzhPlanVideoContentItemVO video : videoList) {
+    private void updateCgiReplyBucketData(String ghId, List<GzhPlanVideoContentItemParam> videoList) {
+        for (GzhPlanVideoContentItemParam video : videoList) {
             if (!StringUtils.hasText(video.getCustomCover()) && !StringUtils.hasText(video.getCustomTitle())) {
                 continue;
             }
@@ -270,7 +281,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         }
     }
 
-    private void saveGzhPlanVideo(GzhPlanSaveParam param, List<Long> videoIds, Long id, Long loginAccountId) {
+    private void saveGzhPlanVideo(GzhPlanSaveParam param, List<Long> videoIds, Long id, ContentPlatformAccount loginAccount) {
         List<ContentPlatformGzhPlanVideo> existsVideo = getGzhVideoByPlanId(id);
         List<Long> existsVideoIds = existsVideo.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
         Map<Long, ContentPlatformGzhPlanVideo> existsVideoMap = existsVideo.stream()
@@ -280,7 +291,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                 gzhPlanVideoMapper.deleteByPrimaryKey(item.getId());
             }
         }
-        for (GzhPlanVideoContentItemVO vo : param.getVideoList()) {
+        for (GzhPlanVideoContentItemParam vo : param.getVideoList()) {
             if (existsVideoIds.contains(vo.getVideoId())) {
                 ContentPlatformGzhPlanVideo item = existsVideoMap.get(vo.getVideoId());
                 item.setTitle(vo.getTitle());
@@ -299,7 +310,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                 item.setCustomCover(vo.getCustomCover());
                 item.setCustomCoverType(vo.getCustomCoverType());
                 item.setVideo(vo.getVideo());
-                item.setCreateAccountId(loginAccountId);
+                item.setCreateAccountId(loginAccount.getId());
                 item.setCreateTimestamp(System.currentTimeMillis());
                 gzhPlanVideoMapper.insertSelective(item);
             }

+ 22 - 5
api-module/src/main/resources/mapper/contentplatform/ContentPlatformGzhPlanMapper.xml

@@ -10,6 +10,7 @@
     <result column="external_id" jdbcType="VARCHAR" property="externalId" />
     <result column="select_video_type" jdbcType="INTEGER" property="selectVideoType" />
     <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="stage_publish_status" jdbcType="INTEGER" property="stagePublishStatus" />
     <result column="create_account_id" jdbcType="BIGINT" property="createAccountId" />
     <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
     <result column="update_timestamp" jdbcType="BIGINT" property="updateTimestamp" />
@@ -74,7 +75,7 @@
   </sql>
   <sql id="Base_Column_List">
     id, `type`, publish_stage, account_id, scene, external_id, select_video_type, `status`, 
-    create_account_id, create_timestamp, update_timestamp
+    stage_publish_status, create_account_id, create_timestamp, update_timestamp
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlanExample" resultMap="BaseResultMap">
     select
@@ -112,12 +113,14 @@
   <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlan">
     insert into content_platform_gzh_plan (id, `type`, publish_stage, 
       account_id, scene, external_id, 
-      select_video_type, `status`, create_account_id, 
-      create_timestamp, update_timestamp)
+      select_video_type, `status`, stage_publish_status, 
+      create_account_id, create_timestamp, update_timestamp
+      )
     values (#{id,jdbcType=BIGINT}, #{type,jdbcType=INTEGER}, #{publishStage,jdbcType=INTEGER}, 
       #{accountId,jdbcType=BIGINT}, #{scene,jdbcType=INTEGER}, #{externalId,jdbcType=VARCHAR}, 
-      #{selectVideoType,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createAccountId,jdbcType=BIGINT}, 
-      #{createTimestamp,jdbcType=BIGINT}, #{updateTimestamp,jdbcType=BIGINT})
+      #{selectVideoType,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{stagePublishStatus,jdbcType=INTEGER}, 
+      #{createAccountId,jdbcType=BIGINT}, #{createTimestamp,jdbcType=BIGINT}, #{updateTimestamp,jdbcType=BIGINT}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlan">
     insert into content_platform_gzh_plan
@@ -146,6 +149,9 @@
       <if test="status != null">
         `status`,
       </if>
+      <if test="stagePublishStatus != null">
+        stage_publish_status,
+      </if>
       <if test="createAccountId != null">
         create_account_id,
       </if>
@@ -181,6 +187,9 @@
       <if test="status != null">
         #{status,jdbcType=INTEGER},
       </if>
+      <if test="stagePublishStatus != null">
+        #{stagePublishStatus,jdbcType=INTEGER},
+      </if>
       <if test="createAccountId != null">
         #{createAccountId,jdbcType=BIGINT},
       </if>
@@ -225,6 +234,9 @@
       <if test="record.status != null">
         `status` = #{record.status,jdbcType=INTEGER},
       </if>
+      <if test="record.stagePublishStatus != null">
+        stage_publish_status = #{record.stagePublishStatus,jdbcType=INTEGER},
+      </if>
       <if test="record.createAccountId != null">
         create_account_id = #{record.createAccountId,jdbcType=BIGINT},
       </if>
@@ -249,6 +261,7 @@
       external_id = #{record.externalId,jdbcType=VARCHAR},
       select_video_type = #{record.selectVideoType,jdbcType=INTEGER},
       `status` = #{record.status,jdbcType=INTEGER},
+      stage_publish_status = #{record.stagePublishStatus,jdbcType=INTEGER},
       create_account_id = #{record.createAccountId,jdbcType=BIGINT},
       create_timestamp = #{record.createTimestamp,jdbcType=BIGINT},
       update_timestamp = #{record.updateTimestamp,jdbcType=BIGINT}
@@ -280,6 +293,9 @@
       <if test="status != null">
         `status` = #{status,jdbcType=INTEGER},
       </if>
+      <if test="stagePublishStatus != null">
+        stage_publish_status = #{stagePublishStatus,jdbcType=INTEGER},
+      </if>
       <if test="createAccountId != null">
         create_account_id = #{createAccountId,jdbcType=BIGINT},
       </if>
@@ -301,6 +317,7 @@
       external_id = #{externalId,jdbcType=VARCHAR},
       select_video_type = #{selectVideoType,jdbcType=INTEGER},
       `status` = #{status,jdbcType=INTEGER},
+      stage_publish_status = #{stagePublishStatus,jdbcType=INTEGER},
       create_account_id = #{createAccountId,jdbcType=BIGINT},
       create_timestamp = #{createTimestamp,jdbcType=BIGINT},
       update_timestamp = #{updateTimestamp,jdbcType=BIGINT}