zyp пре 2 месеци
родитељ
комит
f00c62c25e

+ 1 - 1
fs-qwhook/src/main/java/com/fs/FsQwhookApplication.java

@@ -11,7 +11,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
 @EnableTransactionManagement
 @EnableAsync
-@EnableScheduling
+//@EnableScheduling
 public class FsQwhookApplication {
 
 

+ 58 - 0
fs-qwhook/src/main/java/com/fs/app/controller/FsUserCourseVideoController.java

@@ -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);
+    }
+
 }

+ 11 - 0
fs-qwhook/src/main/resources/application-dev.yml

@@ -125,3 +125,14 @@ spring:
                     wall:
                         config:
                             multi-statement-allow: true
+
+rocketmq:
+    name-server: rmq-1243b25nj.rocketmq.gz.public.tencenttdmq.com:8080 # RocketMQ NameServer 地址
+    producer:
+        group: my-producer-group
+        access-key: ak1243b25nj17d4b2dc1a03 # 替换为实际的 accessKey
+        secret-key: sk08a7ea1f9f4b0237 # 替换为实际的 secretKey
+    consumer:
+        group: my-consumer-group
+        access-key: ak1243b25nj17d4b2dc1a03 # 替换为实际的 accessKey
+        secret-key: sk08a7ea1f9f4b0237 # 替换为实际的 secretKey

+ 28 - 0
fs-service-system/src/main/java/com/fs/course/param/FsCourseLinkRoomParam.java

@@ -0,0 +1,28 @@
+package com.fs.course.param;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class FsCourseLinkRoomParam {
+
+    private Long videoId;
+
+    private String qwUserId;
+
+    private String corpId;
+
+    private Long companyId;
+
+    private Long companyUserId;
+
+    private Long courseId;
+
+    private String title;//标题
+
+    private String imageUrl;//封面
+
+    private String desc;//描述
+
+}

+ 4 - 0
fs-service-system/src/main/java/com/fs/course/param/newfs/FsUserCourseListParam.java

@@ -18,5 +18,9 @@ public class FsUserCourseListParam {
     @ApiModelProperty(value = "公司id,不用传")
     private Long companyId;
 
+    private String corpId;
+
+    private String qwUserId;
+
 
 }

+ 1 - 1
fs-service-system/src/main/java/com/fs/course/param/newfs/UserCourseVideoPageParam.java

@@ -28,7 +28,7 @@ public class UserCourseVideoPageParam implements Serializable {
 
     private String corpId;
 
-    private String qwUserid;
+    private String qwUserId;