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
7c64eda2
Commit
7c64eda2
authored
Jul 12, 2021
by
Jbb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
excel下载有问题 让前端解析
parent
1002e0cc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
service/view/src/main/java/com/founder/view/controller/TbStLayerDataController.java
+12
-9
No files found.
service/view/src/main/java/com/founder/view/controller/TbStLayerDataController.java
View file @
7c64eda2
...
@@ -48,18 +48,18 @@ public class TbStLayerDataController {
...
@@ -48,18 +48,18 @@ public class TbStLayerDataController {
* @param lrr
* @param lrr
* @param lrdwdm
* @param lrdwdm
* @param lrdwdc
* @param lrdwdc
* @param response
* @return
* @return
*/
*/
@RequestMapping
(
"/uploadExcel"
)
@RequestMapping
(
"/uploadExcel"
)
public
MapRestResult
uploadDown
(
@RequestParam
(
"excelFile"
)
MultipartFile
excelFile
,
public
MapRestResult
uploadDown
(
@RequestParam
(
"excelFile"
)
MultipartFile
excelFile
,
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
Double
threshold
,
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
Double
threshold
,
@RequestParam
(
required
=
false
)
String
lrr
,
@RequestParam
(
required
=
false
)
String
lrdwdm
,
@RequestParam
(
required
=
false
)
String
lrr
,
@RequestParam
(
required
=
false
)
String
lrdwdm
,
@RequestParam
(
required
=
false
)
String
lrdwdc
,
HttpServletResponse
response
)
{
@RequestParam
(
required
=
false
)
String
lrdwdc
)
{
TbStLayer
tbStLayer
=
new
TbStLayer
();
TbStLayer
tbStLayer
=
new
TbStLayer
();
String
layerId
=
KeyUtil
.
getUUIDKey
(
"L"
);
String
layerId
=
KeyUtil
.
getUUIDKey
(
"L"
);
ServletOutputStream
outputStream
=
null
;
/*
ServletOutputStream outputStream = null;
byte[] bytes = null;
byte[] bytes = null;
Boolean flag = null;*/
try
{
try
{
tbStLayer
.
setXxzjbh
(
layerId
);
tbStLayer
.
setXxzjbh
(
layerId
);
tbStLayer
.
setName
(
name
);
tbStLayer
.
setName
(
name
);
...
@@ -175,7 +175,7 @@ public class TbStLayerDataController {
...
@@ -175,7 +175,7 @@ public class TbStLayerDataController {
pointList
.
add
(
errorData
);
pointList
.
add
(
errorData
);
}
}
}
}
XSSFWorkbook
wb
=
new
XSSFWorkbook
();
/*
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet();
XSSFSheet sheet = wb.createSheet();
if(pointList != null && pointList.size() > 0){
if(pointList != null && pointList.size() > 0){
//输出流写入到excel中
//输出流写入到excel中
...
@@ -196,9 +196,9 @@ public class TbStLayerDataController {
...
@@ -196,9 +196,9 @@ public class TbStLayerDataController {
rowData.createCell(2).setCellValue(title);
rowData.createCell(2).setCellValue(title);
rowData.createCell(3).setCellValue(timeFormat);
rowData.createCell(3).setCellValue(timeFormat);
}
}
}
}
*/
//通过输出流下载
//通过输出流下载
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");
outputStream = response.getOutputStream();
outputStream = response.getOutputStream();
//设置文件响应输出格式
//设置文件响应输出格式
...
@@ -208,16 +208,19 @@ public class TbStLayerDataController {
...
@@ -208,16 +208,19 @@ public class TbStLayerDataController {
response.setContentType("application/msexcel;charset=utf-8");
response.setContentType("application/msexcel;charset=utf-8");
bytes = os.toByteArray();
bytes = os.toByteArray();
outputStream.write(bytes);
outputStream.write(bytes);
/*wb.write(outputStream);
*/
/*wb.write(outputStream);
wb.close();
wb.close();
outputStream.flush();
outputStream.flush();
outputStream.close();*/
outputStream.close();*//*
return
MapRestResult
.
build
(
200
,
"数据上传成功!"
,
bytes
);
flag = true;*/
//return null;
return
MapRestResult
.
build
(
200
,
"数据上传成功!"
,
pointList
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
//如果保存数据、poi生成excel失败了就将之前的数据删除....
//如果保存数据、poi生成excel失败了就将之前的数据删除....
tbStLayerService
.
removeById
(
layerId
);
tbStLayerService
.
removeById
(
layerId
);
accidentPointService
.
deleteByGlId
(
layerId
);
accidentPointService
.
deleteByGlId
(
layerId
);
//flag = false;
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