|
@@ -24,11 +24,13 @@ public class DDImplClient_Contacts implements DDClient_Contacts {
|
|
|
* @apiNote https://open.dingtalk.com/document/orgapp/obtain-a-sub-department-id-list-v2
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<Number> listSubDepartmentId(String access_token, Number dept_id) {
|
|
|
+ public List<Long> listSubDepartmentId(String access_token, long dept_id) {
|
|
|
Map param = UtilMap.map("access_token", access_token);
|
|
|
Map body = UtilMap.map("dept_id", dept_id);
|
|
|
Map rsp = (Map) DDR.doPost("https://oapi.dingtalk.com/topapi/v2/department/listsubid", null, param, body).getResult();
|
|
|
- return (List<Number>) rsp.get("dept_id_list");
|
|
|
+ List<Number> list = (List<Number>) rsp.get("dept_id_list");
|
|
|
+ // ppExt: 不要直接使用 Number 作为类型, 不同基本类型比较值时会有偏差 [可以作为父类接受数据, 避免直接强制类型转换错误, 再进行基本类型处理]
|
|
|
+ return list.stream().map(item -> item.longValue()).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -37,7 +39,7 @@ public class DDImplClient_Contacts implements DDClient_Contacts {
|
|
|
* @apiNote https://open.dingtalk.com/document/orgapp/obtain-the-department-list-v2
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<Map> listSubDepartmentDetail(String access_token, Number dept_id) {
|
|
|
+ public List<Map> listSubDepartmentDetail(String access_token, long dept_id) {
|
|
|
Map param = UtilMap.map("access_token", access_token);
|
|
|
Map body = UtilMap.map("dept_id", dept_id);
|
|
|
return (List<Map>) DDR.doPost("https://oapi.dingtalk.com/topapi/v2/department/listsub", null, param, body).getResult();
|
|
@@ -56,9 +58,9 @@ public class DDImplClient_Contacts implements DDClient_Contacts {
|
|
|
* 获取全部架构内部门_全部 id [包含一级部门]
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<Number> getDepartmentId_all(String access_token, boolean containsTop) {
|
|
|
+ public List<Long> getDepartmentId_all(String access_token, boolean containsTop) {
|
|
|
List<Long> deptList = containsTop ? UtilList.asList(DDConf.TOP_DEPARTMENT) : new ArrayList<>();
|
|
|
- return (List<Number>) _getDepartment_all(access_token, DDConf.TOP_DEPARTMENT, deptList, true)
|
|
|
+ return (List<Long>) _getDepartment_all(access_token, DDConf.TOP_DEPARTMENT, deptList, true)
|
|
|
.stream().map(detpId -> Long.valueOf(String.valueOf(detpId))).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
@@ -81,7 +83,7 @@ public class DDImplClient_Contacts implements DDClient_Contacts {
|
|
|
* @apiNote https://open.dingtalk.com/document/orgapp/query-the-list-of-department-userids
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<String> listDepartmentUserId(String access_token, Number dept_id) {
|
|
|
+ public List<String> listDepartmentUserId(String access_token, long dept_id) {
|
|
|
Map param = UtilMap.map("access_token", access_token);
|
|
|
Map body = UtilMap.map("dept_id", dept_id);
|
|
|
Map rsp = (Map) DDR.doPost("https://oapi.dingtalk.com/topapi/user/listid", null, param, body).getResult();
|
|
@@ -105,7 +107,8 @@ public class DDImplClient_Contacts implements DDClient_Contacts {
|
|
|
public Map getUserInfoByMobile(String access_token, String mobile) {
|
|
|
Map param = UtilMap.map("access_token", access_token);
|
|
|
Map body = UtilMap.map("mobile", mobile);
|
|
|
- return (Map) DDR.doPost("https://oapi.dingtalk.com/topapi/v2/user/getbymobile", null, param, body).getResult();
|
|
|
+ Map result = (Map) DDR.doPost("https://oapi.dingtalk.com/topapi/v2/user/getbymobile", null, param, body).getResult();
|
|
|
+ return getUserInfoById(access_token, String.valueOf(result.get("userid")));
|
|
|
}
|
|
|
|
|
|
/**
|