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
e1686bf4
Commit
e1686bf4
authored
Jul 25, 2018
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决重置实名信息失败时反馈成功bug
parent
30e9d3f7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
25 deletions
+35
-25
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+18
-8
IUserDetailRepository.java
.../cn/quantgroup/xyqb/repository/IUserDetailRepository.java
+2
-7
IUserDetailService.java
...a/cn/quantgroup/xyqb/service/user/IUserDetailService.java
+2
-4
UserDetailServiceImpl.java
...ntgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
+13
-6
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
e1686bf4
...
@@ -1296,15 +1296,17 @@ public class InnerController implements IBaseController {
...
@@ -1296,15 +1296,17 @@ public class InnerController implements IBaseController {
if
(
Objects
.
nonNull
(
userId
)
&&
ValidationUtil
.
validateChinese
(
name
))
{
if
(
Objects
.
nonNull
(
userId
)
&&
ValidationUtil
.
validateChinese
(
name
))
{
try
{
try
{
User
user
=
userService
.
findById
(
userId
);
User
user
=
userService
.
findById
(
userId
);
int
rows
=
userDetailService
.
updateIdCard
(
name
,
idNo
,
user
.
getPhoneNo
());
int
rows
=
userDetailService
.
update
NameAnd
IdCard
(
name
,
idNo
,
user
.
getPhoneNo
());
log
.
info
(
"重置用户实名信息,userId:{},name:{},idNo:{},result:[{}]"
,
userId
,
name
,
idNo
,
rows
);
log
.
info
(
"重置用户实名信息,userId:{},name:{},idNo:{},result:[{}]"
,
userId
,
name
,
idNo
,
rows
);
return
JsonResult
.
buildSuccessResult
(
"用户姓名已重置."
,
name
);
if
(
rows
>
0
){
return
JsonResult
.
buildSuccessResult
(
"用户实名信息已重置."
,
name
.
concat
(
","
).
concat
(
idNo
).
concat
(
","
).
concat
(
userId
.
toString
()));
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"用户
姓名
重置失败,userId[{}],name[{}],err:[{}]"
,
userId
,
name
,
e
);
log
.
error
(
"用户
实名信息
重置失败,userId[{}],name[{}],err:[{}]"
,
userId
,
name
,
e
);
}
}
return
JsonResult
.
buildErrorStateResult
(
"用户
姓名
重置失败."
,
"Error data"
);
return
JsonResult
.
buildErrorStateResult
(
"用户
实名信息
重置失败."
,
"Error data"
);
}
else
{
}
else
{
return
JsonResult
.
buildErrorStateResult
(
"用户
姓名
重置失败."
,
"Error data"
);
return
JsonResult
.
buildErrorStateResult
(
"用户
实名信息
重置失败."
,
"Error data"
);
}
}
}
}
...
@@ -1356,9 +1358,17 @@ public class InnerController implements IBaseController {
...
@@ -1356,9 +1358,17 @@ public class InnerController implements IBaseController {
log
.
info
(
"手机号有误, phoneNo:{}"
,
phoneNo
);
log
.
info
(
"手机号有误, phoneNo:{}"
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误"
,
null
);
}
}
int
affectedRows
=
userDetailService
.
updateIdCard
(
name
,
idNo
,
phoneNo
);
log
.
info
(
"重置用户实名信息 phoneNo:{},name:{},idNo:{}"
,
phoneNo
,
name
,
idNo
);
log
.
info
(
"更新用户的信息,name;{},idNo:{},phoneNo:{},操作的理由reason:{},受影响的行数affectedRows:{}"
,
name
,
idNo
,
phoneNo
,
reason
,
affectedRows
);
try
{
return
JsonResult
.
buildSuccessResult
(
"修改用户身份证号或姓名成功"
,
affectedRows
);
int
rows
=
userDetailService
.
updateNameAndIdCard
(
name
,
idNo
,
phoneNo
);
log
.
info
(
"重置用户实名信息,phoneNo:{},name:{},idNo:{},result:[{}],操作的理由reason:{}"
,
phoneNo
,
name
,
idNo
,
rows
,
reason
);
if
(
rows
>
0
){
return
JsonResult
.
buildSuccessResult
(
"用户实名信息已重置."
,
phoneNo
.
concat
(
","
).
concat
(
name
).
concat
(
","
).
concat
(
idNo
));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"用户实名信息重置失败,phoneNo[{}],name[{}],err:[{}]"
,
phoneNo
,
name
,
e
);
}
return
JsonResult
.
buildErrorStateResult
(
"用户实名信息重置失败."
,
"Error data"
);
}
}
/**
/**
...
...
src/main/java/cn/quantgroup/xyqb/repository/IUserDetailRepository.java
View file @
e1686bf4
...
@@ -49,13 +49,8 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>,
...
@@ -49,13 +49,8 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>,
@Transactional
@Transactional
@Modifying
@Modifying
@Query
(
value
=
"update user_detail set id_no=?1,gender=?2 where phone_no=?3"
,
nativeQuery
=
true
)
@Query
(
value
=
"update user_detail set name=?1,id_no=?2,gender=?3 where phone_no=?4"
,
nativeQuery
=
true
)
int
updateIdNoByPhoneNo
(
String
idNo
,
int
gender
,
String
phoneNo
);
int
updateNameAndIdNoByPhoneNo
(
String
name
,
String
idNo
,
int
gender
,
String
phoneNo
);
@Transactional
@Modifying
@Query
(
value
=
"update user_detail set name=?1 where phone_no=?2"
,
nativeQuery
=
true
)
int
updateNameByPhoneNo
(
String
name
,
String
phoneNo
);
/**
/**
* 按照身份证号和手机号 - 模糊查询
* 按照身份证号和手机号 - 模糊查询
...
...
src/main/java/cn/quantgroup/xyqb/service/user/IUserDetailService.java
View file @
e1686bf4
...
@@ -30,9 +30,7 @@ public interface IUserDetailService {
...
@@ -30,9 +30,7 @@ public interface IUserDetailService {
List
<
UserDetail
>
findByIdnos
(
List
<
String
>
idnos
);
List
<
UserDetail
>
findByIdnos
(
List
<
String
>
idnos
);
Page
<
UserDetail
>
getUserDetailsPage
(
List
<
Long
>
userId
,
List
<
String
>
phoneNos
,
List
<
String
>
idNos
,
int
pageNumber
,
int
pageSize
,
Page
<
UserDetail
>
getUserDetailsPage
(
List
<
Long
>
userId
,
List
<
String
>
phoneNos
,
List
<
String
>
idNos
,
int
pageNumber
,
int
pageSize
,
String
sortType
);
String
sortType
);
/**
/**
* 更新用户的身份证号
* 更新用户的身份证号
...
@@ -42,7 +40,7 @@ public interface IUserDetailService {
...
@@ -42,7 +40,7 @@ public interface IUserDetailService {
* @param phoneNo phoneNo
* @param phoneNo phoneNo
* @return 受影响的行数
* @return 受影响的行数
*/
*/
int
updateIdCard
(
String
name
,
String
idNo
,
String
phoneNo
);
int
update
NameAnd
IdCard
(
String
name
,
String
idNo
,
String
phoneNo
);
List
<
UserDetail
>
findByPhones
(
List
<
String
>
phoneNos
);
List
<
UserDetail
>
findByPhones
(
List
<
String
>
phoneNos
);
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
View file @
e1686bf4
...
@@ -196,19 +196,26 @@ public class UserDetailServiceImpl implements IUserDetailService {
...
@@ -196,19 +196,26 @@ public class UserDetailServiceImpl implements IUserDetailService {
}
}
@Override
@Override
public
int
updateIdCard
(
String
name
,
String
idNo
,
String
phoneNo
)
{
public
int
update
NameAnd
IdCard
(
String
name
,
String
idNo
,
String
phoneNo
)
{
UserDetail
userDetail
=
userDetailRepository
.
findByPhoneNo
(
phoneNo
);
UserDetail
userDetail
=
userDetailRepository
.
findByPhoneNo
(
phoneNo
);
if
(
null
!=
userDetail
)
{
if
(
null
!=
userDetail
)
{
String
newName
=
userDetail
.
getName
();
String
newIdNo
=
userDetail
.
getIdNo
();
Gender
newGender
=
Gender
.
UNKNOWN
;
if
(
ValidationUtil
.
validateChinese
(
name
))
{
newName
=
name
;
}
if
(
StringUtils
.
isNotBlank
(
idNo
))
{
if
(
StringUtils
.
isNotBlank
(
idNo
))
{
IdCardInfo
idCardInfo
=
idCardService
.
getIdCardInfo
(
idNo
);
IdCardInfo
idCardInfo
=
idCardService
.
getIdCardInfo
(
idNo
);
if
(
idCardInfo
==
null
||
!
idCardInfo
.
isValid
())
{
if
(
Objects
.
nonNull
(
idCardInfo
)
&&
idCardInfo
.
isValid
()){
newIdNo
=
idCardInfo
.
getIdNo
();
newGender
=
idCardInfo
.
getGender
();
}
else
{
log
.
error
(
"用户的身份证错误,phoneNo:{},idNo:{}"
,
phoneNo
,
idNo
);
log
.
error
(
"用户的身份证错误,phoneNo:{},idNo:{}"
,
phoneNo
,
idNo
);
return
0
;
}
}
return
userDetailRepository
.
updateIdNoByPhoneNo
(
idCardInfo
.
getIdNo
(),
Optional
.
ofNullable
(
idCardInfo
.
getGender
()).
orElse
(
Gender
.
UNKNOWN
).
ordinal
(),
phoneNo
);
}
}
if
(
StringUtils
.
isNotBlank
(
name
)
&&
ValidationUtil
.
validateChinese
(
name
))
{
if
(!
Objects
.
equals
(
newName
,
userDetail
.
getName
())
||
!
Objects
.
equals
(
newIdNo
,
userDetail
.
getIdNo
()))
{
return
userDetailRepository
.
updateName
ByPhoneNo
(
name
,
phoneNo
);
return
userDetailRepository
.
updateName
AndIdNoByPhoneNo
(
newName
,
newIdNo
,
Optional
.
ofNullable
(
newGender
).
orElse
(
Gender
.
UNKNOWN
).
ordinal
()
,
phoneNo
);
}
}
}
}
return
0
;
return
0
;
...
...
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