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

20191024 添加非空判断

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