提交 f71d9f90 编写于 作者: wenhao.qin's avatar wenhao.qin

手机号加密权限处理

上级 ae9079c8
流水线 #43143 已失败 于阶段
...@@ -30,4 +30,7 @@ public class HospitalSaasUserListReq { ...@@ -30,4 +30,7 @@ public class HospitalSaasUserListReq {
@ApiModelProperty("页码") @ApiModelProperty("页码")
private Integer pageNo = 1; private Integer pageNo = 1;
@ApiModelProperty("登录来源 0:saas 1:运营平台")
private Integer loginFlag = 0;
} }
...@@ -50,7 +50,6 @@ public class HospitalSaasUserReq { ...@@ -50,7 +50,6 @@ public class HospitalSaasUserReq {
@ApiModelProperty("登录来源 0:saas 1:运营平台") @ApiModelProperty("登录来源 0:saas 1:运营平台")
private Integer loginFlag = 0; private Integer loginFlag = 0;
public void checkInsertParams() { public void checkInsertParams() {
if (StringUtils.isBlank(this.mobile)) { if (StringUtils.isBlank(this.mobile)) {
throw new PicaWarnException(AccountExceptionEnum.PICA_NOT_EMPTY.getCode(), "手机号不能为空"); throw new PicaWarnException(AccountExceptionEnum.PICA_NOT_EMPTY.getCode(), "手机号不能为空");
......
...@@ -94,17 +94,14 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService { ...@@ -94,17 +94,14 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
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.getSourceType(), md5Pwd);
accountInfoDetailMapper.insertSelective(accountInfo); accountInfoDetailMapper.insertSelective(accountInfo);
Integer acctId = accountInfo.getId(); Integer acctId = accountInfo.getId();
accountInfoDetailMapper.updateCreateInfo(acctId); accountInfoDetailMapper.updateCreateInfo(acctId);
// doctor // doctor
Account account = buildDoctorMsg(req, mobileEncrypt, currentTime, req.getSourceType(), md5Pwd, acctId); Account account = buildDoctorMsg(req, mobileEncrypt, currentTime, req.getSourceType(), md5Pwd, acctId);
accountMapper.insertSelective(account); accountMapper.insertSelective(account);
insertAppRole(account.getId()); insertAppRole(account.getId());
insertSaasRole(req, account.getId(), account.getId()); insertSaasRole(req, account.getId(), account.getId());
redisClient.del(nxKey); redisClient.del(nxKey);
...@@ -171,7 +168,10 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService { ...@@ -171,7 +168,10 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
String phone = EncryptUtils.decryptContent(t.getMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE, EncryptConstants.ENCRYPT_DECRYPT_KEY); String phone = EncryptUtils.decryptContent(t.getMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE, EncryptConstants.ENCRYPT_DECRYPT_KEY);
String mixMobile = mixMobile(phone); String mixMobile = mixMobile(phone);
t.setMobile(mixMobile); t.setMobile(mixMobile);
if (Objects.equals(t.getRoleId(), SaasRoleEnum.SAAS_MAIN_ADMIN.getCode())) { if (req.getLoginFlag() == 0 && Objects.nonNull(t.getRoleId()) && t.getRoleId() < SaasRoleEnum.SAAS_DOCTOR.getCode()) {
t.setAdminSaasFlag(1);
}
if (req.getLoginFlag() == 1 && Objects.nonNull(t.getRoleId()) && t.getRoleId() < SaasRoleEnum.SAAS_MAIN_ADMIN.getCode()) {
t.setAdminSaasFlag(1); t.setAdminSaasFlag(1);
} }
}); });
...@@ -285,13 +285,18 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService { ...@@ -285,13 +285,18 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
if (null == resp) { if (null == resp) {
return new HospitalSaasUserEditResp(); return new HospitalSaasUserEditResp();
} }
//手机号 不为空 解密脱敏 //手机号 不为空 解密脱敏
if (StringUtils.isNotBlank(resp.getMobile()) && StringUtils.isNotBlank(resp.getPassword())) { 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;
} }
resp.setPwdFlag(2); resp.setPwdFlag(2);
if (StringUtils.isNotBlank(resp.getPassword())) {
resp.setPwdFlag(1);
}
return resp; return resp;
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册