Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
9b785369
提交
9b785369
authored
7月 26, 2022
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update: springboot 2.6.8 ==> 2.6.9
update: hutool 5.6.1 ==> 5.7.22
上级
1b84f3f1
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
22 行增加
和
26 行删除
+22
-26
pom.xml
yudao-dependencies/pom.xml
+2
-2
JsonUtils.java
...n/iocoder/yudao/framework/common/util/json/JsonUtils.java
+5
-6
BizTraceAspect.java
...coder/yudao/framework/tracer/core/aop/BizTraceAspect.java
+1
-1
RandomUtils.java
...n/iocoder/yudao/framework/test/core/util/RandomUtils.java
+2
-2
YudaoSwaggerAutoConfiguration.java
...amework/swagger/config/YudaoSwaggerAutoConfiguration.java
+12
-15
没有找到文件。
yudao-dependencies/pom.xml
浏览文件 @
9b785369
...
...
@@ -16,7 +16,7 @@
<properties>
<revision>
1.6.2-snapshot
</revision>
<!-- 统一依赖管理 -->
<spring.boot.version>
2.6.
8
</spring.boot.version>
<spring.boot.version>
2.6.
9
</spring.boot.version>
<spring.cloud.version>
2021.0.1
</spring.cloud.version>
<spring.cloud.alibaba.version>
2021.0.1.0
</spring.cloud.alibaba.version>
<!-- Web 相关 -->
...
...
@@ -53,7 +53,7 @@
<jasypt-spring-boot-starter.version>
3.0.4
</jasypt-spring-boot-starter.version>
<lombok.version>
1.18.20
</lombok.version>
<mapstruct.version>
1.4.1.Final
</mapstruct.version>
<hutool.version>
5.
6.1
</hutool.version>
<hutool.version>
5.
7.22
</hutool.version>
<easyexcel.verion>
2.2.7
</easyexcel.verion>
<velocity.version>
2.2
</velocity.version>
<screw.version>
1.0.5
</screw.version>
...
...
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/JsonUtils.java
浏览文件 @
9b785369
...
...
@@ -41,11 +41,6 @@ public class JsonUtils {
JsonUtils
.
objectMapper
=
objectMapper
;
}
@SneakyThrows
public
static
String
toJsonPrettyString
(
Object
object
)
{
return
objectMapper
.
writerWithDefaultPrettyPrinter
().
writeValueAsString
(
object
);
}
@SneakyThrows
public
static
String
toJsonString
(
Object
object
)
{
return
objectMapper
.
writeValueAsString
(
object
);
...
...
@@ -56,6 +51,10 @@ public class JsonUtils {
return
objectMapper
.
writeValueAsBytes
(
object
);
}
@SneakyThrows
public
static
String
toJsonPrettyString
(
Object
object
)
{
return
objectMapper
.
writerWithDefaultPrettyPrinter
().
writeValueAsString
(
object
);
}
public
static
<
T
>
T
parseObject
(
String
text
,
Class
<
T
>
clazz
)
{
if
(
StrUtil
.
isEmpty
(
text
))
{
...
...
@@ -137,7 +136,7 @@ public class JsonUtils {
}
public
static
boolean
isJson
(
String
text
)
{
return
JSONUtil
.
is
Json
(
text
);
return
JSONUtil
.
is
TypeJSON
(
text
);
}
}
yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/core/aop/BizTraceAspect.java
浏览文件 @
9b785369
...
...
@@ -38,7 +38,7 @@ public class BizTraceAspect {
String
operationName
=
getOperationName
(
joinPoint
,
trace
);
Span
span
=
tracer
.
buildSpan
(
operationName
)
.
withTag
(
Tags
.
COMPONENT
.
getKey
(),
"biz"
)
.
start
Manual
();
.
start
();
try
{
// 执行原有方法
return
joinPoint
.
proceed
();
...
...
yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java
浏览文件 @
9b785369
...
...
@@ -40,7 +40,7 @@ public class RandomUtils {
// Integer
PODAM_FACTORY
.
getStrategy
().
addOrReplaceTypeManufacturer
(
Integer
.
class
,
(
dataProviderStrategy
,
attributeMetadata
,
map
)
->
{
// 如果是 status 的字段,返回 0 或 1
if
(
attributeMetadata
.
getAttributeName
().
equals
(
"status"
))
{
if
(
"status"
.
equals
(
attributeMetadata
.
getAttributeName
()
))
{
return
RandomUtil
.
randomEle
(
CommonStatusEnum
.
values
()).
getStatus
();
}
// 如果是 type、status 结尾的字段,返回 tinyint 范围
...
...
@@ -53,7 +53,7 @@ public class RandomUtils {
// Boolean
PODAM_FACTORY
.
getStrategy
().
addOrReplaceTypeManufacturer
(
Boolean
.
class
,
(
dataProviderStrategy
,
attributeMetadata
,
map
)
->
{
// 如果是 deleted 的字段,返回非删除
if
(
attributeMetadata
.
getAttributeName
().
equals
(
"deleted"
))
{
if
(
"deleted"
.
equals
(
attributeMetadata
.
getAttributeName
()
))
{
return
false
;
}
return
RandomUtil
.
randomBoolean
();
...
...
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
浏览文件 @
9b785369
...
...
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.framework.swagger.config;
import
cn.iocoder.yudao.framework.swagger.core.SpringFoxHandlerProviderBeanPostProcessor
;
import
com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
...
...
@@ -22,6 +21,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
import
java.util.Collections
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
web
.
core
.
util
.
WebFrameworkUtils
.
HEADER_TENANT_ID
;
import
static
springfox
.
documentation
.
builders
.
RequestHandlerSelectors
.
basePackage
;
/**
...
...
@@ -44,27 +44,22 @@ public class YudaoSwaggerAutoConfiguration {
}
@Bean
@ConditionalOnMissingBean
public
SwaggerProperties
swaggerProperties
()
{
return
new
SwaggerProperties
();
}
@Bean
public
Docket
createRestApi
()
{
SwaggerProperties
properties
=
swaggerProperties
();
public
Docket
createRestApi
(
SwaggerProperties
properties
)
{
// 创建 Docket 对象
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
// 用来创建该 API 的基本信息,展示在文档的页面中(自定义展示的信息)
//
①
用来创建该 API 的基本信息,展示在文档的页面中(自定义展示的信息)
.
apiInfo
(
apiInfo
(
properties
))
// 设置扫描指定 package 包下的
//
②
设置扫描指定 package 包下的
.
select
()
.
apis
(
basePackage
(
properties
.
getBasePackage
()))
// .apis(basePackage("cn.iocoder.yudao.module.system")) // 可用于 swagger 无法展示时使用
.
paths
(
PathSelectors
.
any
())
.
build
()
// ③ 安全上下文(认证)
.
securitySchemes
(
securitySchemes
())
.
globalRequestParameters
(
globalRequestParameters
())
.
securityContexts
(
securityContexts
());
.
securityContexts
(
securityContexts
())
// ④ 全局参数(多租户 header)
.
globalRequestParameters
(
globalRequestParameters
());
}
// ========== apiInfo ==========
...
...
@@ -99,7 +94,8 @@ public class YudaoSwaggerAutoConfiguration {
private
static
List
<
SecurityContext
>
securityContexts
()
{
return
Collections
.
singletonList
(
SecurityContext
.
builder
()
.
securityReferences
(
securityReferences
())
.
forPaths
(
PathSelectors
.
regex
(
"^(?!auth).*$"
))
// 通过 PathSelectors.regex("^(?!auth).*$"),排除包含 "auth" 的接口不需要使用securitySchemes
.
operationSelector
(
o
->
o
.
requestMappingPattern
().
matches
(
"^(?!auth).*$"
))
.
build
());
}
...
...
@@ -114,7 +110,8 @@ public class YudaoSwaggerAutoConfiguration {
// ========== globalRequestParameters ==========
private
static
List
<
RequestParameter
>
globalRequestParameters
()
{
RequestParameterBuilder
tenantParameter
=
new
RequestParameterBuilder
().
name
(
"tenant-id"
).
description
(
"租户编号"
)
RequestParameterBuilder
tenantParameter
=
new
RequestParameterBuilder
()
.
name
(
HEADER_TENANT_ID
).
description
(
"租户编号"
)
.
in
(
ParameterType
.
HEADER
).
example
(
new
ExampleBuilder
().
value
(
1L
).
build
());
return
Collections
.
singletonList
(
tenantParameter
.
build
());
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论