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
430f744d
Commit
430f744d
authored
May 16, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.0.0项目初始化
parent
36e88aaf
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
366 additions
and
1 deletions
+366
-1
datax-service-workflow-dev.yml
.../src/main/resources/config/datax-service-workflow-dev.yml
+74
-0
StartedUpRunner.java
.../java/cn/datax/service/system/config/StartedUpRunner.java
+8
-0
DictServiceImpl.java
...cn/datax/service/system/service/impl/DictServiceImpl.java
+1
-1
DataxWorkFlowApplication.java
...a/cn/datax/service/workflow/DataxWorkFlowApplication.java
+15
-0
DataResourceServerConfig.java
...tax/service/workflow/config/DataResourceServerConfig.java
+67
-0
StartedUpRunner.java
...ava/cn/datax/service/workflow/config/StartedUpRunner.java
+31
-0
SwaggerConfig.java
.../java/cn/datax/service/workflow/config/SwaggerConfig.java
+104
-0
InnerController.java
...cn/datax/service/workflow/controller/InnerController.java
+11
-0
bootstrap.yml
...-parent/workflow-service/src/main/resources/bootstrap.yml
+29
-0
spy.properties
...parent/workflow-service/src/main/resources/spy.properties
+26
-0
No files found.
datax-config/src/main/resources/config/datax-service-workflow-dev.yml
0 → 100644
View file @
430f744d
# 数据源配置
spring
:
redis
:
database
:
1
host
:
127.0.0.1
port
:
6379
password
:
# 密码(默认为空)
timeout
:
6000ms
# 连接超时时长(毫秒)
lettuce
:
pool
:
max-active
:
1000
# 连接池最大连接数(使用负值表示没有限制)
max-wait
:
-1ms
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle
:
10
# 连接池中的最大空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
datasource
:
dynamic
:
type
:
com.zaxxer.hikari.HikariDataSource
hikari
:
auto-commit
:
false
connection-timeout
:
30000
idle-timeout
:
25000
login-timeout
:
5
max-lifetime
:
30000
read-only
:
false
validation-timeout
:
3000
maximum-pool-size
:
15
minimum-idle
:
5
pool-name
:
DataxHikariCP
connection-test-query
:
SELECT 1 FROM DUAL
data-source-properties
:
cachePrepStmts
:
true
prepStmtCacheSize
:
250
prepStmtCacheSqlLimit
:
2048
useServerPrepStmts
:
true
useLocalSessionState
:
true
rewriteBatchedStatements
:
true
cacheResultSetMetadata
:
true
cacheServerConfiguration
:
true
elideSetAutoCommits
:
true
maintainTimeStats
:
false
primary
:
mysql
datasource
:
mysql
:
driver-class-name
:
com.p6spy.engine.spy.P6SpyDriver
url
:
jdbc:p6spy:mysql://127.0.0.1:3306/data_cloud?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
password
:
1234@abcd
mybatis-plus
:
mapper-locations
:
classpath*:mapper/*Mapper.xml
type-aliases-package
:
cn.datax.service.workflow.api.entity
global-config
:
db-config
:
id-type
:
ASSIGN_ID
banner
:
false
configuration
:
map-underscore-to-camel-case
:
true
cache-enabled
:
false
call-setters-on-nulls
:
true
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
# spring security 配置
security
:
oauth2
:
client
:
access-token-uri
:
http://localhost:8612/auth/oauth/token
user-authorization-uri
:
http://localhost:8612/auth/oauth/authorize
client-id
:
datax
client-secret
:
123456
scope
:
all
resource
:
loadBalanced
:
true
token-info-uri
:
http://localhost:8612/auth/oauth/check_token
\ No newline at end of file
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/config/StartedUpRunner.java
View file @
430f744d
package
cn
.
datax
.
service
.
system
.
config
;
package
cn
.
datax
.
service
.
system
.
config
;
import
cn.datax.service.system.service.DictService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.ConfigurableApplicationContext
;
...
@@ -17,6 +19,9 @@ public class StartedUpRunner implements ApplicationRunner {
...
@@ -17,6 +19,9 @@ public class StartedUpRunner implements ApplicationRunner {
private
final
ConfigurableApplicationContext
context
;
private
final
ConfigurableApplicationContext
context
;
private
final
Environment
environment
;
private
final
Environment
environment
;
@Autowired
private
DictService
dictService
;
@Override
@Override
public
void
run
(
ApplicationArguments
args
)
{
public
void
run
(
ApplicationArguments
args
)
{
if
(
context
.
isActive
())
{
if
(
context
.
isActive
())
{
...
@@ -26,6 +31,9 @@ public class StartedUpRunner implements ApplicationRunner {
...
@@ -26,6 +31,9 @@ public class StartedUpRunner implements ApplicationRunner {
"端口号:"
+
environment
.
getProperty
(
"server.port"
)
+
"\n"
+
"端口号:"
+
environment
.
getProperty
(
"server.port"
)
+
"\n"
+
"-----------------------------------------"
;
"-----------------------------------------"
;
System
.
out
.
println
(
banner
);
System
.
out
.
println
(
banner
);
// 项目启动时,初始化缓存
dictService
.
refreshDict
();
}
}
}
}
}
}
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/service/impl/DictServiceImpl.java
View file @
430f744d
...
@@ -64,12 +64,12 @@ public class DictServiceImpl extends BaseServiceImpl<DictDao, DictEntity> implem
...
@@ -64,12 +64,12 @@ public class DictServiceImpl extends BaseServiceImpl<DictDao, DictEntity> implem
@Override
@Override
public
void
refreshDict
()
{
public
void
refreshDict
()
{
List
<
DictEntity
>
dictEntityList
=
dictDao
.
queryDictList
(
DataConstant
.
EnableState
.
ENABLE
.
getKey
());
String
key
=
"data:system:dicts"
;
String
key
=
"data:system:dicts"
;
Boolean
hasKey
=
redisService
.
hasKey
(
key
);
Boolean
hasKey
=
redisService
.
hasKey
(
key
);
if
(
hasKey
)
{
if
(
hasKey
)
{
redisService
.
del
(
key
);
redisService
.
del
(
key
);
}
}
List
<
DictEntity
>
dictEntityList
=
dictDao
.
queryDictList
(
DataConstant
.
EnableState
.
ENABLE
.
getKey
());
redisService
.
set
(
key
,
dictEntityList
);
redisService
.
set
(
key
,
dictEntityList
);
}
}
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/DataxWorkFlowApplication.java
0 → 100644
View file @
430f744d
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 @
430f744d
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/StartedUpRunner.java
0 → 100644
View file @
430f744d
package
cn
.
datax
.
service
.
workflow
.
config
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.core.env.Environment
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
@Component
@RequiredArgsConstructor
public
class
StartedUpRunner
implements
ApplicationRunner
{
private
final
ConfigurableApplicationContext
context
;
private
final
Environment
environment
;
@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
);
}
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/config/SwaggerConfig.java
0 → 100644
View file @
430f744d
package
cn
.
datax
.
service
.
workflow
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
springfox.documentation.builders.*
;
import
springfox.documentation.schema.ModelRef
;
import
springfox.documentation.service.ApiInfo
;
import
springfox.documentation.service.ApiKey
;
import
springfox.documentation.service.Parameter
;
import
springfox.documentation.service.ResponseMessage
;
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
@EnableSwagger2
public
class
SwaggerConfig
{
/**
* 创建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
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"cn.datax.service.workflow.controller"
))
//扫描该包下面的API注解
.
paths
(
PathSelectors
.
any
())
.
build
()
//设置安全认证
.
securitySchemes
(
security
());
}
/**
* 创建该API的基本信息(这些基本信息会展现在文档页面中)
* 访问地址:http://项目实际地址/swagger-ui.html
* @return
*/
private
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
()
.
title
(
"系统管理中心"
)
//接口管理文档首页显示
.
description
(
"系统管理中心接口文档"
)
//API的描述
.
version
(
"1.0"
)
.
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/controller/InnerController.java
0 → 100644
View file @
430f744d
package
cn
.
datax
.
service
.
workflow
.
controller
;
import
cn.datax.common.base.BaseController
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/inner"
)
public
class
InnerController
extends
BaseController
{
}
datax-modules/workflow-service-parent/workflow-service/src/main/resources/bootstrap.yml
0 → 100644
View file @
430f744d
server
:
port
:
8818
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/spy.properties
0 → 100644
View file @
430f744d
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
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