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
44b84151
Commit
44b84151
authored
Aug 04, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
31ce94c0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
6 deletions
+14
-6
WordUtil.java
...ce/src/main/java/cn/datax/commo/office/word/WordUtil.java
+2
-2
DataApiServiceImpl.java
.../service/data/market/service/impl/DataApiServiceImpl.java
+9
-3
api_1.0.0.docx
...arket-service/src/main/resources/templates/api_1.0.0.docx
+0
-0
MetadataSourceServiceImpl.java
...data/metadata/service/impl/MetadataSourceServiceImpl.java
+3
-1
No files found.
datax-common/datax-common-office/src/main/java/cn/datax/commo/office/word/WordUtil.java
View file @
44b84151
...
...
@@ -171,7 +171,7 @@ public class WordUtil {
* @param doc word文件流
* @param watermarkText 水印内容
*/
p
rivate
stat
ic
void
insertWatermarkText
(
Document
doc
,
String
watermarkText
)
throws
Exception
{
p
ubl
ic
void
insertWatermarkText
(
Document
doc
,
String
watermarkText
)
throws
Exception
{
Shape
watermark
=
new
Shape
(
doc
,
ShapeType
.
TEXT_PLAIN_TEXT
);
watermark
.
setName
(
"WaterMark"
);
watermark
.
getTextPath
().
setText
(
watermarkText
);
...
...
@@ -195,7 +195,7 @@ public class WordUtil {
}
}
private
static
void
insertWatermarkIntoHeader
(
Paragraph
watermarkPara
,
Section
sect
,
int
headerType
)
throws
Exception
{
private
void
insertWatermarkIntoHeader
(
Paragraph
watermarkPara
,
Section
sect
,
int
headerType
)
throws
Exception
{
HeaderFooter
header
=
sect
.
getHeadersFooters
().
getByHeaderFooterType
(
headerType
);
if
(
header
==
null
)
{
header
=
new
HeaderFooter
(
sect
.
getDocument
(),
headerType
);
...
...
datax-modules/data-market-service-parent/data-market-service/src/main/java/cn/datax/service/data/market/service/impl/DataApiServiceImpl.java
View file @
44b84151
...
...
@@ -4,6 +4,8 @@ import cn.datax.commo.office.word.WordUtil;
import
cn.datax.common.core.DataConstant
;
import
cn.datax.common.exception.DataException
;
import
cn.datax.common.rabbitmq.config.RabbitMqConstant
;
import
cn.datax.common.utils.MD5Util
;
import
cn.datax.common.utils.SecurityUtil
;
import
cn.datax.common.utils.ThrowableUtil
;
import
cn.datax.service.data.market.api.dto.*
;
import
cn.datax.service.data.market.api.entity.DataApiEntity
;
...
...
@@ -253,11 +255,14 @@ public class DataApiServiceImpl extends BaseServiceImpl<DataApiDao, DataApiEntit
DataApiEntity
dataApiEntity
=
super
.
getById
(
id
);
// 合并模版
ClassPathResource
classPathResource
=
new
ClassPathResource
(
"templates/api_1.0.0.docx"
);
InputStream
inputStream
=
classPathResource
.
getInputStream
();
InputStream
inputStream
=
classPathResource
.
getInputStream
();
Document
doc
=
WordUtil
.
getInstance
().
getDocument
(
inputStream
);
// 提供字段
String
[]
fieldNames
=
new
String
[]
{
"apiName"
,
"apiVersion"
,
"reqMethod"
,
"resType"
,
"apiUrl"
,
"remark"
};
Object
[]
fieldValues
=
new
Object
[]
{
dataApiEntity
.
getApiName
(),
dataApiEntity
.
getApiVersion
(),
dataApiEntity
.
getReqMethod
(),
dataApiEntity
.
getResType
(),
"/services/"
+
dataApiEntity
.
getApiVersion
()+
dataApiEntity
.
getApiUrl
(),
dataApiEntity
.
getRemark
()};
MD5Util
mt
=
MD5Util
.
getInstance
();
String
apiKey
=
mt
.
encode
(
id
);
String
secretkey
=
mt
.
encode
(
SecurityUtil
.
getUserId
());
String
[]
fieldNames
=
new
String
[]
{
"apiName"
,
"apiVersion"
,
"reqMethod"
,
"resType"
,
"apiUrl"
,
"remark"
,
"apiKey"
,
"secretkey"
};
Object
[]
fieldValues
=
new
Object
[]
{
dataApiEntity
.
getApiName
(),
dataApiEntity
.
getApiVersion
(),
dataApiEntity
.
getReqMethod
(),
dataApiEntity
.
getResType
(),
"/services/"
+
dataApiEntity
.
getApiVersion
()+
dataApiEntity
.
getApiUrl
(),
dataApiEntity
.
getRemark
(),
apiKey
,
secretkey
};
MailMerge
mailMerge
=
doc
.
getMailMerge
();
mailMerge
.
execute
(
fieldNames
,
fieldValues
);
// 请求参数 TableStart:ReqParamList TableEnd:ReqParamList
...
...
@@ -296,6 +301,7 @@ public class DataApiServiceImpl extends BaseServiceImpl<DataApiDao, DataApiEntit
resParamTable
.
getRows
().
add
(
row
);
}
mailMerge
.
executeWithRegions
(
resParamTable
);
WordUtil
.
getInstance
().
insertWatermarkText
(
doc
,
SecurityUtil
.
getUserName
());
return
doc
;
}
}
datax-modules/data-market-service-parent/data-market-service/src/main/resources/templates/api_1.0.0.docx
View file @
44b84151
No preview for this file type
datax-modules/data-metadata-service-parent/data-metadata-service/src/main/java/cn/datax/service/data/metadata/service/impl/MetadataSourceServiceImpl.java
View file @
44b84151
...
...
@@ -9,6 +9,7 @@ import cn.datax.common.database.constants.DbQueryProperty;
import
cn.datax.common.database.core.DbColumn
;
import
cn.datax.common.database.core.DbTable
;
import
cn.datax.common.exception.DataException
;
import
cn.datax.common.utils.SecurityUtil
;
import
cn.datax.service.data.metadata.api.dto.DbSchema
;
import
cn.datax.service.data.metadata.api.dto.MetadataSourceDto
;
import
cn.datax.service.data.metadata.api.entity.MetadataColumnEntity
;
...
...
@@ -219,7 +220,7 @@ public class MetadataSourceServiceImpl extends BaseServiceImpl<MetadataSourceDao
dataSet
.
getRelations
().
add
(
dataRelation
);
// 合并模版
ClassPathResource
classPathResource
=
new
ClassPathResource
(
"templates/metadata_1.0.0.doc"
);
InputStream
inputStream
=
classPathResource
.
getInputStream
();
InputStream
inputStream
=
classPathResource
.
getInputStream
();
Document
doc
=
WordUtil
.
getInstance
().
getDocument
(
inputStream
);
// 提供数据源
String
[]
fieldNames
=
new
String
[]
{
"database"
};
...
...
@@ -227,6 +228,7 @@ public class MetadataSourceServiceImpl extends BaseServiceImpl<MetadataSourceDao
MailMerge
mailMerge
=
doc
.
getMailMerge
();
mailMerge
.
execute
(
fieldNames
,
fieldValues
);
mailMerge
.
executeWithRegions
(
dataSet
);
WordUtil
.
getInstance
().
insertWatermarkText
(
doc
,
SecurityUtil
.
getUserName
());
return
doc
;
}
}
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