use of com.jeecg.qywx.api.department.vo.Department in project jeecg-boot by jeecgboot.
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;
}
use of com.jeecg.qywx.api.department.vo.Department in project kykms by mahonelau.
the class ThirdAppWechatEnterpriseServiceImpl method syncLocalDepartmentToThirdApp.
@Override
public boolean syncLocalDepartmentToThirdApp(String ids) {
String accessToken = this.getAccessToken();
if (accessToken == null) {
return false;
}
// 获取企业微信所有的部门
List<Department> departments = JwDepartmentAPI.getAllDepartment(accessToken);
if (departments == null) {
return false;
}
// 删除企业微信有但本地没有的部门(以本地部门数据为主)(以为企业微信不能创建同名部门,所以只能先删除)
List<JwDepartmentTreeVo> departmentTreeList = JwDepartmentTreeVo.listToTree(departments);
this.deleteDepartRecursion(departmentTreeList, accessToken, true);
// 获取本地所有部门树结构
List<SysDepartTreeModel> sysDepartsTree = sysDepartService.queryTreeList();
// -- 企业微信不能创建新的顶级部门,所以新的顶级部门的parentId就为1
Department parent = new Department();
parent.setId("1");
// 递归同步部门
departments = JwDepartmentAPI.getAllDepartment(accessToken);
this.syncDepartmentRecursion(sysDepartsTree, departments, parent, accessToken);
return true;
}
use of com.jeecg.qywx.api.department.vo.Department in project kms 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;
}
use of com.jeecg.qywx.api.department.vo.Department in project kms by mahonelau.
the class ThirdAppWechatEnterpriseServiceImpl method syncLocalDepartmentToThirdApp.
@Override
public boolean syncLocalDepartmentToThirdApp(String ids) {
String accessToken = this.getAccessToken();
if (accessToken == null) {
return false;
}
// 获取企业微信所有的部门
List<Department> departments = JwDepartmentAPI.getAllDepartment(accessToken);
if (departments == null) {
return false;
}
// 删除企业微信有但本地没有的部门(以本地部门数据为主)(以为企业微信不能创建同名部门,所以只能先删除)
List<JwDepartmentTreeVo> departmentTreeList = JwDepartmentTreeVo.listToTree(departments);
this.deleteDepartRecursion(departmentTreeList, accessToken, true);
// 获取本地所有部门树结构
List<SysDepartTreeModel> sysDepartsTree = sysDepartService.queryTreeList();
// -- 企业微信不能创建新的顶级部门,所以新的顶级部门的parentId就为1
Department parent = new Department();
parent.setId("1");
// 递归同步部门
departments = JwDepartmentAPI.getAllDepartment(accessToken);
this.syncDepartmentRecursion(sysDepartsTree, departments, parent, accessToken);
return true;
}
use of com.jeecg.qywx.api.department.vo.Department in project jeecg-boot by jeecgboot.
the class ThirdAppWechatEnterpriseServiceImpl method syncLocalDepartmentToThirdApp.
@Override
public SyncInfoVo syncLocalDepartmentToThirdApp(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;
}
// 删除企业微信有但本地没有的部门(以本地部门数据为主)(以为企业微信不能创建同名部门,所以只能先删除)
List<JwDepartmentTreeVo> departmentTreeList = JwDepartmentTreeVo.listToTree(departments);
this.deleteDepartRecursion(departmentTreeList, accessToken, true);
// 获取本地所有部门树结构
List<SysDepartTreeModel> sysDepartsTree = sysDepartService.queryTreeList();
// -- 企业微信不能创建新的顶级部门,所以新的顶级部门的parentId就为1
Department parent = new Department();
parent.setId("1");
// 递归同步部门
departments = JwDepartmentAPI.getAllDepartment(accessToken);
this.syncDepartmentRecursion(sysDepartsTree, departments, parent, accessToken);
return syncInfo;
}
Aggregations