use of com.easy.cloud.core.basic.pojo.dto.EcBaseServiceResult in project dq-easy-cloud by dq-open-cloud.
the class EcBaseBusinessException method getMessage.
@Override
public String getMessage() {
if (!isFormated) {
if (EcStringUtils.isNotEmpty(errorMsg) && EcArrayUtils.isNotEmpty(this.formatValues)) {
this.errorMsg = String.format(errorMsg, this.formatValues);
this.isFormated = true;
}
}
EcBaseServiceResult result = EcBaseServiceResult.newInstance();
result.buildErrorCodeAndMsg(errorCode, errorMsg);
result.buildResult(exceptionDetail);
return EcJSONUtils.parseObject(result, String.class);
}
use of com.easy.cloud.core.basic.pojo.dto.EcBaseServiceResult in project dq-easy-cloud by dq-open-cloud.
the class EcBaseExceptionHandle method handleAndReturnData.
/**
* 基于@ExceptionHandler异常处理
*/
@ExceptionHandler
@ResponseBody
public EcBaseServiceResult handleAndReturnData(HttpServletRequest request, HttpServletResponse response, Exception ex) {
logger.error(ex.getMessage(), ex);
EcBaseServiceResult ecBaseServiceResult = EcBaseServiceResult.newInstance();
EcBaseServiceResultException serviceResultException = EcBaseServiceResultException.newInstance();
String path = request.getRequestURL().toString();
if (ex instanceof EcBaseBusinessException) {
EcBaseBusinessException dbbException = (EcBaseBusinessException) ex;
ecBaseServiceResult.buildErrorCodeAndMsg(dbbException.getErrorCode(), dbbException.getErrorMsg());
} else if (ex instanceof RuntimeException) {
ecBaseServiceResult.buildDqBaseErrorCodeInf(EcBaseErrorCodeEnum.RUNTIME_EXCEPTION);
} else {
ecBaseServiceResult.buildDqBaseErrorCodeInf(EcBaseErrorCodeEnum.SYS_EXCEPTION);
}
serviceResultException.setException(ex.getClass().getName());
serviceResultException.setFailureDetails(ex.getMessage());
serviceResultException.setTimstamp(EcDateUtils.getCurrentDate());
serviceResultException.setPath(path);
ecBaseServiceResult.buildServiceResultException(serviceResultException);
EcLogUtils.error("异常统一处理日志", ecBaseServiceResult, logger);
return ecBaseServiceResult;
}
use of com.easy.cloud.core.basic.pojo.dto.EcBaseServiceResult in project dq-easy-cloud by dq-open-cloud.
the class SysFilterConfigLogic method updateSysFilterConfig.
@Transactional(rollbackFor = Exception.class)
public EcBaseServiceResult updateSysFilterConfig(SysFilterConfigDTO sysFilterConfigDTO) {
EcBaseServiceResult serviceResult = sysFilterConfigService.updateSysFilterConfig(sysFilterConfigDTO);
authorityManager.updateFilterChains(sysFilterConfigService.loadFilterChainDefinitions());
return serviceResult;
}
use of com.easy.cloud.core.basic.pojo.dto.EcBaseServiceResult 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.core.basic.pojo.dto.EcBaseServiceResult 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);
}
Aggregations