|
|
@@ -1,6 +1,8 @@
|
|
|
package com.fs.feishu.service;
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.fs.course.domain.FsCourseLink;
|
|
|
+import com.fs.course.mapper.FsCourseLinkMapper;
|
|
|
import com.fs.feishu.config.FeiShuConfig;
|
|
|
import com.fs.feishu.model.FeishuFileDTO;
|
|
|
import com.fs.feishu.model.FeishuLinkParam;
|
|
|
@@ -38,6 +40,9 @@ public class FeiShuService {
|
|
|
@Autowired
|
|
|
private FsUserCourseVideoMapper videoMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FsCourseLinkMapper courseLinkMapper;
|
|
|
+
|
|
|
private Client client;
|
|
|
|
|
|
@PostConstruct
|
|
|
@@ -111,7 +116,7 @@ public class FeiShuService {
|
|
|
String documentId = createDocument(userCourseVideo.getTitle());
|
|
|
|
|
|
// 拼接新看课url
|
|
|
- String url = buildCourseNewLink(param.getCompanyId(), param.getCompanyUserId(), param.getCourseId(), param.getVideoId(),param.getUserId());
|
|
|
+ String url = buildCourseNewLink(param.getCompanyId(), param.getCompanyUserId(), param.getCourseId(), param.getVideoId(),param.getUserId(),param.getLink());
|
|
|
|
|
|
// 创建iframe块
|
|
|
createIframeBlock(documentId, url);
|
|
|
@@ -144,7 +149,7 @@ public class FeiShuService {
|
|
|
/**
|
|
|
* 拼接看课url(课程参数JSON方式,适配飞书iframe,双重URL编码)
|
|
|
*/
|
|
|
- private String buildCourseNewLink(Long companyId, Long companyUserId, Long courseId, Long videoId,Long userId) {
|
|
|
+ private String buildCourseNewLink(Long companyId, Long companyUserId, Long courseId, Long videoId,Long userId,String link) {
|
|
|
String json = configService.selectConfigByKey("course.config");
|
|
|
CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
|
@@ -154,6 +159,17 @@ public class FeiShuService {
|
|
|
courseParam.put("videoId", videoId);
|
|
|
courseParam.put("companyId", companyId);
|
|
|
courseParam.put("courseId", courseId);
|
|
|
+ courseParam.put("link", link);
|
|
|
+
|
|
|
+ //查询课程短链表拼接参数
|
|
|
+ FsCourseLink fsCourseLink = courseLinkMapper.selectFsCourseLinkByLink(link);
|
|
|
+ if (fsCourseLink==null){
|
|
|
+ throw new CustomException("课程链接已过期");
|
|
|
+ }
|
|
|
+ courseParam.put("corpId", fsCourseLink.getCorpId());
|
|
|
+ courseParam.put("linkType", fsCourseLink.getLinkType());
|
|
|
+ courseParam.put("qwExternalId", fsCourseLink.getQwExternalId());
|
|
|
+ courseParam.put("qwUserId", fsCourseLink.getQwUserId());
|
|
|
String courseJson = JSONUtil.toJsonStr(courseParam);
|
|
|
try {
|
|
|
// 第一次编码:对JSON进行URL编码
|