Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
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
常超
map-parent
Commits
10a5f283
Commit
10a5f283
authored
Jul 12, 2021
by
Jbb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下载excel 乱码问题
parent
d9d21b1d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
service/view/src/main/java/com/founder/view/controller/TbStLayerDataController.java
+7
-5
No files found.
service/view/src/main/java/com/founder/view/controller/TbStLayerDataController.java
View file @
10a5f283
...
@@ -55,6 +55,7 @@ public class TbStLayerDataController {
...
@@ -55,6 +55,7 @@ public class TbStLayerDataController {
@RequestParam
(
required
=
false
)
String
lrdwdc
,
HttpServletResponse
response
)
{
@RequestParam
(
required
=
false
)
String
lrdwdc
,
HttpServletResponse
response
)
{
TbStLayer
tbStLayer
=
new
TbStLayer
();
TbStLayer
tbStLayer
=
new
TbStLayer
();
String
layerId
=
KeyUtil
.
getUUIDKey
(
"L"
);
String
layerId
=
KeyUtil
.
getUUIDKey
(
"L"
);
ServletOutputStream
outputStream
=
null
;
try
{
try
{
tbStLayer
.
setXxzjbh
(
layerId
);
tbStLayer
.
setXxzjbh
(
layerId
);
tbStLayer
.
setName
(
name
);
tbStLayer
.
setName
(
name
);
...
@@ -192,18 +193,19 @@ public class TbStLayerDataController {
...
@@ -192,18 +193,19 @@ public class TbStLayerDataController {
rowData
.
createCell
(
3
).
setCellValue
(
timeFormat
);
rowData
.
createCell
(
3
).
setCellValue
(
timeFormat
);
}
}
//通过输出流下载
//通过输出流下载
ServletOutputStream
outputStream
=
response
.
getOutputStream
();
response
.
setCharacterEncoding
(
"UTF-8"
);
//设置文件响应输出格式
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename=error.xlsx"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename=error.xlsx"
);
wb
.
write
(
outputStream
);
outputStream
=
response
.
getOutputStream
();
//设置文件响应输出格式
//wb.write(outputStream);
outputStream
.
flush
();
outputStream
.
flush
();
outputStream
.
close
();
outputStream
.
close
();
}
}
return
MapRestResult
.
build
(
200
,
"数据上传成功!"
,
null
);
return
MapRestResult
.
build
(
200
,
"数据上传成功!"
,
outputStream
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
//如果失败了就将之前的数据删除....
//如果
保存数据、poi生成excel
失败了就将之前的数据删除....
tbStLayerService
.
removeById
(
layerId
);
tbStLayerService
.
removeById
(
layerId
);
accidentPointService
.
deleteByGlId
(
layerId
);
accidentPointService
.
deleteByGlId
(
layerId
);
return
MapRestResult
.
build
(
500
,
"数据上传失败!"
,
null
);
return
MapRestResult
.
build
(
500
,
"数据上传失败!"
,
null
);
...
...
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