Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
7f4ecacf
Commit
7f4ecacf
authored
Mar 27, 2019
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
入参调整为非必传;身份证号掩码与手机号掩码撞库时,最多返回前20条匹配结果,若撞不到则返回空
parent
5de6b024
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
21 deletions
+29
-21
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+20
-19
IUserDetailRepository.java
.../cn/quantgroup/xyqb/repository/IUserDetailRepository.java
+1
-1
UserDetailServiceImpl.java
...ntgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
+1
-1
TestJdk8.java
src/test/java/common/TestJdk8.java
+7
-0
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
7f4ecacf
...
@@ -617,17 +617,18 @@ public class InnerController implements IBaseController {
...
@@ -617,17 +617,18 @@ public class InnerController implements IBaseController {
/**
/**
* 按照身份证号和手机号查询用户实名信息查询 - 模糊查询
* 按照身份证号和手机号查询用户实名信息查询 - 模糊查询
*
*
* @param phoneNo - 手机号
* @param phoneNo - 手机号
* @param idNo - 身份证号
* @param idNo - 身份证号
* @param userName - 用户姓名
* @return JsonResult<List < UserDetail>>
* @return JsonResult<List < UserDetail>>
*/
*/
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"按照身份证号和手机号查询用户实名信息查询 - 模糊查询"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"按照身份证号和手机号查询用户实名信息查询 - 模糊查询"
)
@RequestMapping
(
"/user_detail/fuzzyQuery"
)
@RequestMapping
(
"/user_detail/fuzzyQuery"
)
@TargetDataSource
(
type
=
DSType
.
SLAVE
)
@TargetDataSource
(
type
=
DSType
.
SLAVE
)
public
JsonResult
<
List
<
UserDetail
>>
fuzzyQueryUserDetailList
(
@ApiParam
(
value
=
"手机号"
)
@RequestParam
(
name
=
"phoneNo"
)
String
phoneNo
,
public
JsonResult
<
List
<
UserDetail
>>
fuzzyQueryUserDetailList
(
@ApiParam
(
value
=
"手机号"
)
String
phoneNo
,
@ApiParam
(
value
=
"身份证号"
)
@RequestParam
(
name
=
"idNo"
)
String
idNo
,
@ApiParam
(
value
=
"身份证号"
)
String
idNo
,
@ApiParam
(
value
=
"用户姓名"
)
@RequestParam
(
name
=
"userName"
)
String
userName
)
{
@ApiParam
(
value
=
"用户姓名"
)
String
userName
)
{
log
.
info
(
"fuzzyQueryUserDetailList, phone:{},idNo:{},
ip:{}"
,
phoneNo
,
idNo
,
getIp
());
log
.
info
(
"fuzzyQueryUserDetailList, phone:{},idNo:{},
userName:{},ip:{}"
,
phoneNo
,
idNo
,
userName
,
getIp
());
if
(
StringUtils
.
isBlank
(
phoneNo
)
&&
StringUtils
.
isBlank
(
idNo
))
{
if
(
StringUtils
.
isBlank
(
phoneNo
)
&&
StringUtils
.
isBlank
(
idNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"查询条件不能为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"查询条件不能为空"
,
null
);
}
}
...
@@ -638,22 +639,22 @@ public class InnerController implements IBaseController {
...
@@ -638,22 +639,22 @@ public class InnerController implements IBaseController {
int
idNoFullSize
=
18
;
int
idNoFullSize
=
18
;
boolean
phoneNoValid
=
phoneNo
.
length
()
>=
phoneNoMaskSize
||
ValidationUtil
.
validatePhoneNo
(
phoneNo
);
boolean
phoneNoValid
=
phoneNo
.
length
()
>=
phoneNoMaskSize
||
ValidationUtil
.
validatePhoneNo
(
phoneNo
);
boolean
idNoValid
=
idNo
.
length
()
>=
idNoMaskSize
||
Objects
.
equals
(
idNo
.
length
(),
idNoFullSize
);
boolean
idNoValid
=
idNo
.
length
()
>=
idNoMaskSize
||
Objects
.
equals
(
idNo
.
length
(),
idNoFullSize
);
if
(
phoneNoValid
&&
idNoValid
)
{
if
(!
phoneNoValid
&&
!
idNoValid
)
{
List
<
UserDetail
>
userDetailList
=
userDetailService
.
fuzzyQueryByPhoneNoAndIdNo
(
phoneNo
,
idNo
);
return
JsonResult
.
buildErrorStateResult
(
"查询条件不规范!"
,
null
);
if
(
StringUtils
.
isNotEmpty
(
userName
))
{
userDetailList
=
userDetailList
.
stream
().
filter
(
userDetail
->
userName
.
equals
(
userDetail
.
getName
())).
collect
(
Collectors
.
toList
());
}
return
JsonResult
.
buildSuccessResult
(
"success"
,
userDetailList
);
}
}
if
(!
phoneNoValid
&&
idNoValid
)
{
List
<
UserDetail
>
userDetailList
=
null
;
List
<
UserDetail
>
userDetailList
=
userDetailService
.
findByIdNoStartingWith
(
idNo
);
if
(
phoneNoValid
&&
idNoValid
)
{
return
JsonResult
.
buildSuccessResult
(
"success"
,
userDetailList
);
userDetailList
=
userDetailService
.
fuzzyQueryByPhoneNoAndIdNo
(
phoneNo
,
idNo
);
}
else
if
(
idNoValid
)
{
userDetailList
=
userDetailService
.
findByIdNoStartingWith
(
idNo
);
}
else
{
userDetailList
=
userDetailService
.
findByPhoneNoStartingWith
(
phoneNo
);
}
}
if
(
phoneNoValid
)
{
// 如果传入姓名,则进行过滤
List
<
UserDetail
>
userDetailList
=
userDetailService
.
findByPhoneNoStartingWith
(
phoneNo
);
if
(!
CollectionUtils
.
isEmpty
(
userDetailList
)
&&
StringUtils
.
isNotEmpty
(
userName
))
{
return
JsonResult
.
buildSuccessResult
(
"success"
,
userDetailList
);
userDetailList
=
userDetailList
.
stream
().
filter
(
userDetail
->
Objects
.
equals
(
userName
,
userDetail
.
getName
())).
collect
(
Collectors
.
toList
()
);
}
}
return
JsonResult
.
build
ErrorStateResult
(
"查询条件不规范!"
,
null
);
return
JsonResult
.
build
SuccessResult
(
"success"
,
userDetailList
);
}
}
@RequestMapping
(
"/user_ext_info/search/user_id"
)
@RequestMapping
(
"/user_ext_info/search/user_id"
)
...
...
src/main/java/cn/quantgroup/xyqb/repository/IUserDetailRepository.java
View file @
7f4ecacf
...
@@ -62,7 +62,7 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>,
...
@@ -62,7 +62,7 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>,
List
<
UserDetail
>
findByIdNoStartingWithLimit20
(
String
idNo
);
List
<
UserDetail
>
findByIdNoStartingWithLimit20
(
String
idNo
);
List
<
UserDetail
>
findByPhoneNoStartingWith
(
String
phoneNo
);
List
<
UserDetail
>
findByPhoneNoStartingWith
Limit20
(
String
phoneNo
);
List
<
UserDetail
>
findByIdBetween
(
Long
id
,
Long
endId
);
List
<
UserDetail
>
findByIdBetween
(
Long
id
,
Long
endId
);
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
View file @
7f4ecacf
...
@@ -127,7 +127,7 @@ public class UserDetailServiceImpl implements IUserDetailService {
...
@@ -127,7 +127,7 @@ public class UserDetailServiceImpl implements IUserDetailService {
@Override
@Override
public
List
<
UserDetail
>
findByPhoneNoStartingWith
(
String
phoneNo
)
{
public
List
<
UserDetail
>
findByPhoneNoStartingWith
(
String
phoneNo
)
{
return
userDetailRepository
.
findByPhoneNoStartingWith
(
phoneNo
);
return
userDetailRepository
.
findByPhoneNoStartingWith
Limit20
(
phoneNo
);
}
}
private
Specification
<
UserDetail
>
getSpecification
(
String
name
,
String
phoneNo
,
String
idNo
)
{
private
Specification
<
UserDetail
>
getSpecification
(
String
name
,
String
phoneNo
,
String
idNo
)
{
...
...
src/test/java/common/TestJdk8.java
View file @
7f4ecacf
...
@@ -2,6 +2,7 @@ package common;
...
@@ -2,6 +2,7 @@ package common;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.Constants
;
...
@@ -39,4 +40,10 @@ public class TestJdk8 {
...
@@ -39,4 +40,10 @@ public class TestJdk8 {
log
.
info
(
"50963791:{}"
,
content
);
log
.
info
(
"50963791:{}"
,
content
);
}
}
@Test
public
void
uuid
()
{
String
uuid
=
UUID
.
randomUUID
().
toString
();
log
.
info
(
"uuid:{}"
,
uuid
);
}
}
}
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