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
e64586e9
Commit
e64586e9
authored
Aug 03, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
9d8e74b3
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
266 additions
and
491 deletions
+266
-491
WordUtil.java
...ce/src/main/java/cn/datax/commo/office/word/WordUtil.java
+96
-4
datax-auth-dev.yml
datax-config/src/main/resources/config/datax-auth-dev.yml
+0
-24
datax-service-codegen-dev.yml
...g/src/main/resources/config/datax-service-codegen-dev.yml
+0
-24
datax-service-data-api-mapping-dev.yml
...n/resources/config/datax-service-data-api-mapping-dev.yml
+0
-24
datax-service-data-console-dev.yml
.../main/resources/config/datax-service-data-console-dev.yml
+0
-24
datax-service-data-market-dev.yml
...c/main/resources/config/datax-service-data-market-dev.yml
+0
-24
datax-service-data-metadata-dev.yml
...main/resources/config/datax-service-data-metadata-dev.yml
+0
-24
datax-service-data-visual-dev.yml
...c/main/resources/config/datax-service-data-visual-dev.yml
+0
-24
datax-service-email-dev.yml
...fig/src/main/resources/config/datax-service-email-dev.yml
+0
-24
datax-service-file-dev.yml
...nfig/src/main/resources/config/datax-service-file-dev.yml
+0
-24
datax-service-quartz-dev.yml
...ig/src/main/resources/config/datax-service-quartz-dev.yml
+13
-35
datax-service-system-dev.yml
...ig/src/main/resources/config/datax-service-system-dev.yml
+0
-24
MetadataSourceEntity.java
...ervice/data/metadata/api/entity/MetadataSourceEntity.java
+0
-5
MetadataSourceVo.java
.../datax/service/data/metadata/api/vo/MetadataSourceVo.java
+1
-1
pom.xml
...ata-metadata-service-parent/data-metadata-service/pom.xml
+0
-5
pom.xml
...es/data-visual-service-parent/data-visual-service/pom.xml
+0
-5
pom.xml
datax-modules/quartz-service-parent/quartz-service/pom.xml
+0
-6
QuartzConfig.java
...ain/java/cn/datax/service/quartz/config/QuartzConfig.java
+116
-117
RedisCacheConfig.java
...java/cn/datax/service/quartz/config/RedisCacheConfig.java
+0
-69
SchedulerConfig.java
.../java/cn/datax/service/quartz/config/SchedulerConfig.java
+36
-0
pom.xml
pom.xml
+4
-4
No files found.
datax-common/datax-common-office/src/main/java/cn/datax/commo/office/word/WordUtil.java
View file @
e64586e9
...
@@ -5,6 +5,7 @@ import com.aspose.words.*;
...
@@ -5,6 +5,7 @@ import com.aspose.words.*;
import
java.io.*
;
import
java.io.*
;
import
java.util.*
;
import
java.util.*
;
import
java.util.List
;
import
java.util.List
;
import
java.util.function.Function
;
public
class
WordUtil
{
public
class
WordUtil
{
...
@@ -163,7 +164,98 @@ public class WordUtil {
...
@@ -163,7 +164,98 @@ public class WordUtil {
doc
.
save
(
destPath
,
SaveOptions
.
createSaveOptions
(
SaveFormat
.
DOCX
));
doc
.
save
(
destPath
,
SaveOptions
.
createSaveOptions
(
SaveFormat
.
DOCX
));
}
}
// public static void main(String[] args) throws Exception {
/**
* 加水印方法
*
* @param doc word文件流
* @param watermarkText 水印内容
*/
public
static
void
insertWatermarkText
(
Document
doc
,
String
watermarkText
)
{
// 居中
insertWatermarkText
(
doc
,
watermarkText
,
new
Function
<
Shape
,
Object
>()
{
@Override
public
Object
apply
(
Shape
watermark
)
{
// Place the watermark in the page center.
watermark
.
setRelativeHorizontalPosition
(
RelativeHorizontalPosition
.
PAGE
);
watermark
.
setRelativeVerticalPosition
(
RelativeVerticalPosition
.
PAGE
);
watermark
.
setWrapType
(
WrapType
.
NONE
);
watermark
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
watermark
.
setHorizontalAlignment
(
HorizontalAlignment
.
CENTER
);
return
null
;
}
});
// 顶部
insertWatermarkText
(
doc
,
watermarkText
,
new
Function
<
Shape
,
Object
>()
{
@Override
public
Object
apply
(
Shape
watermark
)
{
watermark
.
setRelativeHorizontalPosition
(
RelativeHorizontalPosition
.
MARGIN
);
watermark
.
setRelativeVerticalPosition
(
RelativeVerticalPosition
.
MARGIN
);
watermark
.
setWrapType
(
WrapType
.
NONE
);
// 我们需要自定义距离顶部的高度
watermark
.
setVerticalAlignment
(
VerticalAlignment
.
TOP
);
watermark
.
setHorizontalAlignment
(
HorizontalAlignment
.
CENTER
);
// watermark.setTop(120);
return
null
;
}
});
// 尾部
insertWatermarkText
(
doc
,
watermarkText
,
new
Function
<
Shape
,
Object
>()
{
@Override
public
Object
apply
(
Shape
watermark
)
{
watermark
.
setRelativeHorizontalPosition
(
RelativeHorizontalPosition
.
MARGIN
);
watermark
.
setRelativeVerticalPosition
(
RelativeVerticalPosition
.
MARGIN
);
watermark
.
setWrapType
(
WrapType
.
NONE
);
// 我们需要自定义距离顶部的高度
watermark
.
setVerticalAlignment
(
VerticalAlignment
.
BOTTOM
);
watermark
.
setHorizontalAlignment
(
HorizontalAlignment
.
CENTER
);
// 设置距离顶部的高度
// watermark.setTop(480);
return
null
;
}
});
}
private
static
void
insertWatermarkText
(
Document
doc
,
String
watermarkText
,
Function
<
Shape
,
Object
>
watermaskPositionConfigFunc
)
{
Shape
watermark
=
new
Shape
(
doc
,
ShapeType
.
TEXT_PLAIN_TEXT
);
watermark
.
getTextPath
().
setText
(
watermarkText
);
// 这里设置为宋体可以保证在转换为PDF时中文不是乱码.
watermark
.
getTextPath
().
setFontFamily
(
"WeiRuanYaHei"
);
// WeiRuanYaHei 宋体
try
{
// 水印大小
watermark
.
setWidth
(
150
);
watermark
.
setHeight
(
30
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
// 左下到右上
watermark
.
setRotation
(-
20
);
// 字体RGB颜色
final
String
colorStr
=
"808080"
;
watermark
.
getFill
().
setColor
(
new
java
.
awt
.
Color
(
Integer
.
parseInt
(
colorStr
,
16
)));
watermark
.
setStrokeColor
(
new
java
.
awt
.
Color
(
Integer
.
parseInt
(
colorStr
,
16
)));
watermaskPositionConfigFunc
.
apply
(
watermark
);
Paragraph
watermarkPara
=
new
Paragraph
(
doc
);
watermarkPara
.
appendChild
(
watermark
);
for
(
Section
sect
:
doc
.
getSections
())
{
insertWatermarkIntoHeader
(
watermarkPara
,
sect
,
HeaderFooterType
.
HEADER_PRIMARY
);
}
}
private
static
void
insertWatermarkIntoHeader
(
Paragraph
watermarkPara
,
Section
sect
,
int
headerType
)
{
HeaderFooter
header
=
sect
.
getHeadersFooters
().
getByHeaderFooterType
(
headerType
);
if
(
header
==
null
)
{
header
=
new
HeaderFooter
(
sect
.
getDocument
(),
headerType
);
sect
.
getHeadersFooters
().
add
(
header
);
}
try
{
header
.
appendChild
(
watermarkPara
.
deepClone
(
true
));
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// Map<String, Object> map = new HashMap<>();
// Map<String, Object> map = new HashMap<>();
// map.put("companyName", "测试");
// map.put("companyName", "测试");
// map.put("totalSalary", new BigDecimal("12.34"));
// map.put("totalSalary", new BigDecimal("12.34"));
...
@@ -189,8 +281,8 @@ public class WordUtil {
...
@@ -189,8 +281,8 @@ public class WordUtil {
// objects2.add(entry.getValue());
// objects2.add(entry.getValue());
// }
// }
// WordUtil.getInstance().fillWordListData(objects1.toArray(new String[objects1.size()]), objects2.toArray(new Object[objects2.size()]), "F:\\test\\模板.docx", "F:\\test\\123.docx", list, "workerList");
// WordUtil.getInstance().fillWordListData(objects1.toArray(new String[objects1.size()]), objects2.toArray(new Object[objects2.size()]), "F:\\test\\模板.docx", "F:\\test\\123.docx", list, "workerList");
// WordUtil.getInstance().word2pdf("F:\\test
\\审批流提交.docx", "F:\\test
\\20200420.pdf");
// WordUtil.getInstance().word2pdf("F:\\test
.docx", "F:
\\20200420.pdf");
//
// // 用户表(子表) TableStart:UserList TableEnd:UserList
// // 用户表(子表) TableStart:UserList TableEnd:UserList
// DataTable userTable = new DataTable("UserList");
// DataTable userTable = new DataTable("UserList");
// userTable.getColumns().add("id");
// userTable.getColumns().add("id");
...
@@ -235,5 +327,5 @@ public class WordUtil {
...
@@ -235,5 +327,5 @@ public class WordUtil {
// mailMerge.execute(fieldNames, fieldValues);
// mailMerge.execute(fieldNames, fieldValues);
// mailMerge.executeWithRegions(dataSet);
// mailMerge.executeWithRegions(dataSet);
// doc.save("F:\\test_r.docx", SaveOptions.createSaveOptions(SaveFormat.DOCX));
// doc.save("F:\\test_r.docx", SaveOptions.createSaveOptions(SaveFormat.DOCX));
//
}
}
}
}
datax-config/src/main/resources/config/datax-auth-dev.yml
View file @
e64586e9
...
@@ -14,30 +14,6 @@ spring:
...
@@ -14,30 +14,6 @@ spring:
min-idle
:
5
# 连接池中的最小空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
datasource
:
datasource
:
dynamic
:
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
primary
:
mysql
datasource
:
datasource
:
mysql
:
mysql
:
...
...
datax-config/src/main/resources/config/datax-service-codegen-dev.yml
View file @
e64586e9
...
@@ -14,30 +14,6 @@ spring:
...
@@ -14,30 +14,6 @@ spring:
min-idle
:
5
# 连接池中的最小空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
datasource
:
datasource
:
dynamic
:
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
primary
:
mysql
datasource
:
datasource
:
mysql
:
mysql
:
...
...
datax-config/src/main/resources/config/datax-service-data-api-mapping-dev.yml
View file @
e64586e9
...
@@ -19,30 +19,6 @@ spring:
...
@@ -19,30 +19,6 @@ spring:
password
:
1234@abcd
password
:
1234@abcd
datasource
:
datasource
:
dynamic
:
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
primary
:
mysql
datasource
:
datasource
:
mysql
:
mysql
:
...
...
datax-config/src/main/resources/config/datax-service-data-console-dev.yml
View file @
e64586e9
...
@@ -14,30 +14,6 @@ spring:
...
@@ -14,30 +14,6 @@ spring:
min-idle
:
5
# 连接池中的最小空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
datasource
:
datasource
:
dynamic
:
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
primary
:
mysql
datasource
:
datasource
:
mysql
:
mysql
:
...
...
datax-config/src/main/resources/config/datax-service-data-market-dev.yml
View file @
e64586e9
...
@@ -19,30 +19,6 @@ spring:
...
@@ -19,30 +19,6 @@ spring:
password
:
1234@abcd
password
:
1234@abcd
datasource
:
datasource
:
dynamic
:
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
primary
:
mysql
datasource
:
datasource
:
mysql
:
mysql
:
...
...
datax-config/src/main/resources/config/datax-service-data-metadata-dev.yml
View file @
e64586e9
...
@@ -14,30 +14,6 @@ spring:
...
@@ -14,30 +14,6 @@ spring:
min-idle
:
5
# 连接池中的最小空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
datasource
:
datasource
:
dynamic
:
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
primary
:
mysql
datasource
:
datasource
:
mysql
:
mysql
:
...
...
datax-config/src/main/resources/config/datax-service-data-visual-dev.yml
View file @
e64586e9
...
@@ -14,30 +14,6 @@ spring:
...
@@ -14,30 +14,6 @@ spring:
min-idle
:
5
# 连接池中的最小空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
datasource
:
datasource
:
dynamic
:
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
primary
:
mysql
datasource
:
datasource
:
mysql
:
mysql
:
...
...
datax-config/src/main/resources/config/datax-service-email-dev.yml
View file @
e64586e9
...
@@ -25,30 +25,6 @@ spring:
...
@@ -25,30 +25,6 @@ spring:
min-idle
:
5
# 连接池中的最小空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
datasource
:
datasource
:
dynamic
:
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
primary
:
mysql
datasource
:
datasource
:
mysql
:
mysql
:
...
...
datax-config/src/main/resources/config/datax-service-file-dev.yml
View file @
e64586e9
...
@@ -14,30 +14,6 @@ spring:
...
@@ -14,30 +14,6 @@ spring:
min-idle
:
5
# 连接池中的最小空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
datasource
:
datasource
:
dynamic
:
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
primary
:
mysql
datasource
:
datasource
:
mysql
:
mysql
:
...
...
datax-config/src/main/resources/config/datax-service-quartz-dev.yml
View file @
e64586e9
...
@@ -13,9 +13,12 @@ spring:
...
@@ -13,9 +13,12 @@ spring:
max-idle
:
10
# 连接池中的最大空闲连接
max-idle
:
10
# 连接池中的最大空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
datasource
:
datasource
:
dynamic
:
primary
:
mysql
datasource
:
mysql
:
mysql
:
driver-class-name
:
com.p6spy.engine.spy.P6SpyDriver
driver-class-name
:
com.p6spy.engine.spy.P6SpyDriver
url
:
jdbc:p6spy:mysql://localhost:3306/data_cloud?useUnicode=true&characterEncoding=utf
8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url
:
jdbc:p6spy:mysql://localhost:3306/data_cloud?useUnicode=true&characterEncoding=utf-
8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
username
:
root
password
:
1234@abcd
password
:
1234@abcd
quartz
:
quartz
:
...
@@ -23,38 +26,14 @@ spring:
...
@@ -23,38 +26,14 @@ spring:
url
:
jdbc:mysql://localhost:3306/data_cloud_quartz?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url
:
jdbc:mysql://localhost:3306/data_cloud_quartz?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
username
:
root
password
:
1234@abcd
password
:
1234@abcd
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
quartz
:
quartz
:
job-store-type
:
jdbc
# Job 存储器类型。默认为 memory 表示内存,可选 jdbc 使用数据库。
job-store-type
:
jdbc
auto-startup
:
true
# Quartz 是否自动启动
auto-startup
:
true
startup-delay
:
0
# 延迟 N 秒启动
startup-delay
:
0
wait-for-jobs-to-complete-on-shutdown
:
true
# 应用关闭时,是否等待定时任务执行完成。默认为 false ,建议设置为 true
wait-for-jobs-to-complete-on-shutdown
:
true
overwrite-existing-jobs
:
false
# 是否覆盖已有 Job 的配置
overwrite-existing-jobs
:
false
jdbc
:
# 使用 JDBC 的 JobStore 的时候,JDBC 的配置
jdbc
:
initialize-schema
:
never
# 是否自动使用 SQL 初始化 Quartz 表结构。这里设置成 never ,我们手动创建表结构。
initialize-schema
:
never
properties
:
properties
:
org
:
org
:
quartz
:
quartz
:
...
@@ -63,13 +42,12 @@ spring:
...
@@ -63,13 +42,12 @@ spring:
instanceId
:
AUTO
instanceId
:
AUTO
jobStore
:
jobStore
:
class
:
org.quartz.impl.jdbcjobstore.JobStoreTX
class
:
org.quartz.impl.jdbcjobstore.JobStoreTX
driverDelegateClass
:
org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#StdJDBCDelegate说明支持集群
driverDelegateClass
:
org.quartz.impl.jdbcjobstore.StdJDBCDelegate
dataSource
:
quartzDataSource
tablePrefix
:
QRTZ_
tablePrefix
:
QRTZ_
isClustered
:
true
isClustered
:
true
clusterCheckinInterval
:
1000
clusterCheckinInterval
:
1000
useProperties
:
false
useProperties
:
false
misfireThreshold
:
5000
# 设置临界时间为5秒
misfireThreshold
:
5000
threadPool
:
threadPool
:
class
:
org.quartz.simpl.SimpleThreadPool
class
:
org.quartz.simpl.SimpleThreadPool
threadCount
:
20
threadCount
:
20
...
...
datax-config/src/main/resources/config/datax-service-system-dev.yml
View file @
e64586e9
...
@@ -14,30 +14,6 @@ spring:
...
@@ -14,30 +14,6 @@ spring:
min-idle
:
5
# 连接池中的最小空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
datasource
:
datasource
:
dynamic
:
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
primary
:
mysql
datasource
:
datasource
:
mysql
:
mysql
:
...
...
datax-modules/data-metadata-service-parent/data-metadata-service-api/src/main/java/cn/datax/service/data/metadata/api/entity/MetadataSourceEntity.java
View file @
e64586e9
...
@@ -36,11 +36,6 @@ public class MetadataSourceEntity extends DataScopeBaseEntity {
...
@@ -36,11 +36,6 @@ public class MetadataSourceEntity extends DataScopeBaseEntity {
private
String
sourceName
;
private
String
sourceName
;
/**
/**
* 数据主题
*/
private
String
themeId
;
/**
* 数据源连接信息
* 数据源连接信息
*/
*/
@TableField
(
typeHandler
=
JacksonTypeHandler
.
class
)
@TableField
(
typeHandler
=
JacksonTypeHandler
.
class
)
...
...
datax-modules/data-metadata-service-parent/data-metadata-service-api/src/main/java/cn/datax/service/data/metadata/api/vo/MetadataSourceVo.java
View file @
e64586e9
...
@@ -28,5 +28,5 @@ public class MetadataSourceVo implements Serializable {
...
@@ -28,5 +28,5 @@ public class MetadataSourceVo implements Serializable {
private
String
dbType
;
private
String
dbType
;
private
String
sourceName
;
private
String
sourceName
;
private
DbSchema
dbSchema
;
private
DbSchema
dbSchema
;
private
Integer
sync
;
private
Integer
s
ourceS
ync
;
}
}
datax-modules/data-metadata-service-parent/data-metadata-service/pom.xml
View file @
e64586e9
...
@@ -71,11 +71,6 @@
...
@@ -71,11 +71,6 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
cn.datax
</groupId>
<groupId>
cn.datax
</groupId>
<artifactId>
datax-common-database
</artifactId>
<version>
2.0.0
</version>
</dependency>
<dependency>
<groupId>
cn.datax
</groupId>
<artifactId>
data-metadata-service-api
</artifactId>
<artifactId>
data-metadata-service-api
</artifactId>
<version>
2.0.0
</version>
<version>
2.0.0
</version>
</dependency>
</dependency>
...
...
datax-modules/data-visual-service-parent/data-visual-service/pom.xml
View file @
e64586e9
...
@@ -71,11 +71,6 @@
...
@@ -71,11 +71,6 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
cn.datax
</groupId>
<groupId>
cn.datax
</groupId>
<artifactId>
datax-common-database
</artifactId>
<version>
2.0.0
</version>
</dependency>
<dependency>
<groupId>
cn.datax
</groupId>
<artifactId>
data-visual-service-api
</artifactId>
<artifactId>
data-visual-service-api
</artifactId>
<version>
2.0.0
</version>
<version>
2.0.0
</version>
</dependency>
</dependency>
...
...
datax-modules/quartz-service-parent/quartz-service/pom.xml
View file @
e64586e9
...
@@ -53,12 +53,6 @@
...
@@ -53,12 +53,6 @@
<groupId>
cn.datax
</groupId>
<groupId>
cn.datax
</groupId>
<artifactId>
datax-common-mybatis
</artifactId>
<artifactId>
datax-common-mybatis
</artifactId>
<version>
2.0.0
</version>
<version>
2.0.0
</version>
<exclusions>
<exclusion>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
cn.datax
</groupId>
<groupId>
cn.datax
</groupId>
...
...
datax-modules/quartz-service-parent/quartz-service/src/main/java/cn/datax/service/quartz/config/QuartzConfig.java
View file @
e64586e9
package
cn
.
datax
.
service
.
quartz
.
config
;
//package cn.datax.service.quartz.config;
//
import
cn.datax.service.quartz.quartz.utils.ScheduleUtil
;
//import cn.datax.service.quartz.quartz.utils.ScheduleUtil;
import
com.zaxxer.hikari.HikariDataSource
;
//import com.zaxxer.hikari.HikariDataSource;
import
org.quartz.Scheduler
;
//import org.quartz.Scheduler;
import
org.quartz.spi.TriggerFiredBundle
;
//import org.quartz.spi.TriggerFiredBundle;
import
org.springframework.beans.factory.config.AutowireCapableBeanFactory
;
//import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceProperties
;
//import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import
org.springframework.boot.autoconfigure.quartz.QuartzDataSource
;
//import org.springframework.boot.autoconfigure.quartz.QuartzDataSource;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
//import org.springframework.boot.context.properties.ConfigurationProperties;
import
org.springframework.context.annotation.Bean
;
//import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
//import org.springframework.context.annotation.Configuration;
import
org.springframework.context.annotation.Primary
;
//import org.springframework.context.annotation.Primary;
import
org.springframework.scheduling.quartz.AdaptableJobFactory
;
//import org.springframework.scheduling.quartz.AdaptableJobFactory;
import
org.springframework.scheduling.quartz.SchedulerFactoryBean
;
//import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import
org.springframework.stereotype.Component
;
//import org.springframework.stereotype.Component;
//
import
javax.sql.DataSource
;
//import javax.sql.DataSource;
//
@Configuration
//@Configuration
public
class
QuartzConfig
{
//public class QuartzConfig {
//
/**
// /**
* 创建 mysql 数据源的配置对象
// * 创建 mysql 数据源的配置对象
*/
// */
@Primary
// @Primary
@Bean
(
name
=
"mysqlDataSourceProperties"
)
// @Bean(name = "mysqlDataSourceProperties")
@ConfigurationProperties
(
prefix
=
"spring.datasource.mysql"
)
// 读取 spring.datasource.mysql 配置到 DataSourceProperties 对象
// @ConfigurationProperties(prefix = "spring.datasource.mysql")
public
DataSourceProperties
mysqlDataSourceProperties
()
{
// public DataSourceProperties mysqlDataSourceProperties() {
return
new
DataSourceProperties
();
// return new DataSourceProperties();
}
// }
//
/**
// /**
* 创建 mysql 数据源
// * 创建 mysql 数据源
*/
// */
@Primary
// @Primary
@Bean
(
name
=
"mysqlDataSource"
)
// @Bean(name = "mysqlDataSource")
@ConfigurationProperties
(
prefix
=
"spring.datasource.mysql.hikari"
)
// 读取 spring.datasource.mysql 配置到 HikariDataSource 对象
// @ConfigurationProperties(prefix = "spring.datasource.mysql")
public
DataSource
userDataSource
()
{
// public DataSource userDataSource() {
// 获得 DataSourceProperties 对象
// // 获得 DataSourceProperties 对象
DataSourceProperties
properties
=
this
.
mysqlDataSourceProperties
();
// DataSourceProperties properties = this.mysqlDataSourceProperties();
// 创建 HikariDataSource 对象
// // 创建 HikariDataSource 对象
return
createHikariDataSource
(
properties
);
// return createHikariDataSource(properties);
}
// }
//
/**
// /**
* 创建 quartz 数据源的配置对象
// * 创建 quartz 数据源的配置对象
*/
// */
@Bean
(
name
=
"quartzDataSourceProperties"
)
// @Bean(name = "quartzDataSourceProperties")
@ConfigurationProperties
(
prefix
=
"spring.datasource.quartz"
)
// 读取 spring.datasource.quartz 配置到 DataSourceProperties 对象
// @ConfigurationProperties(prefix = "spring.datasource.quartz")
public
DataSourceProperties
quartzDataSourceProperties
()
{
// public DataSourceProperties quartzDataSourceProperties() {
return
new
DataSourceProperties
();
// return new DataSourceProperties();
}
// }
//
/**
// /**
* 创建 quartz 数据源
// * 创建 quartz 数据源
*/
// */
@Bean
(
name
=
"quartzDataSource"
)
// @Bean(name = "quartzDataSource")
@ConfigurationProperties
(
prefix
=
"spring.datasource.quartz.hikari"
)
// @ConfigurationProperties(prefix = "spring.datasource.quartz")
@QuartzDataSource
// @QuartzDataSource
public
DataSource
quartzDataSource
()
{
// public DataSource quartzDataSource() {
// 获得 DataSourceProperties 对象
// // 获得 DataSourceProperties 对象
DataSourceProperties
properties
=
this
.
quartzDataSourceProperties
();
// DataSourceProperties properties = this.quartzDataSourceProperties();
// 创建 HikariDataSource 对象
// // 创建 HikariDataSource 对象
return
createHikariDataSource
(
properties
);
// return createHikariDataSource(properties);
}
// }
//
private
static
HikariDataSource
createHikariDataSource
(
DataSourceProperties
properties
)
{
// private static HikariDataSource createHikariDataSource(DataSourceProperties properties) {
// 创建 HikariDataSource 对象
// // 创建 HikariDataSource 对象
HikariDataSource
dataSource
=
properties
.
initializeDataSourceBuilder
().
type
(
HikariDataSource
.
class
).
build
();
// HikariDataSource dataSource = properties.initializeDataSourceBuilder().type(HikariDataSource.class).build();
return
dataSource
;
// return dataSource;
}
// }
//
/**
// /**
* 该类主要是为了把 job 对象的注入到 spring 中
// * 该类主要是为了把 job 对象的注入到 spring 中
*/
// */
@Component
(
"quartzJobFactory"
)
// @Component("quartzJobFactory")
public
static
class
QuartzJobFactory
extends
AdaptableJobFactory
{
// public static class QuartzJobFactory extends AdaptableJobFactory {
//这个对象可以通过 ApplicationContext.getAutowireCapableBeanFactory()获取
// //这个对象可以通过 ApplicationContext.getAutowireCapableBeanFactory()获取
private
final
AutowireCapableBeanFactory
capableBeanFactory
;
// private final AutowireCapableBeanFactory capableBeanFactory;
//
public
QuartzJobFactory
(
AutowireCapableBeanFactory
capableBeanFactory
)
{
// public QuartzJobFactory(AutowireCapableBeanFactory capableBeanFactory) {
this
.
capableBeanFactory
=
capableBeanFactory
;
// this.capableBeanFactory = capableBeanFactory;
}
// }
// /**
/**
// * Job 对象的实例化过程是在Quartz中进行的,通过重写此方法 把job 实例注入到spring容器中
* Job 对象的实例化过程是在Quartz中进行的,通过重写此方法 把job 实例注入到spring容器中
// */
*/
// @Override
@Override
// protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
protected
Object
createJobInstance
(
TriggerFiredBundle
bundle
)
throws
Exception
{
// //调用父类的方法
//调用父类的方法
// Object jobInstance = super.createJobInstance(bundle);
Object
jobInstance
=
super
.
createJobInstance
(
bundle
);
// //注入到spring容器
//注入到spring容器
// capableBeanFactory.autowireBean(jobInstance);
capableBeanFactory
.
autowireBean
(
jobInstance
);
// return jobInstance;
return
jobInstance
;
// }
}
// }
}
//
// /**
/**
// * 注入scheduler到spring
* 注入scheduler到spring
// * @param quartzJobFactory
* @param quartzJobFactory
// * @return Scheduler
* @return Scheduler
// * @throws Exception
* @throws Exception
// */
*/
// @Bean(name = "scheduler")
@Bean
(
name
=
"scheduler"
)
// public Scheduler scheduler(QuartzJobFactory quartzJobFactory) throws Exception {
public
Scheduler
scheduler
(
QuartzJobFactory
quartzJobFactory
)
throws
Exception
{
// SchedulerFactoryBean factoryBean = new SchedulerFactoryBean();
SchedulerFactoryBean
factoryBean
=
new
SchedulerFactoryBean
();
// factoryBean.setJobFactory(quartzJobFactory);
factoryBean
.
setJobFactory
(
quartzJobFactory
);
// factoryBean.setDataSource(quartzDataSource());
factoryBean
.
setDataSource
(
quartzDataSource
());
// factoryBean.afterPropertiesSet();
factoryBean
.
afterPropertiesSet
();
// Scheduler scheduler = factoryBean.getScheduler();
Scheduler
scheduler
=
factoryBean
.
getScheduler
();
// scheduler.start();
scheduler
.
start
();
// // 设置ScheduleUtil的定时处理对象
// 设置ScheduleUtil的定时处理对象
// ScheduleUtil.setScheduler(scheduler);
ScheduleUtil
.
setScheduler
(
scheduler
);
// return scheduler;
return
scheduler
;
// }
}
//}
}
datax-modules/quartz-service-parent/quartz-service/src/main/java/cn/datax/service/quartz/config/RedisCacheConfig.java
deleted
100644 → 0
View file @
9d8e74b3
package
cn
.
datax
.
service
.
quartz
.
config
;
import
cn.datax.common.redis.serializer.DataRedisSerializer
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.annotation.CachingConfigurerSupport
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.cache.interceptor.KeyGenerator
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.cache.RedisCacheConfiguration
;
import
org.springframework.data.redis.cache.RedisCacheManager
;
import
org.springframework.data.redis.cache.RedisCacheWriter
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.serializer.RedisSerializationContext
;
import
java.lang.reflect.Method
;
import
java.time.Duration
;
import
java.util.HashMap
;
import
java.util.Map
;
@Configuration
@EnableCaching
public
class
RedisCacheConfig
extends
CachingConfigurerSupport
{
/**
* 在没有指定缓存Key的情况下,key生成策略
* @return
*/
@Bean
@Override
public
KeyGenerator
keyGenerator
()
{
return
new
KeyGenerator
()
{
@Override
public
Object
generate
(
Object
target
,
Method
method
,
Object
...
params
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
target
.
getClass
().
getName
());
sb
.
append
(
"#"
+
method
.
getName
());
for
(
Object
obj
:
params
)
{
sb
.
append
(
obj
.
toString
());
}
return
sb
.
toString
();
}
};
}
@Bean
public
CacheManager
cacheManager
(
RedisConnectionFactory
redisConnectionFactory
)
{
return
new
RedisCacheManager
(
RedisCacheWriter
.
nonLockingRedisCacheWriter
(
redisConnectionFactory
),
this
.
redisCacheConfigurationWithTtl
(
30
),
this
.
redisCacheConfigurationMap
()
);
}
private
Map
<
String
,
RedisCacheConfiguration
>
redisCacheConfigurationMap
()
{
Map
<
String
,
RedisCacheConfiguration
>
redisCacheConfigurationMap
=
new
HashMap
<>();
redisCacheConfigurationMap
.
put
(
"data:quartz:jobs"
,
redisCacheConfigurationWithTtl
(
30
));
return
redisCacheConfigurationMap
;
}
private
RedisCacheConfiguration
redisCacheConfigurationWithTtl
(
Integer
minutes
)
{
DataRedisSerializer
serializer
=
new
DataRedisSerializer
();
RedisCacheConfiguration
redisCacheConfiguration
=
RedisCacheConfiguration
.
defaultCacheConfig
()
.
serializeValuesWith
(
RedisSerializationContext
.
SerializationPair
.
fromSerializer
(
serializer
))
.
entryTtl
(
Duration
.
ofMinutes
(
minutes
));
return
redisCacheConfiguration
;
}
}
\ No newline at end of file
datax-modules/quartz-service-parent/quartz-service/src/main/java/cn/datax/service/quartz/config/SchedulerConfig.java
0 → 100644
View file @
e64586e9
package
cn
.
datax
.
service
.
quartz
.
config
;
import
cn.datax.service.quartz.quartz.utils.ScheduleUtil
;
import
com.baomidou.dynamic.datasource.DynamicRoutingDataSource
;
import
lombok.AllArgsConstructor
;
import
org.quartz.Scheduler
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.quartz.SchedulerFactoryBean
;
import
javax.sql.DataSource
;
@Configuration
@AllArgsConstructor
public
class
SchedulerConfig
{
private
final
DataSource
dataSource
;
@Bean
public
SchedulerFactoryBean
schedulerFactoryBean
()
{
SchedulerFactoryBean
factory
=
new
SchedulerFactoryBean
();
// 手动从多数据源中获取 quartz数据源
DynamicRoutingDataSource
ds
=
(
DynamicRoutingDataSource
)
dataSource
;
DataSource
quartz
=
ds
.
getDataSource
(
"quartz"
);
factory
.
setDataSource
(
quartz
);
return
factory
;
}
@Bean
(
name
=
"scheduler"
)
public
Scheduler
scheduler
()
{
Scheduler
scheduler
=
schedulerFactoryBean
().
getScheduler
();
// 设置ScheduleUtil的定时处理对象
ScheduleUtil
.
setScheduler
(
scheduler
);
return
scheduler
;
}
}
pom.xml
View file @
e64586e9
...
@@ -30,10 +30,10 @@
...
@@ -30,10 +30,10 @@
<spring-cloud.version>
Hoxton.SR4
</spring-cloud.version>
<spring-cloud.version>
Hoxton.SR4
</spring-cloud.version>
<spring-boot-admin.version>
2.2.3
</spring-boot-admin.version>
<spring-boot-admin.version>
2.2.3
</spring-boot-admin.version>
<fastjson.version>
1.2.7
2
</fastjson.version>
<fastjson.version>
1.2.7
3
</fastjson.version>
<hutool.version>
5.3.
9
</hutool.version>
<hutool.version>
5.3.
10
</hutool.version>
<mybatis-plus.version>
3.3.
1
</mybatis-plus.version>
<mybatis-plus.version>
3.3.
2
</mybatis-plus.version>
<dynamic-datasource.version>
2.5.7
</dynamic-datasource.version>
<dynamic-datasource.version>
3.2.0
</dynamic-datasource.version>
<p6spy.version>
3.8.7
</p6spy.version>
<p6spy.version>
3.8.7
</p6spy.version>
<velocity.version>
2.1
</velocity.version>
<velocity.version>
2.1
</velocity.version>
<commons.io.version>
2.6
</commons.io.version>
<commons.io.version>
2.6
</commons.io.version>
...
...
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