Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
41514100
提交
41514100
authored
7月 04, 2020
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
将 mall-spring-boot-starter-swagger 接入到 management-web-app 中
上级
301e2c57
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
21 行增加
和
4 行删除
+21
-4
package-info.java
...r/src/main/java/cn/iocoder/mall/swagger/package-info.java
+3
-0
AccessLogInterceptor.java
...coder/mall/web/core/interceptor/AccessLogInterceptor.java
+6
-4
pom.xml
management-web-app/pom.xml
+5
-0
application.yml
management-web-app/src/main/resources/application.yml
+7
-0
没有找到文件。
common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/package-info.java
浏览文件 @
41514100
/**
* 无情的占位类
*/
package
cn
.
iocoder
.
mall
.
swagger
;
common/mall-spring-boot-starter-web/src/main/java/cn/iocoder/mall/web/core/interceptor/AccessLogInterceptor.java
浏览文件 @
41514100
...
...
@@ -13,7 +13,6 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.util.Assert
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -60,9 +59,12 @@ public class AccessLogInterceptor extends HandlerInterceptorAdapter {
accessLog
.
setUserType
(
CommonWebUtil
.
getUserType
(
request
));
// 设置访问结果
CommonResult
result
=
CommonWebUtil
.
getCommonResult
(
request
);
Assert
.
isTrue
(
result
!=
null
,
"result 必须非空"
);
accessLog
.
setErrorCode
(
result
.
getCode
())
.
setErrorMessage
(
result
.
getMessage
());
if
(
result
!=
null
)
{
accessLog
.
setErrorCode
(
result
.
getCode
()).
setErrorMessage
(
result
.
getMessage
());
}
else
{
// 在访问非 onemall 系统提供的 API 时,会存在没有 CommonResult 的情况。例如说,Swagger 提供的接口
accessLog
.
setErrorCode
(
0
).
setErrorMessage
(
""
);
}
// 设置其它字段
accessLog
.
setTraceId
(
MallUtils
.
getTraceId
())
.
setApplicationName
(
applicationName
)
...
...
management-web-app/pom.xml
浏览文件 @
41514100
...
...
@@ -32,6 +32,11 @@
<artifactId>
mall-spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
mall-spring-boot-starter-swagger
</artifactId>
</dependency>
<!-- RPC 相关 -->
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
...
...
management-web-app/src/main/resources/application.yml
浏览文件 @
41514100
...
...
@@ -30,3 +30,10 @@ dubbo:
version
:
1.0.0
SystemLogRPC
:
version
:
1.0.0
# Swagger 配置项
swagger
:
title
:
管理后台
description
:
提供管理员管理的所有功能
version
:
1.0.0
base-package
:
cn.iocoder.mall.managementweb.controller
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论