Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-backend
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AutogeneralShanghai
yd-backend
Commits
3e005221
Commit
3e005221
authored
Feb 26, 2021
by
Simon Cheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'薪资单PDF输出'
parent
0c070256
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
yd-api/src/main/java/com/yd/api/practitioner/PractitionerSalaryPDFTest.java
+15
-4
No files found.
yd-api/src/main/java/com/yd/api/practitioner/PractitionerSalaryPDFTest.java
View file @
3e005221
...
...
@@ -22,16 +22,27 @@ public class PractitionerSalaryPDFTest {
//html模板文件
String
tempFile
=
"practitionerSalaryTemplate.html"
;
//pdf输出文件
String
outputFile
=
templatePDF
+
"sample.pdf"
;
//薪资单年月
String
yearMonth
=
"202012"
;
//经纪人ID
String
practitionerId
=
"17706"
;
//经纪人公司内部编号
String
practitionerCode
=
"YDSH00134"
;
String
outputFile
=
templatePDF
+
practitionerId
+
"Salary_"
+
yearMonth
+
"_"
+
practitionerCode
+
".pdf"
;
//模板上的变量定义
Map
<
String
,
Object
>
v
ariables
=
new
HashMap
<
String
,
Object
>(
3
);
Map
<
String
,
Object
>
dataV
ariables
=
new
HashMap
<
String
,
Object
>(
3
);
//初始化模板上变量值
initData
(
v
ariables
);
initData
(
dataV
ariables
);
//使用模板文件填充数值后,生成html
String
htmlStr
=
HtmlGenerator
.
generate
(
tempFile
,
v
ariables
);
String
htmlStr
=
HtmlGenerator
.
generate
(
tempFile
,
dataV
ariables
);
System
.
out
.
println
(
htmlStr
);
//根据html生产PDF文件
OutputStream
out
=
new
FileOutputStream
(
outputFile
);
//存放到OSS上,实例:
//https://yindun-images.oss-cn-shanghai-finance-1-pub.aliyuncs.com/payScale/20201207112601/17706Salary_202012_YDSH00134.pdf
PdfGenerator
.
generatePlus
(
htmlStr
,
out
);
System
.
out
.
println
(
outputFile
);
}
catch
(
Exception
ex
)
{
...
...
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