| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取钉钉部门详情 |
| | | * @param deptId |
| | | * @return |
| | | * @throws ApiException |
| | | */ |
| | | public OapiV2DepartmentGetResponse.DeptGetResponse syncDepartmentInfo(Long deptId) throws ApiException { |
| | | DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/get"); |
| | | OapiV2DepartmentGetRequest req = new OapiV2DepartmentGetRequest(); |
| | |
| | | return null; |
| | | } |
| | | Set<String> setUserIdList = new HashSet<>(allUserIdList); |
| | | return syncUserInfo(setUserIdList); |
| | | return syncUserInfoList(setUserIdList); |
| | | } |
| | | |
| | | |
| | | public List<OapiV2UserGetResponse.UserGetResponse> syncUserInfo(Set<String> setUserIdList) throws ApiException { |
| | | public List<OapiV2UserGetResponse.UserGetResponse> syncUserInfoList(Set<String> setUserIdList) throws ApiException { |
| | | List<OapiV2UserGetResponse.UserGetResponse> userList = new ArrayList<>(); |
| | | DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/get"); |
| | | OapiV2UserGetRequest req = new OapiV2UserGetRequest(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | public OapiV2UserGetResponse.UserGetResponse syncUserInfo(String userId)throws ApiException { |
| | | DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/get"); |
| | | OapiV2UserGetRequest req = new OapiV2UserGetRequest(); |
| | | req.setUserid(userId); |
| | | req.setLanguage("zh_CN"); |
| | | OapiV2UserGetResponse rsp = client.execute(req, getToken()); |
| | | if(rsp.getErrcode().equals(Constants.DD_ERR_CODE)){ |
| | | OapiV2UserGetResponse.UserGetResponse userGetResponse = rsp.getResult(); |
| | | return userGetResponse; |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),rsp.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception { |