com.ruoyi.common.enums.BusinessStatus Java Examples

The following examples show how to use com.ruoyi.common.enums.BusinessStatus. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LogAspect.java    From supplierShop with MIT License 4 votes vote down vote up
protected void handleLog(final JoinPoint joinPoint, final Exception e)
{
    try
    {
        // 获得注解
        Log controllerLog = getAnnotationLog(joinPoint);
        if (controllerLog == null)
        {
            return;
        }

        // 获取当前的用户
        SysUser currentUser = ShiroUtils.getSysUser();

        // *========数据库日志=========*//
        SysOperLog operLog = new SysOperLog();
        operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
        // 请求的地址
        String ip = ShiroUtils.getIp();
        operLog.setOperIp(ip);

        operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
        if (currentUser != null)
        {
            operLog.setOperName(currentUser.getLoginName());
            if (StringUtils.isNotNull(currentUser.getDept())
                    && StringUtils.isNotEmpty(currentUser.getDept().getDeptName()))
            {
                operLog.setDeptName(currentUser.getDept().getDeptName());
            }
        }

        if (e != null)
        {
            operLog.setStatus(BusinessStatus.FAIL.ordinal());
            operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000));
        }
        // 设置方法名称
        String className = joinPoint.getTarget().getClass().getName();
        String methodName = joinPoint.getSignature().getName();
        operLog.setMethod(className + "." + methodName + "()");
        // 处理设置注解上的参数
        getControllerMethodDescription(controllerLog, operLog);
        // 保存数据库
        AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
    }
    catch (Exception exp)
    {
        // 记录本地异常日志
        log.error("==前置通知异常==");
        log.error("异常信息:{}", exp.getMessage());
        exp.printStackTrace();
    }
}
 
Example #2
Source File: LogAspect.java    From ruoyiplus with MIT License 4 votes vote down vote up
protected void handleLog(final JoinPoint joinPoint, final Exception e)
{
    try
    {
        // 获得注解
        Log controllerLog = getAnnotationLog(joinPoint);
        if (controllerLog == null)
        {
            return;
        }

        // 获取当前的用户
        SysUser currentUser = ShiroUtils.getSysUser();

        // *========数据库日志=========*//
        SysOperLog operLog = new SysOperLog();
        operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
        // 请求的地址
        String ip = ShiroUtils.getIp();
        operLog.setOperIp(ip);

        operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
        if (currentUser != null)
        {
            operLog.setOperName(currentUser.getLoginName());
            if (StringUtils.isNotNull(currentUser.getDept())
                    && StringUtils.isNotEmpty(currentUser.getDept().getDeptName()))
            {
                operLog.setDeptName(currentUser.getDept().getDeptName());
            }
        }

        if (e != null)
        {
            operLog.setStatus(BusinessStatus.FAIL.ordinal());
            operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000));
        }
        // 设置方法名称
        String className = joinPoint.getTarget().getClass().getName();
        String methodName = joinPoint.getSignature().getName();
        operLog.setMethod(className + "." + methodName + "()");
        // 处理设置注解上的参数
        getControllerMethodDescription(controllerLog, operLog);
        // 保存数据库
        AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
    }
    catch (Exception exp)
    {
        // 记录本地异常日志
        log.error("==前置通知异常==");
        log.error("异常信息:{}", exp.getMessage());
        exp.printStackTrace();
    }
}
 
Example #3
Source File: LogAspect.java    From RuoYi with Apache License 2.0 4 votes vote down vote up
private void handleLog(final JoinPoint joinPoint, final Exception e) {
    try {
        // 获得注解
        Log controllerLog = getAnnotationLog(joinPoint);
        if (controllerLog == null) {
            return;
        }

        // 获取当前的用户
        SysUser currentUser = ShiroUtils.getSysUser();

        // *========数据库日志=========*//
        SysOperLog operLog = new SysOperLog();
        operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
        // 请求的地址
        String ip = ShiroUtils.getIp();
        operLog.setOperIp(ip);

        operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
        if (ObjectUtil.isNotNull(currentUser)) {
            operLog.setOperName(currentUser.getLoginName());
            if (ObjectUtil.isNotNull(currentUser.getDept())
                    && StrUtil.isNotEmpty(currentUser.getDept().getDeptName())) {
                operLog.setDeptName(currentUser.getDept().getDeptName());
            }
        }

        if (e != null) {
            operLog.setStatus(BusinessStatus.FAIL.ordinal());
            operLog.setErrorMsg(StrUtil.sub(e.getMessage(), 0, 2000));
        }
        // 设置方法名称
        String className = joinPoint.getTarget().getClass().getName();
        String methodName = joinPoint.getSignature().getName();
        operLog.setMethod(className + "." + methodName + "()");
        // 处理设置注解上的参数
        getControllerMethodDescription(controllerLog, operLog);
        // 保存数据库
        AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
    } catch (Exception exp) {
        // 记录本地异常日志
        log.error("==前置通知异常==",exp);
        log.error("异常信息:{}" , exp.getMessage());
    }
}