This commit is contained in:
77
2024-04-10 00:01:15 +08:00
parent fd62adf71e
commit 2f3f1ca46b
2 changed files with 7 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package com.ruoyi.common.utils;
import cn.hutool.core.convert.Convert;
import cn.hutool.extra.servlet.ServletUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpStatus;
import com.ruoyi.common.constant.Constants;
import lombok.AccessLevel;
@@ -35,6 +36,7 @@ import java.util.UUID;
public class ServletUtils extends ServletUtil {
private final static String HEAD_UUID = "uuid";
private final static String USER_AGENT = "User-Agent";
/**
* 获取String参数
@@ -208,4 +210,7 @@ public class ServletUtils extends ServletUtil {
}
}
public static String getUserAgent() {
return getRequest().getHeader(USER_AGENT);
}
}

View File

@@ -90,10 +90,12 @@ public class LogAspect {
operLog.setOperName(loginUser.getUsername());
operLog.setUserType(loginUser.getUserType());
operLog.setDeptName(loginUser.getDeptName());
logString.append(String.format("currentUserId=%s;", loginUser.getUserId()));
}
}catch (Exception ex){
// not do
}
logString.append(String.format("user-agent=%s;", ServletUtils.getUserAgent()));
// 处理设置注解上的参数
getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult,logString);
if (e != null) {