Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cnooc_zydeepen-cggl_expert-manage-miniapp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
孙德龙
cnooc_zydeepen-cggl_expert-manage-miniapp
Commits
a07aae54
Commit
a07aae54
authored
Nov 14, 2025
by
weisong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.gdatac.com/sundelong/cnooc_zydeepen-cggl_expert-manage-miniapp
parents
b7178819
8b2a105c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
src/main/java/com/cnooc/expert/auth/service/impl/LoginServiceImpl.java
+18
-5
No files found.
src/main/java/com/cnooc/expert/auth/service/impl/LoginServiceImpl.java
View file @
a07aae54
...
...
@@ -2,6 +2,7 @@ package com.cnooc.expert.auth.service.impl;
import
cn.hutool.core.lang.Validator
;
import
cn.hutool.core.util.IdcardUtil
;
import
com.cnooc.expert.auth.service.AccountLockService
;
import
com.cnooc.expert.common.constant.TokenConstants
;
import
com.cnooc.expert.common.exception.BusinessException
;
import
com.cnooc.expert.common.exception.GlobalErrorCodeConstants
;
...
...
@@ -44,6 +45,9 @@ public class LoginServiceImpl implements LoginService {
private
SmsService
smsService
;
@Autowired
private
AccountLockService
accountLockService
;
@Autowired
private
SysCaptchaService
sysCaptchaService
;
@Autowired
...
...
@@ -166,6 +170,11 @@ public class LoginServiceImpl implements LoginService {
if
(
expertInfoResp
==
null
){
throw
new
BusinessException
(
GlobalErrorCodeConstants
.
USER_NOT_EXISTS
.
getCode
(),
GlobalErrorCodeConstants
.
USER_NOT_EXISTS
.
getMsg
());
}
boolean
isAccountLocked
=
accountLockService
.
isAccountLocked
(
expertInfoResp
.
getZhuanJiaGuid
());
if
(
isAccountLocked
){
//如果账号锁定了,返回错误信息
throw
new
BusinessException
(
GlobalErrorCodeConstants
.
USER_LOCKED
.
getCode
(),
GlobalErrorCodeConstants
.
USER_LOCKED
.
getMsg
());
}
ExpertInfoAppResp
expertInfoAppResp
=
loginServicesClient
.
getZhuanJiaInfoAppById
(
expertInfoResp
.
getZhuanJiaGuid
());
if
(
expertInfoAppResp
==
null
){
throw
new
BusinessException
(
GlobalErrorCodeConstants
.
PASSWORD_NOT_EXIST
.
getCode
(),
GlobalErrorCodeConstants
.
PASSWORD_NOT_EXIST
.
getMsg
());
...
...
@@ -174,8 +183,6 @@ public class LoginServiceImpl implements LoginService {
boolean
flag
=
sysCaptchaService
.
validate
(
loginVO
.
getKey
(),
loginVO
.
getCaptcha
());
if
(!
flag
)
{
// 保存登录日志
//sysLogLoginService.save(login.getUsername(), Constant.FAIL, LoginOperationEnum.CAPTCHA_FAIL.getValue());
throw
new
BusinessException
(
GlobalErrorCodeConstants
.
CAPTCHA_EXPIRED
.
getCode
(),
GlobalErrorCodeConstants
.
CAPTCHA_EXPIRED
.
getMsg
());
}
//1.需要去库中查询,是否存在
...
...
@@ -185,7 +192,7 @@ public class LoginServiceImpl implements LoginService {
flag
=
passwordEncoder
.
matches
(
pwd
,
expertInfoAppResp
.
getPassword
());
if
(!
flag
)
{
// 登录日志
//sysLogLoginService.savePortal(login.getAccountName(), Constant.FAIL, LoginOperationEnum.ACCOUNT_FAIL.getValue(), 1
);
accountLockService
.
handleLoginFailure
(
expertInfoResp
.
getZhuanJiaGuid
()
);
throw
new
BusinessException
(
GlobalErrorCodeConstants
.
PASSWORD_ERROR
.
getCode
(),
GlobalErrorCodeConstants
.
PASSWORD_ERROR
.
getMsg
());
}
...
...
@@ -197,6 +204,7 @@ public class LoginServiceImpl implements LoginService {
UserUtils
.
setUserId
(
zhuanJiaUser
);
String
token
=
JwtUtils
.
createToken
(
expertInfoResp
.
getZhuanJiaGuid
(),
uuidKey
);
//6.返回token
accountLockService
.
handleLoginSuccess
(
expertInfoResp
.
getZhuanJiaGuid
());
return
token
;
}
...
...
@@ -215,10 +223,15 @@ public class LoginServiceImpl implements LoginService {
if
(
expertInfoResp
==
null
){
throw
new
BusinessException
(
GlobalErrorCodeConstants
.
USER_NOT_EXISTS
.
getCode
(),
GlobalErrorCodeConstants
.
USER_NOT_EXISTS
.
getMsg
());
}
boolean
isAccountLocked
=
accountLockService
.
isAccountLocked
(
expertInfoResp
.
getZhuanJiaGuid
());
if
(
isAccountLocked
){
//如果账号锁定了,返回错误信息
throw
new
BusinessException
(
GlobalErrorCodeConstants
.
USER_LOCKED
.
getCode
(),
GlobalErrorCodeConstants
.
USER_LOCKED
.
getMsg
());
}
//2.存在校验验证码
if
(!
smsService
.
verifySmsCode
(
loginVO
.
getPhoneNumber
(),
loginVO
.
getPhoneCode
()))
{
//登录日志
//sysLogLoginService.savePortal(login.getPhone(), Constant.FAIL, LoginOperationEnum.CAPTCHA_FAIL.getValue(), 1
);
accountLockService
.
handleLoginFailure
(
expertInfoResp
.
getZhuanJiaGuid
()
);
throw
new
BusinessException
(
GlobalErrorCodeConstants
.
CAPTCHA_EXPIRED
.
getCode
(),
GlobalErrorCodeConstants
.
CAPTCHA_EXPIRED
.
getMsg
());
}
//3.生成相应的uuid作为redis的key
...
...
@@ -229,7 +242,7 @@ public class LoginServiceImpl implements LoginService {
redisTemplate
.
opsForValue
().
set
(
TokenConstants
.
LOGIN_USER_KEY_
+
expertInfoResp
.
getZhuanJiaGuid
(),
zhuanJiaUser
,
48
,
TimeUnit
.
HOURS
);
UserUtils
.
setUserId
(
zhuanJiaUser
);
String
token
=
JwtUtils
.
createToken
(
expertInfoResp
.
getZhuanJiaGuid
(),
uuidKey
);
accountLockService
.
handleLoginSuccess
(
expertInfoResp
.
getZhuanJiaGuid
());
return
token
;
}
...
...
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