diff --git a/src/main/java/com/project/ding/utils/DingUtil.java b/src/main/java/com/project/ding/utils/DingUtil.java index 485940f..a65d421 100644 --- a/src/main/java/com/project/ding/utils/DingUtil.java +++ b/src/main/java/com/project/ding/utils/DingUtil.java @@ -20,6 +20,9 @@ public class DingUtil { @Autowired private DtService dtService; + + + public List getAllDepartment() throws Exception { return dtService.getDepartmentService().list(null , true); } @@ -36,7 +39,6 @@ public class DingUtil { } public List getUserIdInDepartment(Long id) throws Exception { - List 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 res = new ArrayList<>(Try.of(() -> new ObjectMapper().convertValue( JsonPath.read(responseContent, "$.result.list"), - new TypeReference>() {})).getOrElse(new ArrayList<>())); + new TypeReference>() { + })).getOrElse(new ArrayList<>())); + // 游标获取,hasMore判断是否存在下一页 Boolean hasMore = Try.of(() -> new ObjectMapper().convertValue( JsonPath.read(responseContent, "$.result.has_more"), new TypeReference() {})).getOrElse(Boolean.FALSE);