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
706a9a2f
Commit
706a9a2f
authored
Jun 15, 2017
by
技术部—现金贷—曾丽宾
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
cc2e664d
b11614a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
121 deletions
+89
-121
LogCallHttpAspect.java
...n/quantgroup/xyqb/aspect/logcaller/LogCallHttpAspect.java
+0
-1
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+87
-119
UserServiceImpl.java
...cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
+1
-0
xyqb.properties
src/main/resources/config/dev/xyqb.properties
+1
-1
No files found.
src/main/java/cn/quantgroup/xyqb/aspect/logcaller/LogCallHttpAspect.java
View file @
706a9a2f
...
@@ -52,7 +52,6 @@ public class LogCallHttpAspect {
...
@@ -52,7 +52,6 @@ public class LogCallHttpAspect {
return
result
;
return
result
;
}
}
@Async
public
void
asyncRecordIt
(
ProceedingJoinPoint
pjp
,
Object
result
,
String
remoteIP
){
public
void
asyncRecordIt
(
ProceedingJoinPoint
pjp
,
Object
result
,
String
remoteIP
){
Object
[]
args
=
pjp
.
getArgs
();
Object
[]
args
=
pjp
.
getArgs
();
String
methodName
=
pjp
.
getSignature
().
getName
();
String
methodName
=
pjp
.
getSignature
().
getName
();
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
706a9a2f
package
cn
.
quantgroup
.
xyqb
.
controller
.
external
.
user
;
package
cn
.
quantgroup
.
xyqb
.
controller
.
external
.
user
;
import
cn.quantgroup.user.enums.*
;
import
cn.quantgroup.xyqb.aspect.logcaller.LogHttpCaller
;
import
cn.quantgroup.xyqb.aspect.logcaller.LogHttpCaller
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.entity.enumerate.*
;
import
cn.quantgroup.xyqb.entity.enumerate.EducationEnum
;
import
cn.quantgroup.xyqb.entity.enumerate.IncomeEnum
;
import
cn.quantgroup.xyqb.entity.enumerate.IncomeRangeEnum
;
import
cn.quantgroup.xyqb.entity.enumerate.MaritalStatus
;
import
cn.quantgroup.xyqb.entity.enumerate.OccupationEnum
;
import
cn.quantgroup.xyqb.entity.enumerate.Relation
;
import
cn.quantgroup.xyqb.model.*
;
import
cn.quantgroup.user.enums.*
;
import
cn.quantgroup.xyqb.model.*
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.entity.Address
;
import
cn.quantgroup.xyqb.entity.Address
;
import
cn.quantgroup.xyqb.entity.Contact
;
import
cn.quantgroup.xyqb.entity.Contact
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.User
;
...
@@ -22,12 +9,11 @@ import cn.quantgroup.xyqb.entity.UserDetail;
...
@@ -22,12 +9,11 @@ import cn.quantgroup.xyqb.entity.UserDetail;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
cn.quantgroup.xyqb.entity.UserSpouse
;
import
cn.quantgroup.xyqb.entity.UserSpouse
;
import
cn.quantgroup.xyqb.entity.WechatUserInfo
;
import
cn.quantgroup.xyqb.entity.WechatUserInfo
;
//import cn.quantgroup.xyqb.entity.enumerate.EducationEnum;
import
cn.quantgroup.xyqb.entity.enumerate.EducationEnum
;
//import cn.quantgroup.xyqb.entity.enumerate.IncomeEnum;
import
cn.quantgroup.xyqb.entity.enumerate.IncomeEnum
;
//import cn.quantgroup.xyqb.entity.enumerate.IncomeRangeEnum;
import
cn.quantgroup.xyqb.entity.enumerate.IncomeRangeEnum
;
//import cn.quantgroup.xyqb.entity.enumerate.MaritalStatus;
import
cn.quantgroup.xyqb.entity.enumerate.MaritalStatus
;
//import cn.quantgroup.xyqb.entity.enumerate.OccupationEnum;
import
cn.quantgroup.xyqb.entity.enumerate.OccupationEnum
;
//import cn.quantgroup.xyqb.entity.enumerate.Relation;
import
cn.quantgroup.xyqb.model.AddressRet
;
import
cn.quantgroup.xyqb.model.AddressRet
;
import
cn.quantgroup.xyqb.model.ContactRet
;
import
cn.quantgroup.xyqb.model.ContactRet
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.model.IdType
;
...
@@ -39,13 +25,18 @@ import cn.quantgroup.xyqb.model.UserSpouseRet;
...
@@ -39,13 +25,18 @@ import cn.quantgroup.xyqb.model.UserSpouseRet;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.http.IHttpService
;
import
cn.quantgroup.xyqb.service.http.IHttpService
;
import
cn.quantgroup.xyqb.service.session.ISessionService
;
import
cn.quantgroup.xyqb.service.session.ISessionService
;
import
cn.quantgroup.xyqb.service.user.*
;
import
cn.quantgroup.xyqb.service.user.IAddressService
;
import
cn.quantgroup.xyqb.service.user.IContactService
;
import
cn.quantgroup.xyqb.service.user.ILkbUserService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserExtInfoService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.user.IUserSpouseService
;
import
cn.quantgroup.xyqb.service.wechat.IWechatService
;
import
cn.quantgroup.xyqb.service.wechat.IWechatService
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
import
com.google.common.base.MoreObjects
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
...
@@ -56,6 +47,7 @@ import java.text.ParseException;
...
@@ -56,6 +47,7 @@ import java.text.ParseException;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
...
@@ -68,13 +60,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -68,13 +60,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.sql.Timestamp
;
//import cn.quantgroup.xyqb.entity.enumerate.EducationEnum;
import
java.text.ParseException
;
//import cn.quantgroup.xyqb.entity.enumerate.IncomeEnum;
import
java.util.Collections
;
//import cn.quantgroup.xyqb.entity.enumerate.IncomeRangeEnum;
import
java.util.List
;
//import cn.quantgroup.xyqb.entity.enumerate.MaritalStatus;
import
java.util.Map
;
//import cn.quantgroup.xyqb.entity.enumerate.OccupationEnum;
import
java.util.Random
;
//import cn.quantgroup.xyqb.entity.enumerate.Relation;
import
java.util.stream.Collectors
;
/**
/**
* Created by Miraculous on 2016/12/19.
* Created by Miraculous on 2016/12/19.
...
@@ -133,7 +124,18 @@ public class InnerController implements IBaseController {
...
@@ -133,7 +124,18 @@ public class InnerController implements IBaseController {
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
""
,
null
);
return
JsonResult
.
buildErrorStateResult
(
""
,
null
);
}
}
UserRet
userRet
=
UserRet
.
getUserRet
(
user
);
UserRet
userRet
=
new
UserRet
();
Long
createTimeStamp
=
user
.
getCreatedAt
().
getTime
();
Long
updateTimeStamp
=
user
.
getUpdatedAt
().
getTime
();
userRet
.
setId
(
user
.
getId
());
userRet
.
setPhoneNo
(
user
.
getPhoneNo
());
userRet
.
setEnable
(
user
.
getEnable
());
userRet
.
setPassword
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
defaultIfEmpty
(
user
.
getPassword
(),
""
));
userRet
.
setRegisteredFrom
(
user
.
getRegisteredFrom
());
userRet
.
setUuid
(
user
.
getUuid
());
userRet
.
setCreatedAt
(
createTimeStamp
);
userRet
.
setUpdatedAt
(
updateTimeStamp
);
return
JsonResult
.
buildSuccessResult
(
""
,
userRet
);
return
JsonResult
.
buildSuccessResult
(
""
,
userRet
);
}
}
...
@@ -157,11 +159,11 @@ public class InnerController implements IBaseController {
...
@@ -157,11 +159,11 @@ public class InnerController implements IBaseController {
}
}
List
<
Long
>
userIds
=
JSONObject
.
parseObject
(
userIdsString
,
new
TypeReference
<
List
<
Long
>>()
{
List
<
Long
>
userIds
=
JSONObject
.
parseObject
(
userIdsString
,
new
TypeReference
<
List
<
Long
>>()
{
});
});
if
(!
CollectionUtils
.
isEmpty
(
userIds
)
&&
userIds
.
size
()<=
500
)
{
if
(!
CollectionUtils
.
isEmpty
(
userIds
)
&&
userIds
.
size
()
<=
500
)
{
Map
<
Long
,
String
>
userIdAndPhoneMap
=
userService
.
findPhoneByIdsInDb
(
userIds
);
Map
<
Long
,
String
>
userIdAndPhoneMap
=
userService
.
findPhoneByIdsInDb
(
userIds
);
return
JsonResult
.
buildSuccessResult
(
""
,
userIdAndPhoneMap
);
return
JsonResult
.
buildSuccessResult
(
""
,
userIdAndPhoneMap
);
}
else
{
}
else
{
return
JsonResult
.
buildErrorStateResult
(
"批量查询每次最多进行500条用户信息的查询"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"批量查询每次最多进行500条用户信息的查询"
,
null
);
}
}
}
}
...
@@ -189,7 +191,7 @@ public class InnerController implements IBaseController {
...
@@ -189,7 +191,7 @@ public class InnerController implements IBaseController {
User
user
=
userService
.
findByPhoneWithCache
(
phoneNo
);
User
user
=
userService
.
findByPhoneWithCache
(
phoneNo
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
user
=
new
User
();
user
=
new
User
();
}
else
if
(!
user
.
getEnable
())
{
}
else
if
(!
user
.
getEnable
())
{
return
JsonResult
.
buildErrorStateResult
(
"用户已经注销"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户已经注销"
,
null
);
}
}
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isEmpty
(
user
.
getUuid
()))
{
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isEmpty
(
user
.
getUuid
()))
{
...
@@ -212,17 +214,10 @@ public class InnerController implements IBaseController {
...
@@ -212,17 +214,10 @@ public class InnerController implements IBaseController {
/**
/**
* 保存用户详细信息
* 保存用户详细信息
*
* @param userId
* @param phoneNo
* @param name
* @param idNo
* @param email
* @return
*/
*/
@RequestMapping
(
"/user_detail/save"
)
@RequestMapping
(
"/user_detail/save"
)
public
JsonResult
saveUserDetail
(
Long
userId
,
String
phoneNo
,
String
name
,
String
idNo
,
public
JsonResult
saveUserDetail
(
Long
userId
,
String
phoneNo
,
String
name
,
String
idNo
,
String
email
,
Long
id
)
{
String
email
,
Long
id
)
{
//参数验证
//参数验证
if
(
userId
==
null
||
userId
==
0L
)
{
if
(
userId
==
null
||
userId
==
0L
)
{
return
JsonResult
.
buildErrorStateResult
(
"用户id为空."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户id为空."
,
null
);
...
@@ -264,9 +259,6 @@ public class InnerController implements IBaseController {
...
@@ -264,9 +259,6 @@ public class InnerController implements IBaseController {
/**
/**
* 根据用户id查询用户的详细信息
* 根据用户id查询用户的详细信息
*
* @param userId
* @return
*/
*/
@RequestMapping
(
"/user_detail/search/userId"
)
@RequestMapping
(
"/user_detail/search/userId"
)
@LogHttpCaller
@LogHttpCaller
...
@@ -348,14 +340,12 @@ public class InnerController implements IBaseController {
...
@@ -348,14 +340,12 @@ public class InnerController implements IBaseController {
for
(
Contact
c
:
contacts
)
{
for
(
Contact
c
:
contacts
)
{
c
.
setId
(
null
);
c
.
setId
(
null
);
c
.
setUserId
(
userId
);
c
.
setUserId
(
userId
);
c
.
setRelation
(
c
.
getRelation
()
==
null
?
cn
.
quantgroup
.
user
.
enums
.
Relation
.
OTHER
:
c
.
getRelation
());
c
.
setRelation
(
c
.
getRelation
()
==
null
?
cn
.
quantgroup
.
user
.
enums
.
Relation
.
OTHER
:
c
.
getRelation
());
c
.
setCreatedAt
(
now
);
c
.
setCreatedAt
(
now
);
c
.
setUpdateAt
(
now
);
c
.
setUpdateAt
(
now
);
}
}
}
}
@RequestMapping
(
"/address/search/user_id"
)
@RequestMapping
(
"/address/search/user_id"
)
public
JsonResult
findAddressByUserId
(
Long
userId
)
{
public
JsonResult
findAddressByUserId
(
Long
userId
)
{
if
(
userId
==
null
)
{
if
(
userId
==
null
)
{
...
@@ -395,7 +385,6 @@ public class InnerController implements IBaseController {
...
@@ -395,7 +385,6 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
null
,
AddressRet
.
address2AddressRet
(
addressObj
));
return
JsonResult
.
buildSuccessResult
(
null
,
AddressRet
.
address2AddressRet
(
addressObj
));
}
}
@RequestMapping
(
"/user_ext_info/update"
)
@RequestMapping
(
"/user_ext_info/update"
)
public
JsonResult
updateMarryStatus
(
public
JsonResult
updateMarryStatus
(
Long
userId
,
IncomeEnum
incomeEnum
,
IncomeRangeEnum
incomeRangeEnum
,
Long
userId
,
IncomeEnum
incomeEnum
,
IncomeRangeEnum
incomeRangeEnum
,
...
@@ -444,7 +433,7 @@ public class InnerController implements IBaseController {
...
@@ -444,7 +433,7 @@ public class InnerController implements IBaseController {
@LogHttpCaller
@LogHttpCaller
public
JsonResult
searchUserDetailList
(
String
name
,
String
phoneNo
,
String
idNo
)
{
public
JsonResult
searchUserDetailList
(
String
name
,
String
phoneNo
,
String
idNo
)
{
LOGGER
.
info
(
"searchUserDetailList ,param.name:{},phone:{},idNo:{},ip:{}"
,
name
,
phoneNo
,
idNo
,
getIp
());
LOGGER
.
info
(
"searchUserDetailList ,param.name:{},phone:{},idNo:{},ip:{}"
,
name
,
phoneNo
,
idNo
,
getIp
());
if
(
StringUtils
.
isBlank
(
name
)
&&
StringUtils
.
isBlank
(
phoneNo
)
&&
StringUtils
.
isBlank
(
idNo
))
{
if
(
StringUtils
.
isBlank
(
name
)
&&
StringUtils
.
isBlank
(
phoneNo
)
&&
StringUtils
.
isBlank
(
idNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"至少必须满足一个条件不为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"至少必须满足一个条件不为空"
,
null
);
}
}
...
@@ -453,18 +442,18 @@ public class InnerController implements IBaseController {
...
@@ -453,18 +442,18 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult("success", userDetails);*/
return JsonResult.buildSuccessResult("success", userDetails);*/
ImmutableMap
.
Builder
<
String
,
String
>
builder
=
ImmutableMap
.
builder
();
ImmutableMap
.
Builder
<
String
,
String
>
builder
=
ImmutableMap
.
builder
();
if
(
StringUtils
.
isNotBlank
(
name
))
{
if
(
StringUtils
.
isNotBlank
(
name
))
{
builder
.
put
(
"name"
,
name
);
builder
.
put
(
"name"
,
name
);
}
}
if
(
StringUtils
.
isNotBlank
(
phoneNo
))
{
if
(
StringUtils
.
isNotBlank
(
phoneNo
))
{
builder
.
put
(
"phoneNo"
,
phoneNo
);
builder
.
put
(
"phoneNo"
,
phoneNo
);
}
}
if
(
StringUtils
.
isNotBlank
(
idNo
))
{
if
(
StringUtils
.
isNotBlank
(
idNo
))
{
builder
.
put
(
"idNo"
,
idNo
);
builder
.
put
(
"idNo"
,
idNo
);
}
}
Map
<
String
,
String
>
param
=
builder
.
build
();
Map
<
String
,
String
>
param
=
builder
.
build
();
String
s
=
httpService
.
get
(
queryUrl
.
concat
(
"/innerapi/user_detail/search_list"
),
param
);
String
s
=
httpService
.
get
(
queryUrl
.
concat
(
"/innerapi/user_detail/search_list"
),
param
);
return
JSON
.
parseObject
(
s
,
JsonResult
.
class
);
return
JSON
.
parseObject
(
s
,
JsonResult
.
class
);
}
}
@RequestMapping
(
"/user_ext_info/search/user_id"
)
@RequestMapping
(
"/user_ext_info/search/user_id"
)
...
@@ -522,7 +511,7 @@ public class InnerController implements IBaseController {
...
@@ -522,7 +511,7 @@ public class InnerController implements IBaseController {
sessionService
.
deleteByUserId
(
userId
);
sessionService
.
deleteByUserId
(
userId
);
}
}
LOGGER
.
info
(
"去清除函谷关的缓存"
);
LOGGER
.
info
(
"去清除函谷关的缓存"
);
httpService
.
get
(
hanguguanUrl
.
concat
(
"/innerapi/disableUserCache"
),
ImmutableMap
.
of
(
"phone"
,
user
.
getPhoneNo
()));
httpService
.
get
(
hanguguanUrl
.
concat
(
"/innerapi/disableUserCache"
),
ImmutableMap
.
of
(
"phone"
,
user
.
getPhoneNo
()));
return
JsonResult
.
buildSuccessResult
(
"用户已禁用."
,
user
.
getEnable
()
==
false
);
return
JsonResult
.
buildSuccessResult
(
"用户已禁用."
,
user
.
getEnable
()
==
false
);
}
}
...
@@ -567,128 +556,109 @@ public class InnerController implements IBaseController {
...
@@ -567,128 +556,109 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
null
,
UserSpouseRet
.
getUserSpouseRet
(
userSpouse
));
return
JsonResult
.
buildSuccessResult
(
null
,
UserSpouseRet
.
getUserSpouseRet
(
userSpouse
));
}
}
@RequestMapping
(
"/user/findByPhones"
)
@RequestMapping
(
"/user/findByPhones"
)
public
JsonResult
getUserIdByPhones
(
@RequestParam
(
"userPhones"
)
String
userPhones
)
{
public
JsonResult
getUserIdByPhones
(
@RequestParam
(
"userPhones"
)
String
userPhones
)
{
if
(
StringUtils
.
isBlank
(
userPhones
))
{
if
(
StringUtils
.
isBlank
(
userPhones
))
{
return
JsonResult
.
buildErrorStateResult
(
"传入用户手机号不可为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"传入用户手机号不可为空"
,
null
);
}
}
List
<
String
>
phones
=
JSONObject
.
parseObject
(
userPhones
,
new
TypeReference
<
List
<
String
>>()
{
List
<
String
>
phones
=
JSONObject
.
parseObject
(
userPhones
,
new
TypeReference
<
List
<
String
>>()
{
});
});
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
phones
))
{
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
phones
))
{
if
(!(
phones
.
size
()>
500
))
{
if
(!(
phones
.
size
()
>
500
))
{
List
<
User
>
users
=
userService
.
findByPhones
(
phones
);
List
<
User
>
users
=
userService
.
findByPhones
(
phones
);
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
users
))
{
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
users
))
{
return
JsonResult
.
buildSuccessResult
(
null
,
users
.
stream
().
collect
(
Collectors
.
toMap
(
User:
:
getPhoneNo
,
User:
:
getId
)));
return
JsonResult
.
buildSuccessResult
(
null
,
users
.
stream
().
collect
(
Collectors
.
toMap
(
User:
:
getPhoneNo
,
User:
:
getId
)));
}
else
{
}
else
{
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
}
}
}
}
return
JsonResult
.
buildErrorStateResult
(
"单次批量查询不可超过500个手机号"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"单次批量查询不可超过500个手机号"
,
null
);
}
}
return
JsonResult
.
buildErrorStateResult
(
"传入用户手机号不可为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"传入用户手机号不可为空"
,
null
);
}
}
/**
/**
* 重置密码接口,供内部人员使用(例如绝影)
* 重置密码接口,供内部人员使用(例如绝影)
* @param key
* @param phone
* @return
*/
*/
@RequestMapping
(
"/user/password/reset/{key}/{phone}"
)
@RequestMapping
(
"/user/password/reset/{key}/{phone}"
)
public
JsonResult
resetPassword
(
@PathVariable
(
"key"
)
String
key
,
@PathVariable
(
"phone"
)
String
phone
)
{
public
JsonResult
resetPassword
(
@PathVariable
(
"key"
)
String
key
,
@PathVariable
(
"phone"
)
String
phone
)
{
LOGGER
.
info
(
"密码重置请求,phone:[{}]"
,
phone
);
LOGGER
.
info
(
"密码重置请求,phone:[{}]"
,
phone
);
if
(
StringUtils
.
isBlank
(
key
))
{
if
(
StringUtils
.
isBlank
(
key
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户密码重置失败."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户密码重置失败."
,
null
);
}
}
if
(!
"ecf75c1f-2ccb-4661-8e4b-2874c0f45a2b"
.
equalsIgnoreCase
(
key
))
{
if
(!
"ecf75c1f-2ccb-4661-8e4b-2874c0f45a2b"
.
equalsIgnoreCase
(
key
))
{
LOGGER
.
error
(
"密码重置失败,key错误!@!,phone:[{}]"
,
phone
);
LOGGER
.
error
(
"密码重置失败,key错误!@!,phone:[{}]"
,
phone
);
return
JsonResult
.
buildErrorStateResult
(
"用户密码重置失败."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户密码重置失败."
,
null
);
}
}
try
{
try
{
userService
.
resetPassword
(
phone
,
"123456"
);
//默认重置的密码是123456
userService
.
resetPassword
(
phone
,
"123456"
);
//默认重置的密码是123456
return
JsonResult
.
buildSuccessResult
(
"用户密码已重置."
,
"null"
);
return
JsonResult
.
buildSuccessResult
(
"用户密码已重置."
,
"null"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"密码重置失败,phone[{}],err:[{}]"
,
phone
,
e
);
LOGGER
.
error
(
"密码重置失败,phone[{}],err:[{}]"
,
phone
,
e
);
}
}
return
JsonResult
.
buildErrorStateResult
(
"用户密码重置失败."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户密码重置失败."
,
null
);
}
}
/**
/**
* 保存用户信息,地址信息,联系人信息
* 保存用户信息,地址信息,联系人信息
* @param registeredFrom
* @param channelId
* @param phoneNo
* @param name
* @param idNo
* @param provinceCode
* @param cityCode
* @param districtCode
* @param address
* @param contacts
* @return
*/
*/
@RequestMapping
(
"/user/save_multi"
)
@RequestMapping
(
"/user/save_multi"
)
public
JsonResult
saveMulti
(
public
JsonResult
saveMulti
(
String
registeredFrom
,
String
registeredFrom
,
String
channelId
,
String
channelId
,
String
phoneNo
,
String
phoneNo
,
String
name
,
String
name
,
String
idNo
,
String
idNo
,
String
provinceCode
,
String
provinceCode
,
String
province
,
String
province
,
String
cityCode
,
String
cityCode
,
String
city
,
String
city
,
String
districtCode
,
String
districtCode
,
String
district
,
String
district
,
String
address
,
String
address
,
String
contacts
)
{
String
contacts
)
{
LOGGER
.
info
(
"保存用户、联系人、地址信息:registeredFrom:[{}], phoneNo[{}],name[{}],idNo[{}],provinceCode[{}],cityCode[{}],districtCode[{}],"
+
LOGGER
.
info
(
"保存用户、联系人、地址信息:registeredFrom:[{}], phoneNo[{}],name[{}],idNo[{}],provinceCode[{}],cityCode[{}],districtCode[{}],"
+
"address[{}],contacts[{}]"
,
registeredFrom
,
phoneNo
,
name
,
idNo
,
provinceCode
,
cityCode
,
districtCode
,
address
,
contacts
);
"address[{}],contacts[{}]"
,
registeredFrom
,
phoneNo
,
name
,
idNo
,
provinceCode
,
cityCode
,
districtCode
,
address
,
contacts
);
if
(!
NumberUtils
.
isDigits
(
registeredFrom
))
{
if
(!
NumberUtils
.
isDigits
(
registeredFrom
))
{
return
JsonResult
.
buildErrorStateResult
(
"注册渠道异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"注册渠道异常."
,
null
);
}
}
if
(!
NumberUtils
.
isDigits
(
phoneNo
))
{
if
(!
NumberUtils
.
isDigits
(
phoneNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"手机号异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"手机号异常."
,
null
);
}
}
if
(
StringUtils
.
isBlank
(
name
))
{
if
(
StringUtils
.
isBlank
(
name
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户名异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户名异常."
,
null
);
}
}
if
(!
NumberUtils
.
isDigits
(
idNo
))
{
if
(!
NumberUtils
.
isDigits
(
idNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户身份证号异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户身份证号异常."
,
null
);
}
}
if
(!
NumberUtils
.
isDigits
(
provinceCode
))
{
if
(!
NumberUtils
.
isDigits
(
provinceCode
))
{
return
JsonResult
.
buildErrorStateResult
(
"省份编号异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"省份编号异常."
,
null
);
}
}
if
(
StringUtils
.
isBlank
(
province
))
{
if
(
StringUtils
.
isBlank
(
province
))
{
return
JsonResult
.
buildErrorStateResult
(
"省份异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"省份异常."
,
null
);
}
}
if
(!
NumberUtils
.
isDigits
(
cityCode
))
{
if
(!
NumberUtils
.
isDigits
(
cityCode
))
{
return
JsonResult
.
buildErrorStateResult
(
"城市编号异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"城市编号异常."
,
null
);
}
}
if
(
StringUtils
.
isBlank
(
city
))
{
if
(
StringUtils
.
isBlank
(
city
))
{
return
JsonResult
.
buildErrorStateResult
(
"城市异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"城市异常."
,
null
);
}
}
if
(!
NumberUtils
.
isDigits
(
districtCode
))
{
if
(!
NumberUtils
.
isDigits
(
districtCode
))
{
return
JsonResult
.
buildErrorStateResult
(
"区县编号异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"区县编号异常."
,
null
);
}
}
if
(
StringUtils
.
isBlank
(
district
))
{
if
(
StringUtils
.
isBlank
(
district
))
{
return
JsonResult
.
buildErrorStateResult
(
"区县异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"区县异常."
,
null
);
}
}
if
(
StringUtils
.
isBlank
(
address
))
{
if
(
StringUtils
.
isBlank
(
address
))
{
return
JsonResult
.
buildErrorStateResult
(
"详细地址异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"详细地址异常."
,
null
);
}
}
channelId
=
MoreObjects
.
firstNonNull
(
channelId
,
"-1"
);
channelId
=
MoreObjects
.
firstNonNull
(
channelId
,
"-1"
);
// 验证用户是否已存在
// 验证用户是否已存在
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
if
(
null
!=
user
)
{
if
(
null
!=
user
)
{
return
JsonResult
.
buildErrorStateResult
(
"用户已存在,手机号被占用"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户已存在,手机号被占用"
,
null
);
}
}
...
@@ -696,7 +666,6 @@ public class InnerController implements IBaseController {
...
@@ -696,7 +666,6 @@ public class InnerController implements IBaseController {
UserRet
userRet
=
UserRet
.
getUserRet
(
user
);
UserRet
userRet
=
UserRet
.
getUserRet
(
user
);
return
JsonResult
.
buildSuccessResult
(
null
,
userRet
);
return
JsonResult
.
buildSuccessResult
(
null
,
userRet
);
}
}
@RequestMapping
(
"/user/register"
)
@RequestMapping
(
"/user/register"
)
...
@@ -713,5 +682,4 @@ public class InnerController implements IBaseController {
...
@@ -713,5 +682,4 @@ public class InnerController implements IBaseController {
}
}
return
JsonResult
.
buildSuccessResult
(
null
,
UserRet
.
getUserRet
(
user
));
return
JsonResult
.
buildSuccessResult
(
null
,
UserRet
.
getUserRet
(
user
));
}
}
}
}
\ No newline at end of file
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
View file @
706a9a2f
...
@@ -81,6 +81,7 @@ public class UserServiceImpl implements IUserService {
...
@@ -81,6 +81,7 @@ public class UserServiceImpl implements IUserService {
private
final
static
Random
random
=
new
Random
();
private
final
static
Random
random
=
new
Random
();
@Override
@Override
@Cacheable
(
value
=
"usercache"
,
key
=
"'xyqbuser' + #phone"
,
unless
=
"#result == null"
,
cacheManager
=
"cacheManager"
)
public
User
findByPhoneInDb
(
String
phone
)
{
public
User
findByPhoneInDb
(
String
phone
)
{
return
userRepository
.
findByPhoneNo
(
phone
);
return
userRepository
.
findByPhoneNo
(
phone
);
}
}
...
...
src/main/resources/config/dev/xyqb.properties
View file @
706a9a2f
...
@@ -3,7 +3,7 @@ configserver.disable=1
...
@@ -3,7 +3,7 @@ configserver.disable=1
configserver.system
=
xyqb-user
configserver.system
=
xyqb-user
#xyqb.data.mysql.jdbc-url=jdbc:mysql://192.168.4.22:3306/xyqb_user?useUnicode=true&characterEncoding=UTF8
#xyqb.data.mysql.jdbc-url=jdbc:mysql://192.168.4.22:3306/xyqb_user?useUnicode=true&characterEncoding=UTF8
xyqb.data.mysql.jdbc-url
=
jdbc:mysql://192.168.4.
16
3:3306/xyqb_user?useUnicode=true&characterEncoding=UTF8
xyqb.data.mysql.jdbc-url
=
jdbc:mysql://192.168.4.
2
3:3306/xyqb_user?useUnicode=true&characterEncoding=UTF8
xyqb.data.mysql.password
=
qatest
xyqb.data.mysql.password
=
qatest
...
...
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