Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gdtel-gztel-school-center
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴学德
gdtel-gztel-school-center
Commits
b473858c
Commit
b473858c
authored
Sep 14, 2021
by
伍思炜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Excel文件下载
parent
f32f8e99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
task/src/main/java/com/winsun/service/ExportService.java
+20
-12
No files found.
task/src/main/java/com/winsun/service/ExportService.java
View file @
b473858c
...
@@ -137,10 +137,6 @@ public class ExportService extends BaseController {
...
@@ -137,10 +137,6 @@ public class ExportService extends BaseController {
userId
=
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
());
userId
=
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
());
}
}
List
<
Integer
>
userIds
=
(
List
<
Integer
>)
map
.
get
(
"userIds"
);
List
<
Integer
>
userIds
=
(
List
<
Integer
>)
map
.
get
(
"userIds"
);
EntityWrapper
<
Order
>
wrapper
=
new
EntityWrapper
();
EntityWrapper
<
Order
>
wrapper
=
new
EntityWrapper
();
...
@@ -235,10 +231,21 @@ public class ExportService extends BaseController {
...
@@ -235,10 +231,21 @@ public class ExportService extends BaseController {
columns
.
add
(
"parent_name"
);
columns
.
add
(
"parent_name"
);
columns
.
add
(
"student_number"
);
columns
.
add
(
"student_number"
);
columns
.
add
(
"class_number"
);
columns
.
add
(
"class_number"
);
ServletOutputStream
os
=
null
;
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
String
formatPath
=
format
.
format
(
new
Date
());
String
filePath
=
FilePath
.
IMPORTPATH
.
getValue
()+
formatPath
;
String
fileName
=
"订单"
+
new
Date
().
getTime
()+
".xls"
;
String
filePath1
=
FilePath
.
IMPORTPATH
.
getValue
()+
formatPath
+
"/"
+
fileName
;
File
dir
=
new
File
(
filePath
);
if
(!
dir
.
exists
())
{
dir
.
mkdirs
();
}
FileOutputStream
os
=
null
;
XSSFWorkbook
workbook
=
null
;
try
{
try
{
workbook
=
new
XSSFWorkbook
();
workbook
=
new
XSSFWorkbook
();
os
=
new
FileOutputStream
(
filePath1
);
//创建工作表
//创建工作表
XSSFSheet
sheet
=
workbook
.
createSheet
(
"订单清单"
);
XSSFSheet
sheet
=
workbook
.
createSheet
(
"订单清单"
);
//添加表头
//添加表头
...
@@ -305,13 +312,14 @@ public class ExportService extends BaseController {
...
@@ -305,13 +312,14 @@ public class ExportService extends BaseController {
}
}
}
}
}
}
HttpServletResponse
response
=
getHttpServletResponse
();
response
.
reset
();
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setContentType
(
"application/octet-stream"
);
os
=
response
.
getOutputStream
();
workbook
.
write
(
os
);
workbook
.
write
(
os
);
os
.
flush
();
ExportExcel
exportExcel
=
new
ExportExcel
();
exportExcel
.
setCreateTime
(
new
Date
());
exportExcel
.
setCreateUser
(
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
()));
exportExcel
.
setCreateName
(
map
.
get
(
"userName"
).
toString
());
exportExcel
.
setExportUrl
(
filePath1
);
exportExcel
.
setFileName
(
fileName
);
exportExcelMapper
.
insert
(
exportExcel
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"文件出错!"
+
e
.
getMessage
(),
e
);
log
.
error
(
"文件出错!"
+
e
.
getMessage
(),
e
);
}
finally
{
}
finally
{
...
...
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