@Test public void login() { Assert.assertNotNull(userService.login(TestConsts.EMAIL, TestConsts.PASSWORD)); }
@Override @LogMethod("用户登录") public String login(String loginName, String password) { User user = userDAO.getByUsernameOrEmail(loginName, loginName); if (ObjectUtil.isNotNull(user) && user.getPassword().equals(DigestUtil.md5Hex(password))) { String token = IdUtil.simpleUUID(); Integer tokenExpired = SpringBeeApplication.getBeeConfigBean().getTokenExpired(); user.setLoginTime(System.currentTimeMillis()); save(user, false); userRedisTemplate.opsForValue().set(token, user, tokenExpired, TimeUnit.SECONDS); return token; } throw BeeErrorConsts.USERNAME_PASSWORD_INCORRECT; }
UserServiceImpl implements UserService { @Override @LogMethod("用户登录") public String login(String loginName, String password) { User user = userDAO.getByUsernameOrEmail(loginName, loginName); if (ObjectUtil.isNotNull(user) && user.getPassword().equals(DigestUtil.md5Hex(password))) { String token = IdUtil.simpleUUID(); Integer tokenExpired = SpringBeeApplication.getBeeConfigBean().getTokenExpired(); user.setLoginTime(System.currentTimeMillis()); save(user, false); userRedisTemplate.opsForValue().set(token, user, tokenExpired, TimeUnit.SECONDS); return token; } throw BeeErrorConsts.USERNAME_PASSWORD_INCORRECT; } }
UserServiceImpl implements UserService { @Override @LogMethod("用户登录") public String login(String loginName, String password) { User user = userDAO.getByUsernameOrEmail(loginName, loginName); if (ObjectUtil.isNotNull(user) && user.getPassword().equals(DigestUtil.md5Hex(password))) { String token = IdUtil.simpleUUID(); Integer tokenExpired = SpringBeeApplication.getBeeConfigBean().getTokenExpired(); user.setLoginTime(System.currentTimeMillis()); save(user, false); userRedisTemplate.opsForValue().set(token, user, tokenExpired, TimeUnit.SECONDS); return token; } throw BeeErrorConsts.USERNAME_PASSWORD_INCORRECT; } @Autowired  UserServiceImpl(UserDAO userDAO, RedisTemplate<String, User> userRedisTemplate,
                           CommonService commonService); }
UserServiceImpl implements UserService { @Override @LogMethod("用户登录") public String login(String loginName, String password) { User user = userDAO.getByUsernameOrEmail(loginName, loginName); if (ObjectUtil.isNotNull(user) && user.getPassword().equals(DigestUtil.md5Hex(password))) { String token = IdUtil.simpleUUID(); Integer tokenExpired = SpringBeeApplication.getBeeConfigBean().getTokenExpired(); user.setLoginTime(System.currentTimeMillis()); save(user, false); userRedisTemplate.opsForValue().set(token, user, tokenExpired, TimeUnit.SECONDS); return token; } throw BeeErrorConsts.USERNAME_PASSWORD_INCORRECT; } @Autowired  UserServiceImpl(UserDAO userDAO, RedisTemplate<String, User> userRedisTemplate,
                           CommonService commonService); @Override @LogMethod("更新邮箱") void updateEmail(User user, String email); @Override @LogMethod("更新用户名") void updateUsername(User user, String username); @Override @LogMethod("更新用户头像") void updateAvatar(User user, String avatar); @Override @LogMethod("更新用户信息") void updateInfo(User user, UserInfoVO userInfoVO); @Override @LogMethod("注册用户") void register(RegisterVO registerVO); @Override @LogMethod("重置密码") void resetPassword(String email, String newPassword); @Override @LogMethod("修改密码") boolean updatePassword(User user, String oldPassword, String newPassword); @Override @LogMethod("用户登录") String login(String loginName, String password); @Override User getUserByToken(String token); }
UserServiceImpl implements UserService { @Override @LogMethod("用户登录") public String login(String loginName, String password) { User user = userDAO.getByUsernameOrEmail(loginName, loginName); if (ObjectUtil.isNotNull(user) && user.getPassword().equals(DigestUtil.md5Hex(password))) { String token = IdUtil.simpleUUID(); Integer tokenExpired = SpringBeeApplication.getBeeConfigBean().getTokenExpired(); user.setLoginTime(System.currentTimeMillis()); save(user, false); userRedisTemplate.opsForValue().set(token, user, tokenExpired, TimeUnit.SECONDS); return token; } throw BeeErrorConsts.USERNAME_PASSWORD_INCORRECT; } @Autowired  UserServiceImpl(UserDAO userDAO, RedisTemplate<String, User> userRedisTemplate,
                           CommonService commonService); @Override @LogMethod("更新邮箱") void updateEmail(User user, String email); @Override @LogMethod("更新用户名") void updateUsername(User user, String username); @Override @LogMethod("更新用户头像") void updateAvatar(User user, String avatar); @Override @LogMethod("更新用户信息") void updateInfo(User user, UserInfoVO userInfoVO); @Override @LogMethod("注册用户") void register(RegisterVO registerVO); @Override @LogMethod("重置密码") void resetPassword(String email, String newPassword); @Override @LogMethod("修改密码") boolean updatePassword(User user, String oldPassword, String newPassword); @Override @LogMethod("用户登录") String login(String loginName, String password); @Override User getUserByToken(String token);  }