Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-account
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.account
pica-cloud-account
提交
b6573868
提交
b6573868
编写于
12月 14, 2020
作者:
Peijun.zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
账户密码登录
上级
4015911e
变更
3
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
90 行增加
和
1 行删除
+90
-1
LoginV1Controller.java
.../account/account/server/controller/LoginV1Controller.java
+27
-1
LoginV1Service.java
.../cloud/account/account/server/service/LoginV1Service.java
+4
-0
LoginV1ServiceImpl.java
...count/account/server/service/impl/LoginV1ServiceImpl.java
+59
-0
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/controller/LoginV1Controller.java
浏览文件 @
b6573868
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
controller
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pica.cloud.account.account.server.entity.AesBean.AesAuthCodeReq
;
import
com.pica.cloud.account.account.server.entity.EncryptEntity
;
import
com.pica.cloud.account.account.server.entity.LogLoginAes
;
import
com.pica.cloud.account.account.server.req.BaseRequest
;
import
com.pica.cloud.account.account.server.service.LoginV1Service
;
import
com.pica.cloud.account.account.server.service.LoginV1Service
;
import
com.pica.cloud.account.account.server.util.CryptoUtil
;
import
com.pica.cloud.account.account.server.util.RSAUtil
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -15,7 +27,21 @@ public class LoginV1Controller extends AccountBaseController {
...
@@ -15,7 +27,21 @@ public class LoginV1Controller extends AccountBaseController {
private
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
private
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
@Autowired
@Autowired
private
LoginV1Service
loginService
;
private
LoginV1Service
login
V1
Service
;
@ApiOperation
(
value
=
"统一校验(传空则不会校验)"
)
@PostMapping
(
"/unifiedVerification"
)
public
PicaResponse
unifiedVerification
(
@RequestBody
AesAuthCodeReq
req
)
throws
Exception
{
EncryptEntity
entity
=
new
EncryptEntity
();
entity
.
setKey
(
req
.
getKey
());
entity
.
setContent
(
req
.
getContent
());
BaseRequest
request
=
CryptoUtil
.
decrypt
(
entity
,
BaseRequest
.
class
);
request
.
setSourceType
(
super
.
getSourceType
());
logger
.
info
(
"v1/login/unifiedVerification:{}"
,
JSONObject
.
toJSONString
(
request
));
loginV1Service
.
mobileValidate
(
request
);
return
PicaResponse
.
toResponse
();
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/LoginV1Service.java
浏览文件 @
b6573868
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
;
import
com.pica.cloud.account.account.server.req.BaseRequest
;
public
interface
LoginV1Service
{
public
interface
LoginV1Service
{
void
mobileValidate
(
BaseRequest
request
);
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/LoginV1ServiceImpl.java
浏览文件 @
b6573868
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
import
com.pica.cloud.account.account.server.entity.AccountInfoEntity
;
import
com.pica.cloud.account.account.server.enums.AccountExceptionEnum
;
import
com.pica.cloud.account.account.server.enums.SourceTypeEnum
;
import
com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper
;
import
com.pica.cloud.account.account.server.req.BaseRequest
;
import
com.pica.cloud.account.account.server.service.LoginV1Service
;
import
com.pica.cloud.account.account.server.service.LoginV1Service
;
import
com.pica.cloud.account.account.server.util.AESUtil
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.foundation.entity.PicaWarnException
;
import
com.pica.cloud.foundation.utils.utils.ValidateUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
@Service
@Service
...
@@ -11,5 +22,53 @@ public class LoginV1ServiceImpl implements LoginV1Service {
...
@@ -11,5 +22,53 @@ public class LoginV1ServiceImpl implements LoginV1Service {
private
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
private
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
@Autowired
private
AccountInfoDetailMapper
accountInfoMapper
;
@Override
public
void
mobileValidate
(
BaseRequest
request
)
{
Integer
bizType
=
request
.
getBizType
();
String
mobile
=
request
.
getMobile
();
Integer
sourceType
=
request
.
getSourceType
();
// todo 报错提示 bizetype
if
(
null
==
bizType
)
{
logger
.
info
(
"bizType is null"
);
throw
new
PicaWarnException
(
PicaResultCode
.
PARAM_IS_BLANK
.
code
(),
PicaResultCode
.
PARAM_IS_BLANK
.
message
());
}
// 手机号规则校验
if
(
StringUtils
.
isNotEmpty
(
mobile
)
&&
!
ValidateUtils
.
isMobile
(
mobile
))
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_MOBILE_REG_FALSE
.
getCode
(),
AccountExceptionEnum
.
PICA_MOBILE_REG_FALSE
.
getMessage
());
}
if
(
bizType
.
equals
(
2
))
{
}
else
if
(
bizType
.
equals
(
3
))
{
// 账户密码登录-step1-check mobile
// 手机号是否注册
AccountInfoEntity
accountInfo
=
accountInfoMapper
.
selectByMobile
(
AESUtil
.
encryptV0
(
mobile
));
if
(
accountInfo
==
null
)
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
MOBILE_NOT_REGISTER
.
getCode
(),
AccountExceptionEnum
.
MOBILE_NOT_REGISTER
.
getMessage
().
replace
(
"{mobile}"
,
mobile
));
}
// 手机号是否设置了密码
if
(
StringUtils
.
isEmpty
(
accountInfo
.
getPassword
()))
{
if
(
sourceType
!=
null
&&
SourceTypeEnum
.
H5
.
getCode
().
equals
(
sourceType
))
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_MOBILE_NOT_SETED_PASSWORD_H5
.
getCode
(),
AccountExceptionEnum
.
PICA_MOBILE_NOT_SETED_PASSWORD_H5
.
getMessage
());
}
else
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_MOBILE_NOT_SETED_PASSWORD
.
getCode
(),
AccountExceptionEnum
.
PICA_MOBILE_NOT_SETED_PASSWORD
.
getMessage
().
replace
(
"{mobile}"
,
mobile
));
}
}
}
}
}
}
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录