| 
					
				 | 
			
			
				@@ -1,14 +1,22 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.fs.app.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.common.core.domain.R; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.core.domain.ResponseResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.course.domain.FsUserCourse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.course.param.FsCourseLinkCreateParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.course.param.FsCourseLinkRoomParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.param.newfs.FsUserCourseListParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.param.newfs.UserCourseVideoPageParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.course.service.IFsCourseLinkService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.service.IFsUserCourseService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.service.IFsUserCourseVideoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.vo.newfs.FsUserCourseListVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.vo.newfs.FsUserCourseVideoDetailsVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.vo.newfs.FsUserCourseVideoPageListVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.vo.newfs.FsUserVideoListVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.qw.domain.QwUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.qw.service.IQwUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.github.pagehelper.PageHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.github.pagehelper.PageInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.Api; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -34,9 +42,16 @@ public class FsUserCourseVideoController extends AppBaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private IFsUserCourseService fsUserCourseService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IQwUserService qwUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping("/pageList") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation("课程分页列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public ResponseResult<PageInfo<FsUserCourseVideoPageListVO>> list(UserCourseVideoPageParam param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        QwUser qwUser = qwUserService.getByQwUserIdAndCorId(param.getQwUserId(), param.getCorpId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (qwUser==null||qwUser.getCompanyId()==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResponseResult.fail(500,"无权限"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PageHelper.startPage(param.getPageNum(), param.getPageSize()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         param.setCompanyId(getCompanyId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<FsUserCourseVideoPageListVO> list = fsUserCourseVideoService.pageListCourseVideo(param); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -53,6 +68,10 @@ public class FsUserCourseVideoController extends AppBaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping("/courseList") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation("获取课程下拉列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public ResponseResult<PageInfo<FsUserCourseListVO>> getAllCourseList(FsUserCourseListParam param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        QwUser qwUser = qwUserService.getByQwUserIdAndCorId(param.getQwUserId(), param.getCorpId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (qwUser==null||qwUser.getCompanyId()==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResponseResult.fail(500,"无权限"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PageHelper.startPage(param.getPageNum(), param.getPageSize()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         param.setCompanyId(getCompanyId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<FsUserCourseListVO> fsUserCourseList = fsUserCourseService.getFsUserCourseList(param); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -63,10 +82,49 @@ public class FsUserCourseVideoController extends AppBaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping("/videoList") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation("获取视频下拉列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public ResponseResult<PageInfo<FsUserVideoListVO>> getAllVideoList(UserCourseVideoPageParam param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        QwUser qwUser = qwUserService.getByQwUserIdAndCorId(param.getQwUserId(), param.getCorpId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (qwUser==null||qwUser.getCompanyId()==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResponseResult.fail(500,"无权限"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PageHelper.startPage(param.getPageNum(), param.getPageSize()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         param.setCompanyId(getCompanyId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<FsUserVideoListVO> listCourseVideo = fsUserCourseVideoService.getListCourseVideo(param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PageInfo<FsUserVideoListVO> result = new PageInfo<>(listCourseVideo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return ResponseResult.ok(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IFsCourseLinkService courseLinkService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/createRoomLink") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("创建发群链接") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R createRoomLink(FsCourseLinkRoomParam param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        QwUser qwUser = qwUserService.getByQwUserIdAndCorId(param.getQwUserId(), param.getCorpId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (qwUser==null||qwUser.getCompanyId()==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("无权限"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FsCourseLinkCreateParam createParam = new FsCourseLinkCreateParam(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        createParam.setCourseId(param.getCourseId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        createParam.setVideoId(param.getVideoId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        createParam.setCorpId(param.getCorpId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        createParam.setCompanyUserId(qwUser.getCompanyUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        createParam.setCompanyId(qwUser.getCompanyId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        createParam.setQwUserId(qwUser.getId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String linkUrl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        R createLink = courseLinkService.createRoomLinkUrl(createParam); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (createLink.get("code").equals(500)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("链接生成失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        linkUrl = (String) createLink.get("url"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FsUserCourse course = fsUserCourseService.selectFsUserCourseByCourseId(param.getCourseId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        JSONObject news = new JSONObject(true); // true 表示保持字段顺序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        news.put("link", linkUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        news.put("title", course.getCourseName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        news.put("desc", param.getTitle()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        news.put("imgUrl", course.getImgUrl()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("news",news); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |