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
提交
b4e19bd6
提交
b4e19bd6
编写于
3月 22, 2022
作者:
minghao.wu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev-20220318' into 'release'
Dev 20220318 See merge request
!97
上级
40e5e4c5
41326bc2
流水线
#43788
已取消 于阶段
变更
3
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
35 行增加
和
39 行删除
+35
-39
HospitalSaasUserServiceImpl.java
...ount/server/service/impl/HospitalSaasUserServiceImpl.java
+30
-38
AccountMapper.xml
server/src/main/resources/mybatis/AccountMapper.xml
+4
-0
HospitalMapper.xml
server/src/main/resources/mybatis/HospitalMapper.xml
+1
-1
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/service/impl/HospitalSaasUserServiceImpl.java
浏览文件 @
b4e19bd6
// Copyright 2016-2101 Pica.
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
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.constants.Constants
;
import
com.pica.cloud.account.account.server.entity.*
;
import
com.pica.cloud.account.account.server.entity.*
;
import
com.pica.cloud.account.account.server.enums.SaasRoleEnum
;
import
com.pica.cloud.account.account.server.enums.SaasRoleEnum
;
...
@@ -104,16 +105,17 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
...
@@ -104,16 +105,17 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
//手机号加密
//手机号加密
String
mobileEncrypt
=
AESUtil
.
encryptV0
(
mobile
);
String
mobileEncrypt
=
AESUtil
.
encryptV0
(
mobile
);
AccountInfoEntity
accountInfoEntity
=
accountInfoDetailMapper
.
selectByMobile
(
mobileEncrypt
);
AccountInfoEntity
accountInfoEntity
=
accountInfoDetailMapper
.
selectByMobile
(
mobileEncrypt
);
//密码已经存在的处理逻辑
Account
byMobilePhone
=
accountMapper
.
getByMobilePhone
(
mobileEncrypt
);
if
(
Objects
.
nonNull
(
accountInfoEntity
)
&&
StringUtils
.
isNotBlank
(
accountInfoEntity
.
getPassword
()))
{
if
((
null
==
accountInfoEntity
&&
byMobilePhone
!=
null
)
||
(
null
!=
accountInfoEntity
&&
byMobilePhone
==
null
)){
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"用户已存在,且密码已设置,不可进行编辑"
);
logger
.
error
(
"saas注册,account和doctor存在数据不一致情况, req={}"
,
JSON
.
toJSONString
(
req
));
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"数据有误,本次提交失败"
);
}
}
//用户不存在的处理逻辑
//用户不存在的处理逻辑
if
(
accountInfoEntity
==
null
)
{
if
(
accountInfoEntity
==
null
)
{
Date
currentTime
=
Calendar
.
getInstance
().
getTime
();
Date
currentTime
=
Calendar
.
getInstance
().
getTime
();
String
md5Pwd
=
StringUtils
.
upperCase
(
MD5Util
.
MD5
(
req
.
getPassword
()));
String
md5Pwd
=
StringUtils
.
upperCase
(
MD5Util
.
MD5
(
req
.
getPassword
()));
// account_info
// 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
);
accountInfoDetailMapper
.
insertSelective
(
accountInfo
);
Integer
acctId
=
accountInfo
.
getId
();
Integer
acctId
=
accountInfo
.
getId
();
accountInfoDetailMapper
.
updateCreateInfo
(
acctId
);
accountInfoDetailMapper
.
updateCreateInfo
(
acctId
);
...
@@ -125,31 +127,19 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
...
@@ -125,31 +127,19 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
redisClient
.
del
(
nxKey
);
redisClient
.
del
(
nxKey
);
return
1
;
return
1
;
}
}
Account
byMobilePhone
=
accountMapper
.
getByMobilePhone
(
mobileEncrypt
);
//用户存在的处理逻辑 给出提示信息
if
(!
req
.
getHospitalId
().
equals
(
byMobilePhone
.
getHospitalId
()))
{
Integer
hospitalId
=
byMobilePhone
.
getHospitalId
();
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"正在添加的用户非本机构下用户"
);
Hospital
hospital
;
if
(
null
==
hospitalId
||
null
==
(
hospital
=
hospitalMapper
.
selectByPrimaryKey
(
hospitalId
))){
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"该手机号已存在,但未加入机构,请至云鹊医App中加入机构"
);
}
}
Account
account
=
new
Account
();
if
(
hospitalId
.
equals
(
req
.
getHospitalId
())){
account
.
setId
(
byMobilePhone
.
getId
());
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"该手机号已存在本机构中"
);
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
());
}
}
accountService
.
updateAccountById
(
account
);
if
(!
req
.
getHospitalId
().
equals
(
byMobilePhone
.
getHospitalId
()))
{
/** 修改密码 */
throw
new
PicaException
(
Integer
acctId
=
byMobilePhone
.
getAcctId
();
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
if
(
null
==
acctId
){
String
.
format
(
"该手机号已存在于\"%s\"中,如需修改请至云鹊医App中修改所属机构"
,
hospital
.
getName
()));
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
);
}
}
}
}
return
1
;
return
1
;
...
@@ -331,38 +321,40 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
...
@@ -331,38 +321,40 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
}
}
@Override
@Override
@Transactional
public
HospitalSaasUserEditResp
edit
(
Long
id
)
{
public
HospitalSaasUserEditResp
edit
(
Long
id
)
{
HospitalSaasUserEditResp
resp
=
accountMapper
.
selectUserRoleById
(
id
);
HospitalSaasUserEditResp
resp
=
accountMapper
.
selectUserRoleById
(
id
);
if
(
null
==
resp
)
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"数据有误"
);
}
List
<
RoleDto
>
roleDtos
=
doctorRoleMapper
.
selectRoleByUserId
(
resp
.
getId
());
List
<
RoleDto
>
roleDtos
=
doctorRoleMapper
.
selectRoleByUserId
(
resp
.
getId
());
resp
.
setRoles
(
roleDtos
);
resp
.
setRoles
(
roleDtos
);
resp
.
setRoleIds
(
roleDtos
.
stream
().
map
(
RoleDto:
:
getId
).
collect
(
Collectors
.
toList
()));
resp
.
setRoleIds
(
roleDtos
.
stream
().
map
(
RoleDto:
:
getId
).
collect
(
Collectors
.
toList
()));
if
(
null
==
resp
)
{
return
new
HospitalSaasUserEditResp
();
}
resp
.
setPwdFlag
(
2
);
resp
.
setPwdFlag
(
2
);
if
(
resp
.
getAcctId
()
!=
null
){
AccountInfoEntity
accountInfo
;
AccountInfoEntity
accountInfo
=
accountInfoDetailMapper
.
selectByPrimaryKey
(
resp
.
getAcctId
());
if
(
null
==
resp
.
getAcctId
()
||
null
==
(
accountInfo
=
accountInfoDetailMapper
.
selectByPrimaryKey
(
resp
.
getAcctId
()))){
if
(
StringUtils
.
isNotBlank
(
accountInfo
.
getPassword
()))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"数据有误"
);
resp
.
setPwdFlag
(
1
);
}
resp
.
setPassword
(
accountInfo
.
getPassword
());
if
(
StringUtils
.
isNotBlank
(
accountInfo
.
getPassword
()))
{
}
resp
.
setPwdFlag
(
1
);
resp
.
setPassword
(
accountInfo
.
getPassword
());
}
}
//手机号不为空 解密脱敏
//手机号不为空 解密脱敏
if
(
StringUtils
.
isNotBlank
(
resp
.
getMobile
()))
{
if
(
StringUtils
.
isNotBlank
(
resp
.
getMobile
()))
{
String
phone
=
EncryptUtils
.
decryptContent
(
resp
.
getMobile
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
,
EncryptConstants
.
ENCRYPT_DECRYPT_KEY
);
String
phone
=
EncryptUtils
.
decryptContent
(
resp
.
getMobile
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
,
EncryptConstants
.
ENCRYPT_DECRYPT_KEY
);
resp
.
setMobile
(
phone
);
resp
.
setMobile
(
phone
);
return
resp
;
}
}
return
resp
;
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
();
AccountInfoEntity
accountInfo
=
new
AccountInfoEntity
();
accountInfo
.
setMobilePhone
(
mobileEncrypt
);
accountInfo
.
setMobilePhone
(
mobileEncrypt
);
accountInfo
.
setPassword
(
password
);
accountInfo
.
setPassword
(
password
);
accountInfo
.
setCreatedTime
(
currentTime
);
accountInfo
.
setCreatedTime
(
currentTime
);
accountInfo
.
setCreatedId
(
0
);
accountInfo
.
setCreatedId
(
0
);
accountInfo
.
setModifiedId
(
0
);
accountInfo
.
setModifiedId
(
0
);
accountInfo
.
setName
(
name
);
accountInfo
.
setModifiedTime
(
currentTime
);
accountInfo
.
setModifiedTime
(
currentTime
);
accountInfo
.
setRegTime
(
currentTime
);
accountInfo
.
setRegTime
(
currentTime
);
accountInfo
.
setDeleteFlag
(
1
);
accountInfo
.
setDeleteFlag
(
1
);
...
...
server/src/main/resources/mybatis/AccountMapper.xml
浏览文件 @
b4e19bd6
...
@@ -319,6 +319,9 @@
...
@@ -319,6 +319,9 @@
<if
test=
"birthday != null"
>
<if
test=
"birthday != null"
>
birthday = #{birthday,jdbcType=DATE},
birthday = #{birthday,jdbcType=DATE},
</if>
</if>
<if
test=
"acctId != null"
>
acct_id = #{acctId,jdbcType=INTEGER},
</if>
</set>
</set>
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</update>
...
@@ -394,6 +397,7 @@
...
@@ -394,6 +397,7 @@
p.hospital_id as hospitalId,
p.hospital_id as hospitalId,
p.mobile_phone as mobile,
p.mobile_phone as mobile,
p.comment as comment,
p.comment as comment,
p.password as password,
p.acct_id as acctId
p.acct_id as acctId
from p_doctor as p
from p_doctor as p
where p.id = #{id, jdbcType=INTEGER}
where p.id = #{id, jdbcType=INTEGER}
...
...
server/src/main/resources/mybatis/HospitalMapper.xml
浏览文件 @
b4e19bd6
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
select
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
from p_hospital
from p_hospital
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
and delete_flag = 1
</select>
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from p_hospital
delete from p_hospital
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录