Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
ee9ed356
Commit
ee9ed356
authored
Jun 06, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
a6eb7af8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
82 additions
and
75 deletions
+82
-75
application.yml
yifu-auth/src/main/resources/application.yml
+3
-1
YifuResourceServerConfigurerAdapter.java
...curity/component/YifuResourceServerConfigurerAdapter.java
+1
-1
pom.xml
yifu-upms/yifu-upms-biz/pom.xml
+7
-2
YifuAdminApplication.java
...m/yifu.cloud.plus.v1/yifu/admin/YifuAdminApplication.java
+0
-4
UserController.java
...u.cloud.plus.v1/yifu/admin/controller/UserController.java
+5
-4
Swagger2Config.java
.../yifu/cloud/plus/v1/yifu/admin/config/Swagger2Config.java
+0
-53
Swagger3Config.java
.../yifu/cloud/plus/v1/yifu/admin/config/Swagger3Config.java
+31
-0
application.yml
yifu-upms/yifu-upms-biz/src/main/resources/application.yml
+35
-10
No files found.
yifu-auth/src/main/resources/application.yml
View file @
ee9ed356
...
...
@@ -45,6 +45,7 @@ security:
urls
:
-
/v3/api-docs
-
/actuator/**
-
/swagger-ui/**
# Spring 相关
...
...
@@ -75,7 +76,8 @@ spring:
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
root
password
:
yf_zsk
url
:
jdbc:mysql://192.168.1.65:22306/yifu_upms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url
:
jdbc:mysql://127.0.0.1:3306/yifu_upms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
#url: jdbc:mysql://192.168.1.65:22306/yifu_upms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
freemarker
:
allow-request-override
:
false
allow-session-override
:
false
...
...
yifu-common/yifu-common-security/src/main/java/com/yifu.cloud.plus.v1/yifu/common/security/component/YifuResourceServerConfigurerAdapter.java
View file @
ee9ed356
...
...
@@ -65,7 +65,7 @@ public class YifuResourceServerConfigurerAdapter extends ResourceServerConfigure
permitAllUrl
.
getUrls
().
forEach
(
url
->
registry
.
antMatchers
(
url
).
permitAll
());
// “/user/getInfoByUsername" URL 访问放行
registry
.
and
()
.
authorizeRequests
().
antMatchers
(
"/user/getInfoByUsername"
).
permitAll
()
.
authorizeRequests
().
antMatchers
(
"/user/getInfoByUsername"
,
"/api/**"
,
"/api-docs/**"
).
permitAll
()
.
anyRequest
().
authenticated
().
and
().
csrf
().
disable
();
}
...
...
yifu-upms/yifu-upms-biz/pom.xml
View file @
ee9ed356
...
...
@@ -56,10 +56,15 @@
<artifactId>
yifu-common-log
</artifactId>
</dependency>
<!--接口文档 http://127.0.0.1:4000/swagger-ui/index.html-->
<dependency>
<
!--<
dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>-->
<dependency>
<groupId>
org.springdoc
</groupId>
<artifactId>
springdoc-openapi-ui
</artifactId>
<version>
1.6.8
</version>
</dependency>
<!--<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
...
...
@@ -99,7 +104,7 @@
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-test
</artifactId>
</dependency>
</dependencies>
</dependencies>
<build>
<plugins>
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/YifuAdminApplication.java
View file @
ee9ed356
...
...
@@ -18,18 +18,14 @@ package com.yifu.cloud.plus.v1.yifu.admin;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.EnableYifuResourceServer
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
springfox.documentation.oas.annotations.EnableOpenApi
;
/**
* @author lengleng
* @date 2018年06月21日 用户统一管理系统
*/
//@EnableYifuDoc
@EnableYifuResourceServer
//@EnableYifuFeignClients
@EnableOpenApi
@SpringBootApplication
public
class
YifuAdminApplication
{
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/controller/UserController.java
View file @
ee9ed356
...
...
@@ -20,6 +20,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.pig4cloud.plugin.excel.annotation.RequestExcel
;
import
com.pig4cloud.plugin.excel.annotation.ResponseExcel
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserDTO
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserInfo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser
;
...
...
@@ -33,9 +35,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
com.pig4cloud.plugin.excel.annotation.RequestExcel
;
import
com.pig4cloud.plugin.excel.annotation.ResponseExcel
;
import
io.swagger.annotations.Api
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.security.SecurityRequirement
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -52,7 +52,7 @@ import java.util.Set;
* @author lengleng
* @date 2019/2/1
*/
@
Api
(
tags
=
"用户管理模块
"
)
@
Tag
(
name
=
"用户管理模块"
,
description
=
"用户管理
"
)
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/user"
)
...
...
@@ -66,6 +66,7 @@ public class UserController {
* 获取当前用户全部信息
* @return 用户信息
*/
@Operation
(
summary
=
"获取当前用户全部信息"
,
description
=
"获取当前用户全部信息"
)
@GetMapping
(
value
=
{
"/info"
})
public
R
<
UserInfoVO
>
info
()
{
String
username
=
SecurityUtils
.
getUser
().
getUsername
();
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/config/Swagger2Config.java
deleted
100644 → 0
View file @
a6eb7af8
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
admin
.
config
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping
;
import
springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider
;
import
springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider
;
import
java.lang.reflect.Field
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author fxj * @date 2022年05月31日 17:29 @description
*/
@Configuration
public
class
Swagger2Config
{
@Bean
public
static
BeanPostProcessor
springfoxHandlerProviderBeanPostProcessor
()
{
return
new
BeanPostProcessor
()
{
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
if
(
bean
instanceof
WebMvcRequestHandlerProvider
||
bean
instanceof
WebFluxRequestHandlerProvider
)
{
customizeSpringfoxHandlerMappings
(
getHandlerMappings
(
bean
));
}
return
bean
;
}
private
<
T
extends
RequestMappingInfoHandlerMapping
>
void
customizeSpringfoxHandlerMappings
(
List
<
T
>
mappings
)
{
List
<
T
>
copy
=
mappings
.
stream
()
.
filter
(
mapping
->
mapping
.
getPatternParser
()
==
null
)
.
collect
(
Collectors
.
toList
());
mappings
.
clear
();
mappings
.
addAll
(
copy
);
}
@SuppressWarnings
(
"unchecked"
)
private
List
<
RequestMappingInfoHandlerMapping
>
getHandlerMappings
(
Object
bean
)
{
try
{
Field
field
=
ReflectionUtils
.
findField
(
bean
.
getClass
(),
"handlerMappings"
);
field
.
setAccessible
(
true
);
return
(
List
<
RequestMappingInfoHandlerMapping
>)
field
.
get
(
bean
);
}
catch
(
IllegalArgumentException
|
IllegalAccessException
e
)
{
throw
new
IllegalStateException
(
e
);
}
}
};
}
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/config/Swagger3Config.java
0 → 100644
View file @
ee9ed356
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
admin
.
config
;
import
io.swagger.v3.oas.annotations.ExternalDocumentation
;
import
io.swagger.v3.oas.annotations.OpenAPIDefinition
;
import
io.swagger.v3.oas.annotations.enums.SecuritySchemeIn
;
import
io.swagger.v3.oas.annotations.enums.SecuritySchemeType
;
import
io.swagger.v3.oas.annotations.info.Contact
;
import
io.swagger.v3.oas.annotations.info.Info
;
import
io.swagger.v3.oas.annotations.security.SecurityRequirement
;
import
io.swagger.v3.oas.annotations.security.SecurityScheme
;
/**
* @author fxj * @date 2022年05月31日 17:29 @description
*/
@OpenAPIDefinition
(
info
=
@Info
(
title
=
"Swagger3"
,
version
=
"1.0"
,
description
=
"Swagger3使用演示"
,
contact
=
@Contact
(
name
=
"fxj"
)
),
security
=
@SecurityRequirement
(
name
=
"JWT"
),
externalDocs
=
@ExternalDocumentation
(
description
=
"参考文档"
,
url
=
"https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations"
)
)
@SecurityScheme
(
type
=
SecuritySchemeType
.
HTTP
,
name
=
"JWT"
,
scheme
=
"bearer"
,
in
=
SecuritySchemeIn
.
HEADER
)
public
class
Swagger3Config
{
}
yifu-upms/yifu-upms-biz/src/main/resources/application.yml
View file @
ee9ed356
...
...
@@ -33,12 +33,14 @@ security:
resource
:
loadBalanced
:
true
token-info-uri
:
http://yifu-auth/oauth/check_token
# 通用放行URL,服务个性化,请在对应配置文件覆盖
ignore
:
urls
:
-
/v3/api-docs
-
/actuator/**
-
/swagger-ui/**
ignore
:
# 通用放行URL,服务个性化,请在对应配置文件覆盖
urls
:
-
/v3/api-docs
-
/actuator/**
-
/swagger-ui/**
-
/swagger-ui.html
# 文件上传相关 支持阿里云、华为云、腾讯、minio
oss
:
...
...
@@ -59,12 +61,34 @@ oss:
spring
:
application
:
name
:
@
artifactId@
#mvc:
# pathmatch:
# matching-strategy: ANT_PATH_MATCHER
springdoc
:
api-docs
:
#是否开启文档功能
enabled
:
true
#swagger后端请求地址
path
:
/api-docs
swagger-ui
:
#自定义swagger前端请求路径,输入http:127.0.0.1:8080/test会自动重定向到swagger页面
path
:
/api/upms
#包扫描路径
packages-to-scan
:
com.yifu.cloud.plus.v1.yifu.admin.controller
#这里定义了两个分组,可定义多个,也可以不定义
group-configs
:
#分组名
#- group: admin
#按路径匹配
# pathsToMatch: /admin/**
#分组名
-
group
:
upms
#按包路径匹配
packagesToScan
:
com.yifu.cloud.plus.v1.yifu.admin.controller
---
spring
:
mvc
:
pathmatch
:
matching-strategy
:
ant_path_matcher
config
:
activate
:
on-profile
:
test
...
...
@@ -76,7 +100,8 @@ spring:
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
root
password
:
yf_zsk
url
:
jdbc:mysql://192.168.1.65:22306/yifu_upms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url
:
jdbc:mysql://127.0.0.1:3306/yifu_upms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
#url: jdbc:mysql://192.168.1.65:22306/yifu_upms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
---
spring
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment