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
fb662dba
Commit
fb662dba
authored
Aug 05, 2023
by
唐峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1冻结或注销用户关联用户id为空问题,2根据手机号查询用户信息加密非加密查询数据缺失 3去掉非必要告警
parent
7fea5ffb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
13 deletions
+18
-13
UserApiV2Controller.java
...uantgroup/xyqb/controller/api/v2/UserApiV2Controller.java
+1
-1
UserServiceImpl.java
...cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
+11
-8
SMSLoginStrategy.java
.../java/cn/quantgroup/xyqb/service/v2/SMSLoginStrategy.java
+3
-2
VerificationCodeContext.java
...n/quantgroup/xyqb/service/v2/VerificationCodeContext.java
+3
-2
No files found.
src/main/java/cn/quantgroup/xyqb/controller/api/v2/UserApiV2Controller.java
View file @
fb662dba
...
...
@@ -168,7 +168,7 @@ public class UserApiV2Controller implements IBaseController {
if
(
StringUtils
.
isNotEmpty
(
batchInfoReq
.
getAppId
())
&&
CollectionUtils
.
isNotEmpty
(
batchInfoReq
.
getUnionIds
()))
{
wechatUserInfo
=
wechatService
.
findUnionIdsAndOpenIdAndTenantId
(
batchInfoReq
.
getUnionIds
(),
batchInfoReq
.
getAppId
(),
tenantId
);
List
<
Long
>
userIds
=
wechatUserInfo
.
stream
().
map
(
WechatUserInfo:
:
getUserId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
userIds
=
wechatUserInfo
.
stream
().
filter
(
e
->
e
.
getUserId
()
!=
null
).
map
(
WechatUserInfo:
:
getUserId
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
wechatUserInfo
)
||
CollectionUtils
.
isEmpty
(
userIds
))
{
throw
new
BizException
(
BizExceptionEnum
.
UN_EXIT_USER
);
}
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
View file @
fb662dba
...
...
@@ -184,21 +184,24 @@ public class UserServiceImpl implements IUserService, IBaseController {
return
userRepository
.
findByIdAndTenantId
(
userId
,
tenantId
);
}
@Override
public
List
<
User
>
findByPhones
(
List
<
String
>
phones
,
Integer
tenantId
)
{
Pageable
pageable
=
new
PageRequest
(
0
,
500
,
new
Sort
(
Sort
.
Direction
.
DESC
,
"id"
));
Page
<
User
>
userPageList
=
userRepository
.
findAll
((
root
,
query
,
cb
)
->
{
query
.
where
(
root
.
get
(
Constants
.
ENCRYPTED_PHONE_NO
).
as
(
String
.
class
).
in
(
phones
)
,
root
.
get
(
"tenantId"
).
as
(
Integer
.
class
).
in
(
tenantId
))
;
Page
<
User
>
userPageList
=
userRepository
.
findAll
((
root
,
query
,
cb
)
->
{
query
.
where
(
root
.
get
(
Constants
.
PHONE_NO
).
as
(
String
.
class
).
in
(
phones
),
root
.
get
(
"tenantId"
).
as
(
Integer
.
class
).
in
(
tenantId
));
return
query
.
getRestriction
();
},
pageable
);
},
pageable
);
List
<
User
>
userList
=
userPageList
.
getContent
();
if
(
userList
.
isEmpty
())
{
userList
=
userRepository
.
findAll
((
root
,
query
,
cb
)
->
{
query
.
where
(
root
.
get
(
Constants
.
PHONE_NO
).
as
(
String
.
class
).
in
(
phones
),
root
.
get
(
"tenantId"
).
as
(
Integer
.
class
).
in
(
tenantId
));
userPageList
=
userRepository
.
findAll
((
root
,
query
,
cb
)
->
{
query
.
where
(
root
.
get
(
Constants
.
ENCRYPTED_PHONE_NO
).
as
(
String
.
class
).
in
(
phones
)
,
root
.
get
(
"tenantId"
).
as
(
Integer
.
class
).
in
(
tenantId
))
;
return
query
.
getRestriction
();
});
},
pageable
);
userList
=
userPageList
.
getContent
();
}
return
userList
;
}
...
...
src/main/java/cn/quantgroup/xyqb/service/v2/SMSLoginStrategy.java
View file @
fb662dba
...
...
@@ -5,6 +5,7 @@ import cn.quantgroup.xyqb.controller.req.v2.LoginReq;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.exception.BizException
;
import
cn.quantgroup.xyqb.exception.BizExceptionEnum
;
import
cn.quantgroup.xyqb.exception.SilentBizException
;
import
cn.quantgroup.xyqb.exception.UserNotExistException
;
import
cn.quantgroup.xyqb.exception.VerificationCodeErrorException
;
import
cn.quantgroup.xyqb.model.AuthBean
;
...
...
@@ -71,11 +72,11 @@ public class SMSLoginStrategy implements LoginStrategy {
User
user
=
userService
.
findByPhoneWithCache
(
smsLoginParam
.
getPhone
(),
sessionStruct
.
getTenantId
());
//需要返回用户是否首次注册
//需要返回用户是否首次注册
VerificationCodeContext
boolean
register
=
user
==
null
;
if
(
user
!=
null
)
{
if
(!
user
.
getEnable
())
{
throw
new
BizException
(
BizExceptionEnum
.
ERROR_OR_ENABLE_ERROR
);
throw
new
Silent
BizException
(
BizExceptionEnum
.
ERROR_OR_ENABLE_ERROR
);
}
}
else
{
// Service层会负责发送注册消息到LoanVest
...
...
src/main/java/cn/quantgroup/xyqb/service/v2/VerificationCodeContext.java
View file @
fb662dba
...
...
@@ -4,6 +4,7 @@ import cn.quantgroup.xyqb.controller.req.v2.SMSReq;
import
cn.quantgroup.xyqb.controller.req.v2.SMSVerifyReq
;
import
cn.quantgroup.xyqb.exception.BizException
;
import
cn.quantgroup.xyqb.exception.BizExceptionEnum
;
import
cn.quantgroup.xyqb.exception.SilentBizException
;
import
cn.quantgroup.xyqb.model.SMSCodeBean
;
import
cn.quantgroup.xyqb.service.sms.ISmsService
;
import
org.springframework.stereotype.Service
;
...
...
@@ -35,10 +36,10 @@ public class VerificationCodeContext {
if
(!
smsService
.
verifyPhoneAndCode
(
smsVerifyReq
))
{
// 是否需要重新发送短信验证码
if
(
smsService
.
needResendCode
(
smsVerifyReq
.
getPhoneNo
()))
{
throw
new
BizException
(
BizExceptionEnum
.
INVALID_SMS_CODE
);
throw
new
Silent
BizException
(
BizExceptionEnum
.
INVALID_SMS_CODE
);
}
throw
new
BizException
(
BizExceptionEnum
.
ERROR_SMS_CODE
);
throw
new
Silent
BizException
(
BizExceptionEnum
.
ERROR_SMS_CODE
);
}
return
true
;
}
...
...
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