@Test public void testSetUserPassword() throws Exception { }
public CommonResult setUserPassword(Integer userId, String oldPassword, String newPassword){ String encryptedOldPass = SHAUtils.encodeData(oldPassword); String encryptedNewPass = SHAUtils.encodeData(newPassword); if (userMapper.userAuthentication(userId, encryptedOldPass) == null){ return CommonResult.fail(E_606); } if (encryptedNewPass == null || encryptedNewPass.equals(encryptedOldPass)){ return CommonResult.fail(E_607); } userMapper.setPassword(userId, encryptedNewPass); return CommonResult.success(null); }
UserServiceImpl implements UserService { public CommonResult setUserPassword(Integer userId, String oldPassword, String newPassword){ String encryptedOldPass = SHAUtils.encodeData(oldPassword); String encryptedNewPass = SHAUtils.encodeData(newPassword); if (userMapper.userAuthentication(userId, encryptedOldPass) == null){ return CommonResult.fail(E_606); } if (encryptedNewPass == null || encryptedNewPass.equals(encryptedOldPass)){ return CommonResult.fail(E_607); } userMapper.setPassword(userId, encryptedNewPass); return CommonResult.success(null); } }
UserServiceImpl implements UserService { public CommonResult setUserPassword(Integer userId, String oldPassword, String newPassword){ String encryptedOldPass = SHAUtils.encodeData(oldPassword); String encryptedNewPass = SHAUtils.encodeData(newPassword); if (userMapper.userAuthentication(userId, encryptedOldPass) == null){ return CommonResult.fail(E_606); } if (encryptedNewPass == null || encryptedNewPass.equals(encryptedOldPass)){ return CommonResult.fail(E_607); } userMapper.setPassword(userId, encryptedNewPass); return CommonResult.success(null); }  }
UserServiceImpl implements UserService { public CommonResult setUserPassword(Integer userId, String oldPassword, String newPassword){ String encryptedOldPass = SHAUtils.encodeData(oldPassword); String encryptedNewPass = SHAUtils.encodeData(newPassword); if (userMapper.userAuthentication(userId, encryptedOldPass) == null){ return CommonResult.fail(E_606); } if (encryptedNewPass == null || encryptedNewPass.equals(encryptedOldPass)){ return CommonResult.fail(E_607); } userMapper.setPassword(userId, encryptedNewPass); return CommonResult.success(null); }  CommonResult setUserAvatar(Integer id, String avatarUrl); CommonResult setUserPassword(Integer userId, String oldPassword, String newPassword); CommonResult getUserInfo(String  token); }
UserServiceImpl implements UserService { public CommonResult setUserPassword(Integer userId, String oldPassword, String newPassword){ String encryptedOldPass = SHAUtils.encodeData(oldPassword); String encryptedNewPass = SHAUtils.encodeData(newPassword); if (userMapper.userAuthentication(userId, encryptedOldPass) == null){ return CommonResult.fail(E_606); } if (encryptedNewPass == null || encryptedNewPass.equals(encryptedOldPass)){ return CommonResult.fail(E_607); } userMapper.setPassword(userId, encryptedNewPass); return CommonResult.success(null); }  CommonResult setUserAvatar(Integer id, String avatarUrl); CommonResult setUserPassword(Integer userId, String oldPassword, String newPassword); CommonResult getUserInfo(String  token);  }