Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
fc52fd80
Commit
fc52fd80
authored
Apr 17, 2019
by
chase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge 档案管理
parent
b2ffa029
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
4 deletions
+48
-4
TaxDocumentController.java
...va/pwc/taxtech/atms/controller/TaxDocumentController.java
+2
-2
FileTypesServiceImpl.java
...a/pwc/taxtech/atms/service/impl/FileTypesServiceImpl.java
+3
-1
TaxDocumentServiceImpl.java
...pwc/taxtech/atms/service/impl/TaxDocumentServiceImpl.java
+43
-1
No files found.
atms-api/src/main/java/pwc/taxtech/atms/controller/TaxDocumentController.java
View file @
fc52fd80
...
...
@@ -115,8 +115,8 @@ public class TaxDocumentController {
*/
@PostMapping
(
"/previewPDF"
)
@ResponseBody
public
void
previewPDF
(
@RequestBody
TaxDocumentDto
taxDocumentDto
)
{
taxDocumentService
.
previewPDF
(
taxDocumentDto
.
getPath
());
public
String
previewPDF
(
HttpServletResponse
response
,
@RequestBody
TaxDocumentDto
taxDocumentDto
)
{
return
taxDocumentService
.
previewPDF2
(
response
,
taxDocumentDto
.
getPath
());
/*InputStream is = null;
ByteArrayOutputStream os = null;
try {
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/FileTypesServiceImpl.java
View file @
fc52fd80
...
...
@@ -175,9 +175,11 @@ public class FileTypesServiceImpl {
* @param fileTypes
*/
private
void
requiredFieldFormatToJson
(
FileTypes
fileTypes
)
{
if
(
fileTypes
.
getRequiredField
().
size
()
>
0
)
{
if
(
null
!=
fileTypes
.
getRequiredField
()
&&
fileTypes
.
getRequiredField
().
size
()
>
0
)
{
String
requiredFieldJson
=
JSONObject
.
toJSONString
(
fileTypes
.
getRequiredField
());
fileTypes
.
setRequiredFieldJson
(
requiredFieldJson
);
}
else
{
throw
new
RuntimeException
(
"必填字段没有填写"
);
}
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/TaxDocumentServiceImpl.java
View file @
fc52fd80
...
...
@@ -432,10 +432,11 @@ public class TaxDocumentServiceImpl {
}
}
public
void
previewPDF
(
String
path
)
{
public
void
previewPDF
(
HttpServletResponse
response
,
String
path
)
{
String
imageType
=
"PNG"
;
OutputStream
sos
=
null
;
try
{
sos
=
response
.
getOutputStream
();
PDFToImg
(
sos
,
path
,
getPDFNum
(
path
),
imageType
);
}
catch
(
IOException
e
)
{
log
.
error
(
"PDF转换图片异常: "
+
e
.
getMessage
());
...
...
@@ -1217,4 +1218,45 @@ public class TaxDocumentServiceImpl {
}
return
is
;
}
public
String
previewPDF2
(
HttpServletResponse
response
,
String
path
)
{
InputStream
is
=
null
;
ByteArrayOutputStream
os
=
null
;
String
dUrlData
;
//pdf源路径
byte
[]
buff
=
new
byte
[
1024
];
int
len
;
try
{
is
=
getInputStreamByUrl
(
path
);
os
=
new
ByteArrayOutputStream
();
while
((
len
=
is
.
read
(
buff
))
!=
-
1
)
{
os
.
write
(
buff
,
0
,
len
);
}
os
.
flush
();
os
.
toByteArray
();
dUrlData
=
Base64
.
getEncoder
().
encodeToString
(
os
.
toByteArray
());
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
());
throw
new
RuntimeException
(
"pdf转换错误"
);
}
finally
{
if
(
is
!=
null
)
{
try
{
is
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
());
throw
new
RuntimeException
(
"pdf转换错误"
);
}
}
if
(
os
!=
null
)
{
try
{
os
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
());
throw
new
RuntimeException
(
"pdf转换错误"
);
}
}
}
return
dUrlData
;
}
}
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