Преглед на файлове

更新 VideoPost 相关接口和实现

reghao преди 8 месеца
родител
ревизия
325c9f9282
променени са 16 файла, в които са добавени 81 реда и са изтрити 213 реда
  1. 0 5
      content/content-api/src/main/java/cn/reghao/tnb/content/api/constant/VideoStatus.java
  2. 1 4
      content/content-api/src/main/java/cn/reghao/tnb/content/api/dto/VideoPublishSbt.java
  3. 1 1
      content/content-api/src/main/java/cn/reghao/tnb/content/api/iface/UserContentService.java
  4. 6 6
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/controller/VideoPostController.java
  5. 1 0
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/db/mapper/VideoFileMapper.java
  6. 1 8
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/db/mapper/VideoPostMapper.java
  7. 2 43
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/db/repository/VideoRepository.java
  8. 13 5
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/po/VideoPost.java
  9. 2 8
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/rpc/UserContentServiceImpl.java
  10. 2 3
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/VideoPostService.java
  11. 5 5
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/VideoService.java
  12. 2 2
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPostQueryImpl.java
  13. 38 46
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPostServiceImpl.java
  14. 5 0
      content/content-service/src/main/resources/mapper/vod/VideoFileMapper.xml
  15. 1 76
      content/content-service/src/main/resources/mapper/vod/VideoPostMapper.xml
  16. 1 1
      file/file-service/src/main/java/cn/reghao/tnb/file/app/delay/task/PublishVideoTask.java

+ 0 - 5
content/content-api/src/main/java/cn/reghao/tnb/content/api/constant/VideoStatus.java

@@ -35,15 +35,10 @@ public enum VideoStatus {
         this.desc = desc;
     }
 
-    @Deprecated
     public Integer getCode() {
         return code;
     }
 
-    public int getValue() {
-        return code;
-    }
-
     public String getDesc() {
         return desc;
     }

+ 1 - 4
content/content-api/src/main/java/cn/reghao/tnb/content/api/dto/VideoPublishSbt.java

@@ -10,7 +10,6 @@ import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import java.io.Serializable;
-import java.time.LocalDateTime;
 import java.util.Set;
 
 /**
@@ -24,9 +23,7 @@ public class VideoPublishSbt implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @NotBlank
-    private String videoFileId;
-    @NotNull
-    private Integer channelCode;
+    private String videoId;
     @NotBlank
     private String coverFileId;
     @NotNull

+ 1 - 1
content/content-api/src/main/java/cn/reghao/tnb/content/api/iface/UserContentService.java

@@ -17,5 +17,5 @@ public interface UserContentService {
      * @date 2024-08-03 23:08:488
      */
     List<Long> getContentUser(int publishType);
-    Result publishVideoPost(String videoId);
+    Result setVideoPostPublish(String videoId);
 }

+ 6 - 6
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/controller/VideoPostController.java

@@ -38,17 +38,17 @@ public class VideoPostController {
 
     @AuthUser
     @Operation(summary = "发布视频文件", description = "N")
-    @PostMapping("/file")
+    @PostMapping("/publish/file")
     public String addVideoFile(@RequestBody @Validated VideoFilePublish videoFilePublish) {
-        String videoId = videoPostService.publishVideoFile(videoFilePublish);
-        return WebResult.success(videoId);
+        Result result = videoPostService.publishVideoFile(videoFilePublish);
+        return WebResult.result(result);
     }
 
     @AuthUser
     @Operation(summary = "发布视频稿件", description = "N")
-    @PostMapping("")
-    public String addVideoPost(@RequestBody @Validated VideoPublishSbt videoPublishSbt) {
-        Result result = videoPostService.publishVideo(videoPublishSbt);
+    @PostMapping("/publish/post")
+    public String publishVideoPost(@RequestBody @Validated VideoPublishSbt videoPublishSbt) {
+        Result result = videoPostService.publishVideoPost(videoPublishSbt);
         return WebResult.result(result);
     }
 

+ 1 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/db/mapper/VideoFileMapper.java

@@ -17,6 +17,7 @@ public interface VideoFileMapper extends BaseMapper<VideoFile> {
     void updateDeleteByObjectId(String objectId);
 
     List<VideoUrlDto> findVideoUrls(String videoId);
+    List<VideoFile> findByVideoId(String videoId);
     VideoFile findByVideoFileId(String objectId);
     List<VideoInfo> findVideoInfo(String objectId);
 }

+ 1 - 8
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/db/mapper/VideoPostMapper.java

@@ -29,7 +29,7 @@ public interface VideoPostMapper extends BaseMapper<VideoPost> {
     void updateVideoCover(@Param("videoId") String videoId, @Param("coverUrl") String coverUrl);
     void updateVideoFile(@Param("videoId") String videoId, @Param("videoInfo") VideoInfo videoInfo);
     void updateVideoStatus(@Param("videoId") String videoId, @Param("status") int status);
-    void updateVideoPublish(@Param("videoId") String videoId, @Param("status") int status);
+    void updateVideoPublish(VideoPost videoPost);
     void updateVideoCached(@Param("videoId") String videoId,
                            @Param("videoInfo") VideoInfo videoInfo,
                            @Param("channelId") int channelId);
@@ -43,8 +43,6 @@ public interface VideoPostMapper extends BaseMapper<VideoPost> {
     int countAdminVideo(VideoQuery videoQuery);
     List<VideoPost> findAdminVideoByPage(@Param("page") Page page, @Param("videoQuery") VideoQuery videoQuery);
 
-    List<Integer> countByCriteriaAndUserGroup(VideoQuery videoQuery);
-    List<VideoPostCard> findCriteriaAndUserGroupByPage(@Param("page") Page page, @Param("videoQuery") VideoQuery videoQuery);
     List<VideoPostCard> findByNextVideos(@Param("videoQuery") VideoQuery videoQuery, @Param("publishAt") LocalDateTime publishAt);
 
     VideoPost findByVideoId(String videoId);
@@ -60,11 +58,6 @@ public interface VideoPostMapper extends BaseMapper<VideoPost> {
     List<GroupCount> findPublishByPost();
     List<GroupCount> findPublishByVideo();
     List<GroupCount> findPublishByImage();
-    List<GroupCount> findGroupByCategoryId();
     List<String> findRandomVideoIds(@Param("scopes") List<Integer> scopes, @Param("size") int size);
     List<String> findShortVideo(List<Integer> scopes);
-
-    int countDurationLt(int duration);
-    int countDurationBetween(int duration1, int duration2);
-    int countDurationGt(int duration);
 }

+ 2 - 43
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/db/repository/VideoRepository.java

@@ -12,9 +12,7 @@ import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Collections;
 import java.util.List;
-import java.util.stream.Collectors;
 
 /**
  * @author reghao
@@ -34,9 +32,8 @@ public class VideoRepository {
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public void savePostVideo(VideoFile videoFile, VideoPost videoPost, VideoStatistic videoStatistic) {
-        videoFileMapper.save(videoFile);
-        videoPostMapper.save(videoPost);
+    public void savePostVideo(VideoPost videoPost, VideoStatistic videoStatistic) {
+        videoPostMapper.updateVideoPublish(videoPost);
         videoStatisticMapper.save(videoStatistic);
     }
 
@@ -46,11 +43,6 @@ public class VideoRepository {
         videoPostMapper.save(videoPost);
     }
 
-    @Transactional(rollbackFor = Exception.class)
-    public void saveVideoFiles(List<VideoFile> videoFiles) {
-        videoFileMapper.saveAll(videoFiles);
-    }
-
     @Transactional(rollbackFor = Exception.class)
     public void updateBiliVideoFile(String videoId, VideoInfo videoInfo, int channelId) {
         VideoFile videoFile = new VideoFile(videoId, videoInfo, channelId);
@@ -58,29 +50,6 @@ public class VideoRepository {
         videoPostMapper.updateVideoCached(videoId, videoInfo, channelId);
     }
 
-    @Transactional(rollbackFor = Exception.class)
-    public void updateVideoPublish(String videoId, VideoFile videoFile) {
-        videoFileMapper.save(videoFile);
-        videoPostMapper.updateVideoPublish(videoId, VideoStatus.publish.getValue());
-    }
-
-    public void updateVideoPublish(String videoId) {
-        videoPostMapper.updateVideoPublish(videoId, VideoStatus.publish.getValue());
-    }
-
-    public List<String> deleteVideoFile(String videoFileId) {
-        return Collections.emptyList();
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public void deleteVideoFile0(String videoFileId) {
-        videoFileMapper.updateDeleteByObjectId(videoFileId);
-    }
-
-    public List<VideoInfo> getVideoInfos(String videoFileId) {
-        return videoFileMapper.findVideoInfo(videoFileId);
-    }
-
     public List<VideoUrlDto> findVideoUrls(String videoId) {
         return videoFileMapper.findVideoUrls(videoId);
     }
@@ -108,14 +77,4 @@ public class VideoRepository {
     public VideoPost getVideoPost(String videoId) {
         return videoPostMapper.findByVideoId(videoId);
     }
-
-    public VideoPost getVideoPostByFileId(String videoFileId) {
-        VideoFile videoFile = videoFileMapper.findByVideoFileId(videoFileId);
-        if (videoFile != null) {
-            String videoId = videoFile.getVideoId();
-            return videoPostMapper.findByVideoId(videoId);
-        }
-
-        return null;
-    }
 }

+ 13 - 5
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/po/VideoPost.java

@@ -2,6 +2,7 @@ package cn.reghao.tnb.content.app.vod.model.po;
 
 import cn.reghao.jutil.jdk.converter.DateTimeConverter;
 import cn.reghao.jutil.jdk.db.BaseObject;
+import cn.reghao.oss.sdk.model.dto.media.VideoInfo;
 import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.content.api.constant.PostScope;
 import cn.reghao.tnb.content.api.constant.VideoStatus;
@@ -55,14 +56,10 @@ public class VideoPost extends BaseObject<Integer> {
     public VideoPost(String videoId, String title, VideoFile videoInfo) {
         this.videoId = videoId;
         this.title = title;
-        this.description = "";
-        this.categoryPid = 3;
-        this.categoryId = 4;
         this.duration = videoInfo.getDuration();
         this.horizontal = videoInfo.getHorizontal();
-        this.coverUrl = "";
         this.scope = PostScope.PRIVATE.getCode();
-        this.status = VideoStatus.censor.getValue();
+        this.status = VideoStatus.censor.getCode();
         this.publishAt = DateTimeConverter.localDateTime(System.currentTimeMillis());
         this.publishBy = UserContext.getUser();
     }
@@ -82,4 +79,15 @@ public class VideoPost extends BaseObject<Integer> {
         this.publishAt = DateTimeConverter.localDateTime(video.getPubDate());
         this.publishBy = video.getUserId();
     }
+
+    public void update(VideoPublishSbt video, String coverUrl, long publishAt) {
+        this.title = video.getTitle();
+        this.description = video.getDescription();
+        this.categoryPid = video.getCategoryPid();
+        this.categoryId = video.getCategoryId();
+        this.coverUrl = coverUrl;
+        this.scope = video.getScope();
+        this.status = VideoStatus.publish.getCode();
+        this.publishAt = DateTimeConverter.localDateTime(publishAt);
+    }
 }

+ 2 - 8
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/rpc/UserContentServiceImpl.java

@@ -34,13 +34,7 @@ public class UserContentServiceImpl implements UserContentService {
     }
 
     @Override
-    public Result publishVideoPost(String videoId) {
-        VideoPost videoPost = videoRepository.getVideoPost(videoId);
-        if (videoPost.getStatus() != VideoStatus.publish.getValue()) {
-            videoRepository.updateVideoPublish(videoId);
-            return Result.success();
-        }
-
-        return Result.fail("update video status failed");
+    public Result setVideoPostPublish(String videoId) {
+        return Result.fail("not implement");
     }
 }

+ 2 - 3
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/VideoPostService.java

@@ -13,10 +13,9 @@ import cn.reghao.tnb.content.app.vod.model.po.VideoStatistic;
  * @date 2023-10-08 15:34:48
  */
 public interface VideoPostService {
-    String publishVideoFile(VideoFilePublish videoFilePublish);
-    Result publishVideo(VideoPublishSbt videoPublishSbt);
+    Result publishVideoFile(VideoFilePublish videoFilePublish);
+    Result publishVideoPost(VideoPublishSbt videoPublishSbt);
     void saveVideo(VideoPost videoPost, VideoStatistic videoStatistic, String tags);
-    void updateVideoStatus(VideoScopeUpdate videoScopeUpdate);
     void updateVideoScope(VideoScopeUpdate videoScopeUpdate);
     void updateVideoInfo(VideoInfoUpdate videoInfoUpdate);
     void updateVideoCover(VideoCoverUpdate videoCoverUpdate);

+ 5 - 5
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/VideoService.java

@@ -62,23 +62,23 @@ public class VideoService {
             case noCover:
             case noAudio:
             case noVideo:
-                videoStatus = VideoStatus.needRepair.getValue();
+                videoStatus = VideoStatus.needRepair.getCode();
                 break;
             case noResource:
-                videoStatus = VideoStatus.revoke.getValue();
+                videoStatus = VideoStatus.revoke.getCode();
                 break;
             case hasAd:
-                videoStatus = VideoStatus.hasAd.getValue();
+                videoStatus = VideoStatus.hasAd.getCode();
                 break;
             case needRestore:
-                videoStatus = VideoStatus.needRestore.getValue();
+                videoStatus = VideoStatus.needRestore.getCode();
                 break;
             default:
                 return Result.fail("unknown errorType");
         }
 
         videoPostMapper.updateVideoStatus(videoId, videoStatus);
-        if (videoStatus != VideoStatus.revoke.getValue() || videoStatus != VideoStatus.needRestore.getValue()) {
+        if (videoStatus != VideoStatus.revoke.getCode() || videoStatus != VideoStatus.needRestore.getCode()) {
             VideoError videoError = new VideoError(videoErrorReport);
             videoErrorMapper.save(videoError);
         }

+ 2 - 2
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPostQueryImpl.java

@@ -240,7 +240,7 @@ public class VideoPostQueryImpl implements VideoPostQuery {
         }
 
         int status = videoPost.getStatus();
-        if (status != VideoStatus.publish.getValue() && status != VideoStatus.noVideoFile.getValue()) {
+        if (status != VideoStatus.publish.getCode() && status != VideoStatus.noVideoFile.getCode()) {
             return WebResult.notFound();
         }
 
@@ -301,7 +301,7 @@ public class VideoPostQueryImpl implements VideoPostQuery {
 
     private List<String> getRandomVipVideoIds() {
         VideoQuery videoQuery = new VideoQuery.Builder()
-                .status(List.of(VideoStatus.publish.getValue()))
+                .status(List.of(VideoStatus.publish.getCode()))
                 .scope(List.of(PostScope.PROTECT.getCode()))
                 .categoryPid(11)
                 .build();

+ 38 - 46
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPostServiceImpl.java

@@ -64,27 +64,37 @@ public class VideoPostServiceImpl implements VideoPostService {
         this.videoCategoryPostMapper = videoCategoryPostMapper;
     }
 
-    public String publishVideoFile(VideoFilePublish videoFilePublish) {
+    public Result publishVideoFile(VideoFilePublish videoFilePublish) {
         String title = videoFilePublish.getFilename();
         String videoFileId = videoFilePublish.getVideoFileId();
         int channelCode = videoFilePublish.getChannelCode();
+        Result result;
         try {
             VideoInfo videoInfo = ossService.getVideoInfo(channelCode, videoFileId);
+            if (!videoInfo.getFormatName().contains("mov,mp4")) {
+                long jobId = jobService.addConvertVideoJob(videoFileId, channelCode);
+                /*Result result1 = fileService.convertVideo(videoFileId, channelCode);
+                if (result1.getCode() == ResultStatus.SUCCESS.getCode()) {
+                    videoPost.setStatus(VideoStatus.converted.getCode());
+                } else {
+                    log.error(result1.getMsg());
+                }*/
+            }
+
             String videoId = idGenerator.getUuid();
             VideoFile videoFile = new VideoFile(videoId, videoInfo, channelCode);
             VideoPost videoPost = new VideoPost(videoId, title, videoFile);
             videoRepository.saveVideo(videoFile, videoPost);
-            return videoId;
+            result = Result.success(videoId);
         } catch (Exception e) {
-            e.printStackTrace();
             String errMsg = String.format("视频文件 %s 在 oss 中不存在", videoFileId);
-            log.error("{}", e.getMessage());
+            result = Result.fail(errMsg);
         }
 
-        return null;
+        return result;
     }
 
-    public Result publishVideo(VideoPublishSbt videoPublishSbt) {
+    public Result publishVideoPost(VideoPublishSbt videoPublishSbt) {
         Result result;
         try {
             int coverChannelId = videoPublishSbt.getCoverChannelId();
@@ -94,19 +104,24 @@ public class VideoPostServiceImpl implements VideoPostService {
                 String errMsg = String.format("封面文件 %s 在 oss 中不存在", coverFileId);
                 return Result.fail(errMsg);
             }
-
             String coverUrl = imageInfo.getUrl();
-            String videoFileId = videoPublishSbt.getVideoFileId();
-            int channelCode = videoPublishSbt.getChannelCode();
-            VideoInfo videoInfo = ossService.getVideoInfo(channelCode, videoFileId);
-            if (videoInfo == null) {
-                String errMsg = String.format("视频文件 %s 在 oss 中不存在", videoFileId);
+
+            String videoId = videoPublishSbt.getVideoId();
+            VideoPost videoPost = videoPostMapper.findByVideoId(videoId);
+            if (videoPost == null) {
+                String errMsg = String.format("VideoId %s 不存在", videoId);
                 return Result.fail(errMsg);
             }
 
-            String videoId = idGenerator.getUuid();
-            VideoFile videoFile = new VideoFile(videoId, videoInfo, channelCode);
+            List<VideoFile> videoFileList = videoFileMapper.findByVideoId(videoId);
+            if (videoFileList.isEmpty()) {
+                String errMsg = String.format("VideoId %s 关联的视频文件不存在", videoId);
+                return Result.fail(errMsg);
+            }
+            VideoFile videoFile = videoFileList.get(0);
+            String videoFileId = videoFile.getObjectId();
 
+            int channelCode = videoFile.getChannelCode();
             Integer channelScope = ossService.getChannelScope(channelCode);
             if (channelScope == null ) {
                 String errMsg = String.format("channelCode %s 的 scope 在 oss 中不存在", channelCode);
@@ -121,34 +136,20 @@ public class VideoPostServiceImpl implements VideoPostService {
             Set<String> tags = videoPublishSbt.getTags();
             String tags1 = tags.toString().replace("[", "").replace("]", "");
 
-            VideoPost videoPost;
-            Long publishAt = videoPublishSbt.getScheduledTime();
-            if (publishAt == null) {
-                int postStatus = VideoStatus.publish.getValue();
-                long publishAt1 = System.currentTimeMillis();
-                videoPost = new VideoPost(videoId, videoPublishSbt, coverUrl, videoFile, postStatus, publishAt1);
+            Long scheduledTime = videoPublishSbt.getScheduledTime();
+            if (scheduledTime == null) {
+                long publishAt = System.currentTimeMillis();
+                videoPost.update(videoPublishSbt, coverUrl, publishAt);
             } else {
-                int postStatus = VideoStatus.censor.getValue();
-                videoPost = new VideoPost(videoId, videoPublishSbt, coverUrl, videoFile, postStatus, publishAt);
-
                 /*long duration = publishAt-System.currentTimeMillis();
                 if (duration < 600_000) {
                     return Result.fail("定时发布的时间至少应在 10 分钟后");
                 }*/
+                videoPost.update(videoPublishSbt, coverUrl, scheduledTime);
             }
 
-            if (!videoInfo.getFormatName().contains("mov,mp4")) {
-                long jobId = jobService.addConvertVideoJob(videoFileId, channelCode);
-                /*Result result1 = fileService.convertVideo(videoFileId, channelCode);
-                if (result1.getCode() == ResultStatus.SUCCESS.getCode()) {
-                    videoPost.setStatus(VideoStatus.converted.getValue());
-                } else {
-                    log.error(result1.getMsg());
-                }*/
-            }
-
-            saveVideo(videoFile, videoPost, tags1);
-            if (publishAt != null) {
+            saveVideo(videoPost, tags1);
+            if (scheduledTime != null) {
                 long jobId = jobService.addPublishVideoJob(videoId, videoPublishSbt.getScheduledTime());
             }
             result = Result.success();
@@ -159,11 +160,11 @@ public class VideoPostServiceImpl implements VideoPostService {
         return result;
     }
 
-    public void saveVideo(VideoFile videoFile, VideoPost videoPost, String tags) {
+    public void saveVideo(VideoPost videoPost, String tags) {
         String videoId = videoPost.getVideoId();
         VideoStatistic videoStatistic = new VideoStatistic(videoId);
         setVideoCategoryPost(videoPost);
-        videoRepository.savePostVideo(videoFile, videoPost, videoStatistic);
+        videoRepository.savePostVideo(videoPost, videoStatistic);
         setVideoTags(videoId, videoPost.getScope(), tags);
     }
 
@@ -232,15 +233,6 @@ public class VideoPostServiceImpl implements VideoPostService {
         }
     }
 
-    public void updateVideoStatus(VideoScopeUpdate videoScopeUpdate) {
-        VideoPost videoPost = videoPostMapper.findByVideoId(videoScopeUpdate.getVideoId());
-        if (videoPost == null) {
-            return;
-        }
-
-        videoPostMapper.updateVideoScope(videoScopeUpdate);
-    }
-
     public void updateVideoScope(VideoScopeUpdate videoScopeUpdate) {
         String videoId = videoScopeUpdate.getVideoId();
         VideoPost videoPost = videoPostMapper.findByVideoId(videoId);

+ 5 - 0
content/content-service/src/main/resources/mapper/vod/VideoFileMapper.xml

@@ -32,6 +32,11 @@
         from vod_video_file
         where `deleted`=0 and object_id=#{objectId}
     </select>
+    <select id="findByVideoId" resultType="cn.reghao.tnb.content.app.vod.model.po.VideoFile">
+        select *
+        from vod_video_file
+        where `deleted`=0 and video_id=#{videoId}
+    </select>
     <select id="findByVideoFileId" resultType="cn.reghao.tnb.content.app.vod.model.po.VideoFile">
         select *
         from vod_video_file

+ 1 - 76
content/content-service/src/main/resources/mapper/vod/VideoPostMapper.xml

@@ -36,7 +36,7 @@
     </update>
     <update id="updateVideoPublish">
         update vod_video_post
-        set update_time=now(),`status`=#{status}
+        set update_time=now(),`title`=#{title},`description`=#{description},`category_pid`=#{categoryPid},`category_id`=#{categoryId},`cover_url`=#{coverUrl},`scope`=#{scope},`status`=#{status},`publish_at`=#{publishAt}
         where video_id=#{videoId}
     </update>
     <update id="updateVideoCached">
@@ -228,74 +228,6 @@
         order by #{videoQuery.orderBy} #{videoQuery.orderDirection}
     </select>
 
-    <select id="countByCriteriaAndUserGroup" resultType="java.lang.Integer">
-        select count(*)
-        from vod_video_post
-        <where>
-            deleted=0
-            <if test="status != null">
-                and `status` in
-                <foreach collection="status" item="id" index="index" open="(" close=")" separator=",">
-                    #{id}
-                </foreach>
-            </if>
-            <if test="scope != null">
-                and scope in
-                <foreach collection="scope" item="id" index="index" open="(" close=")" separator=",">
-                    #{id}
-                </foreach>
-            </if>
-            <if test="categoryPid != null">
-                and category_pid=#{categoryPid}
-            </if>
-            <if test="categoryId != null">
-                and category_id=#{categoryId}
-            </if>
-            <if test="duration != null">
-                and duration &lt;= #{duration}
-            </if>
-            <if test="horizontal != null">
-                and horizontal=#{horizontal}
-            </if>
-        </where>
-        group by publish_by
-    </select>
-    <select id="findCriteriaAndUserGroupByPage" resultMap="videoPostCard">
-        select post.id,post.video_id,post.title,post.cover_url,post.duration,post.horizontal,post.publish_at,post.publish_by,post.status,
-        statistic.view,statistic.comment
-        from vod_video_post post
-        inner join vod_video_statistic statistic
-        on statistic.video_id=post.video_id
-        <where>
-            and post.deleted=0
-            <if test="videoQuery.status != null">
-                and post.status in
-                <foreach collection="videoQuery.status" item="id" index="index" open="(" close=")" separator=",">
-                    #{id}
-                </foreach>
-            </if>
-            <if test="videoQuery.scope != null">
-                and post.scope in
-                <foreach collection="videoQuery.scope" item="id" index="index" open="(" close=")" separator=",">
-                    #{id}
-                </foreach>
-            </if>
-            <if test="videoQuery.categoryPid != null">
-                and post.category_pid=#{videoQuery.categoryPid}
-            </if>
-            <if test="videoQuery.categoryId != null">
-                and post.category_id=#{videoQuery.categoryId}
-            </if>
-            <if test="videoQuery.duration != null">
-                and post.duration &lt;= #{videoQuery.duration}
-            </if>
-            <if test="videoQuery.horizontal != null">
-                and post.horizontal=#{videoQuery.horizontal}
-            </if>
-        </where>
-        group by post.publish_by
-    </select>
-
     <resultMap id="videoPostCard" type="cn.reghao.tnb.content.api.dto.VideoPostCard">
         <id column="video_id" property="videoId"/>
         <result column="title" property="title"/>
@@ -507,13 +439,6 @@
         group by publish_by
         order by total desc
     </select>
-    <select id="findGroupByCategoryId" resultType="cn.reghao.tnb.common.db.GroupCount">
-        select category_id as id,count(*) total
-        from vod_video_post
-        where deleted=0
-        group by category_id
-        order by total desc
-    </select>
     <select id="findRandomVideoIds" resultType="java.lang.String">
         SELECT t1.video_id
         FROM vod_video_post AS t1

+ 1 - 1
file/file-service/src/main/java/cn/reghao/tnb/file/app/delay/task/PublishVideoTask.java

@@ -29,7 +29,7 @@ public class PublishVideoTask implements Runnable {
     public void run() {
         String status = JobStatus.Success.getDesc();
         try {
-            Result result = userContentService.publishVideoPost(videoId);
+            Result result = userContentService.setVideoPostPublish(videoId);
             if (result.getCode() != ResultStatus.SUCCESS.getCode()) {
                 status = JobStatus.Fail.getDesc();
             }