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
0b8b24ca
Commit
0b8b24ca
authored
Oct 28, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
afdd390b
92bffdfd
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
175 additions
and
133 deletions
+175
-133
TCutsomerDataPermisson.java
.../plus/v1/yifu/archives/entity/TCutsomerDataPermisson.java
+7
-1
TCutsomerDataPermissonController.java
...archives/controller/TCutsomerDataPermissonController.java
+5
-6
TCutsomerDataPermissonMapper.java
...v1/yifu/archives/mapper/TCutsomerDataPermissonMapper.java
+0
-1
TCutsomerDataPermissonService.java
.../yifu/archives/service/TCutsomerDataPermissonService.java
+0
-1
TCutsomerDataPermissonMapper.xml
...rc/main/resources/mapper/TCutsomerDataPermissonMapper.xml
+6
-0
LdapUtil.java
...om/yifu/cloud/plus/v1/yifu/common/ldap/util/LdapUtil.java
+24
-72
TDispatchInfoServiceImpl.java
...v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
+9
-0
TPaymentInfoServiceImpl.java
.../v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
+2
-2
UserController.java
...u.cloud.plus.v1/yifu/admin/controller/UserController.java
+2
-1
SysDeptMapper.java
...m/yifu.cloud.plus.v1/yifu/admin/mapper/SysDeptMapper.java
+6
-0
SysUserService.java
...yifu.cloud.plus.v1/yifu/admin/service/SysUserService.java
+2
-1
SysDeptServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysDeptServiceImpl.java
+38
-22
SysUserServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysUserServiceImpl.java
+45
-26
SysDeptMapper.xml
...yifu-upms-biz/src/main/resources/mapper/SysDeptMapper.xml
+29
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TCutsomerDataPermisson.java
View file @
0b8b24ca
...
...
@@ -13,6 +13,7 @@ import org.hibernate.validator.constraints.Length;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
* 客户数据权限表
...
...
@@ -92,6 +93,11 @@ public class TCutsomerDataPermisson implements Serializable {
private
String
userDeptName
;
@ExcelIgnore
@Schema
(
description
=
"授权来源0ekp,1mvp,2mvp复制"
,
name
=
"type"
)
@Schema
(
description
=
"授权来源0ekp,1mvp,2mvp复制"
)
private
String
type
;
@TableField
(
exist
=
false
)
@ExcelIgnore
@Schema
(
description
=
"导出选中的行id数组"
)
private
List
<
String
>
idList
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TCutsomerDataPermissonController.java
View file @
0b8b24ca
...
...
@@ -14,7 +14,6 @@ import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.AllArgsConstructor
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Arrays
;
...
...
@@ -83,7 +82,7 @@ public class TCutsomerDataPermissonController {
**/
@Operation
(
description
=
"权限复制 权限同项目分配客服(wxhr:tsettledomain_assign_customerservice)"
)
@GetMapping
(
"/copy"
)
@PreAuthorize
(
"@pms.hasPermission('wxhr:
tsettledomain_assign_customerservice')"
)
//@PreAuthorize("@pms.hasPermission('
tsettledomain_assign_customerservice')")
public
R
<
String
>
insertForCopyCutsomerDataPermisson
(
String
[]
srcUser
,
String
[]
beUser
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
R
result
=
tCutsomerDataPermissonService
.
insertForCopyCutsomerDataPermisson
(
srcUser
,
beUser
,
user
);
...
...
@@ -112,7 +111,7 @@ public class TCutsomerDataPermissonController {
@Operation
(
description
=
"新增"
)
@SysLog
(
"新增客户数据权限表"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('wxhr:
tcutsomerdatapermisson_add')"
)
//@PreAuthorize("@pms.hasPermission('
tcutsomerdatapermisson_add')")
public
R
<
Boolean
>
save
(
@RequestBody
TCutsomerDataPermisson
tCutsomerDataPermisson
){
YifuUser
user
=
SecurityUtils
.
getUser
();
settleDomainService
.
removeSettleCache
(
user
,
Arrays
.
asList
(
tCutsomerDataPermisson
.
getUserId
()));
...
...
@@ -127,7 +126,7 @@ public class TCutsomerDataPermissonController {
@Operation
(
description
=
"修改"
)
@SysLog
(
"修改客户数据权限表"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('wxhr:
tcutsomerdatapermisson_edit')"
)
//@PreAuthorize("@pms.hasPermission('
tcutsomerdatapermisson_edit')")
public
R
<
Boolean
>
update
(
@RequestBody
TCutsomerDataPermisson
tCutsomerDataPermisson
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
settleDomainService
.
removeSettleCache
(
user
,
Arrays
.
asList
(
tCutsomerDataPermisson
.
getUserId
()));
...
...
@@ -139,10 +138,10 @@ public class TCutsomerDataPermissonController {
* @param id
* @return R
*/
@Operation
(
description
=
"删除(
wxhr:
tcutsomerdatapermisson_del)"
)
@Operation
(
description
=
"删除(tcutsomerdatapermisson_del)"
)
@SysLog
(
"删除客户数据权限表"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('wxhr:
tcutsomerdatapermisson_del')"
)
//@PreAuthorize("@pms.hasPermission('
tcutsomerdatapermisson_del')")
public
R
<
Boolean
>
removeById
(
@PathVariable
String
id
){
YifuUser
user
=
SecurityUtils
.
getUser
();
TCutsomerDataPermisson
tdp
=
tCutsomerDataPermissonService
.
getById
(
id
);
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TCutsomerDataPermissonMapper.java
View file @
0b8b24ca
...
...
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TCutsomerDataPermissonService.java
View file @
0b8b24ca
...
...
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TCutsomerDataPermissonMapper.xml
View file @
0b8b24ca
...
...
@@ -38,6 +38,12 @@
</sql>
<sql
id=
"where_getTCutsomerDataPermissonPage"
>
<if
test=
"tCutsomerDataPermisson != null"
>
<if
test=
"tCutsomerDataPermisson.idList != null"
>
AND a.id in
<foreach
item=
"idStr"
index=
"index"
collection=
"tCutsomerDataPermisson.idList"
open=
"("
separator=
","
close=
")"
>
#{idStr}
</foreach>
</if>
<if
test=
"tCutsomerDataPermisson.userNickName != null and tCutsomerDataPermisson.userNickName.trim() != ''"
>
AND a.USER_NICK_NAME like concat('%',#{tCutsomerDataPermisson.userNickName},'%')
</if>
...
...
yifu-common/yifu-common-ldap/src/main/java/com/yifu/cloud/plus/v1/yifu/common/ldap/util/LdapUtil.java
View file @
0b8b24ca
...
...
@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.common.ldap.util;
import
com.unboundid.ldap.sdk.*
;
import
com.unboundid.ldap.sdk.controls.SubentriesRequestControl
;
import
com.unboundid.util.Base64
;
import
com.yifu.cloud.plus.v1.yifu.common.ldap.config.LdapProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.ldap.entity.PersonVo
;
import
com.yifu.cloud.plus.v1.yifu.common.ldap.mapper.PersonAttributesMapper
;
...
...
@@ -10,15 +11,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.ldap.core.LdapTemplate
;
import
javax.naming.Context
;
import
javax.naming.NamingEnumeration
;
import
javax.naming.NamingException
;
import
javax.naming.directory.SearchControls
;
import
javax.naming.ldap.Control
;
import
javax.naming.ldap.InitialLdapContext
;
import
javax.naming.ldap.LdapContext
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.Hashtable
;
import
java.util.List
;
import
static
org
.
springframework
.
ldap
.
query
.
LdapQueryBuilder
.
query
;
...
...
@@ -33,10 +29,6 @@ public class LdapUtil {
@Autowired
private
LdapProperties
ldapProperties
;
private
static
LdapContext
ctx
=
null
;
private
static
final
Control
[]
connCtls
=
null
;
/**
* @return List<SearchResultEntry>
* @author huyc
...
...
@@ -64,71 +56,31 @@ public class LdapUtil {
}
// 校验用户名密码的方法
public
Boolean
authenticate
(
String
usr
,
String
pwd
)
{
boolean
valide
;
public
Boolean
authenticate
(
String
usr
,
String
pwd
)
throws
NoSuchAlgorithmException
{
if
(
pwd
==
null
||
""
.
equals
(
pwd
))
return
false
;
if
(
ctx
==
null
)
{
getCtx
();
}
String
userDN
=
getUserDN
(
usr
);
if
(
""
.
equals
(
userDN
)
||
userDN
==
null
)
{
return
false
;
}
try
{
ctx
.
addToEnvironment
(
Context
.
SECURITY_PRINCIPAL
,
userDN
);
ctx
.
addToEnvironment
(
Context
.
SECURITY_CREDENTIALS
,
pwd
);
ctx
.
reconnect
(
connCtls
);
valide
=
true
;
closeCtx
();
}
catch
(
NamingException
e
)
{
log
.
error
(
userDN
+
" is not authenticated"
);
valide
=
false
;
}
return
valide
;
}
public
void
getCtx
()
{
if
(
ctx
!=
null
)
{
return
;
}
Hashtable
<
String
,
String
>
env
=
new
Hashtable
<>();
env
.
put
(
Context
.
INITIAL_CONTEXT_FACTORY
,
"com.sun.jndi.ldap.LdapCtxFactory"
);
env
.
put
(
Context
.
PROVIDER_URL
,
"ldap://"
+
ldapProperties
.
getUrl
()
+
":"
+
ldapProperties
.
getPort
()
+
"/"
+
ldapProperties
.
getDn
());
env
.
put
(
Context
.
SECURITY_AUTHENTICATION
,
"simple"
);
env
.
put
(
Context
.
SECURITY_PRINCIPAL
,
ldapProperties
.
getUserName
());
env
.
put
(
Context
.
SECURITY_CREDENTIALS
,
ldapProperties
.
getPassword
());
try
{
// 链接ldap
ctx
=
new
InitialLdapContext
(
env
,
connCtls
);
}
catch
(
NamingException
e
)
{
e
.
printStackTrace
();
}
}
public
void
closeCtx
()
throws
NamingException
{
if
(
ctx
!=
null
)
ctx
.
close
();
}
public
String
getUserDN
(
String
uid
)
{
StringBuilder
userDN
=
new
StringBuilder
();
try
{
SearchControls
constraints
=
new
SearchControls
();
constraints
.
setSearchScope
(
SearchControls
.
SUBTREE_SCOPE
);
NamingEnumeration
<?>
en
=
ctx
.
search
(
""
,
"uid="
+
uid
,
constraints
);
while
(
en
!=
null
&&
en
.
hasMoreElements
())
{
Object
obj
=
en
.
nextElement
();
if
(
obj
instanceof
javax
.
naming
.
directory
.
SearchResult
)
{
javax
.
naming
.
directory
.
SearchResult
si
=
(
javax
.
naming
.
directory
.
SearchResult
)
obj
;
userDN
.
append
(
si
.
getName
());
userDN
.
append
(
","
).
append
(
ldapProperties
.
getDn
());
List
<
SearchResultEntry
>
entryList
=
this
.
getAllPersonNamesWithTraditionalWay
();
byte
[]
ldapPw
=
new
byte
[
0
];
for
(
SearchResultEntry
resultEntry:
entryList
){
if
(
resultEntry
.
getDN
().
contains
(
"uid="
+
usr
))
{
String
password
=
resultEntry
.
getAttributeValue
(
"userPassword"
);
if
(
null
!=
password
)
{
String
ldapPwd1
=
password
.
substring
(
5
);
ldapPw
=
Base64
.
decode
(
ldapPwd1
);
break
;
}
else
{
return
false
;
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
MessageDigest
md5
=
MessageDigest
.
getInstance
(
"MD5"
);
md5
.
update
(
pwd
.
getBytes
());
byte
[]
m
=
md5
.
digest
();
return
MessageDigest
.
isEqual
(
m
,
ldapPw
);
}
catch
(
ParseException
e
)
{
log
.
error
(
" is not authenticated"
);
}
return
userDN
.
toString
()
;
return
false
;
}
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
View file @
0b8b24ca
...
...
@@ -2588,6 +2588,15 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dispatch
.
setSettleDomainCode
(
setInfoVo
.
getDepartNo
());
dispatch
.
setBelongUnit
(
setInfoVo
.
getCustomerId
());
dispatch
.
setBelongUnitName
(
setInfoVo
.
getCustomerName
());
TEmployeeProject
temp
=
new
TEmployeeProject
();
temp
.
setDeptId
(
dispatch
.
getSettleDomain
());
temp
.
setEmpId
(
dispatch
.
getEmpId
());
R
<
TEmployeeProject
>
res
=
archivesDaprUtil
.
getTEmployeeProjectById
(
temp
);
if
(
Common
.
isNotNull
(
res
)){
if
(
Common
.
isNotNull
(
res
.
getData
().
getWorkingHours
()))
{
dispatch
.
setWorkingHours
(
res
.
getData
().
getWorkingHours
());
}
}
}
StringBuffer
temp
=
new
StringBuffer
();
if
(
Common
.
isNotNull
(
excel
.
getSocialReduceDate
())){
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
View file @
0b8b24ca
...
...
@@ -2332,8 +2332,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
socialParam
.
setFd_3af9ee3aa9c84a
(
CommonConstants
.
EMPTY_STRING
);
}
//实缴合计
if
(
Common
.
isNotNull
(
library
.
getS
umAll
()))
{
socialParam
.
setFd_3af9ee3c6bfc74
(
library
.
getS
umAll
().
toString
());
if
(
Common
.
isNotNull
(
library
.
getS
ocialSum
()))
{
socialParam
.
setFd_3af9ee3c6bfc74
(
library
.
getS
ocialSum
().
toString
());
}
else
{
socialParam
.
setFd_3af9ee3c6bfc74
(
CommonConstants
.
EMPTY_STRING
);
}
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/controller/UserController.java
View file @
0b8b24ca
...
...
@@ -42,6 +42,7 @@ import org.springframework.validation.BindingResult;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -254,7 +255,7 @@ public class UserController {
*/
@SysLog
(
"登录验证"
)
@PostMapping
(
"/ldapLogin"
)
public
R
<
Boolean
>
loginAuthentication
(
@RequestParam
String
userName
,
@RequestParam
String
password
)
{
public
R
<
Boolean
>
loginAuthentication
(
@RequestParam
String
userName
,
@RequestParam
String
password
)
throws
NoSuchAlgorithmException
{
return
userService
.
loginAuthentication
(
userName
,
password
);
}
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/mapper/SysDeptMapper.java
View file @
0b8b24ca
...
...
@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.admin.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -41,4 +42,9 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
List
<
String
>
selectDnList
();
SysDept
selectCountId
(
@Param
(
"deptId"
)
Long
deptId
);
int
updateDeptById
(
@Param
(
"dept"
)
SysDept
dept
);
SysDept
selectDeptDn
(
@Param
(
"deptDn"
)
String
deptDn
);
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/SysUserService.java
View file @
0b8b24ca
...
...
@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.validation.BindingResult
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -132,6 +133,6 @@ public interface SysUserService extends IService<SysUser> {
* 从ldap中验证登录用户
* @return R
*/
R
<
Boolean
>
loginAuthentication
(
String
userName
,
String
password
);
R
<
Boolean
>
loginAuthentication
(
String
userName
,
String
password
)
throws
NoSuchAlgorithmException
;
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysDeptServiceImpl.java
View file @
0b8b24ca
...
...
@@ -60,8 +60,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
private
final
LdapUtil
ldapUtil
;
private
final
SysDeptMapper
sysDeptMapper
;
private
final
SysUserMapper
sysUserMapper
;
/**
...
...
@@ -188,11 +186,11 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
//获取ldap所有的dn
List
<
String
>
entryDnList
=
entryList
.
stream
().
map
(
SearchResultEntry:
:
getDN
).
collect
(
Collectors
.
toList
());
//获取本地dept表中所有的dn
List
<
String
>
dnList
=
sysDept
Mapper
.
selectDnList
();
List
<
String
>
dnList
=
base
Mapper
.
selectDnList
();
List
<
String
>
delList
=
dnList
.
stream
().
filter
(
p
->
!
entryDnList
.
contains
(
p
)).
collect
(
Collectors
.
toList
());
//删除ldap中不存在的dn的数据
if
(!
delList
.
isEmpty
())
{
sysDept
Mapper
.
delete
(
Wrappers
.<
SysDept
>
query
().
lambda
().
in
(
SysDept:
:
getDeptDn
,
delList
));
base
Mapper
.
delete
(
Wrappers
.<
SysDept
>
query
().
lambda
().
in
(
SysDept:
:
getDeptDn
,
delList
));
}
List
<
Map
<
String
,
Object
>>
updUserList
=
new
ArrayList
<>();
for
(
SearchResultEntry
entry
:
entryList
)
{
...
...
@@ -206,35 +204,52 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
String
deptName
=
saveDnList
.
get
(
0
).
replace
(
"ou="
,
""
);
int
size
=
saveDnList
.
size
();
if
(
size
==
1
)
{
SysDept
sysDept
=
this
.
getOne
(
Wrappers
.<
SysDept
>
query
().
lambda
().
eq
(
SysDept:
:
getDeptDn
,
dn
)
);
SysDept
sysDept
=
baseMapper
.
selectDeptDn
(
dn
);
if
(
null
==
sysDept
)
{
SysDept
insertSysDept
=
new
SysDept
();
insertSysDept
.
setName
(
deptName
);
insertSysDept
.
setParentId
(
0L
);
if
(
Common
.
isNotNull
(
entry
.
getAttributeValue
(
"x-ouid"
)))
{
insertSysDept
.
setDeptId
(
Long
.
valueOf
(
entry
.
getAttributeValue
(
"x-ouid"
)));
if
(
StringUtils
.
isEmpty
(
userId
))
{
SysDept
ins
=
baseMapper
.
selectCountId
(
Long
.
valueOf
(
entry
.
getAttributeValue
(
"x-ouid"
)));
if
(
Common
.
isNotNull
(
ins
))
{
ins
.
setName
(
deptName
);
ins
.
setDeptDn
(
dn
);
baseMapper
.
updateDeptById
(
ins
);
}
else
{
SysDept
insertSysDept
=
new
SysDept
();
insertSysDept
.
setName
(
deptName
);
insertSysDept
.
setParentId
(
0L
);
insertSysDept
.
setDeptDn
(
dn
);
if
(
Common
.
isNotNull
(
entry
.
getAttributeValue
(
"x-ouid"
)))
{
insertSysDept
.
setDeptId
(
Long
.
valueOf
(
entry
.
getAttributeValue
(
"x-ouid"
)));
}
baseMapper
.
insert
(
insertSysDept
);
}
}
insertSysDept
.
setDeptDn
(
dn
);
this
.
save
(
insertSysDept
);
}
else
{
sysDept
.
setName
(
deptName
);
this
.
updateDeptById
(
sysDept
);
baseMapper
.
updateDeptById
(
sysDept
);
}
}
else
{
try
{
SysDept
sysDept
=
this
.
getOne
(
Wrappers
.<
SysDept
>
query
().
lambda
().
eq
(
SysDept:
:
getDeptDn
,
dn
.
substring
(
dn
.
indexOf
(
"ou="
,
2
),
dn
.
length
())));
if
(
null
!=
sysDept
)
{
SysDept
sysDeptCount
=
this
.
getOne
(
Wrappers
.<
SysDept
>
query
().
lambda
().
eq
(
SysDept:
:
getDeptDn
,
dn
)
);
SysDept
sysDeptCount
=
baseMapper
.
selectDeptDn
(
dn
);
if
(
null
==
sysDeptCount
)
{
if
(
StringUtils
.
isEmpty
(
userId
))
{
SysDept
insertSysDept
=
new
SysDept
();
insertSysDept
.
setName
(
deptName
);
insertSysDept
.
setParentId
(
sysDept
.
getDeptId
());
insertSysDept
.
setDeptDn
(
dn
);
if
(
Common
.
isNotNull
(
entry
.
getAttributeValue
(
"x-ouid"
)))
{
insertSysDept
.
setDeptId
(
Long
.
valueOf
(
entry
.
getAttributeValue
(
"x-ouid"
)));
SysDept
ins
=
baseMapper
.
selectCountId
(
Long
.
valueOf
(
entry
.
getAttributeValue
(
"x-ouid"
)));
if
(
Common
.
isNotNull
(
ins
))
{
ins
.
setName
(
deptName
);
ins
.
setDeptDn
(
dn
);
ins
.
setParentId
(
sysDept
.
getDeptId
());
baseMapper
.
updateDeptById
(
ins
);
}
else
{
SysDept
insertSysDept
=
new
SysDept
();
insertSysDept
.
setName
(
deptName
);
insertSysDept
.
setParentId
(
sysDept
.
getDeptId
());
insertSysDept
.
setDeptDn
(
dn
);
if
(
Common
.
isNotNull
(
entry
.
getAttributeValue
(
"x-ouid"
)))
{
insertSysDept
.
setDeptId
(
Long
.
valueOf
(
entry
.
getAttributeValue
(
"x-ouid"
)));
}
baseMapper
.
insert
(
insertSysDept
);
}
this
.
save
(
insertSysDept
);
}
}
else
{
if
(!
StringUtils
.
isEmpty
(
userId
))
{
...
...
@@ -246,7 +261,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
}
else
{
sysDeptCount
.
setName
(
deptName
);
sysDeptCount
.
setParentId
(
sysDept
.
getDeptId
());
this
.
updateDeptById
(
sysDeptCount
);
sysDeptCount
.
setDeptDn
(
dn
);
baseMapper
.
updateDeptById
(
sysDeptCount
);
}
}
}
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysUserServiceImpl.java
View file @
0b8b24ca
...
...
@@ -55,6 +55,7 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.Assert
;
import
org.springframework.validation.BindingResult
;
import
java.security.NoSuchAlgorithmException
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -82,8 +83,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
private
final
LdapUtil
ldapUtil
;
private
final
SysUserMapper
sysUserMapper
;
/**
* 保存用户信息
* @param userDto DTO 对象
...
...
@@ -431,10 +430,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
}
}
if
(!
updateList
.
isEmpty
())
{
sysUser
Mapper
.
batchUpdateUser
(
updateList
);
base
Mapper
.
batchUpdateUser
(
updateList
);
}
if
(!
insertList
.
isEmpty
())
{
sysUser
Mapper
.
batchInsertUser
(
insertList
);
base
Mapper
.
batchInsertUser
(
insertList
);
}
}
List
<
SearchResultEntry
>
entryList
=
ldapUtil
.
getAllPersonNamesWithTraditionalWay
();
...
...
@@ -455,38 +454,55 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
userId
=
dn
.
substring
(
4
,
dn
.
indexOf
(
","
,
1
));
dn
=
dn
.
substring
(
dn
.
indexOf
(
","
,
1
)
+
1
);
}
List
<
String
>
saveDnList
=
Arrays
.
stream
(
dn
.
split
(
","
)
).
filter
(
e
->
(
e
.
contains
(
"ou="
)
&&
!
e
.
equals
(
"ou=wanxin"
))).
collect
(
Collectors
.
toList
());
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
.
select
One
(
Wrappers
.<
SysDept
>
query
().
lambda
().
eq
(
SysDept:
:
getDeptDn
,
dn
)
);
SysDept
sysDept
=
sysDeptMapper
.
select
DeptDn
(
dn
);
if
(
null
==
sysDept
)
{
SysDept
insertSysDept
=
new
SysDept
();
insertSysDept
.
setName
(
deptName
);
insertSysDept
.
setParentId
(
0L
);
insertSysDept
.
setDeptDn
(
dn
);
if
(
Common
.
isNotNull
(
entry
.
getAttributeValue
(
"x-ouid"
)))
{
insertSysDept
.
setDeptId
(
Long
.
valueOf
(
entry
.
getAttributeValue
(
"x-ouid"
)));
if
(
StringUtils
.
isEmpty
(
userId
))
{
SysDept
ins
=
sysDeptMapper
.
selectCountId
(
Long
.
valueOf
(
entry
.
getAttributeValue
(
"x-ouid"
)));
if
(
Common
.
isNotNull
(
ins
))
{
ins
.
setName
(
deptName
);
ins
.
setDeptDn
(
dn
);
sysDeptMapper
.
updateDeptById
(
ins
);
}
else
{
SysDept
insertSysDept
=
new
SysDept
();
insertSysDept
.
setName
(
deptName
);
insertSysDept
.
setParentId
(
0L
);
insertSysDept
.
setDeptDn
(
dn
);
if
(
Common
.
isNotNull
(
entry
.
getAttributeValue
(
"x-ouid"
)))
{
insertSysDept
.
setDeptId
(
Long
.
valueOf
(
entry
.
getAttributeValue
(
"x-ouid"
)));
}
sysDeptMapper
.
insert
(
insertSysDept
);
}
}
sysDeptMapper
.
insert
(
insertSysDept
);
}
else
{
sysDept
.
setName
(
deptName
);
sysDeptMapper
.
updateById
(
sysDept
);
sysDeptMapper
.
update
Dept
ById
(
sysDept
);
}
}
else
{
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
.
select
One
(
Wrappers
.<
SysDept
>
query
().
lambda
().
eq
(
SysDept:
:
getDeptDn
,
dn
)
);
SysDept
sysDeptCount
=
sysDeptMapper
.
select
DeptDn
(
dn
);
if
(
null
==
sysDeptCount
)
{
if
(
StringUtils
.
isEmpty
(
userId
))
{
SysDept
insertSysDept
=
new
SysDept
();
insertSysDept
.
setName
(
deptName
);
insertSysDept
.
setParentId
(
sysDept
.
getDeptId
());
insertSysDept
.
setDeptDn
(
dn
);
if
(
Common
.
isNotNull
(
entry
.
getAttributeValue
(
"x-ouid"
)))
{
insertSysDept
.
setDeptId
(
Long
.
valueOf
(
entry
.
getAttributeValue
(
"x-ouid"
)));
SysDept
ins
=
sysDeptMapper
.
selectCountId
(
Long
.
valueOf
(
entry
.
getAttributeValue
(
"x-ouid"
)));
if
(
Common
.
isNotNull
(
ins
))
{
ins
.
setName
(
deptName
);
ins
.
setDeptDn
(
dn
);
ins
.
setParentId
(
sysDept
.
getDeptId
());
sysDeptMapper
.
updateDeptById
(
ins
);
}
else
{
SysDept
insertSysDept
=
new
SysDept
();
insertSysDept
.
setName
(
deptName
);
insertSysDept
.
setParentId
(
sysDept
.
getDeptId
());
insertSysDept
.
setDeptDn
(
dn
);
if
(
Common
.
isNotNull
(
entry
.
getAttributeValue
(
"x-ouid"
)))
{
insertSysDept
.
setDeptId
(
Long
.
valueOf
(
entry
.
getAttributeValue
(
"x-ouid"
)));
}
sysDeptMapper
.
insert
(
insertSysDept
);
}
sysDeptMapper
.
insert
(
insertSysDept
);
}
}
else
{
if
(!
StringUtils
.
isEmpty
(
userId
))
{
...
...
@@ -497,15 +513,18 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
updUserList
.
add
(
map
);
}
else
{
sysDeptCount
.
setName
(
deptName
);
sysDeptCount
.
setDeptDn
(
dn
);
sysDeptCount
.
setParentId
(
sysDept
.
getDeptId
());
sysDeptMapper
.
updateById
(
sysDeptCount
);
sysDeptMapper
.
update
Dept
ById
(
sysDeptCount
);
}
}
}
}
}
//更新用户信息
sysUserMapper
.
updateUser
(
updUserList
);
if
(!
updUserList
.
isEmpty
())
{
baseMapper
.
updateUser
(
updUserList
);
}
}
catch
(
Exception
e
)
{
log
.
info
(
"用户部门信息同步异常:"
+
e
.
getMessage
());
return
R
.
failed
(
"用户部门信息同步异常!"
);
...
...
@@ -518,8 +537,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
* @return R
*/
@Override
public
R
<
Boolean
>
loginAuthentication
(
String
userName
,
String
password
)
{
if
(
ldapUtil
.
authenticate
(
userName
,
password
))
{
public
R
<
Boolean
>
loginAuthentication
(
String
userName
,
String
password
)
throws
NoSuchAlgorithmException
{
if
(
Boolean
.
TRUE
.
equals
(
ldapUtil
.
authenticate
(
userName
,
password
)
))
{
return
R
.
ok
();
}
return
R
.
failed
(
"验证不通过"
);
...
...
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysDeptMapper.xml
View file @
0b8b24ca
...
...
@@ -38,4 +38,33 @@
WHERE a.del_flag = 0
AND a.dept_dn IS NOT NULL
</select>
<select
id=
"selectCountId"
resultType=
"com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept"
>
SELECT
*
from sys_dept a
<where>
a.dept_id = #{deptId}
</where>
</select>
<select
id=
"selectDeptDn"
resultType=
"com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept"
>
SELECT
*
from sys_dept a
<where>
a.dept_dn = #{deptDn}
</where>
</select>
<update
id=
"updateDeptById"
>
update sys_dept
<trim
prefix=
"set"
suffixOverrides=
","
>
<if
test=
"dept.name != null"
>
name=#{dept.name},
</if>
<if
test=
"dept.parentId != null"
>
parent_id=#{dept.parentId},
</if>
<if
test=
"dept.deptDn != null"
>
dept_dn=#{dept.deptDn},
</if>
update_time = now()
</trim>
WHERE dept_id=#{dept.deptId}
</update>
</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