Search in sources :

Example 6 with Department

use of com.jeecg.qywx.api.department.vo.Department in project kykms by mahonelau.

the class ThirdAppWechatEnterpriseServiceImpl method syncThirdAppDepartmentToLocal.

@Override
public SyncInfoVo syncThirdAppDepartmentToLocal(String ids) {
    SyncInfoVo syncInfo = new SyncInfoVo();
    String accessToken = this.getAccessToken();
    if (accessToken == null) {
        syncInfo.addFailInfo("accessToken获取失败!");
        return syncInfo;
    }
    // 获取企业微信所有的部门
    List<Department> departments = JwDepartmentAPI.getAllDepartment(accessToken);
    if (departments == null) {
        syncInfo.addFailInfo("企业微信部门信息获取失败!");
        return syncInfo;
    }
    String username = JwtUtil.getUserNameByToken(SpringContextUtils.getHttpServletRequest());
    // 将list转为tree
    List<JwDepartmentTreeVo> departmentTreeList = JwDepartmentTreeVo.listToTree(departments);
    // 递归同步部门
    this.syncDepartmentToLocalRecursion(departmentTreeList, null, username, syncInfo);
    return syncInfo;
}
Also used : SyncInfoVo(org.jeecg.modules.system.vo.thirdapp.SyncInfoVo) Department(com.jeecg.qywx.api.department.vo.Department) JwDepartmentTreeVo(org.jeecg.modules.system.vo.thirdapp.JwDepartmentTreeVo)

Aggregations

Department (com.jeecg.qywx.api.department.vo.Department)6 JwDepartmentTreeVo (org.jeecg.modules.system.vo.thirdapp.JwDepartmentTreeVo)6 SyncInfoVo (org.jeecg.modules.system.vo.thirdapp.SyncInfoVo)4 SysDepartTreeModel (org.jeecg.modules.system.model.SysDepartTreeModel)3