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
b53bc006
Commit
b53bc006
authored
Oct 08, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改交还车列表bug
parent
465f130c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
VehicleCountRecordBiz.java
.../com/xxfc/platform/vehicle/biz/VehicleCountRecordBiz.java
+22
-7
VehicleCountRecordController.java
...c/platform/vehicle/rest/VehicleCountRecordController.java
+4
-2
No files found.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleCountRecordBiz.java
View file @
b53bc006
...
...
@@ -26,10 +26,8 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.math.BigDecimal
;
import
java.sql.Timestamp
;
import
java.text.SimpleDateFormat
;
...
...
@@ -362,14 +360,31 @@ public class VehicleCountRecordBiz extends BaseBiz<VehicleCountRecordMapper, Veh
}
}
public
void
export
(
ExcelParamDto
excelParamDto
)
{
public
void
export
(
HttpServletResponse
response
,
ExcelParamDto
excelParamDto
)
{
ExcelExport
ee1
=
new
ExcelExport
();
ee1
.
addSheetByArray
(
excelParamDto
.
getName
(),
excelParamDto
.
getData
(),
excelParamDto
.
getHeader
());
OutputStream
fis
;
try
{
fis
=
new
FileOutputStream
(
"D:\\"
+
excelParamDto
.
getName
()
+
".xlsx"
);
fis
=
new
FileOutputStream
(
"/data/temp/"
+
excelParamDto
.
getName
()
+
".xlsx"
);
ee1
.
getWorkbook
().
write
(
fis
);
// 下载本地文件
String
fileName
=
excelParamDto
.
getName
()
+
".xlsx"
;
// 文件的默认保存名
// 读到流中
InputStream
inStream
=
new
FileInputStream
(
"d:/"
+
fileName
);
// 文件的存放路径
// 设置输出的格式
response
.
reset
();
response
.
setContentType
(
"bin"
);
response
.
addHeader
(
"Content-Disposition"
,
"attachment; filename=\""
+
fileName
+
"\""
);
// 循环取出流中的数据
byte
[]
b
=
new
byte
[
100
];
int
len
;
try
{
while
((
len
=
inStream
.
read
(
b
))
>
0
)
response
.
getOutputStream
().
write
(
b
,
0
,
len
);
inStream
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleCountRecordController.java
View file @
b53bc006
...
...
@@ -7,6 +7,8 @@ import com.xxfc.platform.vehicle.pojo.ExcelParamDto;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
@RestController
@RequestMapping
(
value
=
"/vehicleCount"
)
public
class
VehicleCountRecordController
{
...
...
@@ -26,8 +28,8 @@ public class VehicleCountRecordController {
}
@PostMapping
(
"/app/unauth/export"
)
public
ObjectRestResponse
export
(
@RequestBody
ExcelParamDto
excelParamDto
)
{
vehicleCountRecordBiz
.
export
(
excelParamDto
);
public
ObjectRestResponse
export
(
HttpServletResponse
response
,
@RequestBody
ExcelParamDto
excelParamDto
)
{
vehicleCountRecordBiz
.
export
(
response
,
excelParamDto
);
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