Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit df4db8a4
authored
May 26, 2021
by
黄小葱
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
解决下载模板损坏的问题
1 parent
a064700a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
pom.xml
src/main/java/cn/com/glsx/admin/modules/controller/VehicleController.java
pom.xml
View file @
df4db8a
...
@@ -145,6 +145,21 @@
...
@@ -145,6 +145,21 @@
<skip>
true
</skip>
<skip>
true
</skip>
</configuration>
</configuration>
</plugin>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-resources-plugin
</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>
xlsx
</nonFilteredFileExtension>
<nonFilteredFileExtension>
xls
</nonFilteredFileExtension>
<nonFilteredFileExtension>
zip
</nonFilteredFileExtension>
<nonFilteredFileExtension>
cer
</nonFilteredFileExtension>
<nonFilteredFileExtension>
pfx
</nonFilteredFileExtension>
<nonFilteredFileExtension>
py
</nonFilteredFileExtension>
<nonFilteredFileExtension>
keystore
</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
</plugins>
</build>
</build>
</project>
</project>
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/admin/modules/controller/VehicleController.java
View file @
df4db8a
...
@@ -52,6 +52,8 @@ public class VehicleController {
...
@@ -52,6 +52,8 @@ public class VehicleController {
private
VehicleService
vehicleService
;
private
VehicleService
vehicleService
;
@Autowired
@Autowired
private
DeviceService
deviceService
;
private
DeviceService
deviceService
;
@Autowired
private
HttpServletResponse
response
;
@ApiOperation
(
value
=
"试驾车辆列表查询"
)
@ApiOperation
(
value
=
"试驾车辆列表查询"
)
@GetMapping
(
"/drivevehicle/search"
)
@GetMapping
(
"/drivevehicle/search"
)
...
@@ -101,7 +103,7 @@ public class VehicleController {
...
@@ -101,7 +103,7 @@ public class VehicleController {
@ApiOperation
(
value
=
"导出试驾车辆数据"
)
@ApiOperation
(
value
=
"导出试驾车辆数据"
)
@GetMapping
(
"/drivevehicle/export"
)
@GetMapping
(
"/drivevehicle/export"
)
public
void
exportDriveVehicle
(
HttpServletResponse
response
,
VehicleManageSearch
search
)
throws
Exception
{
public
void
exportDriveVehicle
(
VehicleManageSearch
search
)
throws
Exception
{
List
<
TrialDriveVehicleExport
>
list
=
vehicleService
.
exportDriveVehicle
(
search
);
List
<
TrialDriveVehicleExport
>
list
=
vehicleService
.
exportDriveVehicle
(
search
);
String
fileName
=
"试驾车辆_"
+
DateUtils
.
formatSerial
(
new
Date
());
String
fileName
=
"试驾车辆_"
+
DateUtils
.
formatSerial
(
new
Date
());
String
sheetName
=
"Sheet1"
;
String
sheetName
=
"Sheet1"
;
...
@@ -125,8 +127,7 @@ public class VehicleController {
...
@@ -125,8 +127,7 @@ public class VehicleController {
*/
*/
@ApiOperation
(
value
=
"下载车辆管理导入模板"
)
@ApiOperation
(
value
=
"下载车辆管理导入模板"
)
@GetMapping
(
value
=
"/drivevehicle/downloadtemplate"
)
@GetMapping
(
value
=
"/drivevehicle/downloadtemplate"
)
@ResponseBody
public
void
downloadTemplate
()
throws
Exception
{
public
void
downloadTemplate
(
HttpServletResponse
response
)
throws
Exception
{
InputStream
inputStream
=
VehicleController
.
class
.
getResourceAsStream
(
"/templates/importVehicle.xlsx"
);
InputStream
inputStream
=
VehicleController
.
class
.
getResourceAsStream
(
"/templates/importVehicle.xlsx"
);
String
fileName
=
"车辆管理导入模板"
;
String
fileName
=
"车辆管理导入模板"
;
FileIOUtil
.
download
(
inputStream
,
FileIOUtil
.
MimeType
.
EXCEL2007
,
fileName
,
response
);
FileIOUtil
.
download
(
inputStream
,
FileIOUtil
.
MimeType
.
EXCEL2007
,
fileName
,
response
);
...
@@ -134,8 +135,7 @@ public class VehicleController {
...
@@ -134,8 +135,7 @@ public class VehicleController {
@ApiOperation
(
value
=
"下载导入失败的文件"
)
@ApiOperation
(
value
=
"下载导入失败的文件"
)
@GetMapping
(
value
=
"/drivevehicle/downloadFailFile"
)
@GetMapping
(
value
=
"/drivevehicle/downloadFailFile"
)
@ResponseBody
public
void
downloadFailFile
(
String
failSeqNoFile
)
throws
Exception
{
public
void
downloadFailFile
(
HttpServletResponse
response
,
String
failSeqNoFile
)
throws
Exception
{
InputStream
inputStream
=
vehicleService
.
downloadFailExcelFile
(
failSeqNoFile
);
InputStream
inputStream
=
vehicleService
.
downloadFailExcelFile
(
failSeqNoFile
);
String
fileName
=
"试驾车辆_"
+
DateUtils
.
formatSerial
(
new
Date
());
String
fileName
=
"试驾车辆_"
+
DateUtils
.
formatSerial
(
new
Date
());
FileIOUtil
.
download
(
inputStream
,
FileIOUtil
.
MimeType
.
EXCEL2007
,
fileName
,
response
);
FileIOUtil
.
download
(
inputStream
,
FileIOUtil
.
MimeType
.
EXCEL2007
,
fileName
,
response
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment