| | |
| | | } |
| | | |
| | | @Override |
| | | public AccountUser selectAccountUserByUsername(String userName) |
| | | { |
| | | return accountUserMapper.selectAccountUserByUsername(userName); |
| | | } |
| | | |
| | | @Override |
| | | public List<AccountUser> selectAccountUserList(AccountUser accountUser) |
| | | { |
| | | return accountUserMapper.selectAccountUserList(accountUser); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void resetPasswordByPhone(String phone, String rawPassword) |
| | | { |
| | | // STEP 1: 入参兜底校验(认证服务已校验,此处做服务层兜底) |
| | | if (StringUtils.isEmpty(phone)) |
| | | { |
| | | throw new ServiceException("请输入手机号"); |
| | | } |
| | | if (StringUtils.isEmpty(rawPassword)) |
| | | { |
| | | throw new ServiceException("请输入新密码"); |
| | | } |
| | | // STEP 2: 按手机号定位会员(逻辑删除已在 SQL 中过滤) |
| | | AccountUser accountUser = accountUserMapper.selectAccountUserByPhone(phone); |
| | | if (StringUtils.isNull(accountUser)) |
| | | { |
| | | throw new ServiceException("该手机号未注册,请先注册"); |
| | | } |
| | | // STEP 3: 构造单列更新对象,密码 BCrypt 加密后落库(不触碰其它资料) |
| | | AccountUser update = new AccountUser(); |
| | | update.setUserId(accountUser.getUserId()); |
| | | update.setPassword(SecurityUtils.encryptPassword(rawPassword)); |
| | | update.setUpdateBy(phone); |
| | | // STEP 4: 只更新 password 一列;影响行数为 0 说明会员不存在或已删除 |
| | | if (accountUserMapper.updateUserPassword(update) == 0) |
| | | { |
| | | throw new ServiceException("密码重置失败,请稍后重试"); |
| | | } |
| | | log.info("[MEMBER_RESET_PWD] reset success, phone={}", maskPhone(phone)); |
| | | } |
| | | |
| | | @Override |
| | | public AccountUserInfoVo getAccountUserInfo(Long userId) |
| | | { |
| | | // STEP 1: 校验会员ID(登录态缺失时直接失败,避免无归属查询) |