|
@@ -38,11 +38,9 @@ import java.util.concurrent.TimeUnit;
|
|
|
@Slf4j
|
|
|
public class DingUtil {
|
|
|
|
|
|
- // private static final RedisCache redisCache = SpringUtil.getBean(RedisCache.class);
|
|
|
- private static final RedisCache redisCache =null;
|
|
|
+ private static final RedisCache redisCache = SpringUtil.getBean(RedisCache.class);
|
|
|
|
|
|
- // private static final SuiteTicketInfoService suiteTicketInfoService = SpringUtil.getBean(SuiteTicketInfoService.class);
|
|
|
- private static final SuiteTicketInfoService suiteTicketInfoService = null;
|
|
|
+ private static final SuiteTicketInfoService suiteTicketInfoService = SpringUtil.getBean(SuiteTicketInfoService.class);
|
|
|
|
|
|
private static final String corpAccessTokenRedisKey = "corpAccessToken:";
|
|
|
|
|
@@ -112,18 +110,13 @@ public class DingUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- getDeptList("", 1L);
|
|
|
- }
|
|
|
-
|
|
|
public static List<OapiV2DepartmentListsubResponse.DeptBaseResponse> getDeptList(String corpId, Long deptId) {
|
|
|
try {
|
|
|
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/listsub");
|
|
|
OapiV2DepartmentListsubRequest req = new OapiV2DepartmentListsubRequest();
|
|
|
req.setDeptId(deptId);
|
|
|
req.setLanguage("zh_CN");
|
|
|
- // OapiV2DepartmentListsubResponse rsp = client.execute(req, getCorpAccessToken(corpId));
|
|
|
- OapiV2DepartmentListsubResponse rsp = client.execute(req, "53b78b270b28320e869bf98a9f8e8486");
|
|
|
+ OapiV2DepartmentListsubResponse rsp = client.execute(req, getCorpAccessToken(corpId));
|
|
|
return rsp.getResult();
|
|
|
} catch (Exception e) {
|
|
|
log.error("获取用户部门失败", e);
|