Pārlūkot izejas kodu

修改sop发飞书逻辑10

cgp 3 dienas atpakaļ
vecāks
revīzija
5844a94be3

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

@@ -1,5 +1,6 @@
 package com.fs.app.service;
 
+import com.fs.common.core.redis.RedisCache;
 import com.fs.common.exception.CustomException;
 import com.fs.feishu.domain.FeishuAccount;
 import com.fs.feishu.service.FeiShuService;
@@ -21,6 +22,12 @@ public class FeishuAsyncService {
 
     @Autowired
     private FeiShuService feiShuService;
+
+    @Autowired
+    private RedisCache redisCache;
+
+    private static final String FEISHU_CLIENT = "fei_shu_client:";
+
     @Async // 开启异步任务
     public void processFeishuDocAsync(Client client, String docId, String authUrl,
                                       Long videoId, Long companyId, Long courseId,
@@ -29,7 +36,10 @@ public class FeishuAsyncService {
         try {
             docApiService.createTextLinkBlock(client, docId, authUrl);
             docApiService.changeDocumentPermissions(client, docId);
-            // 成功时无需记录错误
+            // 成功时需要更新docId的文档内容为已填充
+            String amountKey = FEISHU_CLIENT+docId;
+            account.setDocumentIdFillFlag(Boolean.TRUE);
+            redisCache.setCacheObject(amountKey, account);
         } catch (CustomException e) {
             // 调用原Service的方法处理异常
             Integer code = e.getCode();

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

@@ -113,13 +113,9 @@ public class IpadSendServer {
     @Autowired
     private FsCourseLinkMapper courseLinkMapper;
     @Autowired
-    private FeishuAccountMapper feishuAccountMapper;
-    @Autowired
     private FeishuLinkErrorMapper feishuLinkErrorMapper;
     @Autowired
     private FeiShuService feiShuService;
-    @Autowired
-    private QwSopLogsMapper qwSopLogsMapper;
 
     //销售的个人飞书应用账户缓存的key
     private static final String FEISHU_COMPANY_USER_KEY = "feishu:account_company_user:";
@@ -395,10 +391,7 @@ public class IpadSendServer {
             // ============ 异步调用飞书API完善文档内容与文档权限 ============
             //异步之前要做个判断,如果缓存中的文档填充标识为true,则不需要进行异步处理(因为已经填充过了)
             if (!account.getDocumentIdFillFlag()){
-                //更新缓存中文档填充标识为true
-                account.setDocumentIdFillFlag(Boolean.TRUE);
-                redisCache.setCacheObject(amountKey, account);
-                //异步处理
+                //异步处理(同时异步更新缓存的文档填充标识为true)
                 asyncService.processFeishuDocAsync(
                         client, feiShuDocId, authUrl,
                         videoId, companyId, courseId,

+ 2 - 3
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -2364,9 +2364,8 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         //获取生成的课程短链码
         String shortCode = feishuH5Link.get("link");
 
-        //3.调用生成飞书注册授权链接
-//        String feishuLink = feiShuService.getFeishuRegisterLink(videoId, companyId, courseId, companyUserId,shortCode);
-        String feishuLink = feiShuService.getNewFeishuRegisterLink(videoId, companyId, courseId, companyUserId,shortCode);
+        //3.调用生成飞书注册授权链接(不走ipad)
+        String feishuLink = feiShuService.getFeishuRegisterLink(videoId, companyId, courseId, companyUserId,shortCode);
 
 
         //生成卡片链接