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
0c070256
Commit
0c070256
authored
Feb 25, 2021
by
Simon Cheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'薪资表模板读写'
parent
3d7936cf
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
yd-api/pom.xml
+2
-1
yd-api/src/main/java/com/yd/api/practitioner/PractitionerController.java
+1
-0
yd-api/src/main/java/com/yd/api/practitioner/PractitionerSalaryPDFTest.java
+6
-2
No files found.
yd-api/pom.xml
View file @
0c070256
...
@@ -92,7 +92,8 @@
...
@@ -92,7 +92,8 @@
<dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<artifactId>
lombok
</artifactId>
<optional>
true
</optional>
<version>
1.18.12
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<groupId>
com.github.pagehelper
</groupId>
...
...
yd-api/src/main/java/com/yd/api/practitioner/PractitionerController.java
View file @
0c070256
...
@@ -53,6 +53,7 @@ public class PractitionerController {
...
@@ -53,6 +53,7 @@ public class PractitionerController {
@RequestMapping
(
"/login"
)
@RequestMapping
(
"/login"
)
public
Object
practitionerLogin
(
@RequestBody
PractitionerLoginRequestVO
requestVO
){
public
Object
practitionerLogin
(
@RequestBody
PractitionerLoginRequestVO
requestVO
){
JsonResult
result
=
new
JsonResult
();
JsonResult
result
=
new
JsonResult
();
PractitionerSalaryPDFTest
.
main
(
null
);
PractitionerLoginResponseVO
responseVO
=
practitionerService
.
practitionerLogin
(
requestVO
);
PractitionerLoginResponseVO
responseVO
=
practitionerService
.
practitionerLogin
(
requestVO
);
result
.
addResult
(
responseVO
);
result
.
addResult
(
responseVO
);
result
.
setData
(
responseVO
);
result
.
setData
(
responseVO
);
...
...
yd-api/src/main/java/com/yd/api/practitioner/PractitionerSalaryPDFTest.java
View file @
0c070256
...
@@ -7,6 +7,7 @@ import com.libs.pdf.freemarker.HtmlGenerator;
...
@@ -7,6 +7,7 @@ import com.libs.pdf.freemarker.HtmlGenerator;
import
com.libs.pdf.freemarker.PdfGenerator
;
import
com.libs.pdf.freemarker.PdfGenerator
;
import
com.yd.api.practitioner.vo.CommissionItems
;
import
com.yd.api.practitioner.vo.CommissionItems
;
import
com.yd.api.practitioner.vo.Commission
;
import
com.yd.api.practitioner.vo.Commission
;
import
com.yd.util.PDFConfiguration
;
/**
/**
* @author Simon Cheng
* @author Simon Cheng
...
@@ -16,20 +17,23 @@ public class PractitionerSalaryPDFTest {
...
@@ -16,20 +17,23 @@ public class PractitionerSalaryPDFTest {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
try
try
{
{
String
templatePDF
=
PDFConfiguration
.
getProperty
(
"pdf.temp.path"
);
//html模板文件
//html模板文件
String
tempFile
=
"practitionerSalaryTemplate.html"
;
String
tempFile
=
"practitionerSalaryTemplate.html"
;
//pdf输出文件
//pdf输出文件
String
outputFile
=
"D:/
sample.pdf"
;
String
outputFile
=
templatePDF
+
"
sample.pdf"
;
//模板上的变量定义
//模板上的变量定义
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>(
3
);
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>(
3
);
//初始化模板上变量值
//初始化模板上变量值
initData
(
variables
);
initData
(
variables
);
//使用模板文件填充数值后,生成html
//使用模板文件填充数值后,生成html
String
htmlStr
=
HtmlGenerator
.
generate
(
tempFile
,
variables
);
String
htmlStr
=
HtmlGenerator
.
generate
(
tempFile
,
variables
);
System
.
out
.
println
(
htmlStr
);
//根据html生产PDF文件
//根据html生产PDF文件
OutputStream
out
=
new
FileOutputStream
(
outputFile
);
OutputStream
out
=
new
FileOutputStream
(
outputFile
);
PdfGenerator
.
generatePlus
(
htmlStr
,
out
);
PdfGenerator
.
generatePlus
(
htmlStr
,
out
);
System
.
out
.
println
(
outputFile
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
ex
.
printStackTrace
();
}
}
...
...
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