com.ruoyi.system.domain.SysOperLog Java Examples

The following examples show how to use com.ruoyi.system.domain.SysOperLog. 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 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 File: LogAspect.java    From ruoyiplus with 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 File: SysOperlogController.java    From RuoYi with 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 #4
Source File: AsyncFactory.java    From RuoYi with 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 #5
Source File: LogAspect.java    From RuoYi with 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 #6
Source File: SysOperlogController.java    From ruoyiplus with 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 #7
Source File: AsyncFactory.java    From ruoyiplus with 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 File: LogAspect.java    From ruoyiplus with 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 #9
Source File: SysOperlogController.java    From supplierShop with 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 #10
Source File: AsyncFactory.java    From supplierShop with 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 #11
Source File: LogAspect.java    From supplierShop with 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 #12
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 #13
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());
    }
}
 
Example #14
Source File: SysOperLogServiceImpl.java    From ruoyiplus with MIT License 4 votes vote down vote up
/**
 * 新增操作日志
 * 
 * @param operLog 操作日志对象
 */
@Override
public void insertOperlog(SysOperLog operLog)
{
    operLogMapper.insertOperlog(operLog);
}
 
Example #15
Source File: SysOperLogServiceImpl.java    From supplierShop with MIT License 4 votes vote down vote up
/**
 * 新增操作日志
 * 
 * @param operLog 操作日志对象
 */
@Override
public void insertOperlog(SysOperLog operLog)
{
    operLogMapper.insertOperlog(operLog);
}
 
Example #16
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 #17
Source File: SysOperLogServiceImpl.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 查询操作日志详细
 *
 * @param operId 操作ID
 * @return 操作日志对象
 */
@Override
public SysOperLog selectOperLogById(Long operId) {
    return operLogMapper.selectOperLogById(operId);
}
 
Example #18
Source File: SysOperLogServiceImpl.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 查询系统操作日志集合
 *
 * @param operLog 操作日志对象
 * @return 操作日志集合
 */
@Override
public List<SysOperLog> selectOperLogList(SysOperLog operLog) {
    return operLogMapper.selectOperLogList(operLog);
}
 
Example #19
Source File: SysOperLogServiceImpl.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 新增操作日志
 *
 * @param operLog 操作日志对象
 */
@Override
public void insertOperlog(SysOperLog operLog) {
    operLogMapper.insertOperlog(operLog);
}
 
Example #20
Source File: ISysOperLogService.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 查询操作日志详细
 *
 * @param operId 操作ID
 * @return 操作日志对象
 */
SysOperLog selectOperLogById(Long operId);
 
Example #21
Source File: ISysOperLogService.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 查询系统操作日志集合
 *
 * @param operLog 操作日志对象
 * @return 操作日志集合
 */
List<SysOperLog> selectOperLogList(SysOperLog operLog);
 
Example #22
Source File: SysOperLogMapper.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 新增操作日志
 *
 * @param operLog 操作日志对象
 */
void insertOperlog(SysOperLog operLog);
 
Example #23
Source File: ISysOperLogService.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 新增操作日志
 *
 * @param operLog 操作日志对象
 */
void insertOperlog(SysOperLog operLog);
 
Example #24
Source File: SysOperLogMapper.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 查询系统操作日志集合
 *
 * @param operLog 操作日志对象
 * @return 操作日志集合
 */
List<SysOperLog> selectOperLogList(SysOperLog operLog);
 
Example #25
Source File: LogAspect.java    From RuoYi with Apache License 2.0 2 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(params);
}
 
Example #26
Source File: SysOperLogMapper.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 查询操作日志详细
 *
 * @param operId 操作ID
 * @return 操作日志对象
 */
SysOperLog selectOperLogById(Long operId);
 
Example #27
Source File: SysOperLogMapper.java    From ruoyiplus with MIT License 2 votes vote down vote up
/**
 * 查询系统操作日志集合
 * 
 * @param operLog 操作日志对象
 * @return 操作日志集合
 */
public List<SysOperLog> selectOperLogList(SysOperLog operLog);
 
Example #28
Source File: ISysOperLogService.java    From supplierShop with MIT License 2 votes vote down vote up
/**
 * 新增操作日志
 * 
 * @param operLog 操作日志对象
 */
public void insertOperlog(SysOperLog operLog);
 
Example #29
Source File: SysOperLogMapper.java    From ruoyiplus with MIT License 2 votes vote down vote up
/**
 * 查询操作日志详细
 * 
 * @param operId 操作ID
 * @return 操作日志对象
 */
public SysOperLog selectOperLogById(Long operId);
 
Example #30
Source File: SysOperLogServiceImpl.java    From supplierShop with MIT License 2 votes vote down vote up
/**
 * 查询操作日志详细
 * 
 * @param operId 操作ID
 * @return 操作日志对象
 */
@Override
public SysOperLog selectOperLogById(Long operId)
{
    return operLogMapper.selectOperLogById(operId);
}