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;
}
Aggregations