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
提交
61489083
提交
61489083
编写于
3月 04, 2022
作者:
minghao.wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 添加用户
上级
7436af87
流水线
#42957
已取消 于阶段
变更
1
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
29 行增加
和
56 行删除
+29
-56
HospitalSaasUserServiceImpl.java
...ount/server/service/impl/HospitalSaasUserServiceImpl.java
+29
-56
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/service/impl/HospitalSaasUserServiceImpl.java
浏览文件 @
61489083
...
...
@@ -88,7 +88,7 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
String
nxKey
=
Constants
.
REPEAT_REGISTER_PREFIX
+
mobile
;
Long
resultNx
=
redisClient
.
setnx
(
nxKey
,
mobile
);
if
(
resultNx
==
0
)
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"
该角色名称重复
"
);
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"
重复提交
"
);
}
redisClient
.
expire
(
nxKey
,
2
);
if
(
resultNx
==
1
)
{
...
...
@@ -97,46 +97,46 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
AccountInfoEntity
accountInfoEntity
=
accountInfoDetailMapper
.
selectByMobile
(
mobileEncrypt
);
//密码已经存在的处理逻辑
if
(
Objects
.
nonNull
(
accountInfoEntity
)
&&
StringUtils
.
isNotBlank
(
accountInfoEntity
.
getPassword
()))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"
密码已经存在
,不可进行编辑"
);
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"
用户已存在,且密码已设置
,不可进行编辑"
);
}
Account
byMobilePhone
=
accountMapper
.
getByMobilePhone
(
mobileEncrypt
);
//用户不存在的处理逻辑
if
(
accountInfoEntity
==
null
)
{
redisClient
.
expire
(
nxKey
,
30
);
Date
currentTime
=
Calendar
.
getInstance
().
getTime
();
String
password
=
req
.
getPassword
();
String
md5Pwd
=
MD5Util
.
MD5
(
password
);
String
md5Pwd
=
StringUtils
.
upperCase
(
MD5Util
.
MD5
(
req
.
getPassword
()));
// account_info
AccountInfoEntity
accountInfo
=
buildAccountInfo
(
mobileEncrypt
,
currentTime
,
req
.
getProductType
(),
req
.
getSourceType
(),
md5Pwd
);
accountInfoDetailMapper
.
insertSelective
(
accountInfo
);
Integer
acctId
=
accountInfo
.
getId
();
accountInfoDetailMapper
.
updateCreateInfo
(
acctId
);
Account
account
=
buildDoctorMsg
(
req
,
mobileEncrypt
,
currentTime
,
req
.
getSourceType
(),
password
,
acctId
);
// doctor
Account
account
=
buildDoctorMsg
(
req
,
mobileEncrypt
,
currentTime
,
req
.
getSourceType
(),
md5Pwd
,
acctId
);
accountMapper
.
insertSelective
(
account
);
Long
userId
=
account
.
getId
();
processAgreement
(
userId
);
insert
AppRole
(
userId
);
insertSaasRole
(
req
,
account
.
getId
(),
userId
);
insertAppRole
(
account
.
getId
()
);
insert
SaasRole
(
req
,
account
.
getId
(),
account
.
getId
()
);
redisClient
.
del
(
nxKey
);
return
1
;
}
//用户存在,但密码不存在的处理逻辑
if
(
Objects
.
nonNull
(
accountInfoEntity
)
&&
StringUtils
.
isBlank
(
accountInfoEntity
.
getPassword
()))
{
byMobilePhone
.
setPassword
(
req
.
getPassword
());
byMobilePhone
.
setComment
(
req
.
getComment
());
accountMapper
.
updateByIdSelective
(
byMobilePhone
);
if
(!
Objects
.
equals
(
req
.
getRoleId
(),
-
1
))
{
insertSaasRole
(
req
,
byMobilePhone
.
getId
(),
doctorId
);
}
Account
byMobilePhone
=
accountMapper
.
getByMobilePhone
(
mobileEncrypt
);
if
(!
req
.
getHospitalId
().
equals
(
byMobilePhone
.
getHospitalId
()))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"正在添加的用户非本机构下用户"
);
}
Account
account
=
new
Account
();
account
.
setId
(
byMobilePhone
.
getId
());
account
.
setModifyId
(
doctorId
);
account
.
setHospitalId
(
req
.
getHospitalId
());
account
.
setModifyTime
(
Calendar
.
getInstance
().
getTime
());
if
(
StringUtils
.
isNotEmpty
(
req
.
getComment
()))
{
account
.
setComment
(
req
.
getComment
());
}
//用户存在,但密码不存在的处理逻辑
if
(
Objects
.
nonNull
(
accountInfoEntity
)
&&
StringUtils
.
isBlank
(
accountInfoEntity
.
getPassword
()))
{
byMobilePhone
.
setPassword
(
req
.
getPassword
());
byMobilePhone
.
setComment
(
req
.
getComment
());
byMobilePhone
.
setHospitalId
(
req
.
getHospitalId
());
accountMapper
.
updateByIdSelective
(
byMobilePhone
);
if
(!
Objects
.
equals
(
req
.
getRoleId
(),
-
1
))
{
insertSaasRole
(
req
,
byMobilePhone
.
getId
(),
doctorId
);
}
accountService
.
updateAccountById
(
account
);
/** 修改密码 */
if
(
StringUtils
.
isNotEmpty
(
req
.
getPassword
())
&&
StringUtils
.
isEmpty
(
byMobilePhone
.
getPassword
()))
{
passwordService
.
modifyPassword
(
mobileEncrypt
,
byMobilePhone
.
getPassword
(),
StringUtils
.
upperCase
(
MD5Util
.
MD5
(
req
.
getPassword
())),
true
);
}
}
return
1
;
...
...
@@ -155,29 +155,6 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
doctorRoleMapper
.
insert
(
doctorRole
);
}
private
void
processAgreement
(
Long
userId
)
{
ExecutorService
executor
=
ExecutorServiceUtils
.
getExecutor
();
executor
.
submit
(()
->
{
Integer
protocolId
=
agreementLogEntityMapper
.
getLatestProtocolId
(
2
);
//获取最新用户协议ID
PProtocolLog
log
=
new
PProtocolLog
();
log
.
setUserId
(
userId
.
toString
());
log
.
setProtocolId
(
protocolId
);
log
.
setUserType
(
2
);
log
.
setType
(
2
);
log
.
setStatus
((
short
)
1
);
log
.
setCreatedId
(
userId
.
intValue
());
log
.
setModifiedId
(
userId
.
intValue
());
agreementLogEntityMapper
.
insertProtocolLog
(
log
);
agreementLogEntityMapper
.
updateSignNum
(
protocolId
);
//更新用户协议签署数量
protocolId
=
agreementLogEntityMapper
.
getLatestProtocolId
(
3
);
//获取最新隐私协议ID
log
.
setProtocolId
(
protocolId
);
log
.
setType
(
3
);
agreementLogEntityMapper
.
insertProtocolLog
(
log
);
agreementLogEntityMapper
.
updateSignNum
(
protocolId
);
//更新隐私协议签署数量
});
}
@Override
public
HospitalSaasUserResp
listByPage
(
HospitalSaasUserListReq
req
)
{
String
mobileEncrypt
=
AESUtil
.
encryptV0
(
req
.
getMobile
());
...
...
@@ -306,11 +283,7 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
String
phone
=
EncryptUtils
.
decryptContent
(
resp
.
getMobile
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
,
EncryptConstants
.
ENCRYPT_DECRYPT_KEY
);
resp
.
setMobile
(
phone
);
}
if
(
StringUtils
.
isNotBlank
(
resp
.
getPassword
()))
{
resp
.
setPwdFlag
(
1
);
}
else
{
resp
.
setPwdFlag
(
2
);
}
resp
.
setPwdFlag
(
2
);
return
resp
;
}
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录