Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cocktail-party-server
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cocktail-party
cocktail-party-server
Commits
1bb6342b
提交
1bb6342b
authored
11月 22, 2022
作者:
RuoYi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复Log注解GET请求记录不到参数问题
上级
27acbe5b
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
38 行增加
和
8 行删除
+38
-8
AjaxResult.java
...rc/main/java/com/ruoyi/common/core/domain/AjaxResult.java
+4
-4
ServletUtils.java
...on/src/main/java/com/ruoyi/common/utils/ServletUtils.java
+32
-0
LogAspect.java
.../src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
+2
-4
没有找到文件。
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java
浏览文件 @
1bb6342b
...
@@ -127,7 +127,7 @@ public class AjaxResult extends HashMap<String, Object>
...
@@ -127,7 +127,7 @@ public class AjaxResult extends HashMap<String, Object>
/**
/**
* 返回错误消息
* 返回错误消息
*
*
* @return
* @return
错误消息
*/
*/
public
static
AjaxResult
error
()
public
static
AjaxResult
error
()
{
{
...
@@ -138,7 +138,7 @@ public class AjaxResult extends HashMap<String, Object>
...
@@ -138,7 +138,7 @@ public class AjaxResult extends HashMap<String, Object>
* 返回错误消息
* 返回错误消息
*
*
* @param msg 返回内容
* @param msg 返回内容
* @return
警告
消息
* @return
错误
消息
*/
*/
public
static
AjaxResult
error
(
String
msg
)
public
static
AjaxResult
error
(
String
msg
)
{
{
...
@@ -150,7 +150,7 @@ public class AjaxResult extends HashMap<String, Object>
...
@@ -150,7 +150,7 @@ public class AjaxResult extends HashMap<String, Object>
*
*
* @param msg 返回内容
* @param msg 返回内容
* @param data 数据对象
* @param data 数据对象
* @return
警告
消息
* @return
错误
消息
*/
*/
public
static
AjaxResult
error
(
String
msg
,
Object
data
)
public
static
AjaxResult
error
(
String
msg
,
Object
data
)
{
{
...
@@ -162,7 +162,7 @@ public class AjaxResult extends HashMap<String, Object>
...
@@ -162,7 +162,7 @@ public class AjaxResult extends HashMap<String, Object>
*
*
* @param code 状态码
* @param code 状态码
* @param msg 返回内容
* @param msg 返回内容
* @return
警告
消息
* @return
错误
消息
*/
*/
public
static
AjaxResult
error
(
int
code
,
String
msg
)
public
static
AjaxResult
error
(
int
code
,
String
msg
)
{
{
...
...
ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java
浏览文件 @
1bb6342b
...
@@ -4,6 +4,10 @@ import java.io.IOException;
...
@@ -4,6 +4,10 @@ import java.io.IOException;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.net.URLDecoder
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.servlet.ServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
javax.servlet.http.HttpSession
;
...
@@ -68,6 +72,34 @@ public class ServletUtils
...
@@ -68,6 +72,34 @@ public class ServletUtils
return
Convert
.
toBool
(
getRequest
().
getParameter
(
name
),
defaultValue
);
return
Convert
.
toBool
(
getRequest
().
getParameter
(
name
),
defaultValue
);
}
}
/**
* 获得所有请求参数
*
* @param request 请求对象{@link ServletRequest}
* @return Map
*/
public
static
Map
<
String
,
String
[]>
getParams
(
ServletRequest
request
)
{
final
Map
<
String
,
String
[]>
map
=
request
.
getParameterMap
();
return
Collections
.
unmodifiableMap
(
map
);
}
/**
* 获得所有请求参数
*
* @param request 请求对象{@link ServletRequest}
* @return Map
*/
public
static
Map
<
String
,
String
>
getParamMap
(
ServletRequest
request
)
{
Map
<
String
,
String
>
params
=
new
HashMap
<>();
for
(
Map
.
Entry
<
String
,
String
[]>
entry
:
getParams
(
request
).
entrySet
())
{
params
.
put
(
entry
.
getKey
(),
StringUtils
.
join
(
entry
.
getValue
(),
","
));
}
return
params
;
}
/**
/**
* 获取request
* 获取request
*/
*/
...
...
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
浏览文件 @
1bb6342b
...
@@ -13,7 +13,6 @@ import org.slf4j.LoggerFactory;
...
@@ -13,7 +13,6 @@ import org.slf4j.LoggerFactory;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.servlet.HandlerMapping
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSON
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
...
@@ -103,7 +102,6 @@ public class LogAspect
...
@@ -103,7 +102,6 @@ public class LogAspect
catch
(
Exception
exp
)
catch
(
Exception
exp
)
{
{
// 记录本地异常日志
// 记录本地异常日志
log
.
error
(
"==前置通知异常=="
);
log
.
error
(
"异常信息:{}"
,
exp
.
getMessage
());
log
.
error
(
"异常信息:{}"
,
exp
.
getMessage
());
exp
.
printStackTrace
();
exp
.
printStackTrace
();
}
}
...
@@ -153,8 +151,8 @@ public class LogAspect
...
@@ -153,8 +151,8 @@ public class LogAspect
}
}
else
else
{
{
Map
<?,
?>
paramsMap
=
(
Map
<?,
?>)
ServletUtils
.
getRequest
().
getAttribute
(
HandlerMapping
.
URI_TEMPLATE_VARIABLES_ATTRIBUTE
);
Map
<?,
?>
paramsMap
=
ServletUtils
.
getParamMap
(
ServletUtils
.
getRequest
()
);
operLog
.
setOperParam
(
StringUtils
.
substring
(
paramsMap
.
toString
(
),
0
,
2000
));
operLog
.
setOperParam
(
StringUtils
.
substring
(
JSON
.
toJSONString
(
paramsMap
,
excludePropertyPreFilter
()
),
0
,
2000
));
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论