Przeglądaj źródła

增加站点同步至飞书表格

Cyan 7 miesięcy temu
rodzic
commit
6790d4dea5

+ 22 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/entity/FeiShuConfigManager.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.okki.site.entity;
+
+/**
+ * @author Chen
+ */
+public class FeiShuConfigManager {
+
+    private static final FeiShuConfigManager INSTANCE = new FeiShuConfigManager();
+    private final FeiShuConfigEnum feiShuConfigEnum;
+
+    private FeiShuConfigManager() {
+        this.feiShuConfigEnum = FeiShuConfigEnum.valueOf("PROD");
+    }
+
+    public static FeiShuConfigManager getInstance() {
+        return INSTANCE;
+    }
+
+    public FeiShuConfigEnum getConfigEnum() {
+        return feiShuConfigEnum;
+    }
+}

+ 2 - 1
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/IFeiShuCommonService.java

@@ -11,6 +11,7 @@ import com.lark.oapi.service.bitable.v1.model.ListAppTableRecordRespBody;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.FastJsonUtil;
 import org.jeecg.modules.okki.site.entity.FeiShuConfigEnum;
+import org.jeecg.modules.okki.site.entity.FeiShuConfigManager;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -30,7 +31,7 @@ public class IFeiShuCommonService {
      * @param targetGroups
      */
     public Map<String, List<JSONObject>> getFeiShuTeamSheet(List<String> targetGroups) {
-        FeiShuConfigEnum configEnum = FeiShuConfigEnum.valueOf("DEV");
+        FeiShuConfigEnum configEnum = FeiShuConfigManager.getInstance().getConfigEnum();
         List<Map<String, Object>> mapList = new ArrayList<>();
         Client client = Client.newBuilder(configEnum.getAppId(), configEnum.getAppSecret()).build();
 

+ 3 - 2
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/impl/FeiShuGroupServiceImpl.java

@@ -8,6 +8,7 @@ import com.lark.oapi.service.im.v1.model.*;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.FastJsonUtil;
 import org.jeecg.modules.okki.site.entity.FeiShuConfigEnum;
+import org.jeecg.modules.okki.site.entity.FeiShuConfigManager;
 import org.jeecg.modules.okki.site.service.IFeiShuCommonService;
 import org.jeecg.modules.okki.site.service.IFeiShuGroupService;
 import org.jeecg.modules.okki.site.service.IFeiShuMsgService;
@@ -108,7 +109,7 @@ public class FeiShuGroupServiceImpl implements IFeiShuGroupService {
      */
     @Override
     public void sendCreateFeiShuGroupRequest(String customerName, String siteId, String feiShuGroupName, String ownerId, String[] needJoinFeiShuIdsArray) {
-        FeiShuConfigEnum configEnum = FeiShuConfigEnum.valueOf("DEV");
+        FeiShuConfigEnum configEnum = FeiShuConfigManager.getInstance().getConfigEnum();
         // 构建client
         Client client = Client.newBuilder(configEnum.getAppId(), configEnum.getAppSecret()).build();
 
@@ -156,7 +157,7 @@ public class FeiShuGroupServiceImpl implements IFeiShuGroupService {
      * @param feiShuGroupName
      */
     public void sendGroupMsg(String feiShuGroupName, String feiShuGroupId) {
-        FeiShuConfigEnum configEnum = FeiShuConfigEnum.valueOf("DEV");
+        FeiShuConfigEnum configEnum = FeiShuConfigManager.getInstance().getConfigEnum();
         // 构建client
         Client client = Client.newBuilder(configEnum.getAppId(), configEnum.getAppSecret()).build();
 

+ 3 - 2
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/impl/FeiShuSheetServiceImpl.java

@@ -10,6 +10,7 @@ import org.jeecg.modules.okki.account.entity.OkkiAccount;
 import org.jeecg.modules.okki.account.service.IOkkiAccountService;
 import org.jeecg.modules.okki.site.dto.FeiShuRecordSheetDto;
 import org.jeecg.modules.okki.site.entity.FeiShuConfigEnum;
+import org.jeecg.modules.okki.site.entity.FeiShuConfigManager;
 import org.jeecg.modules.okki.site.entity.OkkiSite;
 import org.jeecg.modules.okki.site.service.IFeiShuCommonService;
 import org.jeecg.modules.okki.site.service.IFeiShuGroupService;
@@ -48,7 +49,7 @@ public class FeiShuSheetServiceImpl implements IFeiShuSheetService {
      */
     @Override
     public void syncWebsiteToFeiShuSheet(OkkiSite okkiSite) {
-        FeiShuConfigEnum configEnum = FeiShuConfigEnum.valueOf("DEV");
+        FeiShuConfigEnum configEnum = FeiShuConfigManager.getInstance().getConfigEnum();
         Client client = Client.newBuilder(configEnum.getAppId(), configEnum.getAppSecret()).build();
 
         Map<String, Object> map = new HashMap<>();
@@ -170,7 +171,7 @@ public class FeiShuSheetServiceImpl implements IFeiShuSheetService {
      * @return
      */
     public boolean sendUpdateRequestFeiShuSheet(Map<String, Object> updateMap, FeiShuRecordSheetDto recordSheetDto) {
-        FeiShuConfigEnum configEnum = FeiShuConfigEnum.valueOf("DEV");
+        FeiShuConfigEnum configEnum = FeiShuConfigManager.getInstance().getConfigEnum();
         Client client = Client.newBuilder(configEnum.getAppId(), configEnum.getAppSecret()).build();
 
         UpdateAppTableRecordReq updateReq = UpdateAppTableRecordReq.newBuilder()