Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-cost-system
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
bltdc
dc-cost-system
Commits
2a2f5a9f
Commit
2a2f5a9f
authored
Apr 28, 2020
by
yinyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
出纳附件文件下载
parent
ca4d9d30
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
1 deletion
+73
-1
CostListController.java
...m/blt/other/other_cost/controller/CostListController.java
+35
-0
CostDto.java
...e/src/main/java/com/blt/other/other_cost/dto/CostDto.java
+18
-0
CostCashiercallbackServiceImpl.java
...her_cost/service/impl/CostCashiercallbackServiceImpl.java
+2
-1
CostDomain.java
...n/java/com/blt/other/other_database/model/CostDomain.java
+18
-0
No files found.
cost-core/src/main/java/com/blt/other/other_cost/controller/CostListController.java
View file @
2a2f5a9f
...
@@ -299,4 +299,39 @@ public class CostListController {
...
@@ -299,4 +299,39 @@ public class CostListController {
.
contentType
(
MediaType
.
parseMediaType
(
"application/octet-stream"
))
.
contentType
(
MediaType
.
parseMediaType
(
"application/octet-stream"
))
.
body
(
new
InputStreamResource
(
file
.
getInputStream
()));
.
body
(
new
InputStreamResource
(
file
.
getInputStream
()));
}
}
@GetMapping
(
"downloadCashierAnnex"
)
public
ResponseEntity
<
InputStreamResource
>
downCashierAnnex
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
String
detailNo
=
request
.
getParameter
(
"detailNo"
);
CostDomain
cost
=
costService
.
getByNo
(
detailNo
);
String
filePath
=
null
;
String
fileName
=
null
;
if
(
null
!=
cost
)
{
filePath
=
cost
.
getCashierFilePath
();
if
(
null
!=
filePath
){
String
[]
split
=
filePath
.
split
(
"."
);
if
(
null
!=
split
&&
split
.
length
>=
1
){
fileName
=
split
[
split
.
length
-
1
];
}
}
}
else
{
return
null
;
}
FileSystemResource
file
=
new
FileSystemResource
(
filePath
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"Cache-Control"
,
"no-cache, no-store, must-revalidate"
);
// new String(fileName.getBytes("UTF-8"),"iso-8859-1") 解决文件下载的时候文件名乱码的问题
headers
.
add
(
"Content-Disposition"
,
String
.
format
(
"attachment; filename=\"%s\""
,
new
String
(
fileName
.
getBytes
(
"UTF-8"
),
"iso-8859-1"
)));
headers
.
add
(
"Pragma"
,
"no-cache"
);
headers
.
add
(
"Expires"
,
"0"
);
return
ResponseEntity
.
ok
()
.
headers
(
headers
)
.
contentLength
(
file
.
contentLength
())
.
contentType
(
MediaType
.
parseMediaType
(
"application/octet-stream"
))
.
body
(
new
InputStreamResource
(
file
.
getInputStream
()));
}
}
}
cost-core/src/main/java/com/blt/other/other_cost/dto/CostDto.java
View file @
2a2f5a9f
...
@@ -68,6 +68,8 @@ public class CostDto {
...
@@ -68,6 +68,8 @@ public class CostDto {
private
Integer
hasInvoice
;
private
Integer
hasInvoice
;
private
Integer
rejectType
;
private
Integer
rejectType
;
private
Integer
rejectTime
;
private
Integer
rejectTime
;
private
String
cashierFilePath
;
private
String
cashierDownloadPath
;
public
String
getDic
()
{
public
String
getDic
()
{
return
dic
;
return
dic
;
...
@@ -543,6 +545,22 @@ public class CostDto {
...
@@ -543,6 +545,22 @@ public class CostDto {
this
.
rejectTime
=
rejectTime
;
this
.
rejectTime
=
rejectTime
;
}
}
public
String
getCashierFilePath
()
{
return
cashierFilePath
;
}
public
void
setCashierFilePath
(
String
cashierFilePath
)
{
this
.
cashierFilePath
=
cashierFilePath
;
}
public
String
getCashierDownloadPath
()
{
return
cashierDownloadPath
;
}
public
void
setCashierDownloadPath
(
String
cashierDownloadPath
)
{
this
.
cashierDownloadPath
=
cashierDownloadPath
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"CostDto{"
+
return
"CostDto{"
+
...
...
cost-core/src/main/java/com/blt/other/other_cost/service/impl/CostCashiercallbackServiceImpl.java
View file @
2a2f5a9f
...
@@ -64,9 +64,10 @@ public class CostCashiercallbackServiceImpl implements CostCashiercallbackServic
...
@@ -64,9 +64,10 @@ public class CostCashiercallbackServiceImpl implements CostCashiercallbackServic
if
(!
downloadUrl
.
contains
(
"uploadfile"
))
{
if
(!
downloadUrl
.
contains
(
"uploadfile"
))
{
continue
;
continue
;
}
}
String
suffix
=
downloadUrl
.
substring
(
downloadUrl
.
lastIndexOf
(
"."
));
ResponseEntity
<
byte
[]>
response
=
restTemplate
.
exchange
(
downloadUrl
,
HttpMethod
.
GET
,
httpEntity
,
byte
[].
class
);
ResponseEntity
<
byte
[]>
response
=
restTemplate
.
exchange
(
downloadUrl
,
HttpMethod
.
GET
,
httpEntity
,
byte
[].
class
);
try
{
try
{
String
filePath
=
PathUtil
.
getBasePath
()+
PathUtil
.
getPath
(
"cashier/"
+
costNo
+
"/"
+
UUID
.
randomUUID
()+
"."
+
response
.
getHeaders
().
getContentType
().
getSubtype
()
);
String
filePath
=
PathUtil
.
getBasePath
()+
PathUtil
.
getPath
(
"cashier/"
+
costNo
+
"/"
+
UUID
.
randomUUID
()+
suffix
);
File
file
=
new
File
(
filePath
);
File
file
=
new
File
(
filePath
);
if
(!
file
.
getParentFile
().
exists
()){
if
(!
file
.
getParentFile
().
exists
()){
file
.
getParentFile
().
mkdirs
();
file
.
getParentFile
().
mkdirs
();
...
...
cost-core/src/main/java/com/blt/other/other_database/model/CostDomain.java
View file @
2a2f5a9f
...
@@ -63,6 +63,8 @@ public class CostDomain {
...
@@ -63,6 +63,8 @@ public class CostDomain {
private
Integer
hasInvoice
;
//发票状态
private
Integer
hasInvoice
;
//发票状态
private
Integer
rejectType
;
//驳回类型
private
Integer
rejectType
;
//驳回类型
private
Date
rejectTime
;
//财务驳回时间
private
Date
rejectTime
;
//财务驳回时间
private
String
cashierFilePath
;
private
String
cashierDownloadPath
;
public
String
getDic
()
{
public
String
getDic
()
{
return
dic
;
return
dic
;
...
@@ -497,6 +499,22 @@ public class CostDomain {
...
@@ -497,6 +499,22 @@ public class CostDomain {
this
.
rejectTime
=
rejectTime
;
this
.
rejectTime
=
rejectTime
;
}
}
public
String
getCashierFilePath
()
{
return
cashierFilePath
;
}
public
void
setCashierFilePath
(
String
cashierFilePath
)
{
this
.
cashierFilePath
=
cashierFilePath
;
}
public
String
getCashierDownloadPath
()
{
return
cashierDownloadPath
;
}
public
void
setCashierDownloadPath
(
String
cashierDownloadPath
)
{
this
.
cashierDownloadPath
=
cashierDownloadPath
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"CostDomain{"
+
return
"CostDomain{"
+
...
...
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