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
提交
2af49397
提交
2af49397
编写于
10月 25, 2019
作者:
rushui.chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
20191025 完善修改密码接口
上级
51c3e31b
流水线
#16312
已失败 于阶段
in 0 second
变更
6
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
27 行增加
和
17 行删除
+27
-17
PasswordController.java
...account/account/server/controller/PasswordController.java
+3
-3
DoctorMapper.java
...ica/cloud/account/account/server/mapper/DoctorMapper.java
+4
-0
PasswordService.java
...cloud/account/account/server/service/PasswordService.java
+2
-2
PasswordServiceImpl.java
...ount/account/server/service/impl/PasswordServiceImpl.java
+11
-11
AESUtil.java
...a/com/pica/cloud/account/account/server/util/AESUtil.java
+1
-1
DoctorMapper.xml
server/src/main/resources/mybatis/DoctorMapper.xml
+6
-0
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/controller/PasswordController.java
浏览文件 @
2af49397
...
@@ -44,15 +44,15 @@ public class PasswordController extends AccountBaseController {
...
@@ -44,15 +44,15 @@ public class PasswordController extends AccountBaseController {
@PostMapping
(
value
=
"/modify"
)
@PostMapping
(
value
=
"/modify"
)
public
PicaResponse
modifyPassword
(
@RequestBody
EncryptEntity
entity
)
throws
Exception
{
public
PicaResponse
modifyPassword
(
@RequestBody
EncryptEntity
entity
)
throws
Exception
{
PicaUser
picaUser
=
super
.
getPicaUser
();
PicaUser
picaUser
=
super
.
getPicaUser
();
String
mobile
=
picaUser
.
getMobile
(
);
String
mobile
=
AESUtil
.
encryptV0
(
picaUser
.
getMobile
()
);
AccountInfoEntity
accountInfoEntity
=
accountInfoDetailMapper
.
selectByMobile
(
AESUtil
.
encryptV0
(
mobile
)
);
AccountInfoEntity
accountInfoEntity
=
accountInfoDetailMapper
.
selectByMobile
(
mobile
);
if
(
accountInfoEntity
!=
null
)
{
if
(
accountInfoEntity
!=
null
)
{
BaseRequest
request
=
CryptoUtil
.
decrypt
(
entity
,
BaseRequest
.
class
);
BaseRequest
request
=
CryptoUtil
.
decrypt
(
entity
,
BaseRequest
.
class
);
String
oldPwd
=
request
.
getOldPwd
();
String
oldPwd
=
request
.
getOldPwd
();
String
password
=
request
.
getPassword
();
String
password
=
request
.
getPassword
();
if
(!
StringUtils
.
isEmpty
(
password
)
&&
!
StringUtils
.
isEmpty
(
oldPwd
))
{
if
(!
StringUtils
.
isEmpty
(
password
)
&&
!
StringUtils
.
isEmpty
(
oldPwd
))
{
if
(!
password
.
equals
(
oldPwd
))
{
if
(!
password
.
equals
(
oldPwd
))
{
passwordService
.
modifyPassword
(
accountInfoEntity
.
getId
()
,
oldPwd
,
password
);
passwordService
.
modifyPassword
(
mobile
,
oldPwd
,
password
);
return
PicaResponse
.
toResponse
();
return
PicaResponse
.
toResponse
();
}
else
{
}
else
{
throw
new
AccountException
(
AccountExceptionEnum
.
PICA_PASSWORD_EQUAL
);
throw
new
AccountException
(
AccountExceptionEnum
.
PICA_PASSWORD_EQUAL
);
...
...
server/src/main/java/com/pica/cloud/account/account/server/mapper/DoctorMapper.java
浏览文件 @
2af49397
...
@@ -48,6 +48,8 @@ public interface DoctorMapper {
...
@@ -48,6 +48,8 @@ public interface DoctorMapper {
*/
*/
void
updateByAcctId
(
Doctor
doctor
);
void
updateByAcctId
(
Doctor
doctor
);
void
updateByMobile
(
Doctor
doctor
);
int
deleteByPrimaryKey
(
Integer
id
);
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
Doctor
record
);
int
insert
(
Doctor
record
);
...
@@ -75,6 +77,8 @@ public interface DoctorMapper {
...
@@ -75,6 +77,8 @@ public interface DoctorMapper {
void
updateDeleteByPrimaryKey
(
Integer
id
);
void
updateDeleteByPrimaryKey
(
Integer
id
);
/**
/**
* 通过手机号获取用户id
* 通过手机号获取用户id
* @param mobile
* @param mobile
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/PasswordService.java
浏览文件 @
2af49397
...
@@ -7,11 +7,11 @@ public interface PasswordService {
...
@@ -7,11 +7,11 @@ public interface PasswordService {
/**
/**
* 修改密码
* 修改密码
*
*
* @param
acctId
账户id
* @param
mobile
账户id
* @param oldPwd 旧密码
* @param oldPwd 旧密码
* @param pwd 新密码
* @param pwd 新密码
*/
*/
void
modifyPassword
(
Integer
acctId
,
String
oldPwd
,
String
pwd
);
void
modifyPassword
(
String
mobile
,
String
oldPwd
,
String
pwd
);
/**
/**
* 忘记密码
* 忘记密码
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/impl/PasswordServiceImpl.java
浏览文件 @
2af49397
...
@@ -37,19 +37,19 @@ public class PasswordServiceImpl implements PasswordService {
...
@@ -37,19 +37,19 @@ public class PasswordServiceImpl implements PasswordService {
@Override
@Override
@Transactional
@Transactional
public
void
modifyPassword
(
Integer
acctId
,
String
oldPwd
,
String
pwd
)
{
public
void
modifyPassword
(
String
mobile
,
String
oldPwd
,
String
pwd
)
{
AccountInfoEntity
entity
=
accountInfoDetailMapper
.
selectBy
PrimaryKey
(
acctId
);
AccountInfoEntity
entity
=
accountInfoDetailMapper
.
selectBy
Mobile
(
mobile
);
if
(
entity
!=
null
)
{
if
(
entity
!=
null
)
{
if
(
entity
.
getPassword
().
equals
(
oldPwd
))
{
if
(
entity
.
getPassword
().
equals
(
oldPwd
))
{
Date
currentTime
=
new
Date
();
Date
currentTime
=
new
Date
();
AccountInfoEntity
accountInfoEntity
=
new
AccountInfoEntity
();
AccountInfoEntity
accountInfoEntity
=
new
AccountInfoEntity
();
accountInfoEntity
.
setId
(
acctId
);
accountInfoEntity
.
setId
(
entity
.
getId
()
);
accountInfoEntity
.
setModifiedId
(
acctId
);
accountInfoEntity
.
setModifiedId
(
entity
.
getId
()
);
accountInfoEntity
.
setModifiedTime
(
currentTime
);
accountInfoEntity
.
setModifiedTime
(
currentTime
);
accountInfoEntity
.
setPassword
(
pwd
);
accountInfoEntity
.
setPassword
(
pwd
);
accountInfoDetailMapper
.
updatePasswordByPrimaryKey
(
accountInfoEntity
);
accountInfoDetailMapper
.
updatePasswordByPrimaryKey
(
accountInfoEntity
);
if
(
doubleWritingMode
)
{
if
(
doubleWritingMode
)
{
processDoubleWrite
(
acctId
,
pwd
);
processDoubleWrite
(
mobile
,
pwd
);
}
}
//密码修改日志
//密码修改日志
LogPWDModifyEntity
logPWDModifyEntity
=
AccountLogEntityUtils
.
getLogPWDModifyEntity
(
acctId
,
entity
.
getMobilePhone
(),
LogPWDModifyEntity
logPWDModifyEntity
=
AccountLogEntityUtils
.
getLogPWDModifyEntity
(
acctId
,
entity
.
getMobilePhone
(),
...
@@ -78,7 +78,7 @@ public class PasswordServiceImpl implements PasswordService {
...
@@ -78,7 +78,7 @@ public class PasswordServiceImpl implements PasswordService {
accountInfoEntity
.
setPassword
(
password
);
accountInfoEntity
.
setPassword
(
password
);
accountInfoDetailMapper
.
updatePasswordByPrimaryKey
(
accountInfoEntity
);
accountInfoDetailMapper
.
updatePasswordByPrimaryKey
(
accountInfoEntity
);
if
(
doubleWritingMode
)
{
if
(
doubleWritingMode
)
{
processDoubleWrite
(
accId
,
password
);
processDoubleWrite
(
AESUtil
.
encryptV0
(
request
.
getMobile
())
,
password
);
}
}
//密码修改日志
//密码修改日志
LogPWDModifyEntity
logPWDModifyEntity
=
AccountLogEntityUtils
.
getLogPWDModifyEntity
(
accId
,
entity
.
getMobilePhone
(),
LogPWDModifyEntity
logPWDModifyEntity
=
AccountLogEntityUtils
.
getLogPWDModifyEntity
(
accId
,
entity
.
getMobilePhone
(),
...
@@ -93,16 +93,16 @@ public class PasswordServiceImpl implements PasswordService {
...
@@ -93,16 +93,16 @@ public class PasswordServiceImpl implements PasswordService {
/**
/**
* 双写模式,把密码存储到p_doctor表
* 双写模式,把密码存储到p_doctor表
*
*
* @param
accId
* @param
mobile
* @param password
* @param password
*/
*/
private
void
processDoubleWrite
(
Integer
accId
,
String
password
)
{
private
void
processDoubleWrite
(
String
mobile
,
String
password
)
{
Date
currentTime
=
new
Date
();
Date
currentTime
=
new
Date
();
Doctor
doctor
=
new
Doctor
();
Doctor
doctor
=
new
Doctor
();
doctor
.
setPassword
(
password
);
doctor
.
setPassword
(
password
);
doctor
.
set
AcctId
(
accId
);
doctor
.
set
MobilePhone
(
mobile
);
doctor
.
setModifyTime
(
currentTime
);
doctor
.
setModifyTime
(
currentTime
);
doctor
.
setModifyId
(
accId
);
doctor
.
setModifyId
(
0
);
doctorMapper
.
updateBy
AcctId
(
doctor
);
doctorMapper
.
updateBy
Mobile
(
doctor
);
}
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/AESUtil.java
浏览文件 @
2af49397
...
@@ -157,7 +157,7 @@ public class AESUtil {
...
@@ -157,7 +157,7 @@ public class AESUtil {
*/
*/
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
KEY
=
"zJJ$c5md3$yuuhWW"
;
String
KEY
=
"zJJ$c5md3$yuuhWW"
;
String
content
=
"1
2322222222
"
;
String
content
=
"1
5607241351
"
;
System
.
out
.
println
(
"加密前:"
+
content
);
System
.
out
.
println
(
"加密前:"
+
content
);
System
.
out
.
println
(
"加密密钥和解密密钥:"
+
KEY
);
System
.
out
.
println
(
"加密密钥和解密密钥:"
+
KEY
);
String
encrypt
=
aesEncrypt
(
content
,
KEY
);
String
encrypt
=
aesEncrypt
(
content
,
KEY
);
...
...
server/src/main/resources/mybatis/DoctorMapper.xml
浏览文件 @
2af49397
...
@@ -143,6 +143,12 @@
...
@@ -143,6 +143,12 @@
<!--limit 0,1-->
<!--limit 0,1-->
<!--</select>-->
<!--</select>-->
<update
id=
"updateByMobile"
parameterType=
"com.pica.cloud.account.account.server.entity.Doctor"
>
update p_doctor set password=#{password},modify_time=now(), modify_id=#{id} where mobile_phone=#{mobilePhone} and delete_flag=1 limit 1
</update>
<!--通过账户id更新用户信息-->
<!--通过账户id更新用户信息-->
<update
id=
"updateByAcctId"
parameterType=
"com.pica.cloud.account.account.server.entity.Doctor"
>
<update
id=
"updateByAcctId"
parameterType=
"com.pica.cloud.account.account.server.entity.Doctor"
>
update p_doctor
update p_doctor
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录