use of com.netsteadfast.greenstep.po.hbm.TbAccount in project bamboobsc by billchen198318.
the class AccountServiceImpl method generateNewPassword.
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public String generateNewPassword(String account) throws ServiceException, Exception {
if (StringUtils.isBlank(account)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
TbAccount entity = new TbAccount();
entity.setAccount(account);
entity = this.findByEntityUK(entity);
if (entity == null || StringUtils.isBlank(entity.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_NO_EXIST));
}
String newPasswordStr = SimpleUtils.createRandomString(5);
entity.setPassword(this.tranPassword(newPasswordStr));
this.update(entity);
return newPasswordStr;
}
Aggregations