Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
56fae1fa
Commit
56fae1fa
authored
Oct 08, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车辆统计导出bug
parent
782a04d9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
VehicleCountRecordBiz.java
.../com/xxfc/platform/vehicle/biz/VehicleCountRecordBiz.java
+8
-7
VehicleCountRecordController.java
...c/platform/vehicle/rest/VehicleCountRecordController.java
+2
-2
No files found.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleCountRecordBiz.java
View file @
56fae1fa
...
...
@@ -362,23 +362,24 @@ public class VehicleCountRecordBiz extends BaseBiz<VehicleCountRecordMapper, Veh
}
}
public
String
export
(
ExcelParamDto
excelParamDto
)
{
public
ObjectRestResponse
export
(
ExcelParamDto
excelParamDto
)
{
ExcelExport
ee1
=
new
ExcelExport
();
ee1
.
addSheetByArray
(
excelParamDto
.
getName
(),
excelParamDto
.
getData
(),
excelParamDto
.
getHeader
());
String
fileName
=
"/data/temp/"
+
excelParamDto
.
getName
()
+
".xlsx"
;
String
path
=
"/data/temp/"
+
excelParamDto
.
getName
()
+
".xlsx"
;
OutputStream
fis
;
try
{
fis
=
new
FileOutputStream
(
fileName
);
fis
=
new
FileOutputStream
(
path
);
ee1
.
getWorkbook
().
write
(
fis
);
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
return
ObjectRestResponse
.
createFailedResult
(
1002
,
"文件不存在"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
ObjectRestResponse
.
createFailedResult
(
1002
,
"文件导出失败!"
);
}
return
fileName
;
return
ObjectRestResponse
.
succ
(
path
)
;
}
public
void
download
(
String
path
,
HttpServletResponse
response
)
{
public
HttpServletResponse
download
(
String
path
,
HttpServletResponse
response
)
{
try
{
// path是指欲下载的文件的路径。
File
file
=
new
File
(
path
);
...
...
@@ -386,7 +387,6 @@ public class VehicleCountRecordBiz extends BaseBiz<VehicleCountRecordMapper, Veh
String
filename
=
file
.
getName
();
// 取得文件的后缀名。
String
ext
=
filename
.
substring
(
filename
.
lastIndexOf
(
"."
)
+
1
).
toUpperCase
();
// 以流的形式下载文件。
InputStream
fis
=
new
BufferedInputStream
(
new
FileInputStream
(
path
));
byte
[]
buffer
=
new
byte
[
fis
.
available
()];
...
...
@@ -405,6 +405,7 @@ public class VehicleCountRecordBiz extends BaseBiz<VehicleCountRecordMapper, Veh
}
catch
(
IOException
ex
)
{
ex
.
printStackTrace
();
}
return
response
;
}
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleCountRecordController.java
View file @
56fae1fa
...
...
@@ -29,11 +29,11 @@ public class VehicleCountRecordController {
@PostMapping
(
"/app/unauth/export"
)
public
ObjectRestResponse
export
(
@RequestBody
ExcelParamDto
excelParamDto
)
{
return
ObjectRestResponse
.
succ
(
vehicleCountRecordBiz
.
export
(
excelParamDto
)
);
return
vehicleCountRecordBiz
.
export
(
excelParamDto
);
}
@PostMapping
(
"/app/unauth/download"
)
public
ObjectRestResponse
download
(
String
path
,
HttpServletResponse
response
)
{
public
ObjectRestResponse
download
(
@RequestBody
String
path
,
HttpServletResponse
response
)
{
vehicleCountRecordBiz
.
download
(
path
,
response
);
return
ObjectRestResponse
.
succ
();
}
...
...
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