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
784af0ce
Commit
784af0ce
authored
Apr 16, 2020
by
杨锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 查询用户全量信息 for koala.
parent
07eb517b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
189 additions
and
9 deletions
+189
-9
InnerController.java
...tgroup/xyqb/controller/internal/user/InnerController.java
+19
-6
UserFullResp.java
...roup/xyqb/controller/internal/user/resp/UserFullResp.java
+94
-0
IUserService.java
...in/java/cn/quantgroup/xyqb/service/user/IUserService.java
+12
-1
UserServiceImpl.java
...cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
+64
-2
No files found.
src/main/java/cn/quantgroup/xyqb/controller/internal/user/InnerController.java
View file @
784af0ce
...
...
@@ -6,6 +6,7 @@ import cn.quantgroup.user.enums.*;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.aspect.accessable.IpValidator
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.controller.internal.user.resp.UserFullResp
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.exception.UserNotExistException
;
import
cn.quantgroup.xyqb.model.*
;
...
...
@@ -593,7 +594,7 @@ public class InnerController implements IBaseController {
* @param name - 姓名
* @param phoneNo - 手机号
* @param idNo - 身份证号
* @return JsonResult<List
<
UserDetail>>
* @return JsonResult<List
<
UserDetail>>
*/
@RequestMapping
(
"/user_detail/search_list"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"按照姓名、份证号或手机号查询用户实名信息 - 精确查询,供客服用,不限制入参正确性"
)
...
...
@@ -613,7 +614,7 @@ public class InnerController implements IBaseController {
* @param phoneNo - 手机号
* @param idNo - 身份证号
* @param userName - 用户姓名
* @return JsonResult<List
<
UserDetail>>
* @return JsonResult<List
<
UserDetail>>
*/
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"按照身份证号和手机号查询用户实名信息查询 - 模糊查询"
)
@RequestMapping
(
"/user_detail/fuzzyQuery"
)
...
...
@@ -778,7 +779,7 @@ public class InnerController implements IBaseController {
}
@ApiResponses
({
@ApiResponse
(
code
=
HttpStatus
.
SC_OK
,
message
=
"Nice!"
,
responseContainer
=
"UserAssociationModel = {Long id, String uuid, String phoneNo, String idNo, String name, String gender, String marryStatus, String educationEnum, String occupationEnum, String qq, Long registerFrom, Long merchantId, List<AddressModel> addressList, List<ContactModel> contactList}"
),
@ApiResponse
(
code
=
HttpStatus
.
SC_OK
,
message
=
"Nice!"
,
responseContainer
=
"UserAssociationModel = {Long id, String uuid, String phoneNo, String idNo, String name, String gender, String marryStatus, String educationEnum, String occupationEnum, String qq, Long registerFrom, Long merchantId, List<AddressModel> addressList, List<ContactModel> contactList}"
),
@ApiResponse
(
code
=
HttpStatus
.
SC_BAD_REQUEST
,
message
=
"Invalid params supplied"
,
response
=
cn
.
quantgroup
.
xyqb
.
model
.
ApiResponse
.
class
),
@ApiResponse
(
code
=
HttpStatus
.
SC_NOT_FOUND
,
message
=
"User not found"
,
response
=
cn
.
quantgroup
.
xyqb
.
model
.
ApiResponse
.
class
)
})
...
...
@@ -799,6 +800,17 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
""
,
bean
);
}
/**
* 查询用户全量信息 for koala
*
* @param userId 用户id
* @return
*/
@GetMapping
(
"/user-full/search/userId"
)
public
JsonResult
<
UserFullResp
>
findUserFullSearchByUserId
(
@RequestParam
Long
userId
)
{
return
JsonResult
.
buildSuccessResultGeneric
(
userService
.
findUserFullSearchByUserId
(
userId
));
}
@RequestMapping
(
"/user-association/search/phone"
)
public
JsonResult
findUserAssociationByPhone
(
String
phoneNo
)
{
UserDetail
userDetail
=
userDetailService
.
findByPhoneNo
(
phoneNo
);
...
...
@@ -1098,7 +1110,8 @@ public class InnerController implements IBaseController {
List
<
Contact
>
contactList
=
null
;
// 目前对空白字符串和null值容错,因是api调用,不考虑对非法格式容错(会阻断注册)
if
(
StringUtils
.
isNotBlank
(
contacts
))
{
contactList
=
JSONObject
.
parseObject
(
contacts
,
new
TypeReference
<
List
<
Contact
>>()
{});
contactList
=
JSONObject
.
parseObject
(
contacts
,
new
TypeReference
<
List
<
Contact
>>()
{
});
for
(
Contact
contact
:
contactList
)
{
contact
.
setRelation
(
contact
.
getRelation
()
==
null
?
Relation
.
OTHER
:
contact
.
getRelation
());
Tuple
<
String
,
Boolean
>
stringBooleanTuple
=
contact
.
validAndResult
();
...
...
@@ -1313,9 +1326,9 @@ public class InnerController implements IBaseController {
public
JsonResult
resetPassword
(
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
required
=
false
)
String
password
)
{
if
(
ValidationUtil
.
validatePhoneNo
(
phone
))
{
// 默认重置的密码是123456
if
(
StringUtils
.
isBlank
(
password
))
{
if
(
StringUtils
.
isBlank
(
password
))
{
password
=
PasswordUtil
.
PASSWORD_DEFAULT
;
}
else
if
(!
ValidationUtil
.
validatePassword
(
password
))
{
}
else
if
(!
ValidationUtil
.
validatePassword
(
password
))
{
return
JsonResult
.
buildErrorStateResult
(
PasswordUtil
.
TOAST_MSG
,
null
);
}
try
{
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/resp/UserFullResp.java
0 → 100644
View file @
784af0ce
package
cn
.
quantgroup
.
xyqb
.
controller
.
internal
.
user
.
resp
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
UserFullResp
{
/**
* userId : 1396263648485684
* gender : 2
* idType : 6
* idNo : aliqua esse
* name : sunt consectetur nisi
* phoneNo : non consectetur dolore ea
* uuid : qui dolor ipsum minim
* incomeRange : 1
* incomeType : 2
* qq : exercitation eu
* email : s
* hasSocialSecurity : 0
* hasCar : 1
* education : 3
* occupation : 7
* hasCreditCard : 1
* hasHouse : 1
* marryStatus : 1
*/
private
Long
userId
;
private
Integer
gender
;
private
Integer
idType
;
private
String
idNo
;
private
String
name
;
private
String
phoneNo
;
private
String
uuid
;
private
Integer
incomeRange
;
private
Integer
incomeType
;
private
String
qq
;
private
String
email
;
private
Integer
hasSocialSecurity
;
private
Integer
hasCar
;
private
Integer
education
;
private
Integer
occupation
;
private
Integer
hasCreditCard
;
private
Integer
hasHouse
;
private
Integer
marryStatus
;
/**
* districtCode : do adipisicing minim sit deserunt
* city : enim ipsum voluptate do
* cityCode : voluptate
* province : mollit
* provinceCode : sint culpa in laborum
* address : ut nostrud incididunt
* district : incididunt ullamco dolore in
*/
private
Long
districtCode
;
private
String
city
;
private
Long
cityCode
;
private
String
province
;
private
Long
provinceCode
;
private
String
address
;
private
String
district
;
private
List
<
Contact
>
contacts
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
static
class
Contact
{
/**
* userId : 4069695050527240
* name : ex reprehenderit dolore dol
* mobile : fugiat quis ad veniam dolor
* relation : 1
*/
private
Long
userId
;
private
String
name
;
private
String
mobile
;
private
Integer
relation
;
}
}
src/main/java/cn/quantgroup/xyqb/service/user/IUserService.java
View file @
784af0ce
package
cn
.
quantgroup
.
xyqb
.
service
.
user
;
import
cn.quantgroup.xyqb.controller.internal.user.resp.UserFullResp
;
import
cn.quantgroup.xyqb.entity.Merchant
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.model.JsonResult
;
...
...
@@ -58,6 +59,7 @@ public interface IUserService {
/**
* 修改手机号码.
*
* @param oldPhoneNo 旧手机号
* @param newPhoneNo 新手机号
* @return 返回用户信息
...
...
@@ -66,7 +68,8 @@ public interface IUserService {
/**
* 删除这个用户相关缓存
* @param uuid 根据 uuid
*
* @param uuid 根据 uuid
* @param phoneNo 根据手机号
*/
void
userCacheEvict
(
String
uuid
,
String
phoneNo
);
...
...
@@ -74,4 +77,12 @@ public interface IUserService {
JsonResult
loginFast
(
Long
channelId
,
String
appChannel
,
Long
createdFrom
,
Long
btRegisterChannelId
,
String
dimension
,
String
clickId
,
HttpServletRequest
request
,
Merchant
merchant
,
String
phoneNo
);
/**
* 查询用户全量信息
*
* @param userId 用户id
* @return
*/
UserFullResp
findUserFullSearchByUserId
(
Long
userId
);
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
View file @
784af0ce
...
...
@@ -3,6 +3,7 @@ package cn.quantgroup.xyqb.service.user.impl;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.aspect.lock.RedisLock
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.controller.internal.user.resp.UserFullResp
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.event.PhoneNoUpdateEvent
;
import
cn.quantgroup.xyqb.exception.DataException
;
...
...
@@ -16,8 +17,7 @@ import cn.quantgroup.xyqb.repository.IUserHashPhoneNoIdNoMappingRepository;
import
cn.quantgroup.xyqb.repository.IUserRepository
;
import
cn.quantgroup.xyqb.service.register.IUserRegisterService
;
import
cn.quantgroup.xyqb.service.session.ISessionService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.user.*
;
import
cn.quantgroup.xyqb.service.wechat.IWechatService
;
import
cn.quantgroup.xyqb.util.*
;
import
com.alibaba.fastjson.JSON
;
...
...
@@ -74,6 +74,13 @@ public class UserServiceImpl implements IUserService, IBaseController {
@Autowired
private
ISessionService
sessionService
;
@Resource
private
IUserExtInfoService
userExtInfoService
;
@Resource
private
IAddressService
addressService
;
@Resource
private
IContactService
contactService
;
@Override
@Cacheable
(
value
=
"usercache"
,
key
=
"'xyqbuser' + #phone"
,
unless
=
"#result == null"
,
cacheManager
=
"cacheManager"
)
public
User
findByPhoneInDb
(
String
phone
)
{
...
...
@@ -324,4 +331,59 @@ public class UserServiceImpl implements IUserService, IBaseController {
}
return
false
;
}
/**
* 查询用户全量信息
*
* @param userId 用户id
* @return
*/
@Override
public
UserFullResp
findUserFullSearchByUserId
(
Long
userId
)
{
User
user
=
userRepository
.
findById
(
userId
);
if
(
user
==
null
)
{
throw
new
DataException
(
"用户userId = 【"
+
userId
+
"】不存在"
);
}
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
userId
);
UserExtInfo
userExtInfo
=
userExtInfoService
.
findByUserId
(
userId
);
Address
address
=
addressService
.
findByUserId
(
userId
);
List
<
UserFullResp
.
Contact
>
contacts
=
Lists
.
newArrayList
();
contactService
.
findByUserId
(
userId
,
true
).
forEach
(
contact
->
{
contacts
.
add
(
UserFullResp
.
Contact
.
builder
()
.
userId
(
userId
)
.
name
(
contact
.
getName
())
.
mobile
(
contact
.
getPhoneNo
())
.
relation
(
contact
.
getRelation
().
ordinal
())
.
build
());
});
return
UserFullResp
.
builder
()
.
userId
(
userId
)
.
uuid
(
user
.
getUuid
())
.
phoneNo
(
userDetail
.
getPhoneNo
())
.
name
(
userDetail
.
getName
())
.
idNo
(
userDetail
.
getIdNo
())
.
idType
(
userDetail
.
getIdType
().
ordinal
())
.
gender
(
userDetail
.
getGender
().
ordinal
())
.
email
(
userDetail
.
getEmail
())
.
qq
(
userDetail
.
getQq
())
.
incomeType
(
userExtInfo
.
getIncomeEnum
().
ordinal
())
.
incomeRange
(
userExtInfo
.
getIncomeRangeEnum
().
ordinal
())
.
occupation
(
userExtInfo
.
getOccupationEnum
().
ordinal
())
.
education
(
userExtInfo
.
getEducationEnum
().
ordinal
())
.
hasCar
(
userExtInfo
.
getHasCar
()
?
1
:
0
)
.
hasSocialSecurity
(
userExtInfo
.
getHasSocialSecurity
()
?
1
:
0
)
.
hasHouse
(
userExtInfo
.
getHasHouse
()
?
1
:
0
)
.
hasCreditCard
(
userExtInfo
.
getHasCreditCard
()
?
1
:
0
)
.
marryStatus
(
userExtInfo
.
getMarryStatus
().
ordinal
())
.
provinceCode
(
address
.
getProvinceCode
())
.
province
(
address
.
getProvince
())
.
cityCode
(
address
.
getCityCode
())
.
city
(
address
.
getCity
())
.
districtCode
(
address
.
getDistrictCode
())
.
district
(
address
.
getDistrict
())
.
address
(
address
.
getAddress
())
.
contacts
(
contacts
)
.
build
();
}
}
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