|
|
|
@ -20,6 +20,9 @@ public class DingUtil { |
|
|
|
@Autowired |
|
|
|
private DtService dtService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<DtDepart> getAllDepartment() throws Exception { |
|
|
|
return dtService.getDepartmentService().list(null , true); |
|
|
|
} |
|
|
|
@ -36,7 +39,6 @@ public class DingUtil { |
|
|
|
} |
|
|
|
|
|
|
|
public List<DingUserDTO> getUserIdInDepartment(Long id) throws Exception { |
|
|
|
List<DingUserDTO> res = new ArrayList<>(); |
|
|
|
|
|
|
|
JsonObject jsonObject = new JsonObject(); |
|
|
|
jsonObject.addProperty("dept_id" , id); |
|
|
|
@ -45,9 +47,11 @@ public class DingUtil { |
|
|
|
|
|
|
|
String url = dtService.getDtConfigStorage().getApiUrl("/topapi/v2/user/list"); |
|
|
|
String responseContent = dtService.post(url, jsonObject); |
|
|
|
res.addAll(Try.of(() -> new ObjectMapper().convertValue( |
|
|
|
List<DingUserDTO> res = new ArrayList<>(Try.of(() -> new ObjectMapper().convertValue( |
|
|
|
JsonPath.read(responseContent, "$.result.list"), |
|
|
|
new TypeReference<List<DingUserDTO>>() {})).getOrElse(new ArrayList<>())); |
|
|
|
new TypeReference<List<DingUserDTO>>() { |
|
|
|
})).getOrElse(new ArrayList<>())); |
|
|
|
// 游标获取,hasMore判断是否存在下一页
|
|
|
|
Boolean hasMore = Try.of(() -> new ObjectMapper().convertValue( |
|
|
|
JsonPath.read(responseContent, "$.result.has_more"), |
|
|
|
new TypeReference<Boolean>() {})).getOrElse(Boolean.FALSE); |
|
|
|
|