Search in sources :

Example 6 with EcBaseServiceResult

use of com.easy.cloud.core.basic.pojo.dto.EcBaseServiceResult in project dq-easy-cloud by dq-open-cloud.

the class UserServiceImpl method login.

@Override
public EcBaseServiceResult login(UserComposeQuery userComposeQuery) {
    if (EcBaseUtils.isNull(userComposeQuery)) {
        throw EcBaseBusinessException.newInstance(EcBaseErrorCodeEnum.QUERY_OBJ_CANT_NULL);
    }
    if (EcStringUtils.isEmpty(userComposeQuery.getPassword())) {
        throw EcBaseBusinessException.newInstance(UserErrorCodeEnum.USER_PASSWOR_CANT_EMPTY);
    }
    Integer loginMode = userComposeQuery.getLoginMode();
    if (LoginMode.isNotAvailableValue(LoginMode.class, loginMode)) {
        throw EcBaseBusinessException.newInstance(UserComposeErrorCodeEnum.LOGIN_MODE_WRONG);
    }
    if (LoginMode.isLoginByEmailAndPassword(loginMode)) {
        if (EcStringUtils.isEmpty(userComposeQuery.getEmail())) {
            throw EcBaseBusinessException.newInstance(UserErrorCodeEnum.USER_EMAIL_CANT_EMPTY);
        }
    } else if (LoginMode.isLoginByUsernameAndPassword(loginMode)) {
        if (EcStringUtils.isEmpty(userComposeQuery.getUserName())) {
            throw EcBaseBusinessException.newInstance(UserErrorCodeEnum.USER_NAME_CANT_EMPTY);
        }
    }
    EcBaseServiceResult dqBaseServiceResult = EcBaseServiceResult.newInstanceOfSuccess();
    if (LoginMode.isLoginByEmailAndPassword(loginMode)) {
        dqBaseServiceResult = userClient.loginByEmailAndPassword(userComposeQuery);
    } else if (LoginMode.isLoginByUsernameAndPassword(loginMode)) {
        dqBaseServiceResult = userClient.loginByUserNameAndPassword(userComposeQuery);
    }
    return dqBaseServiceResult;
}
Also used : EcBaseServiceResult(com.easy.cloud.core.basic.pojo.dto.EcBaseServiceResult)

Example 7 with EcBaseServiceResult

use of com.easy.cloud.core.basic.pojo.dto.EcBaseServiceResult in project dq-easy-cloud by dq-open-cloud.

the class SysFilterConfigLogic method saveSysFilterConfig.

@Transactional(rollbackFor = Exception.class)
public EcBaseServiceResult saveSysFilterConfig(SysFilterConfigDTO sysFilterConfigDTO) {
    EcBaseServiceResult serviceResult = sysFilterConfigService.saveSysFilterConfig(sysFilterConfigDTO);
    authorityManager.updateFilterChains(sysFilterConfigService.loadFilterChainDefinitions());
    return serviceResult;
}
Also used : EcBaseServiceResult(com.easy.cloud.core.basic.pojo.dto.EcBaseServiceResult) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

EcBaseServiceResult (com.easy.cloud.core.basic.pojo.dto.EcBaseServiceResult)7 Transactional (org.springframework.transaction.annotation.Transactional)4 UserEntity (com.easy.cloud.user.base.pojo.entity.UserEntity)2 EcBaseBusinessException (com.easy.cloud.core.exception.bo.EcBaseBusinessException)1 EcBaseServiceResultException (com.easy.cloud.core.exception.dto.EcBaseServiceResultException)1 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1