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
72808a08
Commit
72808a08
authored
Jun 14, 2023
by
王亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused code.
parent
7ed15f5b
Changes
43
Show whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
25 additions
and
1242 deletions
+25
-1242
UserDetailController.java
...tgroup/xyqb/controller/external/UserDetailController.java
+0
-2
UserQueryLogController.java
.../controller/internal/querylog/UserQueryLogController.java
+0
-10
InnerController.java
...tgroup/xyqb/controller/internal/user/InnerController.java
+6
-173
SyncUserController.java
...oup/xyqb/controller/internal/user/SyncUserController.java
+0
-2
OauthClientDetailsController.java
...er/internal/user/center/OauthClientDetailsController.java
+0
-29
UserCenterController.java
...controller/internal/user/center/UserCenterController.java
+1
-67
UserDetailController.java
...troller/middleoffice/userdetail/UserDetailController.java
+0
-3
UserExtController.java
...qb/controller/middleoffice/userext/UserExtController.java
+0
-53
UserExtReq.java
.../xyqb/controller/middleoffice/userext/req/UserExtReq.java
+0
-2
SmsTemplateEntity.java
...ain/java/cn/quantgroup/xyqb/entity/SmsTemplateEntity.java
+0
-98
UserDetail.java
src/main/java/cn/quantgroup/xyqb/entity/UserDetail.java
+0
-13
UserExtInfo.java
src/main/java/cn/quantgroup/xyqb/entity/UserExtInfo.java
+0
-58
UserHashPhoneNoIdNoMapping.java
...cn/quantgroup/xyqb/entity/UserHashPhoneNoIdNoMapping.java
+0
-25
UserSpouse.java
src/main/java/cn/quantgroup/xyqb/entity/UserSpouse.java
+0
-49
DetailRegisteredEventListener.java
.../quantgroup/xyqb/event/DetailRegisteredEventListener.java
+0
-2
PhoneHashEventListener.java
...java/cn/quantgroup/xyqb/event/PhoneHashEventListener.java
+2
-28
UserExtInfoSaveEvent.java
...n/java/cn/quantgroup/xyqb/event/UserExtInfoSaveEvent.java
+0
-29
UserDetailRet.java
src/main/java/cn/quantgroup/xyqb/model/UserDetailRet.java
+0
-2
UserExtInfoRet.java
src/main/java/cn/quantgroup/xyqb/model/UserExtInfoRet.java
+0
-52
UserFullInfo.java
src/main/java/cn/quantgroup/xyqb/model/UserFullInfo.java
+0
-1
UserInfo.java
src/main/java/cn/quantgroup/xyqb/model/UserInfo.java
+0
-1
UserModel.java
src/main/java/cn/quantgroup/xyqb/model/UserModel.java
+0
-1
UserSpouseRet.java
src/main/java/cn/quantgroup/xyqb/model/UserSpouseRet.java
+0
-42
ISmsTemplateRepository.java
...cn/quantgroup/xyqb/repository/ISmsTemplateRepository.java
+0
-15
IUserDetailRepository.java
.../cn/quantgroup/xyqb/repository/IUserDetailRepository.java
+5
-16
IUserExtInfoRepository.java
...cn/quantgroup/xyqb/repository/IUserExtInfoRepository.java
+0
-18
IUserHashPhoneNoIdNoMappingRepository.java
...yqb/repository/IUserHashPhoneNoIdNoMappingRepository.java
+0
-15
IUserSpouseRepository.java
.../cn/quantgroup/xyqb/repository/IUserSpouseRepository.java
+0
-8
PageServiceImpl.java
...cn/quantgroup/xyqb/service/page/impl/PageServiceImpl.java
+0
-15
CleanDataService.java
...ava/cn/quantgroup/xyqb/service/user/CleanDataService.java
+0
-7
ISmsService.java
...ain/java/cn/quantgroup/xyqb/service/user/ISmsService.java
+0
-59
IUserDetailService.java
...a/cn/quantgroup/xyqb/service/user/IUserDetailService.java
+2
-7
IUserExtInfoService.java
.../cn/quantgroup/xyqb/service/user/IUserExtInfoService.java
+0
-20
IUserSpouseService.java
...a/cn/quantgroup/xyqb/service/user/IUserSpouseService.java
+0
-10
CleanDataServiceImp.java
...uantgroup/xyqb/service/user/impl/CleanDataServiceImp.java
+0
-119
ModifyPhoneNoServiceImpl.java
...roup/xyqb/service/user/impl/ModifyPhoneNoServiceImpl.java
+2
-2
TenantServiceImpl.java
.../quantgroup/xyqb/service/user/impl/TenantServiceImpl.java
+0
-1
UserDetailServiceImpl.java
...ntgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
+6
-32
UserExtInfoServiceImpl.java
...tgroup/xyqb/service/user/impl/UserExtInfoServiceImpl.java
+0
-43
UserServiceImpl.java
...cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
+1
-33
UserSpouseServiceImpl.java
...ntgroup/xyqb/service/user/impl/UserSpouseServiceImpl.java
+0
-29
UserDetailVO.java
...java/cn/quantgroup/xyqb/service/user/vo/UserDetailVO.java
+0
-49
JsonTest.java
src/test/java/common/JsonTest.java
+0
-2
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/UserDetailController.java
View file @
72808a08
...
...
@@ -70,12 +70,10 @@ public class UserDetailController implements IBaseController {
if
(
Objects
.
isNull
(
userDetail
))
{
userDetail
=
new
UserDetail
();
}
userDetail
.
setIdNo
(
idNo
);
userDetail
.
setPhoneNo
(
user
.
getPhoneNo
());
userDetail
.
setUserId
(
user
.
getId
());
userDetail
.
setName
(
name
);
userDetail
.
setGender
(
info
.
getGender
());
userDetail
.
setIdType
(
IdType
.
ID_CARD
);
userDetail
.
setIsAuthenticated
(
false
);
log
.
info
(
"UserDetailController saveUserDetail, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
user
.
getPhoneNo
(),
name
);
try
{
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/querylog/UserQueryLogController.java
View file @
72808a08
...
...
@@ -301,13 +301,6 @@ public class UserQueryLogController {
}
}
userDetails
=
userDetailService
.
findByPhoneNos
(
queryV
);
}
else
if
(
Objects
.
equals
(
key
,
Constants
.
ID_NO
))
{
for
(
String
idno
:
queryV
)
{
if
(!
IdcardValidator
.
is18Idcard
(
idno
)
&&
!
IdcardValidator
.
is15Idcard
(
idno
))
{
return
JsonResult
.
buildErrorStateResult
(
"查询的身份证号"
+
idno
+
"格式有误"
,
idno
);
}
}
userDetails
=
userDetailService
.
findByIdnos
(
queryV
);
}
List
<
UserQueryInfo
>
userQueryInfos
=
toUserQueryInfo
(
key
,
columns
,
queryV
,
userDetails
);
/*
...
...
@@ -363,9 +356,6 @@ public class UserQueryLogController {
List
<
UserQueryInfo
>
userQueryInfos
=
new
ArrayList
<>();
for
(
UserDetail
ud
:
userDetails
)
{
UserQueryInfo
uqi
=
new
UserQueryInfo
();
if
(
columns
.
contains
(
Constants
.
ID_NO
))
{
uqi
.
setIdNo
(
ud
.
getIdNo
());
}
if
(
columns
.
contains
(
Constants
.
PHONE_NO
))
{
uqi
.
setPhoneNo
(
ud
.
getPhoneNo
());
}
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/InnerController.java
View file @
72808a08
...
...
@@ -9,7 +9,6 @@ import cn.quantgroup.xyqb.controller.internal.user.resp.UserFullResp;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.event.DisableActiveEvent
;
import
cn.quantgroup.xyqb.event.UserDisableRecordEvent
;
import
cn.quantgroup.xyqb.event.UserExtInfoSaveEvent
;
import
cn.quantgroup.xyqb.exception.UserNotExistException
;
import
cn.quantgroup.xyqb.model.Gender
;
import
cn.quantgroup.xyqb.model.IdType
;
...
...
@@ -77,14 +76,10 @@ public class InnerController implements IBaseController {
private
IUserBtRegisterService
userBtRegisterService
;
@Autowired
private
IIdCardService
idCardService
;
@Autowired
private
IUserExtInfoService
userExtInfoService
;
@Autowired
private
IWechatService
wechatService
;
@Autowired
private
IUserSpouseService
userSpouseService
;
@Autowired
private
ISessionService
sessionService
;
@Autowired
private
IUserApiService
userApiService
;
...
...
@@ -94,8 +89,6 @@ public class InnerController implements IBaseController {
private
IUserRegisterService
userRegisterService
;
@Resource
private
ApplicationEventPublisher
applicationEventPublisher
;
@Resource
private
CleanDataService
cleanDataService
;
@Autowired
private
StmsRemoteService
stmsRemoteService
;
...
...
@@ -398,8 +391,6 @@ public class InnerController implements IBaseController {
userDetail
.
setUserId
(
userId
);
userDetail
.
setName
(
name
);
userDetail
.
setPhoneNo
(
phoneNo
);
userDetail
.
setIdNo
(
idNo
);
userDetail
.
setIdType
(
IdType
.
ID_CARD
);
userDetail
.
setGender
(
info
.
getGender
());
userDetail
.
setEmail
(
email
);
userDetail
.
setQq
(
qq
);
...
...
@@ -551,62 +542,6 @@ public class InnerController implements IBaseController {
}
@RequestMapping
(
"/user_ext_info/update"
)
public
JsonResult
updateMarryStatus
(
Long
userId
,
IncomeEnum
incomeEnum
,
IncomeRangeEnum
incomeRangeEnum
,
OccupationEnum
occupationEnum
,
EducationEnum
educationEnum
,
Boolean
hasCar
,
Boolean
hasSocialSecurity
,
Boolean
hasHouse
,
Boolean
hasCreditCard
,
MaritalStatus
maritalStatus
)
{
if
(
null
==
userId
)
{
return
JsonResult
.
buildErrorStateResult
(
"用户ID不能为空"
,
null
);
}
UserExtInfo
info
=
userExtInfoService
.
findByUserId
(
userId
);
if
(
info
==
null
)
{
info
=
new
UserExtInfo
();
info
.
setUserId
(
userId
);
}
if
(
incomeEnum
!=
null
)
{
info
.
setIncomeEnum
(
IncomeEnum
.
valueOf
(
incomeEnum
.
name
()));
}
if
(
incomeRangeEnum
!=
null
)
{
info
.
setIncomeRangeEnum
(
IncomeRangeEnum
.
valueOf
(
incomeRangeEnum
.
name
()));
}
if
(
occupationEnum
!=
null
)
{
if
(
occupationEnum
==
OccupationEnum
.
STUDENT
)
{
//如果是学生那么转成其他
occupationEnum
=
OccupationEnum
.
OTHER
;
}
//不明白为啥这么写 为啥不直接用还要valueof
info
.
setOccupationEnum
(
OccupationEnum
.
valueOf
(
occupationEnum
.
name
()));
}
if
(
educationEnum
!=
null
)
{
info
.
setEducationEnum
(
EducationEnum
.
valueOf
(
educationEnum
.
name
()));
}
if
(
hasCar
!=
null
)
{
info
.
setHasCar
(
hasCar
);
}
if
(
hasCreditCard
!=
null
)
{
info
.
setHasCreditCard
(
hasCreditCard
);
}
if
(
hasSocialSecurity
!=
null
)
{
info
.
setHasSocialSecurity
(
hasSocialSecurity
);
}
if
(
hasHouse
!=
null
)
{
info
.
setHasHouse
(
hasHouse
);
}
if
(
maritalStatus
!=
null
)
{
info
.
setMarryStatus
(
MaritalStatus
.
valueOf
(
maritalStatus
.
name
()));
}
info
=
userExtInfoService
.
save
(
info
);
applicationEventPublisher
.
publishEvent
(
new
UserExtInfoSaveEvent
(
this
,
info
));
return
JsonResult
.
buildSuccessResult
(
null
,
UserExtInfoRet
.
getUserExtInfoRet
(
info
));
}
/**
* 按照姓名、份证号或手机号查询用户实名信息 - 精确查询,供客服用,不限制入参正确性
*
...
...
@@ -652,19 +587,12 @@ public class InnerController implements IBaseController {
int
idNoFullSize
=
18
;
boolean
phoneNoValid
=
StringUtils
.
isBlank
(
phoneNo
)
?
false
:
(
phoneNo
.
length
()
>=
phoneNoMaskSize
||
ValidationUtil
.
validatePhoneNo
(
phoneNo
));
boolean
idNoValid
=
StringUtils
.
isBlank
(
idNo
)
?
false
:
(
idNo
.
length
()
>=
idNoMaskSize
||
Objects
.
equals
(
idNo
.
length
(),
idNoFullSize
));
if
(!
phoneNoValid
&&
!
idNoValid
)
{
if
(!
phoneNoValid
)
{
return
JsonResult
.
buildErrorStateResult
(
"查询条件不规范!"
,
null
);
}
List
<
UserDetail
>
userDetailList
=
null
;
if
(
phoneNoValid
&&
idNoValid
)
{
userDetailList
=
userDetailService
.
fuzzyQueryByPhoneNoAndIdNo
(
phoneNo
,
idNo
);
}
else
if
(
idNoValid
)
{
userDetailList
=
userDetailService
.
findByIdNoStartingWith
(
idNo
);
}
else
{
userDetailList
=
userDetailService
.
findByPhoneNoStartingWith
(
phoneNo
);
}
userDetailList
=
userDetailService
.
fuzzyQueryByPhoneNo
(
phoneNo
);
// 如果传入姓名,则只过滤匹配项
if
(!
CollectionUtils
.
isEmpty
(
userDetailList
)
&&
StringUtils
.
isNotBlank
(
userName
))
{
userDetailList
=
userDetailList
.
stream
()
...
...
@@ -674,17 +602,7 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
"success"
,
userDetailList
);
}
@RequestMapping
(
"/user_ext_info/search/user_id"
)
public
JsonResult
searchUserExtInfoByUserId
(
Long
userId
)
{
if
(
userId
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"userId不能为空"
,
null
);
}
UserExtInfo
userExtInfo
=
userExtInfoService
.
findByUserId
(
userId
);
if
(
userExtInfo
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
return
JsonResult
.
buildSuccessResult
(
null
,
UserExtInfoRet
.
getUserExtInfoRet
(
userExtInfo
));
}
@RequestMapping
(
"/user/query/openId"
)
public
JsonResult
queryOpenIdByUserId
(
Long
userId
)
{
...
...
@@ -746,7 +664,6 @@ public class InnerController implements IBaseController {
if
(!
Objects
.
isNull
(
userDetail
))
{
bean
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
bean
.
setName
(
userDetail
.
getName
());
bean
.
setIdNo
(
userDetail
.
getIdNo
());
bean
.
setQq
(
userDetail
.
getQq
());
bean
.
setEmail
(
userDetail
.
getEmail
());
bean
.
setGender
(
Optional
.
ofNullable
(
userDetail
.
getGender
()).
orElse
(
Gender
.
UNKNOWN
).
getName
());
...
...
@@ -755,32 +672,6 @@ public class InnerController implements IBaseController {
if
(!
Objects
.
isNull
(
userBtRegister
))
{
bean
.
setMerchantId
(
userBtRegister
.
getRegisterBtMerchantId
());
}
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
user
.
getId
());
if
(
Objects
.
nonNull
(
extInfo
))
{
// 婚姻状态
bean
.
setMarryStatus
(
Optional
.
ofNullable
(
extInfo
.
getMarryStatus
())
.
orElse
(
MaritalStatus
.
UNKNOWN
).
getDesc
());
// 受教育程度
bean
.
setEducationEnum
(
Optional
.
ofNullable
(
extInfo
.
getEducationEnum
())
.
orElse
(
EducationEnum
.
UNKNOWN
).
getName
());
// 职业
bean
.
setOccupationEnum
(
Optional
.
ofNullable
(
extInfo
.
getOccupationEnum
())
.
orElse
(
OccupationEnum
.
UNKNOWN
).
getName
());
// 收入水平范围
bean
.
setIncomeRangeEnum
(
Optional
.
ofNullable
(
extInfo
.
getIncomeRangeEnum
())
.
orElse
(
IncomeRangeEnum
.
UNKNOWN
).
getDesc
());
// 收入方式
bean
.
setIncomeEnum
(
Optional
.
ofNullable
(
extInfo
.
getIncomeEnum
())
.
orElse
(
IncomeEnum
.
UNKNOWN
).
getDesc
());
// 是否有车
bean
.
setHasCar
(
Optional
.
ofNullable
(
extInfo
.
getHasCar
()).
orElse
(
false
));
// 是否有社保
bean
.
setHasSocialSecurity
(
Optional
.
ofNullable
(
extInfo
.
getHasSocialSecurity
()).
orElse
(
false
));
// 是否有房
bean
.
setHasHouse
(
Optional
.
ofNullable
(
extInfo
.
getHasHouse
()).
orElse
(
false
));
// 是否有信用卡
bean
.
setHasCreditCard
(
Optional
.
ofNullable
(
extInfo
.
getHasCreditCard
()).
orElse
(
false
));
}
return
bean
;
}
...
...
@@ -837,30 +728,11 @@ public class InnerController implements IBaseController {
private
UserAssociation
getUserAssociation
(
UserDetail
userDetail
)
{
UserAssociation
bean
=
new
UserAssociation
();
if
(
null
!=
userDetail
)
{
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
userDetail
.
getUserId
());
bean
.
setUserId
(
userDetail
.
getUserId
());
bean
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
bean
.
setName
(
userDetail
.
getName
());
bean
.
setIdNo
(
userDetail
.
getIdNo
());
bean
.
setQq
(
userDetail
.
getQq
());
bean
.
setGender
(
Optional
.
ofNullable
(
userDetail
.
getGender
()).
orElse
(
Gender
.
UNKNOWN
).
getName
());
if
(
null
!=
extInfo
)
{
if
(
null
==
extInfo
.
getEducationEnum
())
{
bean
.
setEducationEnum
(
EducationEnum
.
UNKNOWN
.
getName
());
}
else
{
bean
.
setEducationEnum
(
extInfo
.
getEducationEnum
().
getName
());
}
if
(
null
==
extInfo
.
getOccupationEnum
())
{
bean
.
setOccupationEnum
(
OccupationEnum
.
UNKNOWN
.
getName
());
}
else
{
bean
.
setOccupationEnum
(
extInfo
.
getOccupationEnum
().
getName
());
}
if
(
null
==
extInfo
.
getMarryStatus
())
{
bean
.
setMarryStatus
(
MaritalStatus
.
UNKNOWN
.
getDesc
());
}
else
{
bean
.
setMarryStatus
(
extInfo
.
getMarryStatus
().
getDesc
());
}
}
}
return
bean
;
}
...
...
@@ -910,44 +782,6 @@ public class InnerController implements IBaseController {
return
Objects
.
equals
(
enable
,
user
.
getEnable
());
}
@RequestMapping
(
"/user/spouse/save"
)
public
JsonResult
saveSpouse
(
Long
userId
,
MaritalStatus
status
,
String
spousePhone
,
String
spouseName
)
{
if
(
userId
==
null
||
userId
==
0
)
{
return
JsonResult
.
buildErrorStateResult
(
"用户不能为空"
,
null
);
}
if
(
status
==
MaritalStatus
.
MARRIED
)
{
if
(!
ValidationUtil
.
validatePhoneNo
(
spousePhone
))
{
return
JsonResult
.
buildErrorStateResult
(
"手机号格式错误"
,
null
);
}
if
(!
ValidationUtil
.
validateChinese
(
spouseName
))
{
return
JsonResult
.
buildErrorStateResult
(
"配偶姓名错误"
,
null
);
}
}
UserSpouse
userSpouse
=
userSpouseService
.
findByUserId
(
userId
);
if
(
userSpouse
==
null
)
{
userSpouse
=
new
UserSpouse
(
userId
);
}
userSpouse
.
setSpouseName
(
status
==
MaritalStatus
.
MARRIED
?
spouseName
:
""
);
userSpouse
.
setSpousePhone
(
status
==
MaritalStatus
.
MARRIED
?
spousePhone
:
""
);
userSpouse
.
setStatus
(
MaritalStatus
.
valueOf
(
status
.
name
()));
userSpouse
=
userSpouseService
.
save
(
userSpouse
);
return
JsonResult
.
buildSuccessResult
(
null
,
UserSpouseRet
.
getUserSpouseRet
(
userSpouse
));
}
@RequestMapping
(
"/user/spouse/findByUserId"
)
public
JsonResult
querySpouse
(
Long
userId
)
{
if
(
userId
==
null
||
userId
==
0
)
{
return
JsonResult
.
buildErrorStateResult
(
"用户不能为空"
,
null
);
}
UserSpouse
userSpouse
=
userSpouseService
.
findByUserId
(
userId
);
if
(
userSpouse
==
null
||
!
userSpouse
.
valid
())
{
userSpouse
=
new
UserSpouse
(
userId
);
userSpouse
.
setStatus
(
MaritalStatus
.
UNKNOWN
);
}
return
JsonResult
.
buildSuccessResult
(
null
,
UserSpouseRet
.
getUserSpouseRet
(
userSpouse
));
}
@RequestMapping
(
"/user/findByPhones"
)
public
JsonResult
getUserIdByPhones
(
@RequestParam
(
"userPhones"
)
String
userPhones
)
{
if
(
StringUtils
.
isBlank
(
userPhones
))
{
...
...
@@ -1307,7 +1141,7 @@ public class InnerController implements IBaseController {
if
(
Objects
.
nonNull
(
userId
)
&&
ValidationUtil
.
validateChinese
(
name
))
{
try
{
User
user
=
userService
.
findById
(
userId
);
int
rows
=
userDetailService
.
updateName
AndIdCard
(
name
,
idNo
,
user
.
getPhoneNo
());
int
rows
=
userDetailService
.
updateName
(
name
,
user
.
getPhoneNo
());
log
.
info
(
"重置用户实名信息,userId:{},name:{},idNo:{},result:[{}]"
,
userId
,
name
,
idNo
,
rows
);
if
(
rows
>
0
)
{
...
...
@@ -1376,7 +1210,7 @@ public class InnerController implements IBaseController {
}
log
.
info
(
"重置用户实名信息 phoneNo:{},name:{},idNo:{}"
,
phoneNo
,
name
,
idNo
);
try
{
int
rows
=
userDetailService
.
updateName
AndIdCard
(
name
,
idNo
,
phoneNo
);
int
rows
=
userDetailService
.
updateName
(
name
,
phoneNo
);
log
.
info
(
"重置用户实名信息,phoneNo:{},name:{},idNo:{},result:[{}],操作的理由reason:{}"
,
phoneNo
,
name
,
idNo
,
rows
,
reason
);
if
(
rows
>
0
)
{
...
...
@@ -1477,7 +1311,6 @@ public class InnerController implements IBaseController {
// @RequestMapping("/clean")
public
JsonResult
clean
()
{
cleanDataService
.
cleanData
();
return
JsonResult
.
buildSuccessResult
(
"已经开始清洗"
);
}
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/SyncUserController.java
View file @
72808a08
...
...
@@ -71,11 +71,9 @@ public class SyncUserController {
userDetail
=
new
UserDetail
();
}
userDetail
.
setUserId
(
user
.
getId
());
userDetail
.
setIdNo
(
idNo
);
userDetail
.
setPhoneNo
(
phoneNo
);
userDetail
.
setName
(
name
);
userDetail
.
setGender
(
info
.
getGender
());
userDetail
.
setIdType
(
IdType
.
ID_CARD
);
userDetail
.
setIsAuthenticated
(
false
);
log
.
info
(
"SyncUserController saveUserDetail, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
phoneNo
,
name
);
try
{
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/center/OauthClientDetailsController.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
controller
.
internal
.
user
.
center
;
import
cn.quantgroup.xyqb.service.user.IOauthClientDetailsService
;
import
cn.quantgroup.xyqb.service.user.IOauthLoginInfoService
;
import
cn.quantgroup.xyqb.service.user.ISmsService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* Created by 11 on 2017/3/22.
*/
@Slf4j
@RestController
@RequestMapping
(
"/oauthClient"
)
public
class
OauthClientDetailsController
{
@Autowired
private
IOauthClientDetailsService
oauthClientDetailsService
;
@Autowired
private
IOauthLoginInfoService
oauthLoginInfoService
;
@Autowired
private
ISmsService
smsService
;
}
src/main/java/cn/quantgroup/xyqb/controller/internal/user/center/UserCenterController.java
View file @
72808a08
...
...
@@ -11,11 +11,8 @@ import cn.quantgroup.xyqb.aspect.lock.RedisLock;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserAttached
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
cn.quantgroup.xyqb.event.UserExtInfoSaveEvent
;
import
cn.quantgroup.xyqb.model.JsonResult
;
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.UserCenterService
;
import
cn.quantgroup.xyqb.util.TenantUtil
;
...
...
@@ -42,8 +39,6 @@ public class UserCenterController {
private
UserCenterService
userCenterService
;
@Autowired
private
IUserDetailService
userDetailService
;
@Autowired
private
IUserExtInfoService
userExtInfoService
;
@Autowired
private
IUserService
userService
;
...
...
@@ -223,72 +218,11 @@ public class UserCenterController {
if
(
null
==
userId
||
userId
==
0L
)
{
return
JsonResult
.
buildErrorStateResult
(
"该用户不存在"
,
null
);
}
UserExtInfo
userExtInfo
=
userExtInfoService
.
findByUserId
(
userId
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
if
(
null
!=
userExtInfo
)
{
result
.
put
(
"occupation"
,
userExtInfo
.
getOccupationEnum
()
==
null
?
""
:
userExtInfo
.
getOccupationEnum
().
ordinal
());
result
.
put
(
"education"
,
userExtInfo
.
getEducationEnum
()
==
null
?
""
:
userExtInfo
.
getEducationEnum
().
ordinal
());
result
.
put
(
"income"
,
userExtInfo
.
getIncomeRangeEnum
()
==
null
?
""
:
userExtInfo
.
getIncomeRangeEnum
().
ordinal
());
result
.
put
(
"marryStatus"
,
userExtInfo
.
getMarryStatus
()
==
null
?
""
:
userExtInfo
.
getMarryStatus
().
ordinal
());
}
return
JsonResult
.
buildSuccessResult
(
null
,
result
);
}
/**
* 保存用户经济信息
*
* @param educationEnum 学历
* @param occupationEnum 职业
* @param incomeRangeEnum 月收入范围
* @param maritalStatus 婚姻状态
* @return
*/
@AccessForbiddenValidator
@RequestMapping
(
"/save/userExtInfo"
)
@RedisLock
(
prefix
=
"lock:user:ext:"
,
key
=
"#this[0]"
)
public
JsonResult
saveUserExtInfo
(
String
phoneNo
,
EducationEnum
educationEnum
,
MaritalStatus
maritalStatus
,
IncomeRangeEnum
incomeRangeEnum
,
OccupationEnum
occupationEnum
)
{
if
(
StringUtils
.
isEmpty
(
phoneNo
))
{
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
Long
userId
=
queryUserId
(
phoneNo
);
if
(
null
==
userId
||
userId
==
0L
)
{
log
.
error
(
"保存用户经济信息,未获取到用户id. userId:{}"
,
userId
);
return
JsonResult
.
buildErrorStateResult
(
"该用户不存在"
,
null
);
}
//查询用户是否保存过.
UserExtInfo
userExtInfo
=
userExtInfoService
.
findByUserId
(
userId
);
if
(
null
==
userExtInfo
)
{
userExtInfo
=
new
UserExtInfo
();
userExtInfo
.
setUserId
(
userId
);
}
if
(
null
!=
educationEnum
){
userExtInfo
.
setEducationEnum
(
educationEnum
);
}
if
(
null
!=
maritalStatus
){
userExtInfo
.
setMarryStatus
(
maritalStatus
);
}
//如果是学生那么转成其他
if
(
null
!=
occupationEnum
)
{
if
(
OccupationEnum
.
STUDENT
==
occupationEnum
)
{
occupationEnum
=
OccupationEnum
.
OTHER
;
}
}
if
(
null
!=
occupationEnum
){
userExtInfo
.
setOccupationEnum
(
occupationEnum
);
}
if
(
null
!=
incomeRangeEnum
){
userExtInfo
.
setIncomeRangeEnum
(
incomeRangeEnum
);
return
JsonResult
.
buildSuccessResult
(
null
,
result
);
}
userExtInfo
=
userExtInfoService
.
save
(
userExtInfo
);
applicationEventPublisher
.
publishEvent
(
new
UserExtInfoSaveEvent
(
this
,
userExtInfo
));
return
JsonResult
.
buildSuccessResult
(
null
,
userExtInfo
);
}
/**
* 根据手机号查询用户id, nodejs调用接口无法获取到userId.
...
...
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/userdetail/UserDetailController.java
View file @
72808a08
...
...
@@ -48,7 +48,6 @@ public class UserDetailController {
}
//更新
userDetail
.
setName
(
userDetailReq
.
getName
());
userDetail
.
setIdNo
(
userDetailReq
.
getIdNo
());
userDetail
=
userDetailService
.
saveUserDetail
(
userDetail
);
log
.
info
(
"UserDetailController update, userId:{}, name:{}"
,
userId
,
userDetailReq
.
getName
());
return
JsonResult
.
buildSuccessResultGeneric
(
userDetail
);
...
...
@@ -75,8 +74,6 @@ public class UserDetailController {
userDetail
.
setUserId
(
userId
);
userDetail
.
setName
(
userDetailReq
.
getName
());
userDetail
.
setPhoneNo
(
user
.
getPhoneNo
());
userDetail
.
setIdNo
(
userDetailReq
.
getIdNo
());
userDetail
.
setIdType
(
IdType
.
ID_CARD
);
userDetail
.
setGender
(
idCardInfo
.
getGender
());
userDetail
=
userDetailService
.
saveUserDetail
(
userDetail
);
log
.
info
(
"UserDetailController save, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
user
.
getPhoneNo
(),
userDetailReq
.
getName
());
...
...
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/userext/UserExtController.java
View file @
72808a08
...
...
@@ -3,11 +3,8 @@ package cn.quantgroup.xyqb.controller.middleoffice.userext;
import
cn.quantgroup.xyqb.constant.enums.OccupationEnum
;
import
cn.quantgroup.xyqb.controller.middleoffice.userext.req.UserExtReq
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
cn.quantgroup.xyqb.event.UserExtInfoSaveEvent
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserExtInfoService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -23,10 +20,6 @@ import java.util.Map;
@RequestMapping
(
"/middle_office/user/ext"
)
public
class
UserExtController
{
@Resource
private
IUserExtInfoService
userExtInfoService
;
@Resource
private
IUserDetailService
userDetailService
;
...
...
@@ -46,54 +39,8 @@ public class UserExtController {
if
(
userExtReq
.
getQq
()
!=
null
)
{
userDetailService
.
updateUserQq
(
userId
,
userExtReq
.
getQq
());
}
if
(
userExtReq
.
getExtInfo
()
!=
null
)
{
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
userId
);
if
(
extInfo
!=
null
)
{
Long
id
=
extInfo
.
getId
();
userExtReq
.
getExtInfo
().
setId
(
id
);
}
userExtReq
.
getExtInfo
().
setUserId
(
userId
);
if
(
null
!=
userExtReq
.
getExtInfo
().
getOccupationEnum
())
{
//学生转其他
if
(
OccupationEnum
.
STUDENT
==
userExtReq
.
getExtInfo
().
getOccupationEnum
())
{
userExtReq
.
getExtInfo
().
setOccupationEnum
(
OccupationEnum
.
OTHER
);
}
}
userExtInfoService
.
save
(
userExtReq
.
getExtInfo
());
applicationEventPublisher
.
publishEvent
(
new
UserExtInfoSaveEvent
(
this
,
userExtReq
.
getExtInfo
()));
}
return
JsonResult
.
buildSuccessResult
();
}
@GetMapping
(
"/userId/{userId}"
)
public
JsonResult
query
(
@PathVariable
Long
userId
,
@RequestParam
(
defaultValue
=
"false"
)
Boolean
extInfo
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
if
(
extInfo
)
{
result
.
put
(
"extInfo"
,
userExtInfoService
.
findByUserId
(
userId
));
}
return
JsonResult
.
buildSuccessResultGeneric
(
result
);
}
@GetMapping
(
"/phoneNo/{phoneNo}"
)
public
JsonResult
query
(
@PathVariable
String
phoneNo
,
@RequestParam
(
defaultValue
=
"false"
)
Boolean
extInfo
)
{
User
user
=
userService
.
findByPhoneWithCache
(
phoneNo
);
if
(
user
==
null
)
{
return
JsonResult
.
buildSuccessResult
();
}
Long
userId
=
user
.
getId
();
//todo duplicated
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
if
(
extInfo
)
{
result
.
put
(
"extInfo"
,
userExtInfoService
.
findByUserId
(
userId
));
}
return
JsonResult
.
buildSuccessResultGeneric
(
result
);
}
}
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/userext/req/UserExtReq.java
View file @
72808a08
package
cn
.
quantgroup
.
xyqb
.
controller
.
middleoffice
.
userext
.
req
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
lombok.Data
;
@Data
public
class
UserExtReq
{
private
UserExtInfo
extInfo
;
private
String
email
;
private
String
qq
;
}
src/main/java/cn/quantgroup/xyqb/entity/SmsTemplateEntity.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
entity
;
import
cn.quantgroup.xyqb.entity.baseEntity.OptimisticEntity
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
/**
* Created with IntelliJ IDEA.
*
* @author: Li JianHua
* @Date: 2021/9/23
* @Time: 11:02
* Description: No Description
*/
@Entity
@Table
(
name
=
"sms_template"
)
public
class
SmsTemplateEntity
extends
OptimisticEntity
implements
Serializable
{
private
final
static
String
CLASS_NAME
=
SmsTemplateEntity
.
class
.
getSimpleName
();
private
static
final
long
serialVersionUID
=
-
190846609680723652L
;
@Id
@Column
(
name
=
"ID"
,
nullable
=
false
)
private
long
id
;
@Column
(
name
=
"CLIENT_ID"
,
nullable
=
false
)
private
long
clientId
;
@Column
(
name
=
"TYPE"
,
nullable
=
false
,
updatable
=
false
,
length
=
11
)
private
String
type
;
@Column
(
name
=
"MERCHANT_ID"
,
nullable
=
false
,
updatable
=
false
,
length
=
11
)
private
String
merchantId
;
@Column
(
name
=
"CONTENT_ID"
,
nullable
=
false
,
updatable
=
false
,
length
=
11
)
private
String
contentId
;
@Column
(
name
=
"CONTENT"
,
nullable
=
false
,
updatable
=
false
)
private
String
content
;
@Override
public
String
getPersistentKey
()
{
return
null
;
}
public
long
getId
()
{
return
id
;
}
public
void
setId
(
long
id
)
{
this
.
id
=
id
;
}
public
long
getClientId
()
{
return
clientId
;
}
public
void
setClientId
(
long
clientId
)
{
this
.
clientId
=
clientId
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getMerchantId
()
{
return
merchantId
;
}
public
void
setMerchantId
(
String
merchantId
)
{
this
.
merchantId
=
merchantId
;
}
public
String
getContentId
()
{
return
contentId
;
}
public
void
setContentId
(
String
contentId
)
{
this
.
contentId
=
contentId
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
}
src/main/java/cn/quantgroup/xyqb/entity/UserDetail.java
View file @
72808a08
...
...
@@ -36,14 +36,6 @@ public class UserDetail extends BaseEntity implements Serializable {
@Column
(
name
=
"name"
)
private
String
name
;
//证件号
@Column
(
name
=
"id_no"
)
private
String
idNo
;
//0 身份证 1 军官证 2 护照
@Column
(
name
=
"id_type"
)
private
IdType
idType
;
//身份证验真 0 未认证 1认证
@Column
(
name
=
"is_authenticated"
)
private
Boolean
isAuthenticated
=
false
;
...
...
@@ -64,11 +56,6 @@ public class UserDetail extends BaseEntity implements Serializable {
xUserDetail
.
setUserId
(
this
.
getUserId
());
xUserDetail
.
setPhoneNo
(
this
.
getPhoneNo
());
xUserDetail
.
setName
(
this
.
getName
());
xUserDetail
.
setIdNo
(
this
.
getIdNo
());
if
(
this
.
getIdType
()
!=
null
)
{
xUserDetail
.
setIdType
(
cn
.
quantgroup
.
motan
.
enums
.
IdType
.
valueOf
(
this
.
getIdType
()
.
name
()));
}
if
(
this
.
getGender
()
!=
null
)
{
xUserDetail
.
setGender
(
cn
.
quantgroup
.
motan
.
enums
.
Gender
.
valueOf
(
Optional
.
ofNullable
(
this
.
getGender
())
.
orElse
(
Gender
.
UNKNOWN
)
...
...
src/main/java/cn/quantgroup/xyqb/entity/UserExtInfo.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
entity
;
import
cn.quantgroup.motan.retbean.XUserExtInfo
;
import
cn.quantgroup.xyqb.constant.enums.*
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
/**
* Created by 11 on 2016/12/30.
*/
@Data
@Entity
@Table
(
name
=
"user_ext_info"
)
public
class
UserExtInfo
extends
BaseEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1L
;
@Column
(
name
=
"user_id"
)
private
Long
userId
;
@Column
(
name
=
"means_of_income_payment"
)
private
IncomeEnum
incomeEnum
=
IncomeEnum
.
UNKNOWN
;
@Column
(
name
=
"monthly_income_range"
)
private
IncomeRangeEnum
incomeRangeEnum
=
IncomeRangeEnum
.
UNKNOWN
;
@Column
(
name
=
"occupation"
)
private
OccupationEnum
occupationEnum
=
OccupationEnum
.
UNKNOWN
;
@Column
(
name
=
"education"
)
private
EducationEnum
educationEnum
=
EducationEnum
.
UNKNOWN
;
@Column
(
name
=
"has_car"
)
private
Boolean
hasCar
=
false
;
@Column
(
name
=
"has_social_security"
)
private
Boolean
hasSocialSecurity
=
false
;
@Column
(
name
=
"has_house"
)
private
Boolean
hasHouse
=
false
;
@Column
(
name
=
"has_credit_card"
)
private
Boolean
hasCreditCard
=
false
;
@Column
(
name
=
"marry_status"
)
private
MaritalStatus
marryStatus
=
MaritalStatus
.
UNKNOWN
;
public
XUserExtInfo
toXUserExtInfo
()
{
XUserExtInfo
xUserExtInfo
=
new
XUserExtInfo
();
xUserExtInfo
.
setId
(
getId
());
xUserExtInfo
.
setUserId
(
this
.
userId
);
xUserExtInfo
.
setEducationEnum
(
cn
.
quantgroup
.
motan
.
enums
.
EducationEnum
.
valueOf
(
this
.
educationEnum
.
name
()));
xUserExtInfo
.
setIncomeEnum
(
cn
.
quantgroup
.
motan
.
enums
.
IncomeEnum
.
valueOf
(
this
.
incomeEnum
.
name
()));
xUserExtInfo
.
setIncomeRangeEnum
(
cn
.
quantgroup
.
motan
.
enums
.
IncomeRangeEnum
.
valueOf
(
this
.
incomeRangeEnum
.
name
()));
xUserExtInfo
.
setOccupationEnum
(
cn
.
quantgroup
.
motan
.
enums
.
OccupationEnum
.
valueOf
(
this
.
occupationEnum
.
name
()));
xUserExtInfo
.
setHasCar
(
this
.
hasCar
);
xUserExtInfo
.
setHasSocialSecurity
(
this
.
hasSocialSecurity
);
xUserExtInfo
.
setHasCreditCard
(
this
.
hasCreditCard
);
xUserExtInfo
.
setMarryStatus
(
cn
.
quantgroup
.
motan
.
enums
.
MaritalStatus
.
valueOf
(
this
.
marryStatus
.
name
()));
xUserExtInfo
.
setCreatedAt
(
getCreatedAt
());
xUserExtInfo
.
setUpdateAt
(
getUpdatedAt
());
return
xUserExtInfo
;
}
}
src/main/java/cn/quantgroup/xyqb/entity/UserHashPhoneNoIdNoMapping.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
entity
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
@Data
@Entity
@Table
(
name
=
"user_hash_phone_no_id_no_mapping"
)
public
class
UserHashPhoneNoIdNoMapping
extends
BaseEntity
{
@Column
(
name
=
"user_id"
)
private
Long
userId
;
@Column
(
name
=
"phone_no_id_no_md5"
)
private
String
phoneNoIdNoMd5
;
public
UserHashPhoneNoIdNoMapping
()
{
}
public
UserHashPhoneNoIdNoMapping
(
Long
userId
)
{
this
.
userId
=
userId
;
}
}
src/main/java/cn/quantgroup/xyqb/entity/UserSpouse.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
entity
;
import
cn.quantgroup.xyqb.constant.enums.MaritalStatus
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
lombok.*
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
javax.persistence.UniqueConstraint
;
import
java.io.Serializable
;
@Data
@Entity
@Table
(
name
=
"user_spouse"
,
uniqueConstraints
=
@UniqueConstraint
(
columnNames
=
"user_id"
))
@Getter
@Setter
@ToString
@NoArgsConstructor
public
class
UserSpouse
extends
BaseEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1L
;
@Column
(
name
=
"user_id"
)
private
Long
userId
;
@Column
(
name
=
"spouse_phone"
)
private
String
spousePhone
;
@Column
(
name
=
"spouse_name"
)
private
String
spouseName
;
@Column
(
name
=
"status"
)
private
MaritalStatus
status
;
public
UserSpouse
(
Long
userId
)
{
this
.
userId
=
userId
;
}
/**
* 数据合法性校验
*
* @return
*/
public
boolean
valid
()
{
return
(
ValidationUtil
.
validatePhoneNo
(
this
.
spousePhone
)
&&
ValidationUtil
.
validateChinese
(
this
.
spouseName
));
}
}
src/main/java/cn/quantgroup/xyqb/event/DetailRegisteredEventListener.java
View file @
72808a08
...
...
@@ -42,10 +42,8 @@ public class DetailRegisteredEventListener implements ApplicationListener<Regist
return
;
}
UserDetail
userDetail
=
new
UserDetail
();
userDetail
.
setIdNo
(
cardInfo
.
getIdNo
());
userDetail
.
setPhoneNo
(
phoneNo
);
userDetail
.
setName
(
name
);
userDetail
.
setIdType
(
IdType
.
ID_CARD
);
userDetail
.
setUserId
(
user
.
getId
());
userDetail
.
setGender
(
cardInfo
.
getGender
());
log
.
info
(
"DetailRegisteredEventListener saveUserDetail, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
phoneNo
,
name
);
...
...
src/main/java/cn/quantgroup/xyqb/event/PhoneHashEventListener.java
View file @
72808a08
package
cn
.
quantgroup
.
xyqb
.
event
;
import
cn.quantgroup.xyqb.entity.UserHashMapping
;
import
cn.quantgroup.xyqb.entity.UserHashPhoneNoIdNoMapping
;
import
cn.quantgroup.xyqb.model.UserRegisterParam
;
import
cn.quantgroup.xyqb.repository.IUserHashMappingRepository
;
import
cn.quantgroup.xyqb.repository.IUserHashPhoneNoIdNoMappingRepository
;
import
cn.quantgroup.xyqb.util.encrypt.Md5Util
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
...
...
@@ -20,9 +18,6 @@ public class PhoneHashEventListener implements ApplicationListener<RegisterEvent
@Autowired
private
IUserHashMappingRepository
userHashMappingRepository
;
@Resource
private
IUserHashPhoneNoIdNoMappingRepository
userHashPhoneNoIdNoMappingRepository
;
@Override
public
void
onApplicationEvent
(
RegisterEvent
event
)
{
log
.
info
(
"onApplicationEvent cn.quantgroup.xyqb.event.PhoneHashEventListener start"
);
...
...
@@ -30,38 +25,17 @@ public class PhoneHashEventListener implements ApplicationListener<RegisterEvent
String
phoneNo
=
userRegisterParam
.
getPhoneNo
();
Long
userId
=
userRegisterParam
.
getUser
().
getId
();
String
idNo
=
userRegisterParam
.
getIdNo
();
UserHashPhoneNoIdNoMapping
userHashPhoneNoIdNoMapping
=
userHashPhoneNoIdNoMappingRepository
.
findByUserId
(
userId
);
if
(
userHashPhoneNoIdNoMapping
==
null
)
{
userHashPhoneNoIdNoMapping
=
new
UserHashPhoneNoIdNoMapping
(
userId
);
}
StringBuilder
phoneNoIdNoMd5
=
new
StringBuilder
(
phoneNo
);
if
(
StringUtils
.
isNotEmpty
(
idNo
))
{
phoneNoIdNoMd5
.
append
(
idNo
);
}
userHashPhoneNoIdNoMapping
.
setPhoneNoIdNoMd5
(
Md5Util
.
build
(
phoneNoIdNoMd5
.
toString
().
toUpperCase
()));
try
{
userHashPhoneNoIdNoMappingRepository
.
saveAndFlush
(
userHashPhoneNoIdNoMapping
);
}
catch
(
PersistenceException
e
)
{
log
.
error
(
"保存userHashPhoneNoIdNoMapping重复, 无需再保存, userId:{}"
,
userId
);
}
UserHashMapping
userHashMapping
=
userHashMappingRepository
.
findByUserId
(
userId
);
if
(
userHashMapping
!=
null
)
{
//已存在的用户, 并且已存在身份证号
return
;
}
if
(
userHashMapping
==
null
)
{
//创建一个新的
userHashMapping
=
new
UserHashMapping
(
userId
);
}
//无论如何都更新手机号
String
phoneNoMd5
=
Md5Util
.
build
(
phoneNo
);
userHashMapping
.
setPhoneNoMd5
(
phoneNoMd5
);
try
{
userHashMappingRepository
.
saveAndFlush
(
userHashMapping
);
}
catch
(
PersistenceException
e
)
{
...
...
src/main/java/cn/quantgroup/xyqb/event/UserExtInfoSaveEvent.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
event
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
lombok.Getter
;
import
org.springframework.context.ApplicationEvent
;
/**
* @author :dongjianhua
* @date :Created in 2020/12/22 11:42
* @description:用户扩展信息事件监听
* @modified By:
* @version:
*/
@Getter
public
class
UserExtInfoSaveEvent
extends
ApplicationEvent
{
private
UserExtInfo
userExtInfo
;
public
UserExtInfoSaveEvent
(
Object
source
)
{
super
(
source
);
}
public
UserExtInfoSaveEvent
(
Object
source
,
UserExtInfo
extInfo
)
{
super
(
source
);
userExtInfo
=
extInfo
;
}
}
src/main/java/cn/quantgroup/xyqb/model/UserDetailRet.java
View file @
72808a08
...
...
@@ -55,11 +55,9 @@ public class UserDetailRet implements Serializable {
UserDetailRet
userDetailRet
=
new
UserDetailRet
();
userDetailRet
.
setId
(
userDetail
.
getId
());
userDetailRet
.
setName
(
userDetail
.
getName
());
userDetailRet
.
setIdNo
(
userDetail
.
getIdNo
());
userDetailRet
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
userDetailRet
.
setEmail
(
StringUtils
.
defaultIfEmpty
(
userDetail
.
getEmail
(),
""
));
userDetailRet
.
setGender
(
userDetail
.
getGender
());
userDetailRet
.
setIdType
(
userDetail
.
getIdType
());
userDetailRet
.
setIsAuthenticated
(
userDetail
.
getIsAuthenticated
());
userDetailRet
.
setQq
(
StringUtils
.
defaultIfEmpty
(
userDetail
.
getQq
(),
""
));
userDetailRet
.
setUserId
(
userDetail
.
getUserId
());
...
...
src/main/java/cn/quantgroup/xyqb/model/UserExtInfoRet.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
model
;
import
cn.quantgroup.xyqb.constant.enums.*
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
lombok.Data
;
/**
* Created by Miraculous on 2017/2/13.
*/
@Data
public
class
UserExtInfoRet
{
private
static
final
long
serialVersionUID
=
-
1L
;
private
Long
id
;
private
Long
userId
;
private
IncomeEnum
incomeEnum
;
private
IncomeRangeEnum
incomeRangeEnum
;
private
OccupationEnum
occupationEnum
;
private
EducationEnum
educationEnum
;
private
boolean
hasCar
;
private
boolean
hasSocialSecurity
;
private
boolean
hasHouse
;
private
boolean
hasCreditCard
;
private
MaritalStatus
marryStatus
;
private
Long
createdAt
;
private
Long
updateAt
;
private
static
boolean
defaultBoolean
(
Boolean
k
)
{
return
k
==
null
?
false
:
k
;
}
public
static
UserExtInfoRet
getUserExtInfoRet
(
UserExtInfo
extInfo
)
{
if
(
extInfo
==
null
)
{
return
null
;
}
UserExtInfoRet
ret
=
new
UserExtInfoRet
();
ret
.
setUserId
(
extInfo
.
getUserId
());
ret
.
setId
(
extInfo
.
getId
());
ret
.
setIncomeEnum
(
extInfo
.
getIncomeEnum
());
ret
.
setIncomeRangeEnum
(
extInfo
.
getIncomeRangeEnum
());
ret
.
setOccupationEnum
(
extInfo
.
getOccupationEnum
());
ret
.
setEducationEnum
(
extInfo
.
getEducationEnum
());
ret
.
setHasCar
(
defaultBoolean
(
extInfo
.
getHasCar
()));
ret
.
setHasSocialSecurity
(
defaultBoolean
(
extInfo
.
getHasSocialSecurity
()));
ret
.
setHasHouse
(
defaultBoolean
(
extInfo
.
getHasHouse
()));
ret
.
setHasCreditCard
(
defaultBoolean
(
extInfo
.
getHasCreditCard
()));
ret
.
setMarryStatus
(
extInfo
.
getMarryStatus
());
ret
.
setCreatedAt
(
extInfo
.
getCreatedAt
().
getTime
());
ret
.
setUpdateAt
(
extInfo
.
getUpdatedAt
().
getTime
());
return
ret
;
}
}
src/main/java/cn/quantgroup/xyqb/model/UserFullInfo.java
View file @
72808a08
...
...
@@ -47,7 +47,6 @@ public class UserFullInfo implements Serializable {
}
if
(
userDetail
!=
null
)
{
this
.
name
=
userDetail
.
getName
();
this
.
idNo
=
userDetail
.
getIdNo
();
this
.
gender
=
Optional
.
ofNullable
(
userDetail
.
getGender
()).
orElse
(
Gender
.
UNKNOWN
).
getName
();
}
}
...
...
src/main/java/cn/quantgroup/xyqb/model/UserInfo.java
View file @
72808a08
...
...
@@ -33,7 +33,6 @@ public class UserInfo implements Serializable {
this
.
uuid
=
user
.
getUuid
();
if
(
userDetail
!=
null
)
{
this
.
name
=
userDetail
.
getName
();
this
.
IdNo
=
userDetail
.
getIdNo
();
}
}
}
src/main/java/cn/quantgroup/xyqb/model/UserModel.java
View file @
72808a08
...
...
@@ -44,7 +44,6 @@ public class UserModel implements Serializable {
this
.
uuid
=
user
.
getUuid
();
if
(
userDetail
!=
null
)
{
this
.
name
=
userDetail
.
getName
();
this
.
idNo
=
userDetail
.
getIdNo
();
this
.
gender
=
Optional
.
ofNullable
(
userDetail
.
getGender
()).
orElse
(
Gender
.
UNKNOWN
).
getName
();
}
}
...
...
src/main/java/cn/quantgroup/xyqb/model/UserSpouseRet.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
model
;
import
cn.quantgroup.xyqb.constant.enums.MaritalStatus
;
import
cn.quantgroup.xyqb.entity.UserSpouse
;
import
lombok.Data
;
/**
* Created by 11 on 2017/4/19.
*/
@Data
public
class
UserSpouseRet
{
private
Long
userId
;
private
String
spousePhone
;
private
String
spouseName
;
private
Long
createdAt
;
private
Long
updateAt
;
private
MaritalStatus
status
;
public
static
UserSpouseRet
getUserSpouseRet
(
UserSpouse
userSpouse
)
{
if
(
userSpouse
==
null
)
{
return
null
;
}
UserSpouseRet
ret
=
new
UserSpouseRet
();
ret
.
setUserId
(
userSpouse
.
getUserId
());
ret
.
setSpouseName
(
userSpouse
.
getSpouseName
());
ret
.
setSpousePhone
(
userSpouse
.
getSpousePhone
());
if
(
userSpouse
.
getUpdatedAt
()
!=
null
)
{
ret
.
setUpdateAt
(
userSpouse
.
getUpdatedAt
().
getTime
());
}
if
(
userSpouse
.
getCreatedAt
()
!=
null
)
{
ret
.
setCreatedAt
(
userSpouse
.
getCreatedAt
().
getTime
());
}
ret
.
setStatus
(
userSpouse
.
getStatus
());
return
ret
;
}
}
src/main/java/cn/quantgroup/xyqb/repository/ISmsTemplateRepository.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
repository
;
import
cn.quantgroup.xyqb.entity.SmsTemplateEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.stereotype.Repository
;
import
java.util.Optional
;
/**
* Created by hechao on 2020/2/17.
*/
@Repository
public
interface
ISmsTemplateRepository
extends
JpaRepository
<
SmsTemplateEntity
,
Long
>
{
Optional
<
SmsTemplateEntity
>
findFirstByClientIdAndType
(
Long
clientId
,
String
type
);
}
\ No newline at end of file
src/main/java/cn/quantgroup/xyqb/repository/IUserDetailRepository.java
View file @
72808a08
...
...
@@ -37,34 +37,23 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>,
List
<
UserDetail
>
findAll
(
Specification
<
UserDetail
>
specification
);
/**
* 修复线上身份证问题,后续误用
*
* @return
*/
@Query
(
value
=
"select * from user_detail where gender!=1 and gender!=2 and id_no is not null"
,
nativeQuery
=
true
)
List
<
UserDetail
>
selectUserDetailsBy
();
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Modifying
@Query
(
value
=
"update user_detail set name=?1,
id_no=?2,gender=?3 where phone_no=?4
"
,
nativeQuery
=
true
)
int
updateNameAndIdNoByPhoneNo
(
String
name
,
String
idNo
,
int
gender
,
String
phoneNo
);
@Query
(
value
=
"update user_detail set name=?1,
gender=?2 where phone_no=?3
"
,
nativeQuery
=
true
)
int
updateNameAndIdNoByPhoneNo
(
String
name
,
int
gender
,
String
phoneNo
);
/**
* 按照身份证号和手机号 - 模糊查询
*
* @param phoneNo - 手机号
* @param idNo - 身份证号
* @return List<UserDetail>
*/
@Query
(
value
=
"select * from user_detail where phone_no like ?1 and id_no like ?2"
,
nativeQuery
=
true
)
List
<
UserDetail
>
fuzzyQueryByPhoneNoAndIdNo
(
String
phoneNo
,
String
idNo
);
List
<
UserDetail
>
findTop20ByIdNoStartingWith
(
String
idNo
);
@Query
(
value
=
"select * from user_detail where phone_no like ?1"
,
nativeQuery
=
true
)
List
<
UserDetail
>
fuzzyQueryByPhoneNo
(
String
phoneNo
);
List
<
UserDetail
>
findTop20ByPhoneNoStartingWith
(
String
phoneNo
);
List
<
UserDetail
>
findByIdBetween
(
Long
id
,
Long
endId
);
UserDetail
findByUserIdAndPhoneNoAndName
AndIdNo
(
Long
userId
,
String
phoneNo
,
String
name
,
String
idNo
);
UserDetail
findByUserIdAndPhoneNoAndName
(
Long
userId
,
String
phoneNo
,
String
name
);
}
src/main/java/cn/quantgroup/xyqb/repository/IUserExtInfoRepository.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
repository
;
import
cn.quantgroup.xyqb.constant.enums.OccupationEnum
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.sql.Timestamp
;
import
java.util.List
;
/**
* Created by 11 on 2016/12/30.
*/
public
interface
IUserExtInfoRepository
extends
JpaRepository
<
UserExtInfo
,
Long
>
{
UserExtInfo
findByUserId
(
Long
userId
);
List
<
UserExtInfo
>
findByCreatedAtAfterAndCreatedAtBeforeAndOccupationEnum
(
Timestamp
start
,
Timestamp
end
,
OccupationEnum
student
);
}
src/main/java/cn/quantgroup/xyqb/repository/IUserHashPhoneNoIdNoMappingRepository.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
repository
;
import
cn.quantgroup.xyqb.entity.UserHashPhoneNoIdNoMapping
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.transaction.annotation.Transactional
;
public
interface
IUserHashPhoneNoIdNoMappingRepository
extends
JpaRepository
<
UserHashPhoneNoIdNoMapping
,
Long
>
{
UserHashPhoneNoIdNoMapping
findFirstByPhoneNoIdNoMd5
(
String
phoneNoIdNoMd5
);
UserHashPhoneNoIdNoMapping
findByUserId
(
Long
userId
);
@Transactional
void
deleteByUserId
(
Long
userId
);
}
src/main/java/cn/quantgroup/xyqb/repository/IUserSpouseRepository.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
repository
;
import
cn.quantgroup.xyqb.entity.UserSpouse
;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
IUserSpouseRepository
extends
JpaRepository
<
UserSpouse
,
Long
>
{
UserSpouse
findByUserId
(
Long
userId
);
}
src/main/java/cn/quantgroup/xyqb/service/page/impl/PageServiceImpl.java
View file @
72808a08
...
...
@@ -2,12 +2,10 @@ package cn.quantgroup.xyqb.service.page.impl;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
cn.quantgroup.xyqb.model.Tuple
;
import
cn.quantgroup.xyqb.service.page.IPageService
;
import
cn.quantgroup.xyqb.service.page.bean.BasePageType
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserExtInfoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -31,15 +29,6 @@ public class PageServiceImpl implements IPageService {
return
userDetail
!=
null
;
}
};
@Autowired
private
IUserExtInfoService
userExtInfoService
;
private
BasePageType
pageUserFinance
=
new
BasePageType
(
"info"
,
false
)
{
@Override
public
boolean
canPass
(
User
user
)
{
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
user
.
getId
());
return
null
!=
extInfo
;
}
};
...
...
@@ -47,10 +36,6 @@ public class PageServiceImpl implements IPageService {
private
void
init
()
{
routerDefinetion
=
new
HashMap
<>();
routerDefinetion
.
put
(
"cashTarget1"
,
new
BasePageType
[]{
pageIdNo
,
pageUserFinance
});
routerDefinetion
.
put
(
"cashTarget4"
,
new
BasePageType
[]{
pageIdNo
});
...
...
src/main/java/cn/quantgroup/xyqb/service/user/CleanDataService.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
service
.
user
;
import
java.util.Map
;
public
interface
CleanDataService
{
Map
<
String
,
Object
>
cleanData
();
}
src/main/java/cn/quantgroup/xyqb/service/user/ISmsService.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
service
.
user
;
import
cn.quantgroup.xyqb.entity.SmsTemplateEntity
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.repository.ISmsTemplateRepository
;
import
cn.quantgroup.xyqb.util.GcodeUtils
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
javax.inject.Inject
;
import
java.util.*
;
/**
* Created by hechao on 2020/2/17.
*/
@Slf4j
@Service
public
class
ISmsService
{
@Inject
private
ISmsTemplateRepository
smsTemplateRepository
;
public
String
sendSms
(
Long
clientId
,
String
type
,
String
phoneNo
)
{
JsonResult
res
=
new
JsonResult
();
String
code
=
null
;
try
{
Optional
<
SmsTemplateEntity
>
optional
=
smsTemplateRepository
.
findFirstByClientIdAndType
(
clientId
,
type
);
if
(!
optional
.
isPresent
())
{
log
.
error
(
"没有指定的模板"
);
return
code
;
}
SmsTemplateEntity
smsTemplateEntity
=
optional
.
orElse
(
new
SmsTemplateEntity
());
RestTemplate
restTemplate
=
new
RestTemplate
();
Map
<
String
,
Object
>
user
=
new
HashMap
<>();
List
<
String
>
contentArgs
=
new
ArrayList
<>();
code
=
GcodeUtils
.
generatedcode
(
5
);
contentArgs
.
add
(
code
);
user
.
put
(
"merchantId"
,
smsTemplateEntity
.
getMerchantId
());
user
.
put
(
"phoneNo"
,
phoneNo
);
user
.
put
(
"contentId"
,
smsTemplateEntity
.
getContentId
());
user
.
put
(
"contentArgs"
,
contentArgs
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
"https://msgapi-qa.liangkebang.net/middle_office/send/message/quick"
,
user
,
String
.
class
);
//提交的body内容为user对象,请求的返回的body类型为String
int
statusCode
=
responseEntity
.
getStatusCodeValue
();
String
bodyCode
=
JSONObject
.
parseObject
(
responseEntity
.
getBody
(),
HashMap
.
class
).
get
(
"code"
).
toString
();
if
(
200
!=
statusCode
||
!
"0"
.
equals
(
bodyCode
))
{
log
.
error
(
"验证码发送失败"
);
return
null
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"发送验证码异常---{}"
,
e
.
getMessage
());
}
return
code
;
}
}
src/main/java/cn/quantgroup/xyqb/service/user/IUserDetailService.java
View file @
72808a08
...
...
@@ -30,9 +30,6 @@ public interface IUserDetailService {
List
<
UserDetail
>
findByPhoneNos
(
List
<
String
>
phoneNos
);
List
<
UserDetail
>
findByIdnos
(
List
<
String
>
idnos
);
List
<
UserDetail
>
findByIdNoStartingWith
(
String
idNo
);
List
<
UserDetail
>
findByPhoneNoStartingWith
(
String
phoneNo
);
Page
<
UserDetail
>
getUserDetailsPage
(
List
<
Long
>
userId
,
List
<
String
>
phoneNos
,
List
<
String
>
idNos
,
int
pageNumber
,
int
pageSize
,
String
sortType
);
...
...
@@ -41,19 +38,17 @@ public interface IUserDetailService {
* 更新用户的身份证号
*
* @param name name
* @param idNo idNo
* @param phoneNo phoneNo
* @return 受影响的行数
*/
int
updateName
AndIdCard
(
String
name
,
String
idNo
,
String
phoneNo
);
int
updateName
(
String
name
,
String
phoneNo
);
List
<
UserDetail
>
findByPhones
(
List
<
String
>
phoneNos
);
/**
* 按照身份证号和手机号 - 模糊查询
* @param phoneNo - 手机号
* @param idNo - 身份证号
* @return List<UserDetail>
*/
List
<
UserDetail
>
fuzzyQueryByPhoneNo
AndIdNo
(
String
phoneNo
,
String
id
No
);
List
<
UserDetail
>
fuzzyQueryByPhoneNo
(
String
phone
No
);
}
src/main/java/cn/quantgroup/xyqb/service/user/IUserExtInfoService.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
service
.
user
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
java.sql.Timestamp
;
import
java.util.List
;
/**
* Created by Miraculous on 2017/1/3.
*/
public
interface
IUserExtInfoService
{
UserExtInfo
findByUserId
(
Long
userId
);
UserExtInfo
save
(
UserExtInfo
info
);
List
<
UserExtInfo
>
findByCreatedAtAfterAndCreatedAtBeforeAndOccupationEnum
(
Timestamp
start
,
Timestamp
end
);
}
src/main/java/cn/quantgroup/xyqb/service/user/IUserSpouseService.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
service
.
user
;
import
cn.quantgroup.xyqb.entity.UserSpouse
;
public
interface
IUserSpouseService
{
UserSpouse
findByUserId
(
Long
userId
);
UserSpouse
save
(
UserSpouse
userSpouse
);
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/CleanDataServiceImp.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
service
.
user
.
impl
;
import
cn.quantgroup.xyqb.constant.enums.OccupationEnum
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
cn.quantgroup.xyqb.repository.IUserExtInfoRepository
;
import
cn.quantgroup.xyqb.service.user.CleanDataService
;
import
cn.quantgroup.xyqb.service.user.IUserExtInfoService
;
import
com.google.common.base.Stopwatch
;
import
com.google.common.collect.Maps
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.sql.Timestamp
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
/**
* @author :dongjianhua
* @date :Created in 2020/7/17 11:32
* @description:清洗数据
* @modified By:
* @version: 1.0
*/
@Slf4j
@Service
public
class
CleanDataServiceImp
implements
CleanDataService
{
@Resource
private
IUserExtInfoService
iUserExtInfoService
;
@Autowired
private
IUserExtInfoRepository
userExtInfoRepository
;
@Autowired
@Qualifier
(
"stringRedisTemplate"
)
private
RedisTemplate
<
String
,
String
>
stringRedisTemplate
;
public
final
String
LOCKKEY
=
"681F0307-C7F9-11EA-A303-0A58AC100553"
;
@Async
@Override
public
Map
<
String
,
Object
>
cleanData
()
{
Map
<
String
,
Object
>
re
=
Maps
.
newHashMap
();
try
{
Boolean
lock
=
stringRedisTemplate
.
opsForValue
().
setIfAbsent
(
LOCKKEY
,
"lock"
);
if
(!
lock
)
{
return
re
;
}
SimpleDateFormat
sf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Stopwatch
s
=
Stopwatch
.
createStarted
();
Date
parse
=
null
;
try
{
parse
=
sf
.
parse
(
"2015-08-14 00:00:00"
);
// parse = sf.parse("2020-01-01 00:00:00");
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
parse
);
long
all
=
0L
;
while
(
true
)
{
Timestamp
start
=
new
Timestamp
(
calendar
.
getTime
().
getTime
());
calendar
.
add
(
Calendar
.
MONTH
,
1
);
Timestamp
end
=
new
Timestamp
(
calendar
.
getTime
().
getTime
());
String
starDate
=
(
start
.
getYear
()
+
1900
)
+
"年"
+
(
start
.
getMonth
()
+
1
)
+
"月"
+
start
.
getDate
()
+
"日"
;
String
endDate
=
(
end
.
getYear
()
+
1900
)
+
"年"
+
(
end
.
getMonth
()
+
1
)
+
"月"
+
end
.
getDate
()
+
"日"
;
try
{
List
<
UserExtInfo
>
list
=
iUserExtInfoService
.
findByCreatedAtAfterAndCreatedAtBeforeAndOccupationEnum
(
start
,
end
);
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
for
(
UserExtInfo
userExtInfo
:
list
)
{
try
{
userExtInfo
.
setOccupationEnum
(
OccupationEnum
.
OTHER
);
iUserExtInfoService
.
save
(
userExtInfo
);
all
++;
}
catch
(
Exception
e
)
{
log
.
error
(
"保存异常o:{} "
,
userExtInfo
);
}
}
}
log
.
info
(
"开始时间start:{},结束时间end: {} ,条数:{}"
,
starDate
,
endDate
,
list
.
size
());
re
.
put
(
starDate
+
"-"
+
endDate
,
list
.
size
());
if
(
end
.
after
(
new
Date
()))
{
break
;
}
}
catch
(
Exception
e
)
{
log
.
error
(
"时间段:{}--{}执行异常,e"
,
starDate
,
endDate
,
e
);
}
log
.
info
(
"清洗结束总共清洗了all:{}条,耗时:{}秒"
,
all
,
s
.
elapsed
(
TimeUnit
.
SECONDS
));
}
log
.
info
(
"清洗明细:{} "
,
re
);
}
catch
(
Exception
e
)
{
log
.
error
(
"清洗的时候出现了异常e:{}"
,
e
);
}
finally
{
stringRedisTemplate
.
delete
(
LOCKKEY
);
}
return
null
;
}
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/ModifyPhoneNoServiceImpl.java
View file @
72808a08
...
...
@@ -242,7 +242,7 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
if
(
ModifyPhoneNoApplyStatusEnum
.
DONE
==
auditReq
.
getApplyStatus
())
{
log
.
info
(
"audit userId = 【{}】, name = 【{}】, idCard = 【{}】, prevPhoneNo = 【{}】, "
+
"curPhoneNo = 【{}】"
,
modifyPhoneNo
.
getUserId
(),
modifyPhoneNo
.
getName
(),
modifyPhoneNo
.
getIdCard
(),
modifyPhoneNo
.
getPrevPhoneNo
(),
modifyPhoneNo
.
getCurPhoneNo
());
if
(
userDetailRepository
.
findByUserIdAndPhoneNoAndName
AndIdNo
(
modifyPhoneNo
.
getUserId
(),
modifyPhoneNo
.
getPrevPhoneNo
(),
modifyPhoneNo
.
getName
(),
modifyPhoneNo
.
getIdCard
())
==
null
)
{
if
(
userDetailRepository
.
findByUserIdAndPhoneNoAndName
(
modifyPhoneNo
.
getUserId
(),
modifyPhoneNo
.
getPrevPhoneNo
(),
modifyPhoneNo
.
getName
())
==
null
)
{
throw
new
DataException
(
"姓名、身份证、电话号不符。"
);
}
if
(
userRepository
.
findByPhoneNo
(
modifyPhoneNo
.
getCurPhoneNo
())
!=
null
)
{
...
...
@@ -547,7 +547,7 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
if
(!
smsService
.
verifyPhoneAndCode
(
curPhoneNo
,
smsCode
))
{
throw
new
DataException
(
"验证码不正确。"
);
}
if
(
userDetailRepository
.
findByUserIdAndPhoneNoAndName
AndIdNo
(
userId
,
prevPhoneNo
,
name
,
idCard
)
==
null
)
{
if
(
userDetailRepository
.
findByUserIdAndPhoneNoAndName
(
userId
,
prevPhoneNo
,
name
)
==
null
)
{
throw
new
DataException
(
"信息填写有误,请重新填写。"
);
}
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/TenantServiceImpl.java
View file @
72808a08
...
...
@@ -65,7 +65,6 @@ public class TenantServiceImpl implements ITenantService {
UserDetail
tenantUserDetail
=
new
UserDetail
();
tenantUserDetail
.
setUserId
(
userDetail
.
getUserId
());
tenantUserDetail
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
tenantUserDetail
.
setIdNo
(
customerInfo
.
getIdCardNo
());
tenantUserDetail
.
setName
(
customerInfo
.
getName
());
tenantUserDetail
.
setCreatedAt
(
userDetail
.
getCreatedAt
());
tenantUserDetail
.
setUpdatedAt
(
userDetail
.
getUpdatedAt
());
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
View file @
72808a08
...
...
@@ -71,10 +71,6 @@ public class UserDetailServiceImpl implements IUserDetailService {
@Override
public
UserDetail
saveUserDetail
(
UserDetail
userDetail
)
throws
DataIntegrityViolationException
{
String
idNo
=
userDetail
.
getIdNo
();
if
(
StringUtils
.
isNotEmpty
(
idNo
))
{
userDetail
.
setIdNo
(
idNo
.
toUpperCase
());
}
UserDetail
userDetail1
=
userDetailRepository
.
save
(
userDetail
);
// 发送实名登记统计消息
applicationEventPublisher
.
publishEvent
(
new
UserDetailUpdateEvent
(
this
,
userDetail1
));
...
...
@@ -165,19 +161,6 @@ public class UserDetailServiceImpl implements IUserDetailService {
});
}
@Override
public
List
<
UserDetail
>
findByIdnos
(
List
<
String
>
idnos
)
{
return
userDetailRepository
.
findAll
((
root
,
query
,
cb
)
->
{
query
.
where
(
root
.
get
(
"idNo"
).
in
(
idnos
));
return
query
.
getRestriction
();
});
}
@Override
public
List
<
UserDetail
>
findByIdNoStartingWith
(
String
idNo
)
{
return
userDetailRepository
.
findTop20ByIdNoStartingWith
(
idNo
);
}
@Override
public
List
<
UserDetail
>
findByPhoneNoStartingWith
(
String
phoneNo
)
{
return
userDetailRepository
.
findTop20ByPhoneNoStartingWith
(
phoneNo
);
...
...
@@ -240,26 +223,17 @@ public class UserDetailServiceImpl implements IUserDetailService {
}
@Override
public
int
updateName
AndIdCard
(
String
name
,
String
idNo
,
String
phoneNo
)
{
public
int
updateName
(
String
name
,
String
phoneNo
)
{
UserDetail
userDetail
=
userDetailRepository
.
findByPhoneNo
(
phoneNo
);
if
(
null
!=
userDetail
)
{
String
newName
=
userDetail
.
getName
();
String
newIdNo
=
userDetail
.
getIdNo
();
Gender
newGender
=
Gender
.
UNKNOWN
;
if
(
ValidationUtil
.
validateChinese
(
name
))
{
newName
=
name
;
}
if
(
StringUtils
.
isNotBlank
(
idNo
))
{
IdCardInfo
idCardInfo
=
idCardService
.
getIdCardInfo
(
idNo
);
if
(
Objects
.
nonNull
(
idCardInfo
)
&&
idCardInfo
.
isValid
())
{
newIdNo
=
idCardInfo
.
getIdNo
();
newGender
=
idCardInfo
.
getGender
();
}
else
{
log
.
error
(
"用户的身份证错误,phoneNo:{},idNo:{}"
,
phoneNo
,
idNo
);
}
}
if
(!
Objects
.
equals
(
newName
,
userDetail
.
getName
())
||
!
Objects
.
equals
(
newIdNo
,
userDetail
.
getIdNo
()))
{
return
userDetailRepository
.
updateNameAndIdNoByPhoneNo
(
newName
,
newIdNo
,
Optional
.
ofNullable
(
newGender
).
orElse
(
Gender
.
UNKNOWN
).
ordinal
(),
phoneNo
);
if
(!
Objects
.
equals
(
newName
,
userDetail
.
getName
()))
{
return
userDetailRepository
.
updateNameAndIdNoByPhoneNo
(
newName
,
Optional
.
ofNullable
(
newGender
).
orElse
(
Gender
.
UNKNOWN
).
ordinal
(),
phoneNo
);
}
}
return
0
;
...
...
@@ -275,8 +249,8 @@ public class UserDetailServiceImpl implements IUserDetailService {
}
@Override
public
List
<
UserDetail
>
fuzzyQueryByPhoneNo
AndIdNo
(
String
phoneNo
,
String
id
No
)
{
return
userDetailRepository
.
fuzzyQueryByPhoneNo
AndIdNo
(
phoneNo
.
concat
(
"%"
),
id
No
.
concat
(
"%"
));
public
List
<
UserDetail
>
fuzzyQueryByPhoneNo
(
String
phone
No
)
{
return
userDetailRepository
.
fuzzyQueryByPhoneNo
(
phone
No
.
concat
(
"%"
));
}
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserExtInfoServiceImpl.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
service
.
user
.
impl
;
import
cn.quantgroup.xyqb.constant.enums.OccupationEnum
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
cn.quantgroup.xyqb.repository.IUserExtInfoRepository
;
import
cn.quantgroup.xyqb.service.user.IUserExtInfoService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.sql.Timestamp
;
import
java.util.List
;
/**
* Created by Miraculous on 2017/1/3.
*/
@Slf4j
@Service
public
class
UserExtInfoServiceImpl
implements
IUserExtInfoService
{
@Autowired
private
IUserExtInfoRepository
userExtInfoRepository
;
@Override
// @Cacheable(value = "userextinfocache", key = "'extinfo' + #userId", unless = "#result == null", cacheManager = "cacheManager")
public
UserExtInfo
findByUserId
(
Long
userId
)
{
return
userExtInfoRepository
.
findByUserId
(
userId
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@CacheEvict
(
value
=
"userextinfocache"
,
key
=
"'extinfo' + #info.userId"
,
cacheManager
=
"cacheManager"
)
public
UserExtInfo
save
(
UserExtInfo
info
)
{
return
userExtInfoRepository
.
save
(
info
);
}
@Override
public
List
<
UserExtInfo
>
findByCreatedAtAfterAndCreatedAtBeforeAndOccupationEnum
(
Timestamp
start
,
Timestamp
end
)
{
return
userExtInfoRepository
.
findByCreatedAtAfterAndCreatedAtBeforeAndOccupationEnum
(
start
,
end
,
OccupationEnum
.
STUDENT
);
}
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
View file @
72808a08
package
cn
.
quantgroup
.
xyqb
.
service
.
user
.
impl
;
import
cn.quantgroup.xyqb.constant.enums.IncomeRangeEnum
;
import
cn.quantgroup.xyqb.constant.enums.LoginType
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.aspect.lock.RedisLock
;
import
cn.quantgroup.xyqb.constant.enums.LoginType
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.controller.internal.user.resp.UserFullResp
;
import
cn.quantgroup.xyqb.entity.*
;
...
...
@@ -69,9 +68,6 @@ public class UserServiceImpl implements IUserService, IBaseController {
@Autowired
private
IUserHashMappingRepository
userHashMappingRepository
;
@Resource
private
IUserHashPhoneNoIdNoMappingRepository
userHashPhoneNoIdNoMappingRepository
;
@Autowired
private
IUserDetailService
userDetailService
;
...
...
@@ -87,8 +83,6 @@ public class UserServiceImpl implements IUserService, IBaseController {
@Autowired
private
ISessionService
sessionService
;
@Resource
private
IUserExtInfoService
userExtInfoService
;
@Resource
private
ILockIpv4Service
lockIpv4Service
;
...
...
@@ -316,11 +310,6 @@ public class UserServiceImpl implements IUserService, IBaseController {
userHashMapping
=
userHashMappingRepository
.
findByPhoneNoMd5ShortAndPhoneNoMd5
(
value
,
md5Value
);
}
else
{
userHashMapping
=
null
;
UserHashPhoneNoIdNoMapping
userHashPhoneNoIdNoMapping
=
userHashPhoneNoIdNoMappingRepository
.
findFirstByPhoneNoIdNoMd5
(
md5Value
);
if
(
userHashPhoneNoIdNoMapping
!=
null
)
{
userHashMapping
=
new
UserHashMapping
();
userHashMapping
.
setUserId
(
userHashPhoneNoIdNoMapping
.
getUserId
());
}
}
if
(
userHashMapping
==
null
)
{
return
null
;
...
...
@@ -338,11 +327,6 @@ public class UserServiceImpl implements IUserService, IBaseController {
userHashMapping
=
userHashMappingRepository
.
findByPhoneNoMd5ShortAndPhoneNoMd5
(
value
,
md5Value
);
}
else
{
userHashMapping
=
null
;
UserHashPhoneNoIdNoMapping
userHashPhoneNoIdNoMapping
=
userHashPhoneNoIdNoMappingRepository
.
findFirstByPhoneNoIdNoMd5
(
md5Value
);
if
(
userHashPhoneNoIdNoMapping
!=
null
)
{
userHashMapping
=
new
UserHashMapping
();
userHashMapping
.
setUserId
(
userHashPhoneNoIdNoMapping
.
getUserId
());
}
}
if
(
userHashMapping
==
null
)
{
return
null
;
...
...
@@ -508,7 +492,6 @@ public class UserServiceImpl implements IUserService, IBaseController {
public
UserFullResp
findUserFullSearchByUserId
(
Long
userId
)
{
User
user
=
userRepository
.
findById
(
userId
);
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
userId
);
UserExtInfo
userExtInfo
=
userExtInfoService
.
findByUserId
(
userId
);
UserFullResp
userFullResp
=
UserFullResp
.
builder
().
userId
(
userId
).
build
();
if
(
user
!=
null
)
{
...
...
@@ -517,25 +500,10 @@ public class UserServiceImpl implements IUserService, IBaseController {
if
(
userDetail
!=
null
)
{
userFullResp
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
userFullResp
.
setName
(
userDetail
.
getName
());
userFullResp
.
setIdNo
(
userDetail
.
getIdNo
());
userFullResp
.
setIdType
(
userDetail
.
getIdType
().
ordinal
());
userFullResp
.
setGender
(
userDetail
.
getGender
().
ordinal
());
userFullResp
.
setEmail
(
userDetail
.
getEmail
());
userFullResp
.
setQq
(
userDetail
.
getQq
());
}
if
(
userExtInfo
!=
null
)
{
userFullResp
.
setIncomeType
(
userExtInfo
.
getIncomeEnum
().
ordinal
());
userFullResp
.
setIncomeRange
(
userExtInfo
.
getIncomeRangeEnum
()
==
null
?
IncomeRangeEnum
.
UNKNOWN
.
ordinal
()
:
userExtInfo
.
getIncomeRangeEnum
().
ordinal
());
userFullResp
.
setOccupation
(
userExtInfo
.
getOccupationEnum
().
ordinal
());
userFullResp
.
setEducation
(
userExtInfo
.
getEducationEnum
().
ordinal
());
userFullResp
.
setHasCar
(
userExtInfo
.
getHasCar
()
==
null
?
0
:
userExtInfo
.
getHasCar
()
?
1
:
0
);
userFullResp
.
setHasSocialSecurity
(
userExtInfo
.
getHasSocialSecurity
()
==
null
?
0
:
userExtInfo
.
getHasSocialSecurity
()
?
1
:
0
);
userFullResp
.
setHasHouse
(
userExtInfo
.
getHasHouse
()
==
null
?
0
:
userExtInfo
.
getHasHouse
()
?
1
:
0
);
userFullResp
.
setHasCreditCard
(
userExtInfo
.
getHasCreditCard
()
==
null
?
0
:
userExtInfo
.
getHasCreditCard
()
?
1
:
0
);
userFullResp
.
setMarryStatus
(
userExtInfo
.
getMarryStatus
()
!=
null
?
userExtInfo
.
getMarryStatus
().
ordinal
()
:
null
);
}
return
userFullResp
;
}
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserSpouseServiceImpl.java
deleted
100644 → 0
View file @
7ed15f5b
package
cn
.
quantgroup
.
xyqb
.
service
.
user
.
impl
;
import
cn.quantgroup.xyqb.entity.UserSpouse
;
import
cn.quantgroup.xyqb.repository.IUserSpouseRepository
;
import
cn.quantgroup.xyqb.service.user.IUserSpouseService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.stereotype.Service
;
@Service
public
class
UserSpouseServiceImpl
implements
IUserSpouseService
{
@Autowired
private
IUserSpouseRepository
userSpouseRepository
;
@Override
// @Cacheable(value = "userSpouseCache", key = "'spouse' + #userId", unless = "#result == null", cacheManager = "cacheManager")
public
UserSpouse
findByUserId
(
Long
userId
)
{
return
userSpouseRepository
.
findByUserId
(
userId
);
}
@Override
@CacheEvict
(
value
=
"userSpouseCache"
,
key
=
"'spouse' + #userSpouse.userId"
,
cacheManager
=
"cacheManager"
)
public
UserSpouse
save
(
UserSpouse
userSpouse
)
{
return
userSpouseRepository
.
save
(
userSpouse
);
}
}
src/main/java/cn/quantgroup/xyqb/service/user/vo/UserDetailVO.java
View file @
72808a08
...
...
@@ -40,53 +40,4 @@ public class UserDetailVO {
private
Long
updatedAt
;
public
static
UserDetailVO
fromUserDetail
(
UserDetail
userDetail
)
{
UserDetailVO
userDetailVO
=
new
UserDetailVO
();
userDetailVO
.
id
=
userDetail
.
getId
();
userDetailVO
.
userId
=
userDetail
.
getUserId
();
userDetailVO
.
phoneNo
=
userDetail
.
getPhoneNo
();
userDetailVO
.
name
=
userDetail
.
getName
();
userDetailVO
.
idNo
=
userDetail
.
getIdNo
();
userDetailVO
.
idType
=
userDetail
.
getIdType
();
userDetailVO
.
isAuthenticated
=
userDetail
.
getIsAuthenticated
();
userDetailVO
.
gender
=
userDetail
.
getGender
();
userDetailVO
.
email
=
userDetail
.
getEmail
();
userDetailVO
.
qq
=
userDetail
.
getQq
();
if
(
userDetail
.
getCreatedAt
()
!=
null
)
{
userDetailVO
.
createdAt
=
userDetail
.
getCreatedAt
().
getTime
();
}
if
(
userDetail
.
getUpdatedAt
()
!=
null
)
{
userDetailVO
.
updatedAt
=
userDetail
.
getUpdatedAt
().
getTime
();
}
return
userDetailVO
;
}
public
XUserDetail
toXUserDetail
()
{
XUserDetail
xUserDetail
=
new
XUserDetail
();
xUserDetail
.
setId
(
this
.
getId
());
xUserDetail
.
setUserId
(
this
.
getUserId
());
xUserDetail
.
setPhoneNo
(
this
.
getPhoneNo
());
xUserDetail
.
setName
(
this
.
getName
());
xUserDetail
.
setIdNo
(
this
.
getIdNo
());
if
(
this
.
getIdType
()
!=
null
)
{
xUserDetail
.
setIdType
(
cn
.
quantgroup
.
motan
.
enums
.
IdType
.
valueOf
(
this
.
getIdType
().
name
()));
}
if
(
this
.
getGender
()
!=
null
)
{
xUserDetail
.
setGender
(
cn
.
quantgroup
.
motan
.
enums
.
Gender
.
valueOf
(
Optional
.
ofNullable
(
this
.
getGender
()).
orElse
(
Gender
.
UNKNOWN
).
name
()));
}
xUserDetail
.
setEmail
(
this
.
getEmail
());
xUserDetail
.
setQq
(
this
.
getQq
());
xUserDetail
.
setId
(
this
.
getId
());
if
(
this
.
getCreatedAt
()
!=
null
)
{
xUserDetail
.
setCreatedAt
(
new
Timestamp
(
this
.
getCreatedAt
()));
}
if
(
this
.
getUpdatedAt
()
!=
null
)
{
xUserDetail
.
setUpdatedAt
(
new
Timestamp
(
this
.
getUpdatedAt
()));
}
xUserDetail
.
setIsAuthenticated
(
this
.
getIsAuthenticated
());
xUserDetail
.
setEnable
(
this
.
getEnable
());
return
xUserDetail
;
}
}
src/test/java/common/JsonTest.java
View file @
72808a08
...
...
@@ -33,8 +33,6 @@ public class JsonTest {
UserDetail
userData
=
new
UserDetail
();
userData
.
setId
(
131L
);
userData
.
setUserId
(
119L
);
userData
.
setIdNo
(
"wanglaoji"
);
userData
.
setIdType
(
IdType
.
ID_CARD
);
userData
.
setCreatedAt
(
new
Timestamp
(
1
));
log
.
info
(
"序列化--GSON--成功!data:{}"
,
GSON
.
toJson
(
userData
));
log
.
info
(
"序列化--MAPPER--成功!data:{}"
,
MAPPER
.
writeValueAsString
(
userData
));
...
...
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