1.增加操作日志操作地点、登录日志的登录地点、在线用户登录地点。
This commit is contained in:
@ -37,6 +37,7 @@ public class IpUtils
|
||||
{
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
return ip;
|
||||
|
||||
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public class SystemLogUtils
|
||||
{
|
||||
StringBuilder s = new StringBuilder();
|
||||
s.append(LogUtils.getBlock(ShiroUtils.getIp()));
|
||||
s.append(AddressUtils.getRealAddressByIP(ShiroUtils.getIp()));
|
||||
s.append(LogUtils.getBlock(username));
|
||||
s.append(LogUtils.getBlock(status));
|
||||
s.append(LogUtils.getBlock(msg));
|
||||
@ -61,6 +62,7 @@ public class SystemLogUtils
|
||||
logininfor.setLoginName(username);
|
||||
logininfor.setStatus(status);
|
||||
logininfor.setIpaddr(ShiroUtils.getIp());
|
||||
logininfor.setLoginLocation(AddressUtils.getRealAddressByIP(ShiroUtils.getIp()));
|
||||
logininfor.setBrowser(browser);
|
||||
logininfor.setOs(os);
|
||||
logininfor.setMsg(message);
|
||||
|
@ -3,6 +3,7 @@ package com.ruoyi.framework.aspectj;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.common.utils.AddressUtils;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.Signature;
|
||||
import org.aspectj.lang.annotation.AfterReturning;
|
||||
@ -72,7 +73,7 @@ public class LogAspect
|
||||
}
|
||||
|
||||
@Async
|
||||
private void handleLog(final JoinPoint joinPoint, final Exception e)
|
||||
protected void handleLog(final JoinPoint joinPoint, final Exception e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -92,6 +93,9 @@ public class LogAspect
|
||||
// 请求的地址
|
||||
String ip = ShiroUtils.getIp();
|
||||
operLog.setOperIp(ip);
|
||||
//操作地点
|
||||
operLog.setOperLocation(AddressUtils.getRealAddressByIP(ip));
|
||||
|
||||
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
|
||||
if (currentUser != null)
|
||||
{
|
||||
|
@ -1,8 +1,9 @@
|
||||
package com.ruoyi.project.monitor.logininfor.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 系统访问日志情况信息 sys_logininfor
|
||||
*
|
||||
@ -19,6 +20,8 @@ public class Logininfor extends BaseEntity
|
||||
private String status;
|
||||
/** 登录IP地址 */
|
||||
private String ipaddr;
|
||||
/**登录地点*/
|
||||
private String loginLocation;
|
||||
/** 浏览器类型 */
|
||||
private String browser;
|
||||
/** 操作系统 */
|
||||
@ -68,6 +71,14 @@ public class Logininfor extends BaseEntity
|
||||
this.ipaddr = ipaddr;
|
||||
}
|
||||
|
||||
public String getLoginLocation() {
|
||||
return loginLocation;
|
||||
}
|
||||
|
||||
public void setLoginLocation(String loginLocation) {
|
||||
this.loginLocation = loginLocation;
|
||||
}
|
||||
|
||||
public String getBrowser()
|
||||
{
|
||||
return browser;
|
||||
@ -112,7 +123,7 @@ public class Logininfor extends BaseEntity
|
||||
public String toString()
|
||||
{
|
||||
return "Logininfor [infoId=" + infoId + ", loginName=" + loginName + ", status=" + status + ", ipaddr=" + ipaddr
|
||||
+ ", browser=" + browser + ", os=" + os + ", msg=" + msg + ", loginTime=" + loginTime + "]";
|
||||
+ ",loginLocation="+loginLocation+", browser=" + browser + ", os=" + os + ", msg=" + msg + ", loginTime=" + loginTime + "]";
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
package com.ruoyi.project.monitor.online.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.ruoyi.common.utils.AddressUtils;
|
||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
||||
import com.ruoyi.project.monitor.online.domain.OnlineSession.OnlineStatus;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 当前在线会话 sys_user_online
|
||||
*
|
||||
@ -24,6 +26,9 @@ public class UserOnline extends BaseEntity
|
||||
/** 登录IP地址 */
|
||||
private String ipaddr;
|
||||
|
||||
/**登录地址*/
|
||||
private String longinLocation;
|
||||
|
||||
/** 浏览器类型 */
|
||||
private String browser;
|
||||
|
||||
@ -58,6 +63,7 @@ public class UserOnline extends BaseEntity
|
||||
online.setLastAccessTime(session.getLastAccessTime());
|
||||
online.setExpireTime(session.getTimeout());
|
||||
online.setIpaddr(session.getHost());
|
||||
online.setLonginLocation(AddressUtils.getRealAddressByIP(session.getHost()));
|
||||
online.setBrowser(session.getBrowser());
|
||||
online.setOs(session.getOs());
|
||||
online.setStatus(session.getStatus());
|
||||
@ -105,6 +111,14 @@ public class UserOnline extends BaseEntity
|
||||
this.ipaddr = ipaddr;
|
||||
}
|
||||
|
||||
public String getLonginLocation() {
|
||||
return longinLocation;
|
||||
}
|
||||
|
||||
public void setLonginLocation(String longinLocation) {
|
||||
this.longinLocation = longinLocation;
|
||||
}
|
||||
|
||||
public String getBrowser()
|
||||
{
|
||||
return browser;
|
||||
|
@ -1,8 +1,9 @@
|
||||
package com.ruoyi.project.monitor.operlog.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 操作日志记录 oper_log
|
||||
*
|
||||
@ -29,6 +30,8 @@ public class OperLog extends BaseEntity
|
||||
private String operUrl;
|
||||
/** 操作地址 */
|
||||
private String operIp;
|
||||
/** 操作地点*/
|
||||
private String operLocation;
|
||||
/** 请求参数 */
|
||||
private String operParam;
|
||||
/** 状态0正常 1异常 */
|
||||
@ -128,6 +131,14 @@ public class OperLog extends BaseEntity
|
||||
this.operIp = operIp;
|
||||
}
|
||||
|
||||
public String getOperLocation() {
|
||||
return operLocation;
|
||||
}
|
||||
|
||||
public void setOperLocation(String operLocation) {
|
||||
this.operLocation = operLocation;
|
||||
}
|
||||
|
||||
public String getOperParam()
|
||||
{
|
||||
return operParam;
|
||||
@ -173,7 +184,7 @@ public class OperLog extends BaseEntity
|
||||
{
|
||||
return "OperLog [operId=" + operId + ", title=" + title + ", action=" + action + ", method=" + method
|
||||
+ ", channel=" + channel + ", loginName=" + loginName + ", deptName=" + deptName + ", operUrl="
|
||||
+ operUrl + ", operIp=" + operIp + ", operParam=" + operParam + ", status=" + status + ", errorMsg="
|
||||
+ operUrl + ", operIp=" + operIp + ", operLocation=" + operLocation + ", operParam=" + operParam + ", status=" + status + ", errorMsg="
|
||||
+ errorMsg + ", operTime=" + operTime + "]";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user