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
b4adaeac
Commit
b4adaeac
authored
Jun 20, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
08ad960b
3f796936
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
21 deletions
+33
-21
SysDeptServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysDeptServiceImpl.java
+3
-3
SysUserServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysUserServiceImpl.java
+29
-18
SysDataAuthMapper.xml
...-upms-biz/src/main/resources/mapper/SysDataAuthMapper.xml
+1
-0
No files found.
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysDeptServiceImpl.java
View file @
b4adaeac
...
...
@@ -207,9 +207,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
userId
=
dn
.
substring
(
4
,
dn
.
indexOf
(
","
,
1
));
dn
=
dn
.
substring
(
dn
.
indexOf
(
","
,
1
)
+
1
);
}
List
<
String
>
l
ist
=
Arrays
.
asList
(
dn
.
split
(
","
)).
stream
().
filter
(
e
->
(
e
.
contains
(
"ou="
)
&&
!
e
.
equals
(
"ou=wanxin"
))).
collect
(
Collectors
.
toList
());
String
deptName
=
l
ist
.
get
(
0
).
replace
(
"ou="
,
""
);
int
size
=
l
ist
.
size
();
List
<
String
>
saveDnL
ist
=
Arrays
.
asList
(
dn
.
split
(
","
)).
stream
().
filter
(
e
->
(
e
.
contains
(
"ou="
)
&&
!
e
.
equals
(
"ou=wanxin"
))).
collect
(
Collectors
.
toList
());
String
deptName
=
saveDnL
ist
.
get
(
0
).
replace
(
"ou="
,
""
);
int
size
=
saveDnL
ist
.
size
();
if
(
size
==
1
)
{
SysDept
sysDept
=
this
.
getOne
(
Wrappers
.<
SysDept
>
query
().
lambda
().
eq
(
SysDept:
:
getDeptDn
,
dn
));
if
(
null
==
sysDept
)
{
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysUserServiceImpl.java
View file @
b4adaeac
...
...
@@ -20,10 +20,12 @@ import cn.hutool.core.collection.CollUtil;
import
cn.hutool.core.util.ArrayUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.pig4cloud.plugin.excel.vo.ErrorMessage
;
import
com.unboundid.ldap.sdk.SearchResultEntry
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserDTO
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserInfo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.*
;
...
...
@@ -31,6 +33,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.util.ParamResolver;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserExcelVO
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO
;
import
com.yifu.cloud.plus.v1.yifu.admin.mapper.*
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptService
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysMenuService
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysUserService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
...
...
@@ -83,6 +86,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
private
final
SysUserMapper
sysUserMapper
;
private
final
SysDeptService
sysDeptService
;
/**
* 保存用户信息
* @param userDto DTO 对象
...
...
@@ -405,26 +410,32 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
*/
@Override
public
R
<
Boolean
>
updateByLdap
()
{
List
<
PersonVo
>
list
=
ldapUtil
.
getAllPersons
();
if
(
null
!=
list
)
{
List
<
SysUser
>
listUser
=
this
.
list
(
Wrappers
.<
SysUser
>
query
().
lambda
().
eq
(
SysUser:
:
getDelFlag
,
CommonConstants
.
STATUS_NORMAL
));
List
<
String
>
list1
=
listUser
.
stream
().
map
(
SysUser:
:
getUsername
).
collect
(
Collectors
.
toList
());
Map
<
String
,
String
>
map
=
listUser
.
stream
().
collect
(
HashMap:
:
new
,
(
m
,
v
)
->
m
.
put
(
v
.
getUsername
(),
v
.
getUserId
()),
HashMap:
:
putAll
);
List
<
PersonVo
>
updateList
=
new
ArrayList
<>();
List
<
PersonVo
>
insertList
=
new
ArrayList
<>();
for
(
PersonVo
personVo
:
list
)
{
if
(
list1
.
stream
().
anyMatch
(
e
->
e
.
equals
(
personVo
.
getUid
())))
{
updateList
.
add
(
personVo
);
}
else
{
insertList
.
add
(
personVo
);
try
{
List
<
PersonVo
>
list
=
ldapUtil
.
getAllPersons
();
if
(
null
!=
list
)
{
List
<
SysUser
>
listUser
=
this
.
list
(
Wrappers
.<
SysUser
>
query
().
lambda
().
eq
(
SysUser:
:
getDelFlag
,
CommonConstants
.
STATUS_NORMAL
));
List
<
String
>
list1
=
listUser
.
stream
().
map
(
SysUser:
:
getUsername
).
collect
(
Collectors
.
toList
());
Map
<
String
,
String
>
map
=
listUser
.
stream
().
collect
(
HashMap:
:
new
,
(
m
,
v
)
->
m
.
put
(
v
.
getUsername
(),
v
.
getUserId
()),
HashMap:
:
putAll
);
List
<
PersonVo
>
updateList
=
new
ArrayList
<>();
List
<
PersonVo
>
insertList
=
new
ArrayList
<>();
for
(
PersonVo
personVo
:
list
)
{
if
(
list1
.
stream
().
anyMatch
(
e
->
e
.
equals
(
personVo
.
getUid
())))
{
updateList
.
add
(
personVo
);
}
else
{
insertList
.
add
(
personVo
);
}
}
if
(
updateList
.
size
()
>
0
)
{
sysUserMapper
.
batchUpdateUser
(
updateList
);
}
if
(
insertList
.
size
()
>
0
)
{
sysUserMapper
.
batchInsertUser
(
insertList
);
}
}
if
(
updateList
.
size
()>
0
)
{
sysUserMapper
.
batchUpdateUser
(
updateList
);
}
if
(
insertList
.
size
()>
0
)
{
sysUserMapper
.
batchInsertUser
(
insertList
);
}
sysDeptService
.
updateDeptByLdap
();
}
catch
(
Exception
e
)
{
log
.
info
(
"用户部门信息同步异常:"
+
e
.
getMessage
());
return
R
.
failed
(
"用户部门信息同步异常!"
);
}
return
R
.
ok
();
}
...
...
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysDataAuthMapper.xml
View file @
b4adaeac
...
...
@@ -76,5 +76,6 @@
1=1
<include
refid=
"sysDataAuthMap_where"
/>
</where>
order by a.create_time desc
</select>
</mapper>
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