Commit a6359d66 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents 24e7a3f2 1d1e0d62
...@@ -205,6 +205,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -205,6 +205,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
String userId = ""; String userId = "";
if (dn.contains("uid")) { if (dn.contains("uid")) {
userId = dn.substring(4, dn.indexOf(",", 1)); userId = dn.substring(4, dn.indexOf(",", 1));
dn = dn.substring(dn.indexOf(",", 1) + 1);
} }
List<String> list = Arrays.asList(dn.split(",")).stream().filter(e -> (e.contains("ou=") && !e.equals("ou=wanxin"))).collect(Collectors.toList()); List<String> list = Arrays.asList(dn.split(",")).stream().filter(e -> (e.contains("ou=") && !e.equals("ou=wanxin"))).collect(Collectors.toList());
String deptName = list.get(0).replace("ou=", ""); String deptName = list.get(0).replace("ou=", "");
...@@ -214,7 +215,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -214,7 +215,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
if (null == sysDept) { if (null == sysDept) {
SysDept insertSysDept = new SysDept(); SysDept insertSysDept = new SysDept();
insertSysDept.setName(deptName); insertSysDept.setName(deptName);
insertSysDept.setParentId(CommonConstants.DEPT_TREE_ROOT_ID); insertSysDept.setParentId(0L);
insertSysDept.setDeptDn(dn); insertSysDept.setDeptDn(dn);
this.save(insertSysDept); this.save(insertSysDept);
} else { } else {
...@@ -227,21 +228,24 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -227,21 +228,24 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
if (null != sysDept) { if (null != sysDept) {
SysDept sysDeptCount = this.getOne(Wrappers.<SysDept>query().lambda().eq(SysDept::getDeptDn, dn)); SysDept sysDeptCount = this.getOne(Wrappers.<SysDept>query().lambda().eq(SysDept::getDeptDn, dn));
if (null == sysDeptCount) { if (null == sysDeptCount) {
SysDept insertSysDept = new SysDept(); if (StringUtils.isEmpty(userId)) {
insertSysDept.setName(deptName); SysDept insertSysDept = new SysDept();
insertSysDept.setParentId(sysDept.getDeptId()); insertSysDept.setName(deptName);
insertSysDept.setDeptDn(dn); insertSysDept.setParentId(sysDept.getDeptId());
this.save(insertSysDept); insertSysDept.setDeptDn(dn);
this.save(insertSysDept);
}
} else { } else {
if (StringUtils.isNotBlank(userId)) { if (!StringUtils.isEmpty(userId)) {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("userId",userId); map.put("userId",userId);
map.put("deptId",sysDeptCount.getDeptId()); map.put("deptId",sysDeptCount.getDeptId());
updUserList.add(map); updUserList.add(map);
}else {
sysDeptCount.setName(deptName);
sysDeptCount.setParentId(sysDept.getDeptId());
this.updateDeptById(sysDeptCount);
} }
sysDeptCount.setName(deptName);
sysDeptCount.setParentId(sysDept.getDeptId());
this.updateDeptById(sysDeptCount);
} }
} }
} catch (Exception e) { } catch (Exception e) {
......
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