|
|
@@ -2326,6 +2326,60 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
+ public R createCartLinkByFeiShu(FsCourseLinkMiniParam param) {
|
|
|
+
|
|
|
+ QwUser qwUser = qwExternalContactService.getQwUserByRedis(param.getCorpId().trim(), param.getQwUserId().trim());
|
|
|
+
|
|
|
+ if (qwUser==null||qwUser.getCompanyId()==null||qwUser.getCompanyUserId()==null){
|
|
|
+ return R.error("员工未绑定 销售公司 或 销售 请先绑定");
|
|
|
+ }
|
|
|
+
|
|
|
+ QwCompany qwCompany = iQwCompanyService.getQwCompanyByRedis(param.getCorpId());
|
|
|
+
|
|
|
+ if (qwCompany == null ) {
|
|
|
+ return R.error().put("msg","企业不存在,请联系管理员");
|
|
|
+ }
|
|
|
+
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
+ CourseConfig config = JSON.parseObject(json, CourseConfig.class);
|
|
|
+
|
|
|
+ if (config == null) {
|
|
|
+ return R.error().put("msg","课程默认配置为空,请联系管理员");
|
|
|
+ }
|
|
|
+
|
|
|
+ Long courseId = param.getCourseId();
|
|
|
+ //qw_user表的主键id
|
|
|
+ Long qwUserId = qwUser.getId();
|
|
|
+ Date createTime = DateUtils.getNowDate();
|
|
|
+ Long externalUserId = param.getExternalUserId();
|
|
|
+ Long videoId = param.getVideoId();
|
|
|
+ Long companyId = qwCompany.getId();
|
|
|
+ Long companyUserId = qwUser.getCompanyUserId();
|
|
|
+
|
|
|
+ addWatchLogIfNeeded(param.getVideoId(), param.getCourseId(),param.getFsUserId(),qwUser , param.getExternalUserId());
|
|
|
+
|
|
|
+ //2.创建课程短链
|
|
|
+ Map<String, String> feishuH5Link = createFeishuH5Link(param.getCorpId(), createTime, courseId.intValue(), videoId.intValue(), String.valueOf(qwUserId), companyUserId, companyId, externalUserId, config);
|
|
|
+ //获取生成的课程短链码
|
|
|
+ String shortCode = feishuH5Link.get("link");
|
|
|
+
|
|
|
+ //3.调用生成飞书注册授权链接
|
|
|
+ String feishuLink = feiShuService.getFeishuRegisterLink(videoId, companyId, courseId, companyUserId,shortCode);
|
|
|
+
|
|
|
+
|
|
|
+ //生成卡片链接
|
|
|
+ JSONObject news = new JSONObject(true); // true 表示保持字段顺序
|
|
|
+ news.put("linkTitle", param.getTitle());
|
|
|
+ news.put("linkDescribe", param.getTitle());
|
|
|
+ news.put("linkImageUrl", config.getSidebarImageUrl());
|
|
|
+ news.put("linkUrl", feishuLink);
|
|
|
+
|
|
|
+ return R.ok().put("data",news);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//插入观看记录
|
|
|
private void addWatchLogIfNeeded(Long videoId, Long courseId,
|
|
|
Long fsUserId, QwUser qwUser,Long externalId) {
|