Java Code Examples for com.ruoyi.system.domain.SysOperLog

The following examples show how to use com.ruoyi.system.domain.SysOperLog. These examples are extracted from open source projects. 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 Project: supplierShop   Source File: LogAspect.java    License: MIT License 6 votes vote down vote up
/**
 * 获取注解中对方法的描述信息 用于Controller层注解
 * 
 * @param log 日志
 * @param operLog 操作日志
 * @throws Exception
 */
public void getControllerMethodDescription(Log log, SysOperLog operLog) throws Exception
{
    // 设置action动作
    operLog.setBusinessType(log.businessType().ordinal());
    // 设置标题
    operLog.setTitle(log.title());
    // 设置操作人类别
    operLog.setOperatorType(log.operatorType().ordinal());
    // 是否需要保存request,参数和值
    if (log.isSaveRequestData())
    {
        // 获取参数的信息,传入到数据库中。
        setRequestValue(operLog);
    }
}
 
Example 2
Source Project: ruoyiplus   Source File: LogAspect.java    License: MIT License 6 votes vote down vote up
/**
 * 获取注解中对方法的描述信息 用于Controller层注解
 * 
 * @param log 日志
 * @param operLog 操作日志
 * @throws Exception
 */
public void getControllerMethodDescription(Log log, SysOperLog operLog) throws Exception
{
    // 设置action动作
    operLog.setBusinessType(log.businessType().ordinal());
    // 设置标题
    operLog.setTitle(log.title());
    // 设置操作人类别
    operLog.setOperatorType(log.operatorType().ordinal());
    // 是否需要保存request,参数和值
    if (log.isSaveRequestData())
    {
        // 获取参数的信息,传入到数据库中。
        setRequestValue(operLog);
    }
}
 
Example 3
Source Project: supplierShop   Source File: LogAspect.java    License: MIT License 5 votes vote down vote up
/**
 * 获取请求的参数,放到log中
 * 
 * @param operLog 操作日志
 * @throws Exception 异常
 */
private void setRequestValue(SysOperLog operLog) throws Exception
{
    Map<String, String[]> map = ServletUtils.getRequest().getParameterMap();
    String params = JSON.marshal(map);
    operLog.setOperParam(StringUtils.substring(params, 0, 2000));
}
 
Example 4
Source Project: supplierShop   Source File: AsyncFactory.java    License: MIT License 5 votes vote down vote up
/**
 * 操作日志记录
 * 
 * @param operLog 操作日志信息
 * @return 任务task
 */
public static TimerTask recordOper(final SysOperLog operLog)
{
    return new TimerTask()
    {
        @Override
        public void run()
        {
            // 远程查询操作地点
            operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp()));
            SpringUtils.getBean(ISysOperLogService.class).insertOperlog(operLog);
        }
    };
}
 
Example 5
Source Project: supplierShop   Source File: SysOperlogController.java    License: MIT License 5 votes vote down vote up
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("monitor:operlog:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysOperLog operLog)
{
    List<SysOperLog> list = operLogService.selectOperLogList(operLog);
    ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
    return util.exportExcel(list, "操作日志");
}
 
Example 6
Source Project: ruoyiplus   Source File: LogAspect.java    License: MIT License 5 votes vote down vote up
/**
 * 获取请求的参数,放到log中
 * 
 * @param operLog 操作日志
 * @throws Exception 异常
 */
private void setRequestValue(SysOperLog operLog) throws Exception
{
    Map<String, String[]> map = ServletUtils.getRequest().getParameterMap();
    String params = JSON.marshal(map);
    operLog.setOperParam(StringUtils.substring(params, 0, 255));
}
 
Example 7
Source Project: ruoyiplus   Source File: AsyncFactory.java    License: MIT License 5 votes vote down vote up
/**
 * 操作日志记录
 * 
 * @param operLog 操作日志信息
 * @return 任务task
 */
public static TimerTask recordOper(final SysOperLog operLog)
{
    return new TimerTask()
    {
        @Override
        public void run()
        {
            // 远程查询操作地点
            operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp()));
            SpringUtils.getBean(ISysOperLogService.class).insertOperlog(operLog);
        }
    };
}
 
Example 8
Source Project: ruoyiplus   Source File: SysOperlogController.java    License: MIT License 5 votes vote down vote up
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("monitor:operlog:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysOperLog operLog)
{
    List<SysOperLog> list = operLogService.selectOperLogList(operLog);
    ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
    return util.exportExcel(list, "操作日志");
}
 
Example 9
Source Project: RuoYi   Source File: LogAspect.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 获取注解中对方法的描述信息 用于Controller层注解
 *
 * @param operLog 切点
 */
private void getControllerMethodDescription(Log log, SysOperLog operLog) throws Exception {
    // 设置action动作
    operLog.setBusinessType(log.businessType().ordinal());
    // 设置标题
    operLog.setTitle(log.title());
    // 设置操作人类别
    operLog.setOperatorType(log.operatorType().ordinal());
    // 是否需要保存request,参数和值
    if (log.isSaveRequestData()) {
        // 获取参数的信息,传入到数据库中。
        setRequestValue(operLog);
    }
}
 
Example 10
Source Project: RuoYi   Source File: AsyncFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 操作日志记录
 *
 * @param operLog 操作日志信息
 * @return 任务task
 */
public static TimerTask recordOper(final SysOperLog operLog) {
    return new TimerTask() {
        @Override
        public void run() {
            // 远程查询操作地点
            operLog.setOperLocation(AddressUtils.getRealAddressByIp(operLog.getOperIp()));
            SpringUtils.getBean(ISysOperLogService.class).insertOperlog(operLog);
        }
    };
}
 
Example 11
Source Project: RuoYi   Source File: SysOperlogController.java    License: Apache License 2.0 5 votes vote down vote up
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("monitor:operlog:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysOperLog operLog) {
    List<SysOperLog> list = operLogService.selectOperLogList(operLog);
    ExcelUtil<SysOperLog> util = new ExcelUtil<>(SysOperLog.class);
    return util.exportExcel(list, "操作日志");
}
 
Example 12
Source Project: supplierShop   Source File: LogAspect.java    License: 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 13
Source Project: supplierShop   Source File: SysOperLogServiceImpl.java    License: MIT License 4 votes vote down vote up
/**
 * 新增操作日志
 * 
 * @param operLog 操作日志对象
 */
@Override
public void insertOperlog(SysOperLog operLog)
{
    operLogMapper.insertOperlog(operLog);
}
 
Example 14
Source Project: ruoyiplus   Source File: LogAspect.java    License: 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 15
Source Project: ruoyiplus   Source File: SysOperLogServiceImpl.java    License: MIT License 4 votes vote down vote up
/**
 * 新增操作日志
 * 
 * @param operLog 操作日志对象
 */
@Override
public void insertOperlog(SysOperLog operLog)
{
    operLogMapper.insertOperlog(operLog);
}
 
Example 16
Source Project: RuoYi   Source File: LogAspect.java    License: 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());
    }
}
 
Example 17
Source Project: supplierShop   Source File: ISysOperLogService.java    License: MIT License 2 votes vote down vote up
/**
 * 新增操作日志
 * 
 * @param operLog 操作日志对象
 */
public void insertOperlog(SysOperLog operLog);
 
Example 18
Source Project: supplierShop   Source File: ISysOperLogService.java    License: MIT License 2 votes vote down vote up
/**
 * 查询系统操作日志集合
 * 
 * @param operLog 操作日志对象
 * @return 操作日志集合
 */
public List<SysOperLog> selectOperLogList(SysOperLog operLog);
 
Example 19
Source Project: supplierShop   Source File: ISysOperLogService.java    License: MIT License 2 votes vote down vote up
/**
 * 查询操作日志详细
 * 
 * @param operId 操作ID
 * @return 操作日志对象
 */
public SysOperLog selectOperLogById(Long operId);
 
Example 20
Source Project: supplierShop   Source File: SysOperLogServiceImpl.java    License: MIT License 2 votes vote down vote up
/**
 * 查询系统操作日志集合
 * 
 * @param operLog 操作日志对象
 * @return 操作日志集合
 */
@Override
public List<SysOperLog> selectOperLogList(SysOperLog operLog)
{
    return operLogMapper.selectOperLogList(operLog);
}
 
Example 21
Source Project: supplierShop   Source File: SysOperLogServiceImpl.java    License: MIT License 2 votes vote down vote up
/**
 * 查询操作日志详细
 * 
 * @param operId 操作ID
 * @return 操作日志对象
 */
@Override
public SysOperLog selectOperLogById(Long operId)
{
    return operLogMapper.selectOperLogById(operId);
}
 
Example 22
Source Project: supplierShop   Source File: SysOperLogMapper.java    License: MIT License 2 votes vote down vote up
/**
 * 新增操作日志
 * 
 * @param operLog 操作日志对象
 */
public void insertOperlog(SysOperLog operLog);
 
Example 23
Source Project: supplierShop   Source File: SysOperLogMapper.java    License: MIT License 2 votes vote down vote up
/**
 * 查询系统操作日志集合
 * 
 * @param operLog 操作日志对象
 * @return 操作日志集合
 */
public List<SysOperLog> selectOperLogList(SysOperLog operLog);
 
Example 24
Source Project: supplierShop   Source File: SysOperLogMapper.java    License: MIT License 2 votes vote down vote up
/**
 * 查询操作日志详细
 * 
 * @param operId 操作ID
 * @return 操作日志对象
 */
public SysOperLog selectOperLogById(Long operId);
 
Example 25
Source Project: ruoyiplus   Source File: ISysOperLogService.java    License: MIT License 2 votes vote down vote up
/**
 * 新增操作日志
 * 
 * @param operLog 操作日志对象
 */
public void insertOperlog(SysOperLog operLog);
 
Example 26
Source Project: ruoyiplus   Source File: ISysOperLogService.java    License: MIT License 2 votes vote down vote up
/**
 * 查询系统操作日志集合
 * 
 * @param operLog 操作日志对象
 * @return 操作日志集合
 */
public List<SysOperLog> selectOperLogList(SysOperLog operLog);
 
Example 27
Source Project: ruoyiplus   Source File: ISysOperLogService.java    License: MIT License 2 votes vote down vote up
/**
 * 查询操作日志详细
 * 
 * @param operId 操作ID
 * @return 操作日志对象
 */
public SysOperLog selectOperLogById(Long operId);
 
Example 28
Source Project: ruoyiplus   Source File: SysOperLogServiceImpl.java    License: MIT License 2 votes vote down vote up
/**
 * 查询系统操作日志集合
 * 
 * @param operLog 操作日志对象
 * @return 操作日志集合
 */
@Override
public List<SysOperLog> selectOperLogList(SysOperLog operLog)
{
    return operLogMapper.selectOperLogList(operLog);
}
 
Example 29
Source Project: ruoyiplus   Source File: SysOperLogServiceImpl.java    License: MIT License 2 votes vote down vote up
/**
 * 查询操作日志详细
 * 
 * @param operId 操作ID
 * @return 操作日志对象
 */
@Override
public SysOperLog selectOperLogById(Long operId)
{
    return operLogMapper.selectOperLogById(operId);
}
 
Example 30
Source Project: ruoyiplus   Source File: SysOperLogMapper.java    License: MIT License 2 votes vote down vote up
/**
 * 新增操作日志
 * 
 * @param operLog 操作日志对象
 */
public void insertOperlog(SysOperLog operLog);