use of com.easy.cloud.user.base.pojo.entity.UserEntity in project dq-easy-cloud by dq-open-cloud.
the class UserServiceImpl method register.
@Override
@Transactional
public EcBaseServiceResult register(UserDTO userDTO) {
EcBaseServiceResult dqBaseServiceResult = EcBaseServiceResult.newInstanceOfSuccess();
if (EcBaseUtils.isNull(userDTO)) {
throw EcBaseBusinessException.newInstance(UserErrorCodeEnum.USER_CANT_NULL);
}
if (EcStringUtils.isEmpty(userDTO.getUserName())) {
throw EcBaseBusinessException.newInstance(UserErrorCodeEnum.USER_NAME_CANT_EMPTY);
}
if (EcStringUtils.isEmpty(userDTO.getPassword())) {
throw EcBaseBusinessException.newInstance(UserErrorCodeEnum.USER_PASSWOR_CANT_EMPTY);
}
if (EcStringUtils.isEmpty(userDTO.getEmail())) {
throw EcBaseBusinessException.newInstance(UserErrorCodeEnum.USER_EMAIL_CANT_EMPTY);
}
UserEntity userEntity = userRepository.saveUserInfo(EcJSONUtils.parseObject(userDTO, UserEntity.class));
return dqBaseServiceResult.buildResult(userEntity);
}
use of com.easy.cloud.user.base.pojo.entity.UserEntity in project dq-easy-cloud by dq-open-cloud.
the class UserServiceImpl method saveUser.
@Override
@Transactional
public EcBaseServiceResult saveUser(UserDTO userDTO) {
EcBaseServiceResult dqBaseServiceResult = EcBaseServiceResult.newInstanceOfSuccess();
if (EcBaseUtils.isNull(userDTO)) {
dqBaseServiceResult.buildErrorCode(UserErrorCodeEnum.USER_CANT_NULL);
return dqBaseServiceResult;
}
if (EcStringUtils.isEmpty(userDTO.getUserName())) {
dqBaseServiceResult.buildErrorCode(UserErrorCodeEnum.USER_NAME_CANT_EMPTY);
return dqBaseServiceResult;
}
if (EcStringUtils.isEmpty(userDTO.getPassword())) {
dqBaseServiceResult.buildErrorCode(UserErrorCodeEnum.USER_PASSWOR_CANT_EMPTY);
return dqBaseServiceResult;
}
UserEntity userEntity = userRepository.saveUserInfo(EcJSONUtils.parseObject(userDTO, UserEntity.class));
return dqBaseServiceResult.buildResult(userEntity);
}
use of com.easy.cloud.user.base.pojo.entity.UserEntity in project dq-easy-cloud by dq-open-cloud.
the class UserServiceImpl method loginByEmailAndPassword.
@Override
public EcBaseServiceResult loginByEmailAndPassword(UserQuery userQuery) {
UserQuery userQueryOfFilter = new UserQuery();
userQueryOfFilter.setEmail(userQuery.getEmail());
userQueryOfFilter.setPassword(userQuery.getPassword());
UserEntity userEntity = userRepository.findUserByQuery(userQueryOfFilter);
return EcBaseServiceResult.newInstanceOfSucResult(userEntity);
}
use of com.easy.cloud.user.base.pojo.entity.UserEntity in project dq-easy-cloud by dq-open-cloud.
the class UserServiceTest method testSave.
@Test
public void testSave() {
UserEntity userEntity = new UserEntity("userName", "password", 1);
userService.saveUserInfo(userEntity);
}
use of com.easy.cloud.user.base.pojo.entity.UserEntity in project dq-easy-cloud by dq-open-cloud.
the class UserServiceImpl method loginByUserNameAndPassword.
@Override
public EcBaseServiceResult loginByUserNameAndPassword(UserQuery userQuery) {
UserQuery userQueryOfFilter = new UserQuery();
userQueryOfFilter.setUserName(userQuery.getUserName());
userQueryOfFilter.setPassword(userQuery.getPassword());
UserEntity userEntity = userRepository.findUserByQuery(userQueryOfFilter);
return EcBaseServiceResult.newInstanceOfSucResult(userEntity);
}
Aggregations