|
|
@@ -1594,20 +1594,34 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
|
|
|
break;
|
|
|
case "17":
|
|
|
- //飞书看课链接
|
|
|
+ // 飞书看课链接
|
|
|
Long companyIdLong = Long.parseLong(companyId);
|
|
|
Long companyUserIdLong = Long.parseLong(companyUserId);
|
|
|
- Long externalIdLong = Long.parseLong(externalId);
|
|
|
-
|
|
|
- addWatchLogIfNeeded(sopLogs, videoId, courseId, sendTime, qwUserId, companyUserId, companyId, externalId, logVo, 2);
|
|
|
+ Long externalIdLong = null;
|
|
|
+ String chatIdForFeishu = null;
|
|
|
+ if (isGroupChat) {
|
|
|
+ chatIdForFeishu = externalId;
|
|
|
+ } else {
|
|
|
+ externalIdLong = Long.parseLong(externalId);
|
|
|
+ addWatchLogIfNeeded(sopLogs, videoId, courseId, sendTime, qwUserId, companyUserId, companyId, externalId, logVo, 2);
|
|
|
+ }
|
|
|
|
|
|
Map<String, String> feiShuLinkMap = createFeiShuLinkByMiniApp(setting, sopLogs.getCorpId(), sendTime, courseId, videoId,
|
|
|
- qwUserId, companyUserId, companyId, externalIdLong, cachedCourseConfig);
|
|
|
+ qwUserId, companyUserId, companyId, externalIdLong, chatIdForFeishu, cachedCourseConfig);
|
|
|
String shortLink = feiShuLinkMap.get("link");
|
|
|
|
|
|
- String feishuLink = feiShuService.getFeishuRegisterLink(videoId, companyIdLong, courseId, companyUserIdLong, shortLink, null);
|
|
|
- if (StringUtils.isNotEmpty(feishuLink)) {
|
|
|
+ try {
|
|
|
+ String feishuLink = feiShuService.getFeishuRegisterLink(videoId, companyIdLong, courseId, companyUserIdLong,
|
|
|
+ shortLink, setting.getFeishuAccountId());
|
|
|
+ if (StringUtils.isEmpty(feishuLink)) {
|
|
|
+ log.error("生成飞书注册链接失败,sopId={}, videoId={}, externalId={}", logVo.getSopId(), videoId, externalId);
|
|
|
+ throw new RuntimeException("生成飞书注册链接失败");
|
|
|
+ }
|
|
|
setting.setLinkUrl(feishuLink);
|
|
|
+ setting.setIsBindUrl("2");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("生成飞书注册链接异常,sopId={}, videoId={}, externalId={}", logVo.getSopId(), videoId, externalId, e);
|
|
|
+ throw new RuntimeException("生成飞书注册链接失败: " + e.getMessage(), e);
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
@@ -1905,14 +1919,21 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 生成飞书看课课程短链
|
|
|
+ * 生成飞书看课课程短链(私聊传 externalId;发群传 chatId,与 SopUserLogsInfoServiceImpl 一致)
|
|
|
*/
|
|
|
private Map<String, String> createFeiShuLinkByMiniApp(QwSopTempSetting.Content.Setting setting, String corpId, Date sendTime,
|
|
|
Long courseId, Long videoId, String qwUserId,
|
|
|
- String companyUserId, String companyId, Long externalId, CourseConfig config) {
|
|
|
+ String companyUserId, String companyId, Long externalId,
|
|
|
+ String chatId, CourseConfig config) {
|
|
|
+ String externalIdStr = externalId != null ? externalId.toString() : null;
|
|
|
FsCourseLink link = createFsCourseLink(corpId, sendTime, courseId, videoId, qwUserId,
|
|
|
- companyUserId, companyId, externalId.toString(), 3);
|
|
|
+ companyUserId, companyId, externalIdStr, 3);
|
|
|
link.setFeishuAccountId(setting.getFeishuAccountId());
|
|
|
+ link.setProjectCode(cloudHostProper.getProjectCode());
|
|
|
+ if (StringUtils.isNotEmpty(chatId)) {
|
|
|
+ link.setChatId(chatId);
|
|
|
+ link.setQwExternalId(null);
|
|
|
+ }
|
|
|
|
|
|
FsCourseRealLink courseMap = new FsCourseRealLink();
|
|
|
BeanUtils.copyProperties(link, courseMap);
|
|
|
@@ -1928,7 +1949,8 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
Date updateTime = createUpdateTime(setting, sendTime, config);
|
|
|
|
|
|
link.setUpdateTime(updateTime);
|
|
|
- enqueueCourseLink(link);
|
|
|
+ // 飞书注册链接创建前必须已入库,异步入队会导致 requireCourseLink 查不到记录
|
|
|
+ fsCourseLinkMapper.insertFsCourseLink(link);
|
|
|
Map<String, String> result = new HashMap<>();
|
|
|
result.put("url", link.getRealLink());
|
|
|
result.put("link", link.getLink());
|