Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
8f276b49
Commit
8f276b49
authored
Dec 01, 2021
by
xixinzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
检查报告无法下载
parent
93c68329
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
CheckReportServiceImpl.java
...rvision/business/service/impl/CheckReportServiceImpl.java
+9
-7
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/service/impl/CheckReportServiceImpl.java
View file @
8f276b49
...
...
@@ -46,10 +46,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.BufferedOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.io.*
;
import
java.net.URLEncoder
;
import
java.text.ParseException
;
import
java.util.Arrays
;
...
...
@@ -296,15 +293,17 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep
report
.
setReportDate
(
getCheckReportDateStr
(
report
));
report
.
setNowDate
(
DateUtils
.
dateFormat
(
new
Date
(),
DateUtils
.
CHN_DATE_PATTERN
));
if
(!
ValidationUtil
.
isEmpty
(
report
))
{
String
checkReportTemplatePath
=
this
.
getClass
().
getClassLoader
().
getResource
(
"templates/check-report-template"
+
".docx"
).
getFile
();
// String checkReportTemplatePath = this.getClass().getClassLoader().getResource("templates/check-report-template.docx").getFile();
String
fileName
=
report
.
getName
()
+
".docx"
;
InputStream
resourceAsStream
=
this
.
getClass
().
getClassLoader
().
getResourceAsStream
(
"templates/check-report-template.docx"
);
CheckDangerTablePolicy
checkDangerTablePolicy
=
new
CheckDangerTablePolicy
();
ReviewDangerTablePolicy
reviewDangerTablePolicy
=
new
ReviewDangerTablePolicy
();
Configure
.
ConfigureBuilder
configureBuilder
=
Configure
.
newBuilder
();
configureBuilder
.
setElMode
(
ELMode
.
SPEL_MODE
).
bind
(
"checkDangerList"
,
checkDangerTablePolicy
).
bind
(
"reviewDangerList"
,
reviewDangerTablePolicy
).
build
();
XWPFTemplate
template
=
XWPFTemplate
.
compile
(
checkReportTemplatePath
,
configureBuilder
.
build
()).
render
(
report
);
// XWPFTemplate template = XWPFTemplate.compile(checkReportTemplatePath, configureBuilder.build()).render(report);
if
(
resourceAsStream
!=
null
)
{
XWPFTemplate
template
=
XWPFTemplate
.
compile
(
resourceAsStream
,
configureBuilder
.
build
()).
render
(
report
);
response
.
setContentType
(
"application/msword"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
"utf-8"
));
...
...
@@ -328,6 +327,9 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep
e
.
printStackTrace
();
}
}
}
else
{
log
.
error
(
"获取模板失败---------->"
);
}
}
}
...
...
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