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
5b8ef268
Commit
5b8ef268
authored
Jun 14, 2023
by
王亮
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-temp-20230614' into 'master'
Feature temp 20230614 See merge request
!115
parents
b8b329a2
919e5814
Changes
52
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
52 changed files
with
25 additions
and
1745 deletions
+25
-1745
pom.xml
pom.xml
+0
-6
UserAuthorizedController.java
...tgroup/xyqb/controller/dust/UserAuthorizedController.java
+0
-70
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
UserAuthorized.java
src/main/java/cn/quantgroup/xyqb/entity/UserAuthorized.java
+0
-48
UserDetail.java
src/main/java/cn/quantgroup/xyqb/entity/UserDetail.java
+0
-37
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
IUserAuthorizedRepository.java
...quantgroup/xyqb/repository/IUserAuthorizedRepository.java
+0
-26
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
IUserAuthorizedService.java
.../quantgroup/xyqb/service/auth/IUserAuthorizedService.java
+0
-42
UserAuthorizedServiceImpl.java
...oup/xyqb/service/auth/impl/UserAuthorizedServiceImpl.java
+0
-105
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
-54
UserAuthorizedTest.java
src/test/java/UserAuthorizedTest.java
+0
-9
JsonTest.java
src/test/java/common/JsonTest.java
+0
-2
UserAuthorizedRepsitoryTest.java
src/test/java/repsitory/UserAuthorizedRepsitoryTest.java
+0
-83
UserAuthorizedServiceTest.java
src/test/java/service/UserAuthorizedServiceTest.java
+0
-85
No files found.
pom.xml
View file @
5b8ef268
...
...
@@ -283,12 +283,6 @@
<artifactId>
logback-core
</artifactId>
<version>
1.2.3
</version>
</dependency>
<dependency>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
xyqb-user-rpc-commons
</artifactId>
<version>
1.1.6-SNAPSHOT
</version>
</dependency>
<!-- 兼容旧 Spring Session 配置-->
<dependency>
...
...
src/main/java/cn/quantgroup/xyqb/controller/dust/UserAuthorizedController.java
deleted
100644 → 0
View file @
b8b329a2
package
cn
.
quantgroup
.
xyqb
.
controller
.
dust
;
import
cn.quantgroup.xyqb.entity.UserAuthorized
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.UserAuthorizedParam
;
import
cn.quantgroup.xyqb.service.auth.IUserAuthorizedService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
/**
* @author xufei on 2018/1/5.
*/
@Slf4j
@RestController
@RequestMapping
(
"/user/auth"
)
public
class
UserAuthorizedController
{
@Resource
private
IUserAuthorizedService
userAuthorizedService
;
/**
* @Deprecated 20210317
*/
@Deprecated
@RequestMapping
(
value
=
"/hasUserAuthorized"
)
public
JsonResult
hasUserAuthorized
(
String
idNo
)
{
log
.
info
(
"[hasUserAuthorized]需要校验的用户的身份证号为idNo:{}"
,
idNo
);
if
(
userAuthorizedService
.
hasUserAuthorized
(
idNo
))
{
return
JsonResult
.
buildSuccessResult
(
null
,
true
);
}
else
{
return
JsonResult
.
buildErrorStateResult
(
null
,
false
);
}
}
/**
* @Deprecated 20210317
*/
@Deprecated
@RequestMapping
(
value
=
"/createUserAuthorized"
)
public
JsonResult
createUserAuthorized
(
UserAuthorizedParam
userAuthorizedParam
)
{
log
.
info
(
"[createUserAuthorized]创建实名账户,userAuthorizedParam:{},"
,
userAuthorizedParam
);
try
{
if
(
userAuthorizedService
.
checkUserAuthorizedParam
(
userAuthorizedParam
))
{
return
JsonResult
.
buildErrorStateResult
(
"参数异常"
,
null
);
}
}
catch
(
Exception
e
)
{
log
.
info
(
"[createUserAuthorized]创建实名账户失败e:{}"
,
e
);
return
JsonResult
.
buildErrorStateResult
(
"参数异常"
,
null
);
}
UserAuthorized
userAuthorized
=
userAuthorizedService
.
createUserAuthorized
(
userAuthorizedParam
);
if
(
null
==
userAuthorized
)
{
return
JsonResult
.
buildErrorStateResult
(
"重复创建异常或userUuid有误"
,
null
);
}
else
{
return
JsonResult
.
buildSuccessResult
(
"创建成功"
,
userAuthorized
.
getId
());
}
}
/**
* @Deprecated 20210317
*/
@Deprecated
@RequestMapping
(
value
=
"/getUserAuthorizedId"
)
public
JsonResult
getUserAuthorizedId
(
String
userUuid
)
{
log
.
info
(
"[getUserAuthorizedId]获取实名账户的id,userUuid:{}"
,
userUuid
);
return
JsonResult
.
buildSuccessResult
(
null
,
userAuthorizedService
.
getUserAuthorizedId
(
userUuid
));
}
}
src/main/java/cn/quantgroup/xyqb/controller/external/UserDetailController.java
View file @
5b8ef268
...
...
@@ -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 @
5b8ef268
...
...
@@ -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 @
5b8ef268
This diff is collapsed.
Click to expand it.
src/main/java/cn/quantgroup/xyqb/controller/internal/user/SyncUserController.java
View file @
5b8ef268
...
...
@@ -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 @
b8b329a2
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 @
5b8ef268
...
...
@@ -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,73 +218,12 @@ 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
);
}
userExtInfo
=
userExtInfoService
.
save
(
userExtInfo
);
applicationEventPublisher
.
publishEvent
(
new
UserExtInfoSaveEvent
(
this
,
userExtInfo
));
return
JsonResult
.
buildSuccessResult
(
null
,
userExtInfo
);
}
/**
* 根据手机号查询用户id, nodejs调用接口无法获取到userId.
* 所以增加该接口来查询用户id
...
...
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/userdetail/UserDetailController.java
View file @
5b8ef268
...
...
@@ -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 @
5b8ef268
...
...
@@ -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 @
5b8ef268
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 @
b8b329a2
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/UserAuthorized.java
deleted
100644 → 0
View file @
b8b329a2
package
cn
.
quantgroup
.
xyqb
.
entity
;
import
cn.quantgroup.xyqb.model.AuthPattern
;
import
lombok.Data
;
import
org.hibernate.annotations.GenericGenerator
;
import
javax.persistence.*
;
import
java.sql.Timestamp
;
/**
* @author xufei on 2018/1/5.
*/
@Data
@Entity
@Table
(
name
=
"user_authorized"
)
public
class
UserAuthorized
{
@Id
@Column
(
name
=
"id"
)
@GeneratedValue
(
generator
=
"uuid"
)
@GenericGenerator
(
name
=
"uuid"
,
strategy
=
"org.hibernate.id.UUIDGenerator"
)
private
String
id
;
@Column
(
name
=
"user_uuid"
)
private
String
userUuid
;
//证件号
@Column
(
name
=
"id_no"
)
private
String
idNo
;
@Column
(
name
=
"name"
)
private
String
name
;
@Column
(
name
=
"auth_pattern"
)
private
AuthPattern
authPattern
;
@Column
(
name
=
"available"
)
private
Boolean
available
;
//创建时间
@Column
(
name
=
"created_at"
)
private
Timestamp
createdAt
;
//上一次修改时间
@Column
(
name
=
"updated_at"
)
private
Timestamp
updatedAt
;
}
src/main/java/cn/quantgroup/xyqb/entity/UserDetail.java
View file @
5b8ef268
package
cn
.
quantgroup
.
xyqb
.
entity
;
import
cn.quantgroup.motan.retbean.XUserDetail
;
import
cn.quantgroup.xyqb.model.Gender
;
import
cn.quantgroup.xyqb.model.IdType
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
...
...
@@ -12,7 +10,6 @@ import javax.persistence.Entity;
import
javax.persistence.Table
;
import
javax.persistence.UniqueConstraint
;
import
java.io.Serializable
;
import
java.util.Optional
;
/**
* Created by FrankChow on 15/7/8.
...
...
@@ -36,14 +33,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
;
...
...
@@ -57,30 +46,4 @@ public class UserDetail extends BaseEntity implements Serializable {
@Column
(
name
=
"qq"
)
private
String
qq
;
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
());
xUserDetail
.
setCreatedAt
(
this
.
getCreatedAt
());
xUserDetail
.
setUpdatedAt
(
this
.
getUpdatedAt
());
xUserDetail
.
setIsAuthenticated
(
this
.
getIsAuthenticated
());
return
xUserDetail
;
}
}
src/main/java/cn/quantgroup/xyqb/entity/UserExtInfo.java
deleted
100644 → 0
View file @
b8b329a2
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 @
b8b329a2
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 @
b8b329a2
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 @
5b8ef268
...
...
@@ -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 @
5b8ef268
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
);
}
//创建一个新的
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 @
b8b329a2
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 @
5b8ef268
...
...
@@ -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 @
b8b329a2
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 @
5b8ef268
...
...
@@ -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 @
5b8ef268
...
...
@@ -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 @
5b8ef268
...
...
@@ -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 @
b8b329a2
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 @
b8b329a2
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/IUserAuthorizedRepository.java
deleted
100644 → 0
View file @
b8b329a2
package
cn
.
quantgroup
.
xyqb
.
repository
;
import
cn.quantgroup.xyqb.entity.UserAuthorized
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @author xufei on 2018/1/5.
*/
public
interface
IUserAuthorizedRepository
extends
JpaRepository
<
UserAuthorized
,
Long
>,
JpaSpecificationExecutor
<
UserAuthorized
>
{
/**
* 通过身份证号查找实名账户
*
* @param idNo 身份证号
* @return 实体
*/
UserAuthorized
findByIdNo
(
String
idNo
);
/**
* 通过userId查找实名账户
*
* @param userUuid 用户表的uuid
* @return 实体
*/
UserAuthorized
findByUserUuid
(
String
userUuid
);
}
src/main/java/cn/quantgroup/xyqb/repository/IUserDetailRepository.java
View file @
5b8ef268
...
...
@@ -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 @
b8b329a2
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 @
b8b329a2
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 @
b8b329a2
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/auth/IUserAuthorizedService.java
deleted
100644 → 0
View file @
b8b329a2
package
cn
.
quantgroup
.
xyqb
.
service
.
auth
;
import
cn.quantgroup.xyqb.entity.UserAuthorized
;
import
cn.quantgroup.xyqb.model.UserAuthorizedParam
;
/**
* @author xufei on 2018/1/5.
*/
public
interface
IUserAuthorizedService
{
/**
* 该身份证是否有对应的实名账户
*
* @param idNo 身份证号
* @return
*/
Boolean
hasUserAuthorized
(
String
idNo
);
/**
* 创建实名账户
*
* @param userAuthorizedParam
* @return
*/
UserAuthorized
createUserAuthorized
(
UserAuthorizedParam
userAuthorizedParam
);
/**
* 通过userUuid获取实名账户表的id
*
* @param userUuid userUuid
* @return
*/
String
getUserAuthorizedId
(
String
userUuid
);
/**
* 校验参数
*
* @param userAuthorizedParam
* @return
* @throws Exception
*/
Boolean
checkUserAuthorizedParam
(
UserAuthorizedParam
userAuthorizedParam
)
throws
Exception
;
}
src/main/java/cn/quantgroup/xyqb/service/auth/impl/UserAuthorizedServiceImpl.java
deleted
100644 → 0
View file @
b8b329a2
package
cn
.
quantgroup
.
xyqb
.
service
.
auth
.
impl
;
import
cn.quantgroup.xyqb.entity.UserAuthorized
;
import
cn.quantgroup.xyqb.model.AuthPattern
;
import
cn.quantgroup.xyqb.model.UserAuthorizedParam
;
import
cn.quantgroup.xyqb.repository.IUserAuthorizedRepository
;
import
cn.quantgroup.xyqb.repository.IUserRepository
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.auth.IUserAuthorizedService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.text.ParseException
;
import
java.util.Objects
;
/**
* @author xufei on 2018/1/5.
*/
@Slf4j
@Service
public
class
UserAuthorizedServiceImpl
implements
IUserAuthorizedService
{
@Resource
private
IIdCardService
iIdCardService
;
@Resource
private
IUserAuthorizedRepository
userAuthorizedRepository
;
@Resource
private
IUserRepository
userRepository
;
// @Cacheable(value = "user_authorized_idno_cache", key = "#idNo", unless = "#result == false", cacheManager = "cacheManager")
@Override
public
Boolean
hasUserAuthorized
(
String
idNo
)
{
try
{
if
(
StringUtils
.
isBlank
(
idNo
)
||
!
iIdCardService
.
isIdCardValid
(
idNo
))
{
return
Boolean
.
FALSE
;
}
}
catch
(
ParseException
e
)
{
log
.
error
(
"[hasUserAuthorized]参数异常e:{}"
,
e
);
return
Boolean
.
FALSE
;
}
UserAuthorized
userAuthorized
=
userAuthorizedRepository
.
findByIdNo
(
idNo
);
log
.
info
(
"[hasUserAuthorized]查询实名账户userAuthorized:{}"
,
userAuthorized
);
return
null
!=
userAuthorized
;
}
@Override
public
Boolean
checkUserAuthorizedParam
(
UserAuthorizedParam
userAuthorizedParam
)
throws
Exception
{
if
(
null
==
userAuthorizedParam
)
{
return
Boolean
.
TRUE
;
}
String
userUuid
=
userAuthorizedParam
.
getUserUuid
();
if
(
StringUtils
.
isBlank
(
userUuid
))
{
return
Boolean
.
TRUE
;
}
String
name
=
userAuthorizedParam
.
getName
();
String
authPattern
=
userAuthorizedParam
.
getAuthPattern
();
String
idNo
=
userAuthorizedParam
.
getIdNo
();
return
(
StringUtils
.
isBlank
(
name
)
||
StringUtils
.
isBlank
(
authPattern
)
||
!
iIdCardService
.
isIdCardValid
(
idNo
));
}
@Override
public
UserAuthorized
createUserAuthorized
(
UserAuthorizedParam
userAuthorizedParam
)
{
// 数据检查,以及检查userUuid是否存在
if
(
Objects
.
isNull
(
userAuthorizedParam
)
||
this
.
hasUserAuthorized
(
userAuthorizedParam
.
getIdNo
())
||
Objects
.
isNull
(
userRepository
.
findByUuid
(
userAuthorizedParam
.
getUserUuid
())))
{
return
null
;
}
AuthPattern
authPatternEnum
=
AuthPattern
.
valueOf
(
userAuthorizedParam
.
getAuthPattern
());
UserAuthorized
userAuthorized
=
new
UserAuthorized
();
userAuthorized
.
setAuthPattern
(
authPatternEnum
);
userAuthorized
.
setAvailable
(
Boolean
.
TRUE
);
userAuthorized
.
setName
(
userAuthorizedParam
.
getName
());
userAuthorized
.
setIdNo
(
userAuthorizedParam
.
getIdNo
());
userAuthorized
.
setUserUuid
(
userAuthorizedParam
.
getUserUuid
());
try
{
userAuthorized
=
userAuthorizedRepository
.
save
(
userAuthorized
);
log
.
info
(
"[createUserAuthorized]创建实名账户成功,userAuthorized:{}"
,
userAuthorized
);
return
userAuthorized
;
}
catch
(
Exception
e
)
{
log
.
error
(
"[createUserAuthorized]创建实名账户异常e:{}"
,
e
);
return
null
;
}
}
// @Cacheable(value = "user_authorized_uuid_2_id_cache", key = "#userUuid", unless = "#result == null", cacheManager = "cacheManager")
@Override
public
String
getUserAuthorizedId
(
String
userUuid
)
{
if
(
StringUtils
.
isBlank
(
userUuid
))
{
return
null
;
}
UserAuthorized
userAuthorized
=
userAuthorizedRepository
.
findByUserUuid
(
userUuid
);
log
.
info
(
"[getUserAuthorizedId]获取实名账户的id,userUuid:{},userAuthorized:{}"
,
userUuid
,
userAuthorized
);
if
(
null
==
userAuthorized
)
{
return
null
;
}
return
userAuthorized
.
getId
();
}
}
src/main/java/cn/quantgroup/xyqb/service/page/impl/PageServiceImpl.java
View file @
5b8ef268
...
...
@@ -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 @
b8b329a2
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 @
b8b329a2
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 @
5b8ef268
...
...
@@ -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 @
b8b329a2
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 @
b8b329a2
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 @
b8b329a2
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 @
5b8ef268
...
...
@@ -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 @
5b8ef268
...
...
@@ -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 @
5b8ef268
...
...
@@ -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 @
b8b329a2
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 @
5b8ef268
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 @
b8b329a2
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 @
5b8ef268
package
cn
.
quantgroup
.
xyqb
.
service
.
user
.
vo
;
import
cn.quantgroup.motan.retbean.XUserDetail
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.model.Gender
;
import
cn.quantgroup.xyqb.model.IdType
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.sql.Timestamp
;
import
java.util.Optional
;
@Data
@NoArgsConstructor
public
class
UserDetailVO
{
...
...
@@ -40,53 +35,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/UserAuthorizedTest.java
deleted
100644 → 0
View file @
b8b329a2
import
org.junit.runner.RunWith
;
import
org.junit.runners.Suite
;
import
repsitory.UserAuthorizedRepsitoryTest
;
import
service.UserAuthorizedServiceTest
;
import
web.UserAuthorizedControllerTest
;
@RunWith
(
Suite
.
class
)
@Suite
.
SuiteClasses
({
UserAuthorizedRepsitoryTest
.
class
,
UserAuthorizedServiceTest
.
class
,
UserAuthorizedControllerTest
.
class
})
public
class
UserAuthorizedTest
{}
\ No newline at end of file
src/test/java/common/JsonTest.java
View file @
5b8ef268
...
...
@@ -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
));
...
...
src/test/java/repsitory/UserAuthorizedRepsitoryTest.java
deleted
100644 → 0
View file @
b8b329a2
package
repsitory
;
import
cn.quantgroup.xyqb.Bootstrap
;
import
cn.quantgroup.xyqb.entity.UserAuthorized
;
import
cn.quantgroup.xyqb.model.AuthPattern
;
import
cn.quantgroup.xyqb.repository.IUserAuthorizedRepository
;
import
com.ctrip.framework.apollo.spring.config.ApolloPropertySourceInitializer
;
import
demo.BaseParametersTest
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.Parameterized
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.data.domain.Example
;
import
org.springframework.test.annotation.Rollback
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.Arrays
;
import
java.util.Collection
;
/**
* 业务层测试用例
* @author renwc
* @date 2018-01-05
*/
@Slf4j
@Rollback
@Transactional
(
rollbackFor
=
Exception
.
class
)
@RunWith
(
value
=
Parameterized
.
class
)
@SpringBootTest
(
classes
=
Bootstrap
.
class
)
@ContextConfiguration
(
initializers
=
ApolloPropertySourceInitializer
.
class
)
public
class
UserAuthorizedRepsitoryTest
extends
BaseParametersTest
{
@Resource
private
IUserAuthorizedRepository
userAuthorizedRepository
;
private
UserAuthorized
obj
=
new
UserAuthorized
();
public
UserAuthorizedRepsitoryTest
(
String
userUuid
,
String
idNo
,
String
name
,
AuthPattern
authPattern
,
Boolean
available
)
{
obj
.
setUserUuid
(
userUuid
);
obj
.
setIdNo
(
idNo
);
obj
.
setName
(
name
);
obj
.
setAuthPattern
(
authPattern
);
obj
.
setAvailable
(
available
);
}
@Parameterized
.
Parameters
public
static
Collection
<
Object
[]>
data
()
{
Object
[][]
data
=
new
Object
[][]{
{
"711892ae-191b-445a-a4eb-3c0b7bab7840"
,
"350504198805144101"
,
"史书一"
,
AuthPattern
.
ZMXY
,
true
},
{
"711892ae-191b-445a-a4eb-3c0b7bab7841"
,
"350504198805144102"
,
"史书二"
,
AuthPattern
.
ZMXY
,
true
},
{
"711892ae-191b-445a-a4eb-3c0b7bab7842"
,
"350504198805144103"
,
"史书三"
,
AuthPattern
.
FOUR_ELEMENTS_OF_BANK_CARD
,
true
},
{
"711892ae-191b-445a-a4eb-3c0b7bab7843"
,
"IDNO-1"
,
"王-1"
,
AuthPattern
.
ZMXY
,
true
}
};
return
Arrays
.
asList
(
data
);
}
@Test
public
void
testExist
()
throws
Exception
{
log
.
info
(
"testExist: name:{}, idNo:{}, userId:{}, authPattern:{}"
,
obj
.
getName
(),
obj
.
getIdNo
(),
obj
.
getUserUuid
(),
obj
.
getAuthPattern
());
boolean
exist
=
userAuthorizedRepository
.
exists
(
Example
.
of
(
obj
));
Assert
.
assertFalse
(
exist
);
}
@Test
public
void
testSave
()
throws
Exception
{
log
.
info
(
"testSave: name:{}, idNo:{}, userId:{}, authPattern:{}"
,
obj
.
getName
(),
obj
.
getIdNo
(),
obj
.
getUserUuid
(),
obj
.
getAuthPattern
());
Object
o
=
userAuthorizedRepository
.
save
(
obj
);
Assert
.
assertNotNull
(
o
);
Assert
.
assertEquals
(
obj
,
o
);
}
@Test
public
void
testThenQuery
(){
log
.
info
(
"testQuery: name:{}, idNo:{}, userId:{}, authPattern:{}"
,
obj
.
getName
(),
obj
.
getIdNo
(),
obj
.
getUserUuid
(),
obj
.
getAuthPattern
());
UserAuthorized
o
=
userAuthorizedRepository
.
findByIdNo
(
this
.
obj
.
getIdNo
());
Assert
.
assertNotNull
(
o
);
Assert
.
assertEquals
(
obj
.
getIdNo
(),
o
.
getIdNo
());
}
}
src/test/java/service/UserAuthorizedServiceTest.java
deleted
100644 → 0
View file @
b8b329a2
package
service
;
import
cn.quantgroup.xyqb.Bootstrap
;
import
cn.quantgroup.xyqb.entity.UserAuthorized
;
import
cn.quantgroup.xyqb.model.AuthPattern
;
import
cn.quantgroup.xyqb.model.UserAuthorizedParam
;
import
cn.quantgroup.xyqb.service.auth.IUserAuthorizedService
;
import
com.ctrip.framework.apollo.spring.config.ApolloPropertySourceInitializer
;
import
demo.BaseParametersTest
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Assert
;
import
org.junit.FixMethodOrder
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.MethodSorters
;
import
org.junit.runners.Parameterized
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.annotation.Rollback
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Optional
;
/**
* 业务层测试用例
* @author renwc
* @date 2018-01-05
*/
@Slf4j
@Rollback
(
true
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
@RunWith
(
value
=
Parameterized
.
class
)
@SpringBootTest
(
classes
=
Bootstrap
.
class
)
@ContextConfiguration
(
initializers
=
ApolloPropertySourceInitializer
.
class
)
public
class
UserAuthorizedServiceTest
extends
BaseParametersTest
{
@Resource
private
IUserAuthorizedService
userAuthorizedService
;
private
UserAuthorizedParam
obj
=
new
UserAuthorizedParam
();
public
UserAuthorizedServiceTest
(
String
userUuid
,
String
idNo
,
String
name
,
AuthPattern
authPattern
,
Boolean
available
)
{
obj
.
setUserUuid
(
userUuid
);
obj
.
setIdNo
(
idNo
);
obj
.
setName
(
name
);
obj
.
setAuthPattern
(
Optional
.
ofNullable
(
authPattern
).
orElse
(
AuthPattern
.
ZMXY
).
name
());
}
@Parameterized
.
Parameters
public
static
Collection
<
Object
[]>
data
()
{
Object
[][]
data
=
new
Object
[][]{
{
"55544ae9-a1dd-458b-a7ac-2b4e64e59f99"
,
"350504198805144101"
,
"史书一"
,
AuthPattern
.
ZMXY
,
true
},
{
"2f7715f1-e59e-4169-8214-89aef11d2291"
,
"350504198805144102"
,
"史书二"
,
AuthPattern
.
ZMXY
,
true
},
{
"7addad2f-100b-49fa-ac44-bb729dfca06e"
,
"350504198805144103"
,
"史书三"
,
AuthPattern
.
FOUR_ELEMENTS_OF_BANK_CARD
,
true
},
{
"2dae9875-71ba-47bd-9332-0e4922f75f12"
,
"IDNO-1"
,
"王-1"
,
AuthPattern
.
ZMXY
,
true
}
};
return
Arrays
.
asList
(
data
);
}
@Test
public
void
testExist
()
throws
Exception
{
log
.
info
(
"testExist: name:{}, idNo:{}, userId:{}, authPattern:{}"
,
obj
.
getName
(),
obj
.
getIdNo
(),
obj
.
getUserUuid
(),
obj
.
getAuthPattern
());
Boolean
exist
=
userAuthorizedService
.
hasUserAuthorized
(
this
.
obj
.
getIdNo
());
Assert
.
assertFalse
(
exist
);
}
@Test
public
void
testSave
()
throws
Exception
{
log
.
info
(
"testSave: name:{}, idNo:{}, userId:{}, authPattern:{}"
,
obj
.
getName
(),
obj
.
getIdNo
(),
obj
.
getUserUuid
(),
obj
.
getAuthPattern
());
UserAuthorized
o
=
userAuthorizedService
.
createUserAuthorized
(
this
.
obj
);
Assert
.
assertNotNull
(
o
);
Assert
.
assertEquals
(
obj
.
getIdNo
(),
o
.
getIdNo
());
}
@Test
public
void
testThenQuery
(){
log
.
info
(
"testQuery: name:{}, idNo:{}, userId:{}, authPattern:{}"
,
obj
.
getName
(),
obj
.
getIdNo
(),
obj
.
getUserUuid
(),
obj
.
getAuthPattern
());
Object
o
=
userAuthorizedService
.
getUserAuthorizedId
(
this
.
obj
.
getUserUuid
());
Assert
.
assertNotNull
(
o
);
}
}
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