Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
datax-cloud
Overview
Overview
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
黄营
datax-cloud
Commits
0f23b6fd
Commit
0f23b6fd
authored
Aug 10, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
1b2259d5
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
739 additions
and
3 deletions
+739
-3
datax-gateway-dev.yml
datax-config/src/main/resources/config/datax-gateway-dev.yml
+49
-0
logback-spring.xml
...-masterdata-service/src/main/resources/logback-spring.xml
+1
-1
logback-spring.xml
...ata-quality-service/src/main/resources/logback-spring.xml
+1
-1
logback-spring.xml
...ta-standard-service/src/main/resources/logback-spring.xml
+1
-1
pom.xml
datax-modules/pom.xml
+2
-0
pom.xml
datax-modules/workflow-service-parent/pom.xml
+21
-0
pom.xml
...ules/workflow-service-parent/workflow-service-api/pom.xml
+36
-0
spring.factories
...-service-api/src/main/resources/META-INF/spring.factories
+1
-0
pom.xml
...-modules/workflow-service-parent/workflow-service/pom.xml
+94
-0
DataxWorkflowApplication.java
...a/cn/datax/service/workflow/DataxWorkflowApplication.java
+15
-0
DataResourceServerConfig.java
...tax/service/workflow/config/DataResourceServerConfig.java
+67
-0
ProcessEngineConfig.java
...cn/datax/service/workflow/config/ProcessEngineConfig.java
+57
-0
StartedUpRunner.java
...ava/cn/datax/service/workflow/config/StartedUpRunner.java
+41
-0
SwaggerConfig.java
.../java/cn/datax/service/workflow/config/SwaggerConfig.java
+117
-0
SwaggerProperties.java
...a/cn/datax/service/workflow/config/SwaggerProperties.java
+101
-0
bootstrap.yml
...-parent/workflow-service/src/main/resources/bootstrap.yml
+29
-0
logback-spring.xml
...nt/workflow-service/src/main/resources/logback-spring.xml
+79
-0
spy.properties
...parent/workflow-service/src/main/resources/spy.properties
+26
-0
pom.xml
pom.xml
+1
-0
No files found.
datax-config/src/main/resources/config/datax-gateway-dev.yml
View file @
0f23b6fd
...
@@ -120,6 +120,42 @@ spring:
...
@@ -120,6 +120,42 @@ spring:
args
:
args
:
name
:
dataVisualHystrix
name
:
dataVisualHystrix
fallbackUri
:
forward:/fallback
fallbackUri
:
forward:/fallback
# 主数据
-
id
:
datax-service-data-masterdata
uri
:
lb://datax-service-data-masterdata
predicates
:
-
Path=/data/masterdata/**
filters
:
-
SwaggerHeaderFilter
-
StripPrefix=2
-
name
:
Hystrix
args
:
name
:
dataMasterdataHystrix
fallbackUri
:
forward:/fallback
# 数据质量
-
id
:
datax-service-data-quality
uri
:
lb://datax-service-data-quality
predicates
:
-
Path=/data/quality/**
filters
:
-
SwaggerHeaderFilter
-
StripPrefix=2
-
name
:
Hystrix
args
:
name
:
dataQualityHystrix
fallbackUri
:
forward:/fallback
# 数据标准
-
id
:
datax-service-data-standard
uri
:
lb://datax-service-data-standard
predicates
:
-
Path=/data/standard/**
filters
:
-
SwaggerHeaderFilter
-
StripPrefix=2
-
name
:
Hystrix
args
:
name
:
dataStandardHystrix
fallbackUri
:
forward:/fallback
# 定时任务
# 定时任务
-
id
:
datax-service-quartz
-
id
:
datax-service-quartz
uri
:
lb://datax-service-quartz
uri
:
lb://datax-service-quartz
...
@@ -143,4 +179,16 @@ spring:
...
@@ -143,4 +179,16 @@ spring:
-
name
:
Hystrix
-
name
:
Hystrix
args
:
args
:
name
:
codegenHystrix
name
:
codegenHystrix
fallbackUri
:
forward:/fallback
# 工作流
-
id
:
datax-service-workflow
uri
:
lb://datax-service-workflow
predicates
:
-
Path=/workflow/**
filters
:
-
SwaggerHeaderFilter
-
StripPrefix=1
-
name
:
Hystrix
args
:
name
:
workflowHystrix
fallbackUri
:
forward:/fallback
fallbackUri
:
forward:/fallback
\ No newline at end of file
datax-modules/data-masterdata-service-parent/data-masterdata-service/src/main/resources/logback-spring.xml
View file @
0f23b6fd
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
debug=
"false"
>
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
debug=
"false"
>
<springProperty
scope=
"context"
name=
"springAppName"
source=
"spring.application.name"
/>
<springProperty
scope=
"context"
name=
"springAppName"
source=
"spring.application.name"
/>
<property
name=
"log.path"
value=
"logs/datax-service-data-
visual
"
/>
<property
name=
"log.path"
value=
"logs/datax-service-data-
masterdata
"
/>
<property
name=
"log.maxHistory"
value=
"15"
/>
<property
name=
"log.maxHistory"
value=
"15"
/>
<property
name=
"log.totalSizeCap"
value=
"500MB"
/>
<property
name=
"log.totalSizeCap"
value=
"500MB"
/>
<property
name=
"log.maxFileSize"
value=
"10MB"
/>
<property
name=
"log.maxFileSize"
value=
"10MB"
/>
...
...
datax-modules/data-quality-service-parent/data-quality-service/src/main/resources/logback-spring.xml
View file @
0f23b6fd
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
debug=
"false"
>
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
debug=
"false"
>
<springProperty
scope=
"context"
name=
"springAppName"
source=
"spring.application.name"
/>
<springProperty
scope=
"context"
name=
"springAppName"
source=
"spring.application.name"
/>
<property
name=
"log.path"
value=
"logs/datax-service-data-
visual
"
/>
<property
name=
"log.path"
value=
"logs/datax-service-data-
quality
"
/>
<property
name=
"log.maxHistory"
value=
"15"
/>
<property
name=
"log.maxHistory"
value=
"15"
/>
<property
name=
"log.totalSizeCap"
value=
"500MB"
/>
<property
name=
"log.totalSizeCap"
value=
"500MB"
/>
<property
name=
"log.maxFileSize"
value=
"10MB"
/>
<property
name=
"log.maxFileSize"
value=
"10MB"
/>
...
...
datax-modules/data-standard-service-parent/data-standard-service/src/main/resources/logback-spring.xml
View file @
0f23b6fd
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
debug=
"false"
>
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
debug=
"false"
>
<springProperty
scope=
"context"
name=
"springAppName"
source=
"spring.application.name"
/>
<springProperty
scope=
"context"
name=
"springAppName"
source=
"spring.application.name"
/>
<property
name=
"log.path"
value=
"logs/datax-service-data-
visual
"
/>
<property
name=
"log.path"
value=
"logs/datax-service-data-
standard
"
/>
<property
name=
"log.maxHistory"
value=
"15"
/>
<property
name=
"log.maxHistory"
value=
"15"
/>
<property
name=
"log.totalSizeCap"
value=
"500MB"
/>
<property
name=
"log.totalSizeCap"
value=
"500MB"
/>
<property
name=
"log.maxFileSize"
value=
"10MB"
/>
<property
name=
"log.maxFileSize"
value=
"10MB"
/>
...
...
datax-modules/pom.xml
View file @
0f23b6fd
...
@@ -24,5 +24,6 @@
...
@@ -24,5 +24,6 @@
<module>
data-standard-service-parent
</module>
<module>
data-standard-service-parent
</module>
<module>
data-masterdata-service-parent
</module>
<module>
data-masterdata-service-parent
</module>
<module>
data-quality-service-parent
</module>
<module>
data-quality-service-parent
</module>
<module>
workflow-service-parent
</module>
</modules>
</modules>
</project>
</project>
\ No newline at end of file
datax-modules/workflow-service-parent/pom.xml
0 → 100644
View file @
0f23b6fd
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
datax-modules
</artifactId>
<groupId>
cn.datax
</groupId>
<version>
2.0.0
</version>
</parent>
<packaging>
pom
</packaging>
<modelVersion>
4.0.0
</modelVersion>
<version>
2.0.0
</version>
<description>
工作流
</description>
<artifactId>
workflow-service-parent
</artifactId>
<modules>
<module>
workflow-service-api
</module>
<module>
workflow-service
</module>
</modules>
</project>
\ No newline at end of file
datax-modules/workflow-service-parent/workflow-service-api/pom.xml
0 → 100644
View file @
0f23b6fd
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
workflow-service-parent
</artifactId>
<groupId>
cn.datax
</groupId>
<version>
2.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<version>
2.0.0
</version>
<artifactId>
workflow-service-api
</artifactId>
<dependencies>
<dependency>
<groupId>
com.github.xiaoymin
</groupId>
<artifactId>
knife4j-micro-spring-boot-starter
</artifactId>
<version>
${knife4j.version}
</version>
</dependency>
<!--feign 依赖-->
<dependency>
<groupId>
io.github.openfeign
</groupId>
<artifactId>
feign-okhttp
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
</dependency>
<dependency>
<groupId>
cn.datax
</groupId>
<artifactId>
datax-common-core
</artifactId>
<version>
2.0.0
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
datax-modules/workflow-service-parent/workflow-service-api/src/main/resources/META-INF/spring.factories
0 → 100644
View file @
0f23b6fd
org.springframework.boot.autoconfigure.EnableAutoConfiguration=
datax-modules/workflow-service-parent/workflow-service/pom.xml
0 → 100644
View file @
0f23b6fd
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
workflow-service-parent
</artifactId>
<groupId>
cn.datax
</groupId>
<version>
2.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<version>
2.0.0
</version>
<artifactId>
workflow-service
</artifactId>
<dependencies>
<!--web 模块-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<exclusions>
<exclusion>
<artifactId>
spring-boot-starter-tomcat
</artifactId>
<groupId>
org.springframework.boot
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-undertow
</artifactId>
</dependency>
<!--配置中心客户端 -->
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-config
</artifactId>
</dependency>
<dependency>
<groupId>
org.mapstruct
</groupId>
<artifactId>
mapstruct
</artifactId>
<version>
${mapstruct.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.mapstruct
</groupId>
<artifactId>
mapstruct-processor
</artifactId>
<version>
${mapstruct.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
cn.datax
</groupId>
<artifactId>
datax-common-mybatis
</artifactId>
<version>
2.0.0
</version>
<exclusions>
<exclusion>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
cn.datax
</groupId>
<artifactId>
datax-common-redis
</artifactId>
<version>
2.0.0
</version>
</dependency>
<dependency>
<groupId>
cn.datax
</groupId>
<artifactId>
datax-common-security
</artifactId>
<version>
2.0.0
</version>
</dependency>
<dependency>
<groupId>
cn.datax
</groupId>
<artifactId>
datax-common-log
</artifactId>
<version>
2.0.0
</version>
</dependency>
<dependency>
<groupId>
cn.datax
</groupId>
<artifactId>
workflow-service-api
</artifactId>
<version>
2.0.0
</version>
</dependency>
<dependency>
<groupId>
org.flowable
</groupId>
<artifactId>
flowable-spring-boot-starter-process
</artifactId>
<version>
${flowable.version}
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/DataxWorkflowApplication.java
0 → 100644
View file @
0f23b6fd
package
cn
.
datax
.
service
.
workflow
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.cloud.client.SpringCloudApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
@EnableFeignClients
(
basePackages
=
{
"cn.datax.service.system.api.feign"
})
@SpringCloudApplication
public
class
DataxWorkflowApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
DataxWorkflowApplication
.
class
);
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/config/DataResourceServerConfig.java
0 → 100644
View file @
0f23b6fd
package
cn
.
datax
.
service
.
workflow
.
config
;
import
cn.datax.common.security.handler.DataAccessDeniedHandler
;
import
cn.datax.common.security.handler.DataAuthExceptionEntryPoint
;
import
cn.datax.common.security.utils.DataRedisTokenServices
;
import
cn.datax.common.security.utils.RedisTokenStore
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer
;
import
org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter
;
import
org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer
;
import
org.springframework.security.oauth2.provider.token.TokenStore
;
@Configuration
@EnableResourceServer
@EnableGlobalMethodSecurity
(
prePostEnabled
=
true
)
public
class
DataResourceServerConfig
extends
ResourceServerConfigurerAdapter
{
@Autowired
private
DataAccessDeniedHandler
accessDeniedHandler
;
@Autowired
private
DataAuthExceptionEntryPoint
exceptionEntryPoint
;
@Autowired
private
RedisConnectionFactory
redisConnectionFactory
;
@Bean
public
TokenStore
redisTokenStore
()
{
return
new
RedisTokenStore
(
redisConnectionFactory
);
}
@Override
public
void
configure
(
ResourceServerSecurityConfigurer
resources
)
{
DataRedisTokenServices
dataTokenServices
=
new
DataRedisTokenServices
();
dataTokenServices
.
setTokenStore
(
redisTokenStore
());
resources
.
tokenStore
(
redisTokenStore
())
.
tokenServices
(
dataTokenServices
)
.
authenticationEntryPoint
(
exceptionEntryPoint
)
.
accessDeniedHandler
(
accessDeniedHandler
);
}
@Override
public
void
configure
(
HttpSecurity
http
)
throws
Exception
{
//允许使用iframe 嵌套,避免swagger-ui 不被加载的问题
http
.
headers
().
frameOptions
().
disable
();
http
.
authorizeRequests
()
.
antMatchers
(
"/actuator/**"
,
"/v2/api-docs/**"
,
"/swagger-ui.html"
,
"/doc.html"
,
"/swagger-resources/**"
,
"/webjars/**"
,
// feign 内部调用不用授权
"/inner/**"
).
permitAll
()
.
anyRequest
().
authenticated
()
.
and
().
csrf
().
disable
();
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/config/ProcessEngineConfig.java
0 → 100644
View file @
0f23b6fd
package
cn
.
datax
.
service
.
workflow
.
config
;
import
com.zaxxer.hikari.HikariDataSource
;
import
org.flowable.engine.ProcessEngineConfiguration
;
import
org.flowable.spring.SpringProcessEngineConfiguration
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
@Configuration
public
class
ProcessEngineConfig
{
@Bean
@Primary
@ConfigurationProperties
(
"spring.datasource.primary"
)
public
DataSourceProperties
primaryDataSourceProperties
()
{
return
new
DataSourceProperties
();
}
@Bean
@Primary
@ConfigurationProperties
(
"spring.datasource.primary.configuration"
)
public
HikariDataSource
firstDataSource
()
{
return
primaryDataSourceProperties
().
initializeDataSourceBuilder
()
.
type
(
HikariDataSource
.
class
).
build
();
}
@Bean
@ConfigurationProperties
(
"spring.datasource.flowable"
)
public
DataSourceProperties
flowableDataSourceProperties
()
{
return
new
DataSourceProperties
();
}
@Bean
@ConfigurationProperties
(
"spring.datasource.flowable.configuration"
)
public
HikariDataSource
flowableDataSource
()
{
return
flowableDataSourceProperties
().
initializeDataSourceBuilder
()
.
type
(
HikariDataSource
.
class
).
build
();
}
/**
* ProcessEngine 配置,注入DataSourceTransactionManager和DataSource
* @return
*/
@Bean
public
SpringProcessEngineConfiguration
springProcessEngineConfiguration
()
{
SpringProcessEngineConfiguration
springProcessEngineConfiguration
=
new
SpringProcessEngineConfiguration
();
springProcessEngineConfiguration
.
setDataSource
(
flowableDataSource
());
springProcessEngineConfiguration
.
setTransactionManager
(
new
DataSourceTransactionManager
(
flowableDataSource
()));
// 不添加此项配置,在没创建表时,会抛出FlowableWrongDbException异常
springProcessEngineConfiguration
.
setDatabaseSchemaUpdate
(
ProcessEngineConfiguration
.
DB_SCHEMA_UPDATE_TRUE
);
return
springProcessEngineConfiguration
;
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/config/StartedUpRunner.java
0 → 100644
View file @
0f23b6fd
package
cn
.
datax
.
service
.
workflow
.
config
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.core.env.Environment
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.List
;
import
java.util.Map
;
@Component
@RequiredArgsConstructor
public
class
StartedUpRunner
implements
ApplicationRunner
{
private
final
ConfigurableApplicationContext
context
;
private
final
Environment
environment
;
@Autowired
private
JdbcTemplate
jdbcTemplate
;
@Override
public
void
run
(
ApplicationArguments
args
)
{
if
(
context
.
isActive
())
{
String
banner
=
"-----------------------------------------\n"
+
"服务启动成功,时间:"
+
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
LocalDateTime
.
now
())
+
"\n"
+
"服务名称:"
+
environment
.
getProperty
(
"spring.application.name"
)
+
"\n"
+
"端口号:"
+
environment
.
getProperty
(
"server.port"
)
+
"\n"
+
"-----------------------------------------"
;
System
.
out
.
println
(
banner
);
List
<
Map
<
String
,
Object
>>
list
=
jdbcTemplate
.
queryForList
(
"select * from t_user"
);
System
.
out
.
println
(
list
);
}
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/config/SwaggerConfig.java
0 → 100644
View file @
0f23b6fd
package
cn
.
datax
.
service
.
workflow
.
config
;
import
com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration
;
import
springfox.documentation.builders.*
;
import
springfox.documentation.schema.ModelRef
;
import
springfox.documentation.service.*
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
import
java.util.ArrayList
;
import
java.util.List
;
@Configuration
@ConditionalOnProperty
(
prefix
=
"swagger"
,
name
=
"enable"
,
havingValue
=
"true"
)
@EnableConfigurationProperties
(
SwaggerProperties
.
class
)
@EnableSwagger2
@EnableKnife4j
@Import
(
BeanValidatorPluginsConfiguration
.
class
)
public
class
SwaggerConfig
{
@Autowired
private
SwaggerProperties
swaggerProperties
;
/**
* 创建API应用
* apiInfo() 增加API相关信息
* 通过select()函数返回一个ApiSelectorBuilder实例,用来控制哪些接口暴露给Swagger来展现,
* 本例采用指定扫描的包路径来定义指定要建立API的目录。
*
* @return
*/
@Bean
public
Docket
createRestApi
(){
//版本类型是swagger2
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
//通过调用自定义方法apiInfo,获得文档的主要信息
.
apiInfo
(
apiInfo
())
//设置全局参数
.
globalOperationParameters
(
globalParamBuilder
())
//设置全局响应参数
.
globalResponseMessage
(
RequestMethod
.
GET
,
responseBuilder
())
.
globalResponseMessage
(
RequestMethod
.
POST
,
responseBuilder
())
.
globalResponseMessage
(
RequestMethod
.
PUT
,
responseBuilder
())
.
globalResponseMessage
(
RequestMethod
.
DELETE
,
responseBuilder
())
.
select
()
//扫描该包下面的API注解
.
apis
(
RequestHandlerSelectors
.
basePackage
(
swaggerProperties
.
getBasePackage
()))
.
paths
(
PathSelectors
.
any
())
.
build
()
//设置安全认证
.
securitySchemes
(
security
());
}
/**
* 创建该API的基本信息(这些基本信息会展现在文档页面中)
* 访问地址:http://项目实际地址/swagger-ui.html
* @return
*/
private
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
()
.
title
(
swaggerProperties
.
getTitle
())
.
description
(
swaggerProperties
.
getDescription
())
.
termsOfServiceUrl
(
swaggerProperties
.
getTermsOfServiceUrl
())
.
version
(
swaggerProperties
.
getVersion
())
.
contact
(
new
Contact
(
swaggerProperties
.
getContact
().
getName
(),
swaggerProperties
.
getContact
().
getUrl
(),
swaggerProperties
.
getContact
().
getEmail
()))
.
build
();
}
/**
* 安全认证参数
* @return
*/
private
List
<
ApiKey
>
security
()
{
List
<
ApiKey
>
apiKeys
=
new
ArrayList
<>();
apiKeys
.
add
(
new
ApiKey
(
"Authorization"
,
"Authorization"
,
"header"
));
return
apiKeys
;
}
/**
* 构建全局参数列表
* @return
*/
private
List
<
Parameter
>
globalParamBuilder
(){
List
<
Parameter
>
pars
=
new
ArrayList
<>();
pars
.
add
(
parameterBuilder
(
"Authorization"
,
"令牌"
,
"string"
,
"header"
,
false
).
build
());
return
pars
;
}
/**
* 创建参数
* @return
*/
private
ParameterBuilder
parameterBuilder
(
String
name
,
String
desc
,
String
type
,
String
parameterType
,
boolean
required
)
{
ParameterBuilder
tokenPar
=
new
ParameterBuilder
();
tokenPar
.
name
(
name
).
description
(
desc
).
modelRef
(
new
ModelRef
(
type
)).
parameterType
(
parameterType
).
required
(
required
).
build
();
return
tokenPar
;
}
/**
* 创建全局响应值
* @return
*/
private
List
<
ResponseMessage
>
responseBuilder
()
{
List
<
ResponseMessage
>
responseMessageList
=
new
ArrayList
<>();
responseMessageList
.
add
(
new
ResponseMessageBuilder
().
code
(
200
).
message
(
"响应成功"
).
build
());
responseMessageList
.
add
(
new
ResponseMessageBuilder
().
code
(
500
).
message
(
"服务器内部错误"
).
build
());
return
responseMessageList
;
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/config/SwaggerProperties.java
0 → 100644
View file @
0f23b6fd
package
cn
.
datax
.
service
.
workflow
.
config
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
@ConfigurationProperties
(
ignoreUnknownFields
=
false
,
prefix
=
"swagger"
)
public
class
SwaggerProperties
{
private
Boolean
enable
;
private
String
title
;
private
String
description
;
private
String
version
;
private
String
termsOfServiceUrl
;
private
String
basePackage
;
private
Contact
contact
;
public
Boolean
getEnable
()
{
return
enable
;
}
public
void
setEnable
(
Boolean
enable
)
{
this
.
enable
=
enable
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getVersion
()
{
return
version
;
}
public
void
setVersion
(
String
version
)
{
this
.
version
=
version
;
}
public
String
getTermsOfServiceUrl
()
{
return
termsOfServiceUrl
;
}
public
void
setTermsOfServiceUrl
(
String
termsOfServiceUrl
)
{
this
.
termsOfServiceUrl
=
termsOfServiceUrl
;
}
public
String
getBasePackage
()
{
return
basePackage
;
}
public
void
setBasePackage
(
String
basePackage
)
{
this
.
basePackage
=
basePackage
;
}
public
Contact
getContact
()
{
return
contact
;
}
public
void
setContact
(
Contact
contact
)
{
this
.
contact
=
contact
;
}
public
static
class
Contact
{
private
String
name
;
private
String
url
;
private
String
email
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getEmail
()
{
return
email
;
}
public
void
setEmail
(
String
email
)
{
this
.
email
=
email
;
}
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/resources/bootstrap.yml
0 → 100644
View file @
0f23b6fd
server
:
port
:
8814
spring
:
application
:
name
:
datax-service-workflow
profiles
:
active
:
dev
cloud
:
config
:
fail-fast
:
true
name
:
${spring.application.name}
profile
:
${spring.profiles.active}
discovery
:
enabled
:
true
service-id
:
datax-config
# 注册中心配置
eureka
:
instance
:
lease-renewal-interval-in-seconds
:
20
client
:
register-with-eureka
:
true
fetch-registry
:
true
instance-info-replication-interval-seconds
:
30
registry-fetch-interval-seconds
:
3
service-url
:
defaultZone
:
http://localhost:8610/eureka
\ No newline at end of file
datax-modules/workflow-service-parent/workflow-service/src/main/resources/logback-spring.xml
0 → 100644
View file @
0f23b6fd
<?xml version="1.0" encoding="UTF-8"?>
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
debug=
"false"
>
<springProperty
scope=
"context"
name=
"springAppName"
source=
"spring.application.name"
/>
<property
name=
"log.path"
value=
"logs/datax-service-workflow"
/>
<property
name=
"log.maxHistory"
value=
"15"
/>
<property
name=
"log.totalSizeCap"
value=
"500MB"
/>
<property
name=
"log.maxFileSize"
value=
"10MB"
/>
<property
name=
"log.colorPattern"
value=
"%magenta(%d{yyyy-MM-dd HH:mm:ss}) %highlight(%-5level) %boldCyan(${springAppName:-}) %yellow(%thread) %green(%logger) %msg%n"
/>
<property
name=
"log.pattern"
value=
"%d{yyyy-MM-dd HH:mm:ss} %-5level ${springAppName:-} %thread %logger %msg%n"
/>
<!--输出到控制台-->
<appender
name=
"console"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder>
<pattern>
${log.colorPattern}
</pattern>
</encoder>
</appender>
<!--输出到文件-->
<!-- RollingFileAppender:滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 -->
<!-- 以下的大概意思是:1.先按日期存日志,日期变了,将前一天的日志文件名重命名为XXX%日期%索引,新的日志仍然是project_info.log -->
<!-- 2.如果日期没有发生变化,但是当前日志的文件大小超过10MB时,对当前日志进行分割 重命名-->
<appender
name=
"file_info"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!--日志文件路径和名称-->
<File>
${log.path}/info/info.log
</File>
<!--是否追加到文件末尾,默认为true-->
<append>
true
</append>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"
>
<!-- 日志文件的名字会根据fileNamePattern的值,每隔一段时间改变一次 -->
<!-- 文件名:logs/project_info.2017-12-05.0.log -->
<!-- 注意:SizeAndTimeBasedRollingPolicy中 %i和%d令牌都是强制性的,必须存在,要不会报错 -->
<fileNamePattern>
${log.path}/info/info.%d.%i.log
</fileNamePattern>
<!-- 每产生一个日志文件,该日志文件的保存期限为30天, ps:maxHistory的单位是根据fileNamePattern中的翻转策略自动推算出来的,例如上面选用了yyyy-MM-dd,则单位为天
如果上面选用了yyyy-MM,则单位为月,另外上面的单位默认为yyyy-MM-dd-->
<MaxHistory>
${log.maxHistory}
</MaxHistory>
<!-- 每个日志文件到2mb的时候开始切分,最多保留30天,但最大到500MB,哪怕没到30天也要删除多余的日志 -->
<totalSizeCap>
${log.totalSizeCap}
</totalSizeCap>
<!-- maxFileSize:这是活动文件的大小,默认值是10MB,测试时可改成5KB看效果 -->
<maxFileSize>
${log.maxFileSize}
</maxFileSize>
</rollingPolicy>
<encoder>
<pattern>
${log.pattern}
</pattern>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
INFO
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<appender
name=
"file_error"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<File>
${log.path}/error/error.log
</File>
<append>
true
</append>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"
>
<fileNamePattern>
${log.path}/error/error.%d.%i.log
</fileNamePattern>
<MaxHistory>
${log.maxHistory}
</MaxHistory>
<totalSizeCap>
${log.totalSizeCap}
</totalSizeCap>
<maxFileSize>
${log.maxFileSize}
</maxFileSize>
</rollingPolicy>
<encoder>
<pattern>
${log.pattern}
</pattern>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
ERROR
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<root
level=
"debug"
>
<appender-ref
ref=
"console"
/>
</root>
<root
level=
"info"
>
<appender-ref
ref=
"file_info"
/>
<appender-ref
ref=
"file_error"
/>
</root>
</configuration>
\ No newline at end of file
datax-modules/workflow-service-parent/workflow-service/src/main/resources/spy.properties
0 → 100644
View file @
0f23b6fd
module.log
=
com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory
# 自定义日志打印
logMessageFormat
=
com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger
#日志输出到控制台
appender
=
com.baomidou.mybatisplus.extension.p6spy.StdoutLogger
# 使用日志系统记录 sql
#appender=com.p6spy.engine.spy.appender.Slf4JLogger
# 设置 p6spy driver 代理
deregisterdrivers
=
true
# 取消JDBC URL前缀
useprefix
=
true
# 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset.
excludecategories
=
info,debug,result,batch,resultset
# 日期格式
dateformat
=
yyyy-MM-dd HH:mm:ss
# 实际驱动可多个
#driverlist=org.h2.Driver
# 是否开启慢SQL记录
outagedetection
=
true
# 慢SQL记录标准 2 秒
outagedetectioninterval
=
2
# 开启过滤
filter
=
true
# 配置不打印的内容
exclude
=
select 1
\ No newline at end of file
pom.xml
View file @
0f23b6fd
...
@@ -59,6 +59,7 @@
...
@@ -59,6 +59,7 @@
<jasperreports.version>
6.12.2
</jasperreports.version>
<jasperreports.version>
6.12.2
</jasperreports.version>
<mybatis-spring.version>
2.1.2
</mybatis-spring.version>
<mybatis-spring.version>
2.1.2
</mybatis-spring.version>
<bitwalker.version>
1.21
</bitwalker.version>
<bitwalker.version>
1.21
</bitwalker.version>
<flowable.version>
6.5.0
</flowable.version>
</properties>
</properties>
<modules>
<modules>
...
...
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