Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
04c3e418
Commit
04c3e418
authored
Jun 20, 2022
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huyc 部门根节点数值修改
parent
b4adaeac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
7 deletions
+62
-7
SysDeptServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysDeptServiceImpl.java
+0
-2
SysUserServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysUserServiceImpl.java
+62
-5
No files found.
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysDeptServiceImpl.java
View file @
04c3e418
...
@@ -61,8 +61,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
...
@@ -61,8 +61,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
private
final
SysDeptRelationService
sysDeptRelationService
;
private
final
SysDeptRelationService
sysDeptRelationService
;
private
final
SysUserService
sysUserService
;
private
final
LdapUtil
ldapUtil
;
private
final
LdapUtil
ldapUtil
;
private
final
SysDeptMapper
sysDeptMapper
;
private
final
SysDeptMapper
sysDeptMapper
;
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysUserServiceImpl.java
View file @
04c3e418
...
@@ -80,14 +80,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
...
@@ -80,14 +80,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
private
final
SysUserRoleMapper
sysUserRoleMapper
;
private
final
SysUserRoleMapper
sysUserRoleMapper
;
private
final
SysUserPostMapper
sysUserPostMapper
;
private
final
LdapUtil
ldapUtil
;
private
final
LdapUtil
ldapUtil
;
private
final
SysUserMapper
sysUserMapper
;
private
final
SysUserMapper
sysUserMapper
;
private
final
SysDeptService
sysDeptService
;
/**
/**
* 保存用户信息
* 保存用户信息
* @param userDto DTO 对象
* @param userDto DTO 对象
...
@@ -432,7 +428,68 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
...
@@ -432,7 +428,68 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
sysUserMapper
.
batchInsertUser
(
insertList
);
sysUserMapper
.
batchInsertUser
(
insertList
);
}
}
}
}
sysDeptService
.
updateDeptByLdap
();
List
<
SearchResultEntry
>
entryList
=
ldapUtil
.
getAllPersonNamesWithTraditionalWay
();
//获取ldap所有的dn
List
<
String
>
entryDnList
=
entryList
.
stream
().
map
(
SearchResultEntry:
:
getDN
).
collect
(
Collectors
.
toList
());
//获取本地dept表中所有的dn
List
<
String
>
dnList
=
sysDeptMapper
.
selectDnList
();
List
<
String
>
delList
=
dnList
.
stream
().
filter
(
p
->
!
entryDnList
.
contains
(
p
)).
collect
(
Collectors
.
toList
());
//删除ldap中不存在的dn的数据
if
(
delList
.
size
()
>
0
)
{
sysDeptMapper
.
delete
(
Wrappers
.<
SysDept
>
query
().
lambda
().
in
(
SysDept:
:
getDeptDn
,
delList
));
}
List
<
Map
<
String
,
Object
>>
updUserList
=
new
ArrayList
<>();
for
(
SearchResultEntry
entry
:
entryList
)
{
String
dn
=
entry
.
getDN
();
String
userId
=
""
;
if
(
dn
.
contains
(
"uid"
))
{
userId
=
dn
.
substring
(
4
,
dn
.
indexOf
(
","
,
1
));
dn
=
dn
.
substring
(
dn
.
indexOf
(
","
,
1
)
+
1
);
}
List
<
String
>
saveDnList
=
Arrays
.
asList
(
dn
.
split
(
","
)).
stream
().
filter
(
e
->
(
e
.
contains
(
"ou="
)
&&
!
e
.
equals
(
"ou=wanxin"
))).
collect
(
Collectors
.
toList
());
String
deptName
=
saveDnList
.
get
(
0
).
replace
(
"ou="
,
""
);
int
size
=
saveDnList
.
size
();
if
(
size
==
1
)
{
SysDept
sysDept
=
sysDeptMapper
.
selectOne
(
Wrappers
.<
SysDept
>
query
().
lambda
().
eq
(
SysDept:
:
getDeptDn
,
dn
));
if
(
null
==
sysDept
)
{
SysDept
insertSysDept
=
new
SysDept
();
insertSysDept
.
setName
(
deptName
);
insertSysDept
.
setParentId
(
0L
);
insertSysDept
.
setDeptDn
(
dn
);
sysDeptMapper
.
insert
(
insertSysDept
);
}
else
{
sysDept
.
setName
(
deptName
);
sysDeptMapper
.
updateById
(
sysDept
);
}
}
else
if
(
size
>=
2
)
{
SysDept
sysDept
=
sysDeptMapper
.
selectOne
(
Wrappers
.<
SysDept
>
query
().
lambda
().
eq
(
SysDept:
:
getDeptDn
,
dn
.
substring
(
dn
.
indexOf
(
"ou="
,
2
),
dn
.
length
())));
if
(
null
!=
sysDept
)
{
SysDept
sysDeptCount
=
sysDeptMapper
.
selectOne
(
Wrappers
.<
SysDept
>
query
().
lambda
().
eq
(
SysDept:
:
getDeptDn
,
dn
));
if
(
null
==
sysDeptCount
)
{
if
(
StringUtils
.
isEmpty
(
userId
))
{
SysDept
insertSysDept
=
new
SysDept
();
insertSysDept
.
setName
(
deptName
);
insertSysDept
.
setParentId
(
sysDept
.
getDeptId
());
insertSysDept
.
setDeptDn
(
dn
);
sysDeptMapper
.
insert
(
insertSysDept
);
}
}
else
{
if
(!
StringUtils
.
isEmpty
(
userId
))
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"userId"
,
userId
);
map
.
put
(
"deptId"
,
sysDeptCount
.
getDeptId
());
updUserList
.
add
(
map
);
}
else
{
sysDeptCount
.
setName
(
deptName
);
sysDeptCount
.
setParentId
(
sysDept
.
getDeptId
());
sysDeptMapper
.
updateById
(
sysDeptCount
);
}
}
}
}
}
//更新用户信息
sysUserMapper
.
updateUser
(
updUserList
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
info
(
"用户部门信息同步异常:"
+
e
.
getMessage
());
log
.
info
(
"用户部门信息同步异常:"
+
e
.
getMessage
());
return
R
.
failed
(
"用户部门信息同步异常!"
);
return
R
.
failed
(
"用户部门信息同步异常!"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment