Commit 2622062e by qwmqiuwenmin

fix

parent fb975d3d
......@@ -490,27 +490,32 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
@Override
public void initwxDepartment(String corpid, String suiteid, String wxEnterpriseId) {
// List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listDepartment(corpid, suiteid, null);
// logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
//
// com.gic.wechat.api.dto.qywx.DepartmentDTO rootDepartment = null;
// for (com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list) {
// if("0".equals(departmentDTO.getParentid())){
// rootDepartment = departmentDTO;
// break;
// }
// }
//
// String parentId = addDepartment(rootDepartment, wxEnterpriseId, null,corpid,suiteid);
// List<com.gic.wechat.api.dto.qywx.DepartmentDTO> subList = new ArrayList<>();
// for (com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list) {
// if(rootDepartment.getId().equals(departmentDTO.getParentid())){
// subList.add(departmentDTO);
// }
// }
//
// DepartmentDTO parent = EntityUtil.changeEntityByJSON(DepartmentDTO.class,departmentService.selectById(parentId));
// this.addSon(subList, wxEnterpriseId, parent,corpid,suiteid);
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listDepartment(corpid, suiteid, null);
logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
com.gic.wechat.api.dto.qywx.DepartmentDTO rootDepartment = null;
for (com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list) {
if("0".equals(departmentDTO.getParentid())){
rootDepartment = departmentDTO;
break;
}
}
String parentId = addDepartment(rootDepartment, wxEnterpriseId, null,corpid,suiteid);
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> subList = new ArrayList<>();
for (com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list) {
if(rootDepartment.getId().equals(departmentDTO.getParentid())){
subList.add(departmentDTO);
}
if(CollectionUtils.isNotEmpty(list)){
this.addAllDepartment(list, 0, wxEnterpriseId, corpid, suiteid);
}
DepartmentDTO parent = EntityUtil.changeEntityByJSON(DepartmentDTO.class,departmentService.selectById(parentId));
this.addSon(subList, wxEnterpriseId, parent,corpid,suiteid);
}
public void addSon(List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list ,String wxEnterpriseId,DepartmentDTO parent,String corpid, String suiteid){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment