Search in sources :

Example 1 with UserEntity

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);
}
Also used : EcBaseServiceResult(com.easy.cloud.core.basic.pojo.dto.EcBaseServiceResult) UserEntity(com.easy.cloud.user.base.pojo.entity.UserEntity) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with 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);
}
Also used : EcBaseServiceResult(com.easy.cloud.core.basic.pojo.dto.EcBaseServiceResult) UserEntity(com.easy.cloud.user.base.pojo.entity.UserEntity) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with 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);
}
Also used : UserQuery(com.easy.cloud.user.base.pojo.query.UserQuery) UserEntity(com.easy.cloud.user.base.pojo.entity.UserEntity)

Example 4 with 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);
}
Also used : UserEntity(com.easy.cloud.user.base.pojo.entity.UserEntity) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 5 with 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);
}
Also used : UserQuery(com.easy.cloud.user.base.pojo.query.UserQuery) UserEntity(com.easy.cloud.user.base.pojo.entity.UserEntity)

Aggregations

UserEntity (com.easy.cloud.user.base.pojo.entity.UserEntity)6 UserQuery (com.easy.cloud.user.base.pojo.query.UserQuery)3 EcBaseServiceResult (com.easy.cloud.core.basic.pojo.dto.EcBaseServiceResult)2 Transactional (org.springframework.transaction.annotation.Transactional)2 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1