Browse Source

Merge remote-tracking branch 'origin/master'

liaoyongfei 4 years ago
parent
commit
c5ce36b1e4

+ 26 - 8
UI/src/pages/vedioManage/vedioList.js

@@ -192,7 +192,8 @@ class VedioList extends React.Component{
             currentDoctorPage: 1,      //当前医生页码
             currentDepartmentPage: 1,
             singleAssociateDortor: false, // 单个视频关联医生
-            loadingAliVideo:false
+            loadingAliVideo:false,
+            searchVideoPage: 1
         }
     }
 
@@ -208,11 +209,20 @@ class VedioList extends React.Component{
         request({
             url: ymallAPI + '/ymall/video/queryVideos',
             method: 'post',
-            data: { filters: this.state.filters }
+            data: {
+                pageSize: 10,
+                pageIndex: this.state.searchVideoPage,
+                filters: this.state.filters 
+            }
         }).then(res => {
             console.log('视频列表', res)
             this.setState({
-                data: res.items
+                data: this.state.data.concat(res.items),
+                searchVideoPage: this.state.searchVideoPage +1
+            }, () => {
+                if(this.state.data.length < res.totalCount ) {
+                    this.searchDataList()
+                }
             })
         })
     }
@@ -387,7 +397,8 @@ class VedioList extends React.Component{
         }
         this.setState({
             filters: list,
-            currentVideoPage: 1
+            currentVideoPage: 1,
+            searchVideoPage: 1
         }, () => {
             this.searchDataList()
         })
@@ -451,9 +462,11 @@ class VedioList extends React.Component{
                 console.log(res)
                 message.success(res.message)
                 this.setState({
-                    doctorModal: false
+                    doctorModal: false,
+                    searchVideoPage: 1
+                }, () => {
+                    this.searchDataList()  
                 })
-                this.searchDataList()  
             })
         } else {
             //单个视频关联医生
@@ -612,7 +625,11 @@ class VedioList extends React.Component{
         }).then(res => {
             console.log(res)
             message.success(res.message)
-            this.searchDataList()
+            this.setState({
+                searchVideoPage: 1
+            }, () => {
+                this.searchDataList()
+            })
         })
     }
 
@@ -677,7 +694,8 @@ class VedioList extends React.Component{
                 selectedAliId: [],
                 aliVedioModal: false,
                 searchAliVedioName: '',
-                selectedAliVedioList: []
+                selectedAliVedioList: [],
+                searchVideoPage: 1
             })
             this.searchDataList()
         }

+ 11 - 3
UI/src/pages/ymall/accountDetails.js

@@ -16,6 +16,8 @@ class AccountDetails extends React.Component {
     constructor(props) {
         super(props)
         this.state = {
+            pageIndex: 1,
+            dataList: [],
             id: '',                         //账户id
             userRoleName: '',               //用户名
             idPhone: '',                    //用户手机
@@ -196,14 +198,19 @@ class AccountDetails extends React.Component {
             method: 'post',
             data: {
                 pageSize: 10,
-                pageIndex: 1,
+                pageIndex: this.state.pageIndex,
                 filters: this.state.filters.concat([{ field:"id", operate: "equal",value: this.state.id }])
             }
         }).then(res => {
             console.log(res)
             if(!!res.success) {
                 this.setState({
-                    dataList: res.items
+                    dataList: this.state.dataList.concat(res.items),
+                    pageIndex: this.state.pageIndex++
+                }, () => {
+                    if(this.state.dataList.length < res.totalCount) {
+                        this.loadDataList()
+                    }
                 })
             }
         })
@@ -221,7 +228,8 @@ class AccountDetails extends React.Component {
         console.log(filters)
         
         this.setState({ 
-            filters
+            filters,
+            pageIndex: 1
         }, () => { this.loadDataList() })
     }
 

+ 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>