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
5e6176c8
Commit
5e6176c8
authored
Dec 05, 2017
by
贷前—徐菲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改身份证号和姓名分开
parent
89832dd7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
23 deletions
+31
-23
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+7
-8
IUserDetailRepository.java
.../cn/quantgroup/xyqb/repository/IUserDetailRepository.java
+7
-2
UserDetailServiceImpl.java
...ntgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
+17
-13
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
5e6176c8
...
@@ -977,8 +977,8 @@ public class InnerController implements IBaseController {
...
@@ -977,8 +977,8 @@ public class InnerController implements IBaseController {
}
}
@RequestMapping
(
"/updateIdCard"
)
@RequestMapping
(
"/updateIdCard"
)
public
JsonResult
updateIdCard
(
@RequestParam
String
name
,
@RequestParam
String
idNo
,
@RequestParam
String
phone
No
,
public
JsonResult
updateIdCard
(
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
id
No
,
@RequestParam
String
reason
,
@RequestParam
String
content
)
{
@RequestParam
String
phoneNo
,
@RequestParam
String
reason
,
@RequestParam
String
content
)
{
//密文
//密文
if
(
null
!=
content
)
{
if
(
null
!=
content
)
{
content
=
content
.
replaceAll
(
" "
,
"+"
);
content
=
content
.
replaceAll
(
" "
,
"+"
);
...
@@ -987,17 +987,16 @@ public class InnerController implements IBaseController {
...
@@ -987,17 +987,16 @@ public class InnerController implements IBaseController {
if
(
null
==
str
||
!
str
.
equals
(
phoneNo
))
{
if
(
null
==
str
||
!
str
.
equals
(
phoneNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"解密有误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"解密有误"
,
null
);
}
}
if
(
StringUtils
.
isBlank
(
name
)
||
StringUtils
.
isBlank
(
idNo
)
||
StringUtils
.
isBlank
(
phoneNo
)
||
StringUtils
.
isBlank
(
reason
))
{
if
(
StringUtils
.
isBlank
(
name
)
&&
StringUtils
.
isBlank
(
idNo
)){
return
JsonResult
.
buildErrorStateResult
(
"不能全为空"
,
null
);
}
if
(
StringUtils
.
isBlank
(
phoneNo
)
||
StringUtils
.
isBlank
(
reason
))
{
return
JsonResult
.
buildErrorStateResult
(
"参数有误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"参数有误"
,
null
);
}
}
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
LOGGER
.
info
(
"手机号有误, phoneNo:{}"
,
phoneNo
);
LOGGER
.
info
(
"手机号有误, phoneNo:{}"
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误"
,
null
);
}
}
if
(!
ValidationUtil
.
validateChinese
(
name
))
{
LOGGER
.
info
(
"名字有误, name:{}"
,
name
);
return
JsonResult
.
buildErrorStateResult
(
"用户姓名错误"
,
null
);
}
int
affectedRows
=
userDetailService
.
updateIdCard
(
name
,
idNo
,
phoneNo
);
int
affectedRows
=
userDetailService
.
updateIdCard
(
name
,
idNo
,
phoneNo
);
LOGGER
.
info
(
"更新用户的信息,name;{},idNo:{},phoneNo:{},操作的理由reason:{},受影响的行数affectedRows:{}"
,
name
,
idNo
,
phoneNo
,
reason
,
affectedRows
);
LOGGER
.
info
(
"更新用户的信息,name;{},idNo:{},phoneNo:{},操作的理由reason:{},受影响的行数affectedRows:{}"
,
name
,
idNo
,
phoneNo
,
reason
,
affectedRows
);
ImmutableMap
.
Builder
<
String
,
String
>
builder
=
ImmutableMap
.
builder
();
ImmutableMap
.
Builder
<
String
,
String
>
builder
=
ImmutableMap
.
builder
();
...
@@ -1009,7 +1008,7 @@ public class InnerController implements IBaseController {
...
@@ -1009,7 +1008,7 @@ public class InnerController implements IBaseController {
LOGGER
.
info
(
"去清除函谷关的缓存"
);
LOGGER
.
info
(
"去清除函谷关的缓存"
);
Map
<
String
,
String
>
param
=
builder
.
build
();
Map
<
String
,
String
>
param
=
builder
.
build
();
httpService
.
get
(
hanguguanUrl
.
concat
(
"/innerapi/updateIdCard"
),
param
);
httpService
.
get
(
hanguguanUrl
.
concat
(
"/innerapi/updateIdCard"
),
param
);
return
JsonResult
.
buildSuccessResult
(
"修改用户身份证号成功"
,
affectedRows
);
return
JsonResult
.
buildSuccessResult
(
"修改用户身份证号
或姓名
成功"
,
affectedRows
);
}
}
@RequestMapping
(
"/forbiddenUserOrNot"
)
@RequestMapping
(
"/forbiddenUserOrNot"
)
...
...
src/main/java/cn/quantgroup/xyqb/repository/IUserDetailRepository.java
View file @
5e6176c8
...
@@ -42,6 +42,11 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>,J
...
@@ -42,6 +42,11 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>,J
@Transactional
@Transactional
@Modifying
@Modifying
@Query
(
value
=
"update user_detail set name=?1,id_no=?2,gender=?3 where phone_no=?4"
,
nativeQuery
=
true
)
@Query
(
value
=
"update user_detail set id_no=?1,gender=?2 where phone_no=?3"
,
nativeQuery
=
true
)
int
updateIdNoByPhoneNo
(
String
name
,
String
idNo
,
String
gender
,
String
phoneNo
);
int
updateIdNoByPhoneNo
(
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/impl/UserDetailServiceImpl.java
View file @
5e6176c8
...
@@ -3,11 +3,13 @@ package cn.quantgroup.xyqb.service.user.impl;
...
@@ -3,11 +3,13 @@ package cn.quantgroup.xyqb.service.user.impl;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.model.Gender
;
import
cn.quantgroup.xyqb.model.Gender
;
import
cn.quantgroup.xyqb.model.IdCardInfo
;
import
cn.quantgroup.xyqb.repository.IUserDetailRepository
;
import
cn.quantgroup.xyqb.repository.IUserDetailRepository
;
import
cn.quantgroup.xyqb.repository.IUserRepository
;
import
cn.quantgroup.xyqb.repository.IUserRepository
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.vo.UserDetailVO
;
import
cn.quantgroup.xyqb.service.user.vo.UserDetailVO
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -204,19 +206,21 @@ public class UserDetailServiceImpl implements IUserDetailService {
...
@@ -204,19 +206,21 @@ public class UserDetailServiceImpl implements IUserDetailService {
@Override
@Override
public
int
updateIdCard
(
String
name
,
String
idNo
,
String
phoneNo
)
{
public
int
updateIdCard
(
String
name
,
String
idNo
,
String
phoneNo
)
{
String
lastChar
=
""
;
UserDetail
userDetail
=
userDetailRepository
.
findByPhoneNo
(
phoneNo
);
if
(
idNo
.
length
()
==
18
)
{
if
(
null
!=
userDetail
)
{
lastChar
=
idNo
.
substring
(
16
,
17
).
toLowerCase
();
if
(!
StringUtils
.
isBlank
(
idNo
))
{
}
else
if
(
idNo
.
length
()
==
15
)
{
try
{
lastChar
=
idNo
.
substring
(
13
,
14
).
toLowerCase
();
IdCardInfo
idCardInfo
=
idCardService
.
getIdCardInfo
(
idNo
);
}
return
userDetailRepository
.
updateIdNoByPhoneNo
(
idCardInfo
.
getIdNo
(),
idCardInfo
.
getGender
().
ordinal
(),
phoneNo
);
// 判断男女
}
catch
(
ParseException
e
)
{
if
(
Integer
.
parseInt
(
lastChar
)
%
2
==
0
)
{
LOGGER
.
error
(
"用户的身份证错误,phoneNo:{},e:{}"
,
phoneNo
,
e
);
//女
return
0
;
return
userDetailRepository
.
updateIdNoByPhoneNo
(
name
,
idNo
,
"1"
,
phoneNo
);
}
}
else
{
}
//男
if
(!
StringUtils
.
isBlank
(
name
)
&&
ValidationUtil
.
validateChinese
(
name
))
{
return
userDetailRepository
.
updateIdNoByPhoneNo
(
name
,
idNo
,
"2"
,
phoneNo
);
return
userDetailRepository
.
updateNameByPhoneNo
(
name
,
phoneNo
);
}
}
}
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