Browse Source

短视频迁移-bug修改

chenhongzhou1 4 years ago
parent
commit
6b4c2bd3c2

+ 16 - 9
ymall/src/main/java/com/liangjian11/ymall/service/impl/video/VideoServiceImpl.java

@@ -500,8 +500,9 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
     DefaultAcsClient client = RAMConnectUtils.initVodClient();
     int start = (selectDTO.getPageIndex() - 1) * selectDTO.getPageSize();
     int pageSize = selectDTO.getPageSize();
-    String filterSql = " and v.doctor_id is not null and v.recommend_status= 0 ";
-    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSql, start, pageSize);
+    String filterSql = " and v.doctor_id is not null and v.recommend_status= 0";
+    String filterSortSql = filterSql + " order by si.id desc , v.create_time desc ";
+    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSortSql, start, pageSize);
     for (Video video : videoList) {
       GetPlayInfoResponse playInfo = PlayUtils.getPlayInfo(client, video.getVideoId());
       if(!Objects.isNull(playInfo)){
@@ -520,8 +521,9 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
     DefaultAcsClient client = RAMConnectUtils.initVodClient();
     int start = (selectDTO.getPageIndex() - 1) * selectDTO.getPageSize();
     int pageSize = selectDTO.getPageSize();
-    String filterSql = "and v.recommend_status = 2 and v.doctor_id is not null ";
-    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSql, start, pageSize);
+    String filterSql = "and v.recommend_status = 2 and v.doctor_id is not null";
+    String filterSortSql = filterSql + " order by si.id desc , v.create_time desc ";
+    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSortSql, start, pageSize);
     for (Video video : videoList) {
       GetPlayInfoResponse playInfo = PlayUtils.getPlayInfo(client, video.getVideoId());
       if(!Objects.isNull(playInfo)){
@@ -549,7 +551,8 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
     if(!StringUtils.isEmpty(departmentName)){
       filterSql += " and (select array_to_string(ARRAY[array_agg(departmentname)], ',')  from hospitaldepartments where id in (select department_id from video_department vd where vd.video_id =v.id)) like '%"+departmentName+"%'";
     }
-    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSql, start, pageSize);
+    String filterSortSql = filterSql + " order by v.cover_photo asc ";
+    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSortSql,start, pageSize);
     for (Video video : videoList) {
       GetPlayInfoResponse playInfo = PlayUtils.getPlayInfo(client, video.getVideoId());
       if(!Objects.isNull(playInfo)){
@@ -571,7 +574,8 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
     int pageSize = selectDTO.getPageSize();
     String doctorId = selectDTO.getName();
     String filterSql = " and  v.doctor_id = '"+doctorId +"' and v.recommend_status != -1 and v.recommend_status!= 1 ";
-    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSql, start, pageSize);
+    String filterSortSql = filterSql + " order by v.create_time desc ";
+    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSortSql, start, pageSize);
     for (Video video : videoList) {
       GetPlayInfoResponse playInfo = PlayUtils.getPlayInfo(client, video.getVideoId());
       if(!Objects.isNull(playInfo)){
@@ -591,7 +595,8 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
     int start = (selectDTO.getPageIndex() - 1) * selectDTO.getPageSize();
     int pageSize = selectDTO.getPageSize();
     String filterSql = " and  li.id is not null and v.recommend_status!= 1 and v.recommend_status!= -1";
-    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSql, start, pageSize);
+    String filterSortSql = filterSql + " order by v.create_time desc ";
+    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSortSql, start, pageSize);
     for (Video video : videoList) {
       GetPlayInfoResponse playInfo = PlayUtils.getPlayInfo(client, video.getVideoId());
       if(!Objects.isNull(playInfo)){
@@ -610,7 +615,8 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
     int start = (selectDTO.getPageIndex() - 1) * selectDTO.getPageSize();
     int pageSize = selectDTO.getPageSize();
     String filterSql = " and v.doctor_id::uuid='"+doctorId+"' and v.recommend_status=1 ";
-    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSql, start, pageSize);
+    String filterSortSql = filterSql + " order by v.create_time desc ";
+    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSortSql, start, pageSize);
     //TODO 遍历获取视频播放地址?
     int total = videoMapper.countVideoByHome(userId, filterSql);
     return PageResultInfo.createSuccessPage("获取医生的上传且正在转码视频列表成功",videoList,total,selectDTO.getPageIndex(),selectDTO.getPageSize());
@@ -624,7 +630,8 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
     int start = (selectDTO.getPageIndex() - 1) * selectDTO.getPageSize();
     int pageSize = selectDTO.getPageSize();
     String filterSql = " and v.doctor_id::uuid='"+doctorId+"' and ( v.recommend_status = 0 or v.recommend_status = 2 ) ";
-    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSql, start, pageSize);
+    String filterSortSql = filterSql + " order by v.create_time desc ";
+    List<Video> videoList = videoMapper.getVideoByHome(userId, filterSortSql, start, pageSize);
     for (Video video : videoList) {
       GetPlayInfoResponse playInfo = PlayUtils.getPlayInfo(client, video.getVideoId());
       if(!Objects.isNull(playInfo)){

+ 0 - 1
ymall/src/main/resources/mapper/VideoMapper.xml

@@ -147,7 +147,6 @@
     left join video_like_intermediate li on v.id=li.superior_id and li.subordinate_id= #{userId}
     left join video_statistics_intermediate si on v.id=si.superior_id and si.type=7 and si.subordinate_id= #{userId}
     where 1=1 ${filterSql}
-    order by si.id desc , v.create_time desc
     LIMIT #{pageSize} offset #{start}
   </select>