From 50599487f894ed3bf0297a2906f172e91f3ffba2 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期五, 17 九月 2021 14:48:36 +0800 Subject: [PATCH] update [重大改动] 将 framework 与 system 模块 解耦 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java index ff518bd..f4c39f4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java @@ -1,14 +1,19 @@ package com.ruoyi.system.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ArrayUtil; -import com.ruoyi.common.utils.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.service.OperLogService; +import com.ruoyi.common.core.domain.dto.OperLogDTO; import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ip.AddressUtils; import com.ruoyi.system.domain.SysOperLog; import com.ruoyi.system.mapper.SysOperLogMapper; import com.ruoyi.system.service.ISysOperLogService; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import java.util.Arrays; @@ -22,7 +27,21 @@ * @author ruoyi */ @Service -public class SysOperLogServiceImpl extends ServicePlusImpl<SysOperLogMapper, SysOperLog, SysOperLog> implements ISysOperLogService { +public class SysOperLogServiceImpl extends ServicePlusImpl<SysOperLogMapper, SysOperLog, SysOperLog> implements ISysOperLogService, OperLogService { + + /** + * 鎿嶄綔鏃ュ織璁板綍 + * + * @param operLogDTO 鎿嶄綔鏃ュ織淇℃伅 + */ + @Async + @Override + public void recordOper(final OperLogDTO operLogDTO) { + SysOperLog operLog = BeanUtil.toBean(operLogDTO, SysOperLog.class); + // 杩滅▼鏌ヨ鎿嶄綔鍦扮偣 + operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp())); + insertOperlog(operLog); + } @Override public TableDataInfo<SysOperLog> selectPageOperLogList(SysOperLog operLog) { -- Gitblit v1.9.3