Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-module-job
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-module-job
Commits
52a05e9d
提交
52a05e9d
authored
6月 24, 2025
作者:
000516
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FeiShuUtil转移到common-core中
上级
f449b9f3
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
0 行增加
和
182 行删除
+0
-182
FeiShuUtil.java
src/main/java/com/sfa/job/util/FeiShuUtil.java
+0
-182
没有找到文件。
src/main/java/com/sfa/job/util/FeiShuUtil.java
deleted
100644 → 0
浏览文件 @
f449b9f3
//package com.sfa.job.util;
//
//import cn.hutool.http.HttpUtil;
//import cn.hutool.http.Method;
//import com.alibaba.fastjson2.JSONArray;
//import com.alibaba.fastjson2.JSONObject;
//import com.google.gson.JsonParser;
//import com.lark.oapi.Client;
//import com.lark.oapi.core.utils.Jsons;
//import com.lark.oapi.service.contact.v3.enums.ChildrenDepartmentDepartmentIdTypeEnum;
//import com.lark.oapi.service.contact.v3.enums.FindByDepartmentUserDepartmentIdTypeEnum;
//import com.lark.oapi.service.contact.v3.enums.FindByDepartmentUserUserIdTypeEnum;
//import com.lark.oapi.service.contact.v3.model.ChildrenDepartmentReq;
//import com.lark.oapi.service.contact.v3.model.ChildrenDepartmentResp;
//import com.lark.oapi.service.contact.v3.model.FindByDepartmentUserReq;
//import com.lark.oapi.service.contact.v3.model.FindByDepartmentUserResp;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * @author : liqiulin
// * @date : 2024-12-06 16
// * @describe :
// */
//@Slf4j
//@Component
//public class FeiShuUtil {
//
// @Value("${feishu.luzx.app_id}")
// private String appId;
// @Value("${feishu.luzx.app_secret}")
// private String appSecret;
//
// @Value("${feishu.bot_1.app_id}")
// private String botAppId1;
// @Value("${feishu.bot_1.app_secret}")
// private String botAppSecret1;
//
//
// private static final String CONTENT_TYPE = "application/json; charset=utf-8";
// private static final String SHEET_URL = "https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/";
// private static final String TENANT_ACCESS_TOKEN_URL = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal";
// private static final String VALUES_APPEND = "/values_append";
// private static final String VALUES_IMAGE = "/values_image";
// private static final String VALUES_BATCH_GET = "/values_batch_get";
// private static final String VALUES = "/values";
// private static final String STYLE = "/style";
//
//
// /**
// * 根据部门父编码获取子部门
// * 公司编码:"0"
// */
// public JSONArray getDeptByParentId(String parentId) {
// try {
// Client client = getClient();
// ChildrenDepartmentReq req = ChildrenDepartmentReq.newBuilder()
// .departmentId(parentId)
// .departmentIdType(ChildrenDepartmentDepartmentIdTypeEnum.DEPARTMENT_ID)
// .pageSize(50)
// .build();
// ChildrenDepartmentResp resp = client.contact().department().children(req);
// if (!resp.success()) {
// log.error(String.format("code:%s,msg:%s,reqId:%s, resp:%s",
// resp.getCode(), resp.getMsg(), resp.getRequestId(), Jsons.createGSON(true, false).toJson(JsonParser.parseString(new String(resp.getRawResponse().getBody(), "UTF-8")))));
// return null;
// }
// JSONArray items = JSONObject.parse(Jsons.DEFAULT.toJson(resp.getData())).getJSONArray("items");
// return items;
// } catch (Exception e) {
// log.error("获取子部门列表失败,停止执行!");
// }
// return null;
// }
//
// /**
// * 获取部门用户
// */
// public JSONArray getUsersByDeptId(String deptCode) {
// try {
// Client client = getClient();
// FindByDepartmentUserReq req = FindByDepartmentUserReq.newBuilder()
// .userIdType(FindByDepartmentUserUserIdTypeEnum.OPEN_ID)
// .departmentIdType(FindByDepartmentUserDepartmentIdTypeEnum.DEPARTMENT_ID)
// .departmentId(deptCode)
// .pageSize(50)
// .build();
// FindByDepartmentUserResp resp = client.contact().user().findByDepartment(req);
// if(!resp.success()) {
// log.warn(String.format("code:%s,msg:%s,reqId:%s, resp:%s",
// resp.getCode(), resp.getMsg(), resp.getRequestId(), Jsons.createGSON(true, false).toJson(JsonParser.parseString(new String(resp.getRawResponse().getBody(), "UTF-8")))));
// return null;
// }
// JSONArray items = JSONObject.parse(Jsons.DEFAULT.toJson(resp.getData())).getJSONArray("items");
// return items;
// } catch (Exception e) {
// log.error("获取部门用户失败,停止执行!部门id:{}", deptCode);
// }
// return null;
// }
//
// /**
// * 获取表格数据
// */
// public JSONArray pullSheet(String sheetToken, String autoToken, String ranges) {
// try {
// Map<String, Object> params = new HashMap<>();
// params.put("ranges", ranges);
// String result = HttpUtil.createGet(SHEET_URL + sheetToken + VALUES_BATCH_GET).form(params).auth("Bearer " + autoToken).contentType(CONTENT_TYPE).execute().body();
// JSONObject resultJson = JSONObject.parseObject(result);
// int code = resultJson.getInteger("code");
// if (code != 0) {
// throw new RuntimeException("获取飞书表格范围数据错误:"+resultJson.getString("msg"));
// }
// return resultJson.getJSONObject("data").getJSONArray("valueRanges");
// }catch (Exception e) {
// log.error("拉取表格数据失败,停止执行!", e);
// }
// return new JSONArray();
// }
//
// private Client getClient() {
// return Client.newBuilder(appId, appSecret).build();
// }
//
// public Integer pushSetToSheet(String range, List<Object> datas, String sheetToken, String autoToken) {
// // 组装参数
// Map<String, Map<String, Object>> bodyMap = new HashMap<>();
// Map<String, Object> valueRange = new HashMap<>();
// valueRange.put("range", range);
// valueRange.put("values", datas);
// bodyMap.put("valueRange", valueRange);
// String bodyJson = JSONObject.toJSONString(bodyMap);
//
// // body上传
// String result = HttpUtil.createPost(SHEET_URL + sheetToken + VALUES_APPEND)
// .auth("Bearer " + autoToken).contentType(CONTENT_TYPE)
// .body(bodyJson)
// .execute().body();
//
// // 上传结果判断
// JSONObject resultJson = JSONObject.parseObject(result);
// return resultJson.getInteger("code");
// }
//
//
// public String getBotToken1() {
// Map<String, Object> bodyMap = new HashMap<>();
// bodyMap.put("app_id", botAppId1);
// bodyMap.put("app_secret", botAppSecret1);
// String bodyJson = JSONObject.toJSONString(bodyMap);
//
// String result = HttpUtil.createPost(TENANT_ACCESS_TOKEN_URL)
// .contentType(CONTENT_TYPE)
// .body(bodyJson)
// .execute().body();
//
// JSONObject resultJson = JSONObject.parseObject(result);
// int code = resultJson.getInteger("code");
// if (code != 0) {
// throw new RuntimeException("获取tenant_access_token错误");
// }
// return resultJson.getString("tenant_access_token");
// }
//
// public void appendStyle(String sheetToken, Map<String, Object> body,String autoToken) {
// // body上传
// String result = HttpUtil.createRequest(Method.PUT,SHEET_URL + sheetToken + STYLE)
// .auth("Bearer " + autoToken).contentType(CONTENT_TYPE)
// .body(JSONObject.toJSONString(body))
// .execute().body();
// }
//
// public JSONObject pullSheetOneRange(String sheetToken, String botToken1, String ranges) {
// return pullSheet(sheetToken, botToken1, ranges).getJSONObject(0);
// }
//}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论