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
257e66d7
Commit
257e66d7
authored
Dec 26, 2018
by
xiaoguang.xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 重复注册动作默认给返回已注册的信息, 2. 保存用户后快速刷新到数据库
parent
375f11d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
AppController.java
...antgroup/xyqb/controller/external/user/AppController.java
+15
-12
UserServiceImpl.java
...cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
+1
-1
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/AppController.java
View file @
257e66d7
package
cn
.
quantgroup
.
xyqb
.
controller
.
external
.
user
;
package
cn
.
quantgroup
.
xyqb
.
controller
.
external
.
user
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
cn.quantgroup.xyqb.aspect.accessable.IpValidator
;
import
cn.quantgroup.xyqb.aspect.accessable.IpValidator
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.entity.Merchant
;
import
cn.quantgroup.xyqb.entity.Merchant
;
...
@@ -26,6 +15,16 @@ import cn.quantgroup.xyqb.service.session.ISessionService;
...
@@ -26,6 +15,16 @@ import cn.quantgroup.xyqb.service.session.ISessionService;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.util.IPUtil
;
import
cn.quantgroup.xyqb.util.IPUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.persistence.PersistenceException
;
import
javax.servlet.http.HttpServletRequest
;
import
static
cn
.
quantgroup
.
xyqb
.
constant
.
UserConstant
.
USER_ERROR_OR_PASSWORD_ERROR
;
import
static
cn
.
quantgroup
.
xyqb
.
constant
.
UserConstant
.
USER_ERROR_OR_PASSWORD_ERROR
;
...
@@ -132,7 +131,11 @@ public class AppController implements IBaseController {
...
@@ -132,7 +131,11 @@ public class AppController implements IBaseController {
LOGGER
.
info
(
"第三方用户登录 [AppController] loginSuper --> loginFrom:{},phoneNo:{},appChannel:{},channelId:{},btRegisterChannelId:{} requestIp:{},idNo:{},name:{}"
,
registerFrom
,
phoneNo
,
appChannel
,
channelId
,
btRegisterChannelId
,
IPUtil
.
getRemoteIP
(
request
),
idNo
,
name
);
LOGGER
.
info
(
"第三方用户登录 [AppController] loginSuper --> loginFrom:{},phoneNo:{},appChannel:{},channelId:{},btRegisterChannelId:{} requestIp:{},idNo:{},name:{}"
,
registerFrom
,
phoneNo
,
appChannel
,
channelId
,
btRegisterChannelId
,
IPUtil
.
getRemoteIP
(
request
),
idNo
,
name
);
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
user
=
userRegisterService
.
register
(
registerFrom
,
phoneNo
,
idNo
,
name
,
channelId
,
btRegisterChannelId
);
try
{
user
=
userRegisterService
.
register
(
registerFrom
,
phoneNo
,
idNo
,
name
,
channelId
,
btRegisterChannelId
);
}
catch
(
PersistenceException
e
)
{
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
}
}
}
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
USER_ERROR_OR_PASSWORD_ERROR
,
null
);
return
JsonResult
.
buildErrorStateResult
(
USER_ERROR_OR_PASSWORD_ERROR
,
null
);
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
View file @
257e66d7
...
@@ -86,7 +86,7 @@ public class UserServiceImpl implements IUserService {
...
@@ -86,7 +86,7 @@ public class UserServiceImpl implements IUserService {
@Override
@Override
@CacheEvict
(
value
=
"usercache"
,
key
=
"'xyqbuser' + #user.phoneNo"
,
cacheManager
=
"cacheManager"
)
@CacheEvict
(
value
=
"usercache"
,
key
=
"'xyqbuser' + #user.phoneNo"
,
cacheManager
=
"cacheManager"
)
public
User
saveUser
(
User
user
)
{
public
User
saveUser
(
User
user
)
{
return
userRepository
.
save
(
user
);
return
userRepository
.
save
AndFlush
(
user
);
}
}
@Override
@Override
...
...
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