Sfoglia il codice sorgente

查询电话号码 分页

zhaotx 1 anno fa
parent
commit
b020b3473a

+ 17 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/utils/FeishuRobotUtil.java

@@ -80,6 +80,23 @@ public class FeishuRobotUtil {
         if (Check.isNull(telephones)){
             return null;
         }
+        Map<String, String> map = new HashMap<>();
+        int size = telephones.size();
+        int pageSize = 30;
+        int pageNum = size / pageSize + (size % pageSize == 0 ? 0 : 1);
+        for (int i = 0; i < pageNum; i++) {
+            int start = i * pageSize;
+            int end = Math.min(start + pageSize, size);
+            List<String> subList = telephones.subList(start, end);
+            Map<String, String> subMap = getFsUserIdOnePage(token, subList);
+            if (!Check.isNull(subMap)){
+                map.putAll(subMap);
+            }
+        }
+        return map;
+    }
+
+    private static Map<String, String> getFsUserIdOnePage(String token, List<String> telephones) throws IOException {
         //获取token
         String url = "https://open.feishu.cn/open-apis/contact/v3/users/batch_get_id?user_id_type=user_id";
         HttpPost httpPost = new HttpPost(url);