|
@@ -19,6 +19,7 @@ import com.lark.oapi.service.drive.v1.model.ListFileResp;
|
|
|
import com.lark.oapi.service.drive.v2.model.PatchPermissionPublicReq;
|
|
import com.lark.oapi.service.drive.v2.model.PatchPermissionPublicReq;
|
|
|
import com.lark.oapi.service.drive.v2.model.PermissionPublic;
|
|
import com.lark.oapi.service.drive.v2.model.PermissionPublic;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.annotation.PostConstruct;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.io.UnsupportedEncodingException;
|
|
@@ -97,7 +98,7 @@ public class FeiShuService {
|
|
|
String documentId = createDocument(userCourseVideo.getTitle());
|
|
String documentId = createDocument(userCourseVideo.getTitle());
|
|
|
|
|
|
|
|
// 拼接新看课url
|
|
// 拼接新看课url
|
|
|
- String url = buildCourseNewLink(param.getCompanyId(), param.getCompanyUserId(), param.getCourseId(), param.getVideoId(), param.getPeriodId(), param.getProjectId(),param.getUserId(),param.getId());
|
|
|
|
|
|
|
+ String url = buildCourseNewLink(param.getCompanyId(), param.getCompanyUserId(), param.getCourseId(), param.getVideoId(), param.getProjectId(),param.getUserId(),param.getId());
|
|
|
|
|
|
|
|
// 创建iframe块
|
|
// 创建iframe块
|
|
|
createIframeBlock(documentId, url);
|
|
createIframeBlock(documentId, url);
|
|
@@ -112,15 +113,33 @@ public class FeiShuService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public String generateRegisterLink(Long videoId, Long companyId, Long courseId,Long companyUserId, Long projectId, Long id) {
|
|
|
|
|
+ // 读取配置判断是否启用飞书新跳转
|
|
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
|
|
+ if (StringUtils.isBlank(json)) {
|
|
|
|
|
+ throw new CustomException("飞书看课配置为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
+ Boolean enableFeishuNewLink = config.getEnableFeishuNewLink();
|
|
|
|
|
+ if (!Boolean.TRUE.equals(enableFeishuNewLink)) {
|
|
|
|
|
+ throw new CustomException("未开启飞书看课");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ // 构建参数
|
|
|
|
|
+ FeishuLinkParam param = new FeishuLinkParam();
|
|
|
|
|
+ param.setCompanyId(companyId);
|
|
|
|
|
+ param.setCompanyUserId(companyUserId);
|
|
|
|
|
+ param.setCourseId(courseId);
|
|
|
|
|
+ param.setVideoId(videoId);
|
|
|
|
|
+ param.setProjectId(projectId);
|
|
|
|
|
+ param.setId(id);
|
|
|
|
|
+ // 调用原有方法
|
|
|
|
|
+ return getFeishuRegisterLink(param);
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
* 复制飞书注册链接
|
|
* 复制飞书注册链接
|
|
|
*/
|
|
*/
|
|
|
public String getFeishuRegisterLink(FeishuLinkParam param) {
|
|
public String getFeishuRegisterLink(FeishuLinkParam param) {
|
|
|
- if (param == null || param.getCompanyUserId() == null || param.getCompanyId() == null) {
|
|
|
|
|
- throw new CustomException("参数不能为空");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
FsUserCourseVideo userCourseVideo = videoMapper.selectFsUserCourseVideoByVideoId(param.getVideoId());
|
|
FsUserCourseVideo userCourseVideo = videoMapper.selectFsUserCourseVideoByVideoId(param.getVideoId());
|
|
|
if (userCourseVideo == null) {
|
|
if (userCourseVideo == null) {
|
|
|
throw new CustomException("视频不存在: " + param.getVideoId());
|
|
throw new CustomException("视频不存在: " + param.getVideoId());
|
|
@@ -177,13 +196,12 @@ public class FeiShuService {
|
|
|
/**
|
|
/**
|
|
|
* 拼接看课url(课程参数JSON方式,适配飞书iframe,双重URL编码)
|
|
* 拼接看课url(课程参数JSON方式,适配飞书iframe,双重URL编码)
|
|
|
*/
|
|
*/
|
|
|
- private String buildCourseNewLink(Long companyId, Long companyUserId, Long courseId, Long videoId, Long periodId, Long projectId,Long userId,Long id) {
|
|
|
|
|
|
|
+ private String buildCourseNewLink(Long companyId, Long companyUserId, Long courseId, Long videoId, Long projectId,Long userId,Long id) {
|
|
|
String json = configService.selectConfigByKey("course.config");
|
|
String json = configService.selectConfigByKey("course.config");
|
|
|
CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
|
|
|
// 构造课程参数 JSON
|
|
// 构造课程参数 JSON
|
|
|
Map<String, Object> courseParam = new LinkedHashMap<>();
|
|
Map<String, Object> courseParam = new LinkedHashMap<>();
|
|
|
- courseParam.put("periodId", periodId);
|
|
|
|
|
courseParam.put("companyUserId", companyUserId);
|
|
courseParam.put("companyUserId", companyUserId);
|
|
|
courseParam.put("videoId", videoId);
|
|
courseParam.put("videoId", videoId);
|
|
|
courseParam.put("projectId", projectId);
|
|
courseParam.put("projectId", projectId);
|