Search in sources :

Example 1 with PageResult

use of com.jeecg.dingtalk.api.core.vo.PageResult in project kms by mahonelau.

the class ThirdAppDingtalkServiceImpl method getUserListByDeptIdRecursion.

/**
 * 递归查询所有用户
 */
private void getUserListByDeptIdRecursion(int deptId, int cursor, List<User> userList, String accessToken) {
    // 根据钉钉部门查询所有钉钉用户,用于反向同步到本地
    GetUserListBody getUserListBody = new GetUserListBody(deptId, cursor, 100);
    Response<PageResult<User>> response = JdtUserAPI.getUserListByDeptId(getUserListBody, accessToken);
    if (response.isSuccess()) {
        PageResult<User> page = response.getResult();
        userList.addAll(page.getList());
        if (page.getHas_more()) {
            this.getUserListByDeptIdRecursion(deptId, page.getNext_cursor(), userList, accessToken);
        }
    }
}
Also used : User(com.jeecg.dingtalk.api.user.vo.User) GetUserListBody(com.jeecg.dingtalk.api.user.body.GetUserListBody) PageResult(com.jeecg.dingtalk.api.core.vo.PageResult)

Example 2 with PageResult

use of com.jeecg.dingtalk.api.core.vo.PageResult in project kykms by mahonelau.

the class ThirdAppDingtalkServiceImpl method getUserListByDeptIdRecursion.

/**
 * 递归查询所有用户
 */
private void getUserListByDeptIdRecursion(int deptId, int cursor, List<User> userList, String accessToken) {
    // 根据钉钉部门查询所有钉钉用户,用于反向同步到本地
    GetUserListBody getUserListBody = new GetUserListBody(deptId, cursor, 100);
    Response<PageResult<User>> response = JdtUserAPI.getUserListByDeptId(getUserListBody, accessToken);
    if (response.isSuccess()) {
        PageResult<User> page = response.getResult();
        userList.addAll(page.getList());
        if (page.getHas_more()) {
            this.getUserListByDeptIdRecursion(deptId, page.getNext_cursor(), userList, accessToken);
        }
    }
}
Also used : User(com.jeecg.dingtalk.api.user.vo.User) GetUserListBody(com.jeecg.dingtalk.api.user.body.GetUserListBody) PageResult(com.jeecg.dingtalk.api.core.vo.PageResult)

Example 3 with PageResult

use of com.jeecg.dingtalk.api.core.vo.PageResult in project jeecg-boot by jeecgboot.

the class ThirdAppDingtalkServiceImpl method getUserListByDeptIdRecursion.

/**
 * 递归查询所有用户
 */
private void getUserListByDeptIdRecursion(int deptId, int cursor, List<User> userList, String accessToken) {
    // 根据钉钉部门查询所有钉钉用户,用于反向同步到本地
    GetUserListBody getUserListBody = new GetUserListBody(deptId, cursor, 100);
    Response<PageResult<User>> response = JdtUserAPI.getUserListByDeptId(getUserListBody, accessToken);
    if (response.isSuccess()) {
        PageResult<User> page = response.getResult();
        userList.addAll(page.getList());
        if (page.getHas_more()) {
            this.getUserListByDeptIdRecursion(deptId, page.getNext_cursor(), userList, accessToken);
        }
    }
}
Also used : ContactUser(com.jeecg.dingtalk.api.oauth2.vo.ContactUser) User(com.jeecg.dingtalk.api.user.vo.User) GetUserListBody(com.jeecg.dingtalk.api.user.body.GetUserListBody) PageResult(com.jeecg.dingtalk.api.core.vo.PageResult)

Aggregations

PageResult (com.jeecg.dingtalk.api.core.vo.PageResult)3 GetUserListBody (com.jeecg.dingtalk.api.user.body.GetUserListBody)3 User (com.jeecg.dingtalk.api.user.vo.User)3 ContactUser (com.jeecg.dingtalk.api.oauth2.vo.ContactUser)1