将 mall-spring-boot-starter-swagger 接入到 management-web-app 中
This commit is contained in:
parent
301e2c5720
commit
41514100e0
@ -1 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* 无情的占位类
|
||||||
|
*/
|
||||||
package cn.iocoder.mall.swagger;
|
package cn.iocoder.mall.swagger;
|
||||||
|
@ -13,7 +13,6 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.util.Assert;
|
|
||||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -60,9 +59,12 @@ public class AccessLogInterceptor extends HandlerInterceptorAdapter {
|
|||||||
accessLog.setUserType(CommonWebUtil.getUserType(request));
|
accessLog.setUserType(CommonWebUtil.getUserType(request));
|
||||||
// 设置访问结果
|
// 设置访问结果
|
||||||
CommonResult result = CommonWebUtil.getCommonResult(request);
|
CommonResult result = CommonWebUtil.getCommonResult(request);
|
||||||
Assert.isTrue(result != null, "result 必须非空");
|
if (result != null) {
|
||||||
accessLog.setErrorCode(result.getCode())
|
accessLog.setErrorCode(result.getCode()).setErrorMessage(result.getMessage());
|
||||||
.setErrorMessage(result.getMessage());
|
} else {
|
||||||
|
// 在访问非 onemall 系统提供的 API 时,会存在没有 CommonResult 的情况。例如说,Swagger 提供的接口
|
||||||
|
accessLog.setErrorCode(0).setErrorMessage("");
|
||||||
|
}
|
||||||
// 设置其它字段
|
// 设置其它字段
|
||||||
accessLog.setTraceId(MallUtils.getTraceId())
|
accessLog.setTraceId(MallUtils.getTraceId())
|
||||||
.setApplicationName(applicationName)
|
.setApplicationName(applicationName)
|
||||||
|
@ -32,6 +32,11 @@
|
|||||||
<artifactId>mall-spring-boot-starter-web</artifactId>
|
<artifactId>mall-spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
|
<artifactId>mall-spring-boot-starter-swagger</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- RPC 相关 -->
|
<!-- RPC 相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
@ -30,3 +30,10 @@ dubbo:
|
|||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
SystemLogRPC:
|
SystemLogRPC:
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
|
|
||||||
|
# Swagger 配置项
|
||||||
|
swagger:
|
||||||
|
title: 管理后台
|
||||||
|
description: 提供管理员管理的所有功能
|
||||||
|
version: 1.0.0
|
||||||
|
base-package: cn.iocoder.mall.managementweb.controller
|
||||||
|
Loading…
Reference in New Issue
Block a user