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
提交
c651cf11
提交
c651cf11
编写于
3月 22, 2022
作者:
wenhao.qin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码pull修改
上级
343ec708
流水线
#43754
已取消 于阶段
变更
1
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
20 行增加
和
25 行删除
+20
-25
HospitalSaasUserServiceImpl.java
...ount/server/service/impl/HospitalSaasUserServiceImpl.java
+20
-25
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/service/impl/HospitalSaasUserServiceImpl.java
浏览文件 @
c651cf11
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.pica.cloud.account.account.server.constants.Constants
;
import
com.pica.cloud.account.account.server.entity.*
;
import
com.pica.cloud.account.account.server.enums.SaasRoleEnum
;
...
...
@@ -104,6 +105,11 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
//手机号加密
String
mobileEncrypt
=
AESUtil
.
encryptV0
(
mobile
);
AccountInfoEntity
accountInfoEntity
=
accountInfoDetailMapper
.
selectByMobile
(
mobileEncrypt
);
Account
byMobilePhone
=
accountMapper
.
getByMobilePhone
(
mobileEncrypt
);
if
((
null
==
accountInfoEntity
&&
byMobilePhone
!=
null
)
||
(
null
!=
accountInfoEntity
&&
byMobilePhone
==
null
)){
logger
.
error
(
"saas注册,account和doctor存在数据不一致情况, req={}"
,
JSON
.
toJSONString
(
req
));
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"数据有误,本次提交失败"
);
}
//密码已经存在的处理逻辑
if
(
Objects
.
nonNull
(
accountInfoEntity
)
&&
StringUtils
.
isNotBlank
(
accountInfoEntity
.
getPassword
()))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"用户已存在,且密码已设置,不可进行编辑"
);
...
...
@@ -113,7 +119,7 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
Date
currentTime
=
Calendar
.
getInstance
().
getTime
();
String
md5Pwd
=
StringUtils
.
upperCase
(
MD5Util
.
MD5
(
req
.
getPassword
()));
// account_info
AccountInfoEntity
accountInfo
=
buildAccountInfo
(
mobileEncrypt
,
currentTime
,
req
.
getProductType
(),
req
.
getSourceType
(),
md5Pwd
);
AccountInfoEntity
accountInfo
=
buildAccountInfo
(
mobileEncrypt
,
currentTime
,
req
.
getProductType
(),
req
.
get
Name
(),
req
.
get
SourceType
(),
md5Pwd
);
accountInfoDetailMapper
.
insertSelective
(
accountInfo
);
Integer
acctId
=
accountInfo
.
getId
();
accountInfoDetailMapper
.
updateCreateInfo
(
acctId
);
...
...
@@ -125,31 +131,19 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
redisClient
.
del
(
nxKey
);
return
1
;
}
Account
byMobilePhone
=
accountMapper
.
getByMobilePhone
(
mobileEncrypt
);
if
(!
req
.
getHospitalId
().
equals
(
byMobilePhone
.
getHospitalId
()))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"正在添加的用户非本机构下用户"
);
//用户存在的处理逻辑 给出提示信息
Integer
hospitalId
=
byMobilePhone
.
getHospitalId
();
Hospital
hospital
;
if
(
null
==
hospitalId
||
null
==
(
hospital
=
hospitalMapper
.
selectByPrimaryKey
(
hospitalId
))){
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"该手机号已存在,但未加入机构,请至云鹊医App中加入机构"
);
}
Account
account
=
new
Account
();
account
.
setId
(
byMobilePhone
.
getId
());
account
.
setModifyId
(
doctorId
);
account
.
setHospitalId
(
req
.
getHospitalId
());
account
.
setHospital
(
req
.
getHospitalName
());
account
.
setModifyTime
(
Calendar
.
getInstance
().
getTime
());
if
(
StringUtils
.
isNotEmpty
(
req
.
getComment
()))
{
account
.
setComment
(
req
.
getComment
());
if
(
hospitalId
.
equals
(
req
.
getHospitalId
())){
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"该手机号已存在本机构中"
);
}
accountService
.
updateAccountById
(
account
);
/** 修改密码 */
Integer
acctId
=
byMobilePhone
.
getAcctId
();
if
(
null
==
acctId
){
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"数据有误"
);
}
if
(
StringUtils
.
isNotEmpty
(
req
.
getPassword
())
&&
StringUtils
.
isEmpty
(
byMobilePhone
.
getPassword
()))
{
AccountInfoEntity
accountInfo
=
accountInfoDetailMapper
.
selectByPrimaryKey
(
acctId
);
if
(
accountInfo
==
null
){
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"当前用户不存在"
);
}
passwordService
.
modifyPassword
(
mobileEncrypt
,
accountInfo
.
getPassword
(),
StringUtils
.
upperCase
(
MD5Util
.
MD5
(
req
.
getPassword
())),
true
);
if
(!
req
.
getHospitalId
().
equals
(
byMobilePhone
.
getHospitalId
()))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
String
.
format
(
"该手机号已存在于\"%s\"中,如需修改请至云鹊医App中修改所属机构"
,
hospital
.
getName
()));
}
}
return
1
;
...
...
@@ -356,13 +350,14 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
return
resp
;
}
private
AccountInfoEntity
buildAccountInfo
(
String
mobileEncrypt
,
Date
currentTime
,
int
productType
,
int
sourceType
,
String
password
)
{
private
AccountInfoEntity
buildAccountInfo
(
String
mobileEncrypt
,
Date
currentTime
,
int
productType
,
String
name
,
int
sourceType
,
String
password
)
{
AccountInfoEntity
accountInfo
=
new
AccountInfoEntity
();
accountInfo
.
setMobilePhone
(
mobileEncrypt
);
accountInfo
.
setPassword
(
password
);
accountInfo
.
setCreatedTime
(
currentTime
);
accountInfo
.
setCreatedId
(
0
);
accountInfo
.
setModifiedId
(
0
);
accountInfo
.
setName
(
name
);
accountInfo
.
setModifiedTime
(
currentTime
);
accountInfo
.
setRegTime
(
currentTime
);
accountInfo
.
setDeleteFlag
(
1
);
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录