提交 169cc246 编写于 作者: rushui.chen's avatar rushui.chen

20191024 添加非空判断

上级 753091e7
流水线 #16227 已失败 于阶段
in 1 second
...@@ -32,25 +32,30 @@ public class ModifyMobileServiceImpl implements ModifyMobileService { ...@@ -32,25 +32,30 @@ public class ModifyMobileServiceImpl implements ModifyMobileService {
@Transactional @Transactional
public void modify(Integer acctId, String mobile) { public void modify(Integer acctId, String mobile) {
AccountInfoEntity entity = accountInfoDetailMapper.selectByPrimaryKey(acctId); AccountInfoEntity entity = accountInfoDetailMapper.selectByPrimaryKey(acctId);
String mobilePhone = entity.getMobilePhone(); if (entity != null) {
if (StringUtils.isNotEmpty(mobilePhone) && AESUtil.decryptV0(mobilePhone).equals(mobile)) { String mobilePhone = entity.getMobilePhone();
throw new AccountException(AccountExceptionEnum.PICA_MOBILE_SAME); if (StringUtils.isNotEmpty(mobilePhone) && AESUtil.decryptV0(mobilePhone).equals(mobile)) {
} throw new AccountException(AccountExceptionEnum.PICA_MOBILE_SAME);
AccountInfoEntity accountInfoEntity = new AccountInfoEntity(); }
accountInfoEntity.setId(acctId); AccountInfoEntity accountInfoEntity = new AccountInfoEntity();
accountInfoEntity.setModifiedId(acctId); accountInfoEntity.setId(acctId);
accountInfoEntity.setModifiedTime(new Date()); accountInfoEntity.setModifiedId(acctId);
accountInfoEntity.setMobilePhone(AESUtil.encryptV0(mobile)); accountInfoEntity.setModifiedTime(new Date());
accountInfoDetailMapper.updateMobileByPrimaryKey(accountInfoEntity); accountInfoEntity.setMobilePhone(AESUtil.encryptV0(mobile));
if (doubleWritingMode) { accountInfoDetailMapper.updateMobileByPrimaryKey(accountInfoEntity);
//更新p_doctor表中用户的手机号 if (doubleWritingMode) {
Date currentTime = new Date(); //更新p_doctor表中用户的手机号
Doctor doctor = new Doctor(); Date currentTime = new Date();
doctor.setAcctId(acctId); Doctor doctor = new Doctor();
doctor.setModifyTime(currentTime); doctor.setAcctId(acctId);
doctor.setModifyId(acctId); doctor.setModifyTime(currentTime);
doctor.setMobilePhone(AESUtil.encryptV0(mobile)); doctor.setModifyId(acctId);
doctorMapper.updateByAcctId(doctor); doctor.setMobilePhone(AESUtil.encryptV0(mobile));
doctorMapper.updateByAcctId(doctor);
}
} else {
throw new AccountException(AccountExceptionEnum.PICA_NOT_EXIST);
} }
} }
} }
...@@ -39,23 +39,27 @@ public class PasswordServiceImpl implements PasswordService { ...@@ -39,23 +39,27 @@ public class PasswordServiceImpl implements PasswordService {
@Transactional @Transactional
public void modifyPassword(Integer acctId, String oldPwd, String pwd) { public void modifyPassword(Integer acctId, String oldPwd, String pwd) {
AccountInfoEntity entity = accountInfoDetailMapper.selectByPrimaryKey(acctId); AccountInfoEntity entity = accountInfoDetailMapper.selectByPrimaryKey(acctId);
if (entity.getPassword().equals(oldPwd)) { if (entity != null) {
Date currentTime = new Date(); if (entity.getPassword().equals(oldPwd)) {
AccountInfoEntity accountInfoEntity = new AccountInfoEntity(); Date currentTime = new Date();
accountInfoEntity.setId(acctId); AccountInfoEntity accountInfoEntity = new AccountInfoEntity();
accountInfoEntity.setModifiedId(acctId); accountInfoEntity.setId(acctId);
accountInfoEntity.setModifiedTime(currentTime); accountInfoEntity.setModifiedId(acctId);
accountInfoEntity.setPassword(pwd); accountInfoEntity.setModifiedTime(currentTime);
accountInfoDetailMapper.updatePasswordByPrimaryKey(accountInfoEntity); accountInfoEntity.setPassword(pwd);
if (doubleWritingMode) { accountInfoDetailMapper.updatePasswordByPrimaryKey(accountInfoEntity);
processDoubleWrite(acctId, pwd); if (doubleWritingMode) {
processDoubleWrite(acctId, pwd);
}
//密码修改日志
LogPWDModifyEntity logPWDModifyEntity = AccountLogEntityUtils.getLogPWDModifyEntity(acctId, entity.getMobilePhone(),
oldPwd, pwd, AccountTypeEnum.LOG_TYPE_PASSWORD.getCode());
picaLogUtils.info(logPWDModifyEntity);
} else {
throw new AccountException(AccountExceptionEnum.PICA_PASSWORD_ERROR);
} }
//密码修改日志
LogPWDModifyEntity logPWDModifyEntity = AccountLogEntityUtils.getLogPWDModifyEntity(acctId, entity.getMobilePhone(),
oldPwd, pwd, AccountTypeEnum.LOG_TYPE_PASSWORD.getCode());
picaLogUtils.info(logPWDModifyEntity);
} else { } else {
throw new AccountException(AccountExceptionEnum.PICA_PASSWORD_ERROR); throw new AccountException(AccountExceptionEnum.PICA_NOT_EXIST);
} }
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册