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

优化判断逻辑

上级 60f441dd
流水线 #43759 已取消 于阶段
......@@ -324,18 +324,18 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
@Transactional
public HospitalSaasUserEditResp edit(Long id) {
HospitalSaasUserEditResp resp = accountMapper.selectUserRoleById(id);
List<RoleDto> roleDtos = doctorRoleMapper.selectRoleByUserId(resp.getId());
resp.setRoles(roleDtos);
resp.setRoleIds(roleDtos.stream().map(RoleDto::getId).collect(Collectors.toList()));
if (null == resp) {
return new HospitalSaasUserEditResp();
}
List<RoleDto> roleDtos = doctorRoleMapper.selectRoleByUserId(resp.getId());
resp.setRoles(roleDtos);
resp.setRoleIds(roleDtos.stream().map(RoleDto::getId).collect(Collectors.toList()));
resp.setPwdFlag(2);
//维护account信息
if (resp.getAcctId() == null){
if (StringUtils.isNotEmpty(resp.getPassword())){
resp.setPwdFlag(1);
}
//维护account表信息
AccountInfoEntity account = buildAccountInfo(resp.getMobile(), new Date(),3, resp.getName(),6, resp.getPassword());
accountInfoDetailMapper.insertSelective(account);
Account acc=new Account();
......@@ -343,21 +343,20 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
acc.setAcctId(account.getId());
accountMapper.updateByIdSelective(acc);
}
AccountInfoEntity accountInfo;
if (resp.getAcctId() != null && null!=(accountInfo = accountInfoDetailMapper.selectByPrimaryKey(resp.getAcctId()))){
else{
AccountInfoEntity accountInfo=accountInfoDetailMapper.selectByPrimaryKey(resp.getAcctId());
if (null==accountInfo){
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "数据有误");
}
if (StringUtils.isNotBlank(accountInfo.getPassword())) {
resp.setPwdFlag(1);
resp.setPassword(accountInfo.getPassword());
}
}
else {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "数据有误");
}
//手机号不为空 解密脱敏
if (StringUtils.isNotBlank(resp.getMobile())) {
String phone = EncryptUtils.decryptContent(resp.getMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE, EncryptConstants.ENCRYPT_DECRYPT_KEY);
resp.setMobile(phone);
return resp;
}
return resp;
}
......
......@@ -320,7 +320,7 @@
birthday = #{birthday,jdbcType=DATE},
</if>
<if test="acctId != null">
acct_id = #{accId,jdbcType=INTEGER},
acct_id = #{acctId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册