Bladeren bron

app 的视频关注取消

三七 1 week geleden
bovenliggende
commit
b8ed4958d3

+ 39 - 0
fs-service/src/main/java/com/fs/course/dto/VideoCollectionDTO.java

@@ -0,0 +1,39 @@
+package com.fs.course.dto;
+
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+
+@Data
+public class VideoCollectionDTO {
+    /** 合集ID */
+    private Long collectionId;
+
+    private Long userId;
+    /** 合集标题 */
+    @Excel(name = "合集标题")
+    private String title;
+
+    /** 合集描述 */
+    @Excel(name = "合集描述")
+    private String description;
+
+    /** 合集封面图 */
+    @Excel(name = "合集封面图")
+    private String coverUrl;
+
+    /** 达人ID */
+    @Excel(name = "达人ID")
+    private Long talentId;
+
+    /** 状态:1正常 0下架 */
+    @Excel(name = "状态:1正常 0下架")
+    private Long status;
+
+    /** 合集标签 */
+    @Excel(name = "合集标签")
+    private String tags;
+
+    private int count;
+
+    private Boolean isFavorite;
+}

+ 57 - 18
fs-service/src/main/java/com/fs/course/mapper/FsUserVideoMapper.java

@@ -131,20 +131,38 @@ public interface FsUserVideoMapper
     @Update("update fs_user_video set favorite_num=favorite_num-1 where video_id=#{videoId}")
     int minusFavorite(Long videoId);
 
-    @Select({"<script> " +
-            "select v.video_id as id,v.title,v.description as msg,t.user_id,t.nick_name as username,t.avatar as headImg, " +
-            "v.thumbnail as cover,v.url as src,v.likes as likeNum,v.comments as smsNum,v.favorite_num," +
-            "v.create_time,v.views as playNumber,v.product_id,p.img_url,p.package_name,v.upload_type,v.shares,v.add_num from fs_user_video v " +
-            "left join fs_user_talent t on t.talent_id = v.talent_id " +
-            " left join fs_package p on p.package_id = v.product_id " +
-            "where v.is_del = 0 and v.status = 1  " +
-            " and v.is_audit = 1 " +
-            "<if test = ' maps.keyword!=null and maps.keyword != \"\" '> " +
-            "and v.title like CONCAT('%',#{maps.keyword},'%') " +
-            "</if>" +
-            " order by RAND() "+
-            "</script>"})
-    List<FsUserVideoListUVO> selectFsUserVideoListUVO(@Param("maps") FsUserVideoListUParam param);
+//    @Select({"<script> " +
+//            "select v.video_id as id,v.title,v.description as msg,t.user_id,t.nick_name as username,t.avatar as headImg, " +
+//            "v.thumbnail as cover,v.url as src,v.likes as likeNum,v.comments as smsNum,v.favorite_num," +
+//            "v.create_time,v.views as playNumber,v.product_id,p.img_url,p.package_name,v.upload_type,v.shares,v.add_num from fs_user_video v " +
+//            "left join fs_user_talent t on t.talent_id = v.talent_id " +
+//            " left join fs_package p on p.package_id = v.product_id " +
+//            "where v.is_del = 0 and v.status = 1  " +
+//            " and v.is_audit = 1 " +
+//            "<if test = ' maps.keyword!=null and maps.keyword != \"\" '> " +
+//            "and v.title like CONCAT('%',#{maps.keyword},'%') " +
+//            "</if>" +
+//            " order by RAND() "+
+//            "</script>"})
+//    List<FsUserVideoListUVO> selectFsUserVideoListUVO(@Param("maps") FsUserVideoListUParam param);
+@Select({"<script> " +
+        "select v.video_id as id,v.talent_id as talentId,t.user_id as userId,v.title,v.description as msg,t.nick_name as username,t.avatar as headImg, " +
+        "v.thumbnail as cover,v.url as src,v.likes as likeNum,v.comments as smsNum,v.favorite_num as favoriteNum," +
+        "v.create_time,v.views as playNumber,v.product_id,p.img_url,p.package_name,v.upload_type,v.shares,v.add_num " +
+        "<if test = 'maps.userId != null'> " +
+        ",CASE WHEN EXISTS (SELECT 1 FROM fs_user_talent_follow tf WHERE tf.talent_id = v.talent_id AND tf.user_id = #{maps.userId}) THEN '1' ELSE '0' END as isFollow " +
+        "</if> " +
+        "from fs_user_video v " +
+        "left join fs_user_talent t on t.talent_id = v.talent_id " +
+        " left join fs_package p on p.package_id = v.product_id " +
+        "where v.is_del = 0 and v.status = 1  " +
+        " and v.is_audit = 1 " +
+        "<if test = ' maps.keyword!=null and maps.keyword != \"\" '> " +
+        "and v.title like CONCAT('%',#{maps.keyword},'%') " +
+        "</if>" +
+        " order by v.create_time desc "+
+        "</script>"})
+List<FsUserVideoListUVO> selectFsUserVideoListUVO(@Param("maps") FsUserVideoListUParam param);
 
     @Update("UPDATE fs_user_video SET comments = comments+#{commentCount} WHERE video_id = #{videoId}")
     void updateCommentCount(@Param("videoId") Long videoId, @Param("commentCount") Integer commentCount);
@@ -251,10 +269,31 @@ public interface FsUserVideoMapper
             "where v.is_del = 0 and  v.status = 1 and f.user_id = #{userId}")
     int countFavoriteVideos(@Param("userId") Long userId);
 
+//    @Select({"<script> " +
+//            "select v.video_id as id,v.title,v.description as msg,t.nick_name as username,t.avatar as headImg, " +
+//            "v.thumbnail as cover,v.url as src,v.likes as likeNum,v.comments as smsNum,v.favorite_num," +
+//            "v.create_time,v.views as playNumber,v.product_id,p.img_url,p.package_name,v.upload_type,v.shares,v.add_num,v.is_audit,v.status from fs_user_video v " +
+//            "left join fs_user_talent t on t.talent_id = v.talent_id " +
+//            " left join fs_package p on p.package_id = v.product_id " +
+//            "where v.is_del = 0 and (" +
+//            "(#{oneSelf} = true and (v.is_audit = -1 or v.is_audit = 0 or v.is_audit = 1)) or " +
+//            "(#{oneSelf} = false and v.is_audit = 1 and v.status = 1)" +
+//            ") " +
+//            "<if test = ' talentId!=null and talentId != \"\" '> " +
+//            "and v.talent_id = #{talentId}" +
+//            " order by v.create_time" +
+//            "</if>" +
+//            "</script>"})
+//    List<FsUserVideoListUVO> selectFsUserVideoListUVOByUser(@Param("talentId") Long talentId, @Param("oneSelf") boolean oneSelf);
+
     @Select({"<script> " +
-            "select v.video_id as id,v.title,v.description as msg,t.nick_name as username,t.avatar as headImg, " +
-            "v.thumbnail as cover,v.url as src,v.likes as likeNum,v.comments as smsNum,v.favorite_num," +
-            "v.create_time,v.views as playNumber,v.product_id,p.img_url,p.package_name,v.upload_type,v.shares,v.add_num,v.is_audit,v.status from fs_user_video v " +
+            "select v.video_id as id,v.talent_id as talentId,t.user_id as userId,v.title,v.description as msg,t.nick_name as username,t.avatar as headImg, " +
+            "v.thumbnail as cover,v.url as src,v.likes as likeNum,v.comments as smsNum,v.favorite_num as favoriteNum," +
+            "v.create_time,v.views as playNumber,v.product_id,p.img_url,p.package_name,v.upload_type,v.shares,v.add_num,v.is_audit,v.fail_reason,v.status" +
+            "<if test = 'userId != null'> " +
+            ",CASE WHEN EXISTS (SELECT 1 FROM fs_user_talent_follow tf WHERE tf.talent_id = v.talent_id AND tf.user_id = #{userId}) THEN '1' ELSE '0' END as isFollow " +
+            "</if> " +
+            "from fs_user_video v " +
             "left join fs_user_talent t on t.talent_id = v.talent_id " +
             " left join fs_package p on p.package_id = v.product_id " +
             "where v.is_del = 0 and (" +
@@ -266,6 +305,6 @@ public interface FsUserVideoMapper
             " order by v.create_time" +
             "</if>" +
             "</script>"})
-    List<FsUserVideoListUVO> selectFsUserVideoListUVOByUser(@Param("talentId") Long talentId, @Param("oneSelf") boolean oneSelf);
+    List<FsUserVideoListUVO> selectFsUserVideoListUVOByUser(@Param("talentId") Long talentId, @Param("oneSelf") boolean oneSelf, @Param("userId") Long userId);
 }
 

+ 1 - 1
fs-service/src/main/java/com/fs/course/service/impl/FsUserVideoServiceImpl.java

@@ -381,7 +381,7 @@ public class FsUserVideoServiceImpl implements IFsUserVideoService {
 
     @Override
     public List<FsUserVideoListUVO> selectFsUserVideoListUVOByUser(Long talentId, boolean oneSelf, Long userId) {
-        List<FsUserVideoListUVO> list = fsUserVideoMapper.selectFsUserVideoListUVOByUser(talentId, oneSelf);
+        List<FsUserVideoListUVO> list = fsUserVideoMapper.selectFsUserVideoListUVOByUser(talentId, oneSelf,userId);
         /*if (param != null && param.getUserId() != null) {
             Long userId = param.getUserId();
             list = selectLikesAndFavorites(userId, list);

+ 10 - 0
fs-service/src/main/java/com/fs/course/vo/FsUserVideoListUVO.java

@@ -1,6 +1,7 @@
 package com.fs.course.vo;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.course.dto.VideoCollectionDTO;
 import lombok.Data;
 
 import java.util.Date;
@@ -10,6 +11,8 @@ import java.util.List;
 public class FsUserVideoListUVO {
     private String id; // _id
     private Long userId;
+    private Long talentId;//视频发布的达人id
+    private String isFollow;//当前用户是否关注发布视频的达人
     private String username;//2.视频拥有者名称
     private String headImg;//3.发布者头像
     private String cover;//视频封面
@@ -39,4 +42,11 @@ public class FsUserVideoListUVO {
     private Integer uploadType;
     private Long shares;
     private String addNum; //随机添加数
+    private Integer isAudit;
+    private Integer status;
+    private String failReason;
+    private Boolean isInCollection;
+    //合集信息
+    private VideoCollectionDTO videoCollectionDTO;
+    private String thumbnail;
 }

+ 1 - 1
fs-user-app/src/main/java/com/fs/app/controller/TalentController.java

@@ -63,6 +63,7 @@ public class TalentController extends  AppBaseController{
     @Autowired
     private IFsUserVideoTagsService fsUserVideoTagsService;
 
+
     private static final String VIDEO_UPLOAD_DIR = "C:\\fs\\uploadPath\\talent\\video";  // 上传目录
     private static final String FRAME_OUTPUT_DIR = "C:\\fs\\uploadPath\\talent\\frame";  // 输出帧的目录
 
@@ -253,7 +254,6 @@ public class TalentController extends  AppBaseController{
         PageHelper.startPage(param.getPageNum(), param.getPageSize());
         boolean oneSelf = userId == param.getUserId();
         List<FsUserVideoListUVO> list = fsUserVideoService.selectFsUserVideoListUVOByUser(fsUserTalent.getTalentId(),oneSelf,userId);
-
         PageInfo<FsUserVideoListUVO> listPageInfo=new PageInfo<>(list);
         return R.ok().put("data",listPageInfo);
     }