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
0952200b
Commit
0952200b
authored
Mar 21, 2018
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug:保存用户详细信息只查userId不够用,增加了以下判定:1、与用户信息是否匹配,2、详情信息独立存在则进行关联,不独立存在则返回失败
parent
bb6b1aab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
11 deletions
+42
-11
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+24
-7
SyncUserController.java
...oup/xyqb/controller/external/user/SyncUserController.java
+6
-3
UserDetailController.java
...p/xyqb/controller/internal/user/UserDetailController.java
+12
-1
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
0952200b
...
@@ -263,20 +263,37 @@ public class InnerController implements IBaseController {
...
@@ -263,20 +263,37 @@ public class InnerController implements IBaseController {
if
(
Objects
.
isNull
(
info
)
||
!
info
.
isValid
())
{
if
(
Objects
.
isNull
(
info
)
||
!
info
.
isValid
())
{
return
JsonResult
.
buildErrorStateResult
(
"身份证号码错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"身份证号码错误"
,
null
);
}
}
User
user
=
userService
.
findById
(
userId
);
if
(
Objects
.
isNull
(
user
)){
return
JsonResult
.
buildErrorStateResult
(
"用户不存在"
,
null
);
}
else
if
(!
Objects
.
equals
(
user
.
getPhoneNo
(),
phoneNo
)){
return
JsonResult
.
buildErrorStateResult
(
"用户手机号不匹配"
,
null
);
}
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
/*
* 如果已存在记录,则更新
*/
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
userId
);
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
userId
);
Timestamp
time
=
new
Timestamp
(
System
.
currentTimeMillis
());
if
(
Objects
.
isNull
(
userDetail
)){
if
(
null
==
userDetail
)
{
userDetail
=
userDetailService
.
findByPhoneNo
(
phoneNo
);
userDetail
=
new
UserDetail
();
// 按手机号查出记录,如果userId非空,说明是存疑数据或是其他用户的信息,停止修改操作,返回失败
userDetail
.
setCreatedAt
(
time
);
if
(
Objects
.
nonNull
(
userDetail
)
&&
Objects
.
nonNull
(
userDetail
.
getUserId
())){
return
JsonResult
.
buildErrorStateResult
(
"手机号已使用."
,
null
);
}
}
}
if
(
id
!=
null
&&
id
>
0
)
{
if
(
Objects
.
isNull
(
userDetail
)){
userDetail
.
setId
(
id
);
userDetail
=
new
UserDetail
();
userDetail
.
setCreatedAt
(
now
);
// 这三行本不应出现,因为Service层没有提供按id查询UserDetail的方法,保留是为了兼容未知的旧有更新操作
if
(
id
!=
null
&&
id
>
0
)
{
userDetail
.
setId
(
id
);
}
}
}
userDetail
.
setUserId
(
userId
);
userDetail
.
setUserId
(
userId
);
userDetail
.
setName
(
name
);
userDetail
.
setName
(
name
);
userDetail
.
setPhoneNo
(
phoneNo
);
userDetail
.
setPhoneNo
(
phoneNo
);
userDetail
.
setIdNo
(
idNo
);
userDetail
.
setIdNo
(
idNo
);
userDetail
.
setUpdatedAt
(
time
);
userDetail
.
setUpdatedAt
(
now
);
userDetail
.
setIdType
(
IdType
.
ID_CARD
);
userDetail
.
setIdType
(
IdType
.
ID_CARD
);
userDetail
.
setGender
(
info
.
getGender
());
userDetail
.
setGender
(
info
.
getGender
());
userDetail
.
setEmail
(
email
);
userDetail
.
setEmail
(
email
);
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/user/SyncUserController.java
View file @
0952200b
...
@@ -86,14 +86,17 @@ public class SyncUserController {
...
@@ -86,14 +86,17 @@ public class SyncUserController {
if
(
Objects
.
isNull
(
user
)){
if
(
Objects
.
isNull
(
user
)){
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
}
userDetail
.
setId
(
null
);
userDetail
.
setUserId
(
user
.
getId
());
userDetail
.
setUserId
(
user
.
getId
());
/*
/*
* 如果已存在记录,则更新
* 如果已存在记录,则更新
*/
*/
UserDetail
theUserDetail
=
userDetailService
.
findBy
PhoneNo
(
phoneNo
);
UserDetail
theUserDetail
=
userDetailService
.
findBy
UserId
(
user
.
getId
()
);
if
(
Objects
.
isNull
(
theUserDetail
)){
if
(
Objects
.
isNull
(
theUserDetail
)){
theUserDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
theUserDetail
=
userDetailService
.
findByPhoneNo
(
phoneNo
);
// 按手机号查出记录,如果userId非空,说明是存疑数据或是其他用户的信息,停止修改操作,返回失败
if
(
Objects
.
nonNull
(
theUserDetail
)
&&
Objects
.
nonNull
(
theUserDetail
.
getUserId
())){
return
JsonResult
.
buildErrorStateResult
(
"手机号已使用."
,
null
);
}
}
}
if
(
Objects
.
isNull
(
theUserDetail
)){
if
(
Objects
.
isNull
(
theUserDetail
)){
userDetail
.
setId
(
null
);
userDetail
.
setId
(
null
);
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/UserDetailController.java
View file @
0952200b
...
@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.Objects
;
/**
/**
* Created by Miraculous on 2017/1/3.
* Created by Miraculous on 2017/1/3.
...
@@ -53,8 +54,18 @@ public class UserDetailController implements IBaseController {
...
@@ -53,8 +54,18 @@ public class UserDetailController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"系统错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"系统错误"
,
null
);
}
}
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
/*
* 如果已存在记录,则更新
*/
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
if
(
null
==
userDetail
)
{
if
(
Objects
.
isNull
(
userDetail
)){
userDetail
=
userDetailService
.
findByPhoneNo
(
user
.
getPhoneNo
());
// 按手机号查出记录,如果userId非空,说明是存疑数据或是其他用户的信息,停止修改操作,返回失败
if
(
Objects
.
nonNull
(
userDetail
)
&&
Objects
.
nonNull
(
userDetail
.
getUserId
())){
return
JsonResult
.
buildErrorStateResult
(
"手机号已使用."
,
null
);
}
}
if
(
Objects
.
isNull
(
userDetail
)){
userDetail
=
new
UserDetail
();
userDetail
=
new
UserDetail
();
userDetail
.
setCreatedAt
(
now
);
userDetail
.
setCreatedAt
(
now
);
}
}
...
...
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