Selaa lähdekoodia

新飞书逻辑3

cgp 2 päivää sitten
vanhempi
commit
b12dc1b3c0

+ 1 - 1
fs-ipad-task/src/main/java/com/fs/app/service/FeishuAsyncService.java

@@ -78,7 +78,7 @@ public class FeishuAsyncService {
                                       Long companyUserId, String shortLink,
                                       FeishuAccount account) {
         try {
-            docApiService.createTextLinkBlock(client, docId, authUrl);
+            docApiService.createIframeBlock(client, docId, authUrl);
             docApiService.changeDocumentPermissions(client, docId);
             // 成功时需要更新docId的课程内容为已填充
             String amountKey = FEISHU_CLIENT+docId;

+ 3 - 2
fs-ipad-task/src/main/java/com/fs/app/service/IpadSendServer.java

@@ -332,7 +332,8 @@ public class IpadSendServer {
     public void sendLink(BaseVo vo, QwSopCourseFinishTempSetting.Setting content,QwSopLogs qwSopLogs, Long externalId,Long qwUserId) {
         if ("18".equals(content.getContentType())){
             // 完善content里面的飞书注册链接
-            completeFeishuRegisterLink(vo, content,qwSopLogs, externalId,qwUserId);
+            //completeFeishuRegisterLink(vo, content,qwSopLogs, externalId,qwUserId);
+            completeFeishuCourseLink(vo, content,qwSopLogs, externalId,qwUserId);
         }else if ("20".equals(content.getContentType())){
             // 新飞书逻辑
             completeFeishuCourseLink(vo, content,qwSopLogs, externalId,qwUserId);
@@ -404,7 +405,7 @@ public class IpadSendServer {
             String authUrl = buildNewFeiSHuCourseLink(companyId, companyUserId, courseId, videoId, qwSopLogs.getFsUserId(), fsCourseLink,logId);
             // ============ 异步调用飞书API完善文档内容与文档权限 ============
             //异步之前要做个判断,如果缓存中的课程填充标识为true,则不需要进行异步处理(因为已经填充过了)
-            if (!account.getDocumentIdFillFlag()){
+            if (!account.getCourseFillFlag()){
                 //异步处理(同时异步更新缓存的课程内容填充标识为true)
                 asyncService.processFeishuCoursePageAsync(
                         client, feiShuDocId, authUrl,

+ 15 - 7
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -40,6 +40,7 @@ import com.fs.course.service.IFsUserCourseVideoService;
 import com.fs.course.service.IFsVideoResourceService;
 import com.fs.course.vo.*;
 import com.fs.course.vo.newfs.*;
+import com.fs.feishu.model.FeishuLinkParam;
 import com.fs.feishu.service.FeiShuService;
 import com.fs.his.domain.FsUser;
 import com.fs.his.domain.FsUserIntegralLogs;
@@ -2394,7 +2395,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         Long companyId = qwUser.getCompanyId();
         Long companyUserId = qwUser.getCompanyUserId();
 
-        addWatchLogIfNeeded(param.getVideoId(), param.getCourseId(),param.getFsUserId(),qwUser , param.getExternalUserId());
+        Long logId=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);
@@ -2402,7 +2403,14 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         String shortCode = feishuH5Link.get("link");
 
         //3.调用生成飞书注册授权链接(不走ipad)
-        String feishuLink = feiShuService.getFeishuRegisterLink(videoId, companyId, courseId, companyUserId,shortCode);
+        FeishuLinkParam feishuLinkParam=new FeishuLinkParam();
+        feishuLinkParam.setCompanyId(companyId);
+        feishuLinkParam.setCompanyUserId(companyUserId);
+        feishuLinkParam.setCourseId(courseId);
+        feishuLinkParam.setVideoId(videoId);
+        feishuLinkParam.setLink(shortCode);
+        feishuLinkParam.setLogId(logId);
+        String feishuLink = feiShuService.getFeishuCoursePageLink(feishuLinkParam);
 
 
         //生成卡片链接
@@ -2464,9 +2472,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 
 
     //插入观看记录
-    private void addWatchLogIfNeeded(Long videoId, Long courseId,
+    private Long addWatchLogIfNeeded(Long videoId, Long courseId,
                                      Long fsUserId, QwUser qwUser,Long externalId) {
-
+        Long logId=null;
         try {
 
             FsCourseWatchLog watchLog = new FsCourseWatchLog();
@@ -2489,13 +2497,13 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
             watchLog.setUserId(fsUserId);
 
             //存看课记录
-            courseWatchLogMapper.insertOrUpdateFsCourseWatchLog(watchLog);
-
+           courseWatchLogMapper.insertOrUpdateFsCourseWatchLog(watchLog);
+           logId = watchLog.getLogId();
         }catch (Exception e){
             logger.error("一键群发失败-插入观看记录失败:"+e.getMessage());
         }
 
-
+        return logId;
     }
 
     private void createNotionH5Link(String corpId, Date sendTime,

+ 0 - 10
fs-service/src/main/java/com/fs/feishu/service/FeiShuService.java

@@ -210,14 +210,6 @@ public class FeiShuService {
     // ==================== 生成新版飞书课程链接(无授权流程,进入即是看课界面) ====================
 
     public String getFeishuCoursePageLink(FeishuLinkParam param) {
-        String courseLinkKey = String.format("feishu:course_link:%d:%d:%d:%d:%d:%s",
-                param.getCompanyId(), param.getCompanyUserId(),
-                param.getCourseId(), param.getVideoId(),
-                param.getUserId(), param.getLink());
-        String cached = redisCache.getCacheObject(courseLinkKey);
-        if (StringUtils.isNotBlank(cached)) {
-            return cached;
-        }
 
         FsUserCourseVideo userCourseVideo = videoMapper.selectFsUserCourseVideoByVideoId(param.getVideoId());
         if (userCourseVideo == null) {
@@ -247,7 +239,6 @@ public class FeiShuService {
                         redisCache.setCacheObject(accountKey, account);
                     }
                     String result = "https://www.feishu.cn/docx/" + docId;
-                    redisCache.setCacheObject(courseLinkKey, result, 72, TimeUnit.HOURS);
                     return result;
                 } catch (CustomException e) {
                     Integer code = e.getCode();
@@ -296,7 +287,6 @@ public class FeiShuService {
                     redisCache.setCacheObject(accountKey, account);
                 }
                 String result = "https://www.feishu.cn/docx/" + docId;
-                redisCache.setCacheObject(courseLinkKey, result, 72, TimeUnit.HOURS);
                 return result;
             } catch (CustomException e) {
                 Integer code = e.getCode();