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
e7592b9a
Commit
e7592b9a
authored
Oct 19, 2020
by
黎配弘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除处理存储型XSS
parent
af8d5f6d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
10 deletions
+21
-10
service-manager/src/main/java/com/winsun/service/impl/ExportExcelServiceImpl.java
+8
-1
task/src/main/java/com/winsun/service/ExportService.java
+13
-9
No files found.
service-manager/src/main/java/com/winsun/service/impl/ExportExcelServiceImpl.java
View file @
e7592b9a
...
@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.DataInputStream
;
import
java.io.DataInputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.text.SimpleDateFormat
;
/**
/**
* @author liph
* @author liph
...
@@ -25,7 +26,13 @@ public class ExportExcelServiceImpl implements ExportExcelService {
...
@@ -25,7 +26,13 @@ public class ExportExcelServiceImpl implements ExportExcelService {
ServletOutputStream
os
=
null
;
ServletOutputStream
os
=
null
;
try
{
try
{
os
=
response
.
getOutputStream
();
os
=
response
.
getOutputStream
();
fileInputStream
=
new
FileInputStream
(
new
File
(
exportExcel
.
getExportUrl
()));
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
String
formatPath
=
format
.
format
(
exportExcel
.
getCreateTime
());
StringBuilder
filePath
=
new
StringBuilder
();
filePath
.
append
(
"enclosure"
).
append
(
File
.
separator
).
append
(
"export"
).
append
(
File
.
separator
)
.
append
(
formatPath
).
append
(
File
.
separator
).
append
(
"订单"
)
.
append
(
exportExcel
.
getCreateTime
().
getTime
()).
append
(
".xls"
);
fileInputStream
=
new
FileInputStream
(
new
File
(
filePath
.
toString
()));
in
=
new
DataInputStream
(
fileInputStream
);
in
=
new
DataInputStream
(
fileInputStream
);
int
bytes
=
0
;
int
bytes
=
0
;
byte
[]
bufferOut
=
new
byte
[
1024
];
byte
[]
bufferOut
=
new
byte
[
1024
];
...
...
task/src/main/java/com/winsun/service/ExportService.java
View file @
e7592b9a
...
@@ -137,11 +137,11 @@ public class ExportService extends BaseController {
...
@@ -137,11 +137,11 @@ public class ExportService extends BaseController {
columns
.
add
(
"order_status"
);
columns
.
add
(
"order_status"
);
columns
.
add
(
"user_type"
);
columns
.
add
(
"user_type"
);
columns
.
add
(
"student_card_checkStatus"
);
columns
.
add
(
"student_card_checkStatus"
);
final
Date
fileCreateTime
=
new
Date
();
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
String
formatPath
=
format
.
format
(
new
Date
()
);
String
formatPath
=
format
.
format
(
fileCreateTime
);
String
filePath
=
FilePath
.
IMPORTPATH
.
getValue
()+
formatPath
;
String
filePath
=
FilePath
.
IMPORTPATH
.
getValue
()+
formatPath
;
String
fileName
=
"订单"
+
new
Date
().
getTime
()+
".xls"
;
String
filePath1
=
FilePath
.
IMPORTPATH
.
getValue
()+
formatPath
+
"/"
+
fileName
;
File
dir
=
new
File
(
filePath
);
File
dir
=
new
File
(
filePath
);
if
(!
dir
.
exists
())
{
if
(!
dir
.
exists
())
{
dir
.
mkdirs
();
dir
.
mkdirs
();
...
@@ -149,6 +149,16 @@ public class ExportService extends BaseController {
...
@@ -149,6 +149,16 @@ public class ExportService extends BaseController {
FileOutputStream
os
=
null
;
FileOutputStream
os
=
null
;
XSSFWorkbook
workbook
=
null
;
XSSFWorkbook
workbook
=
null
;
try
{
try
{
String
fileName
=
"订单"
+
fileCreateTime
.
getTime
()
+
".xls"
;
String
filePath1
=
FilePath
.
IMPORTPATH
.
getValue
()+
formatPath
+
"/"
+
fileName
;
ExportExcel
exportExcel
=
new
ExportExcel
();
exportExcel
.
setCreateTime
(
fileCreateTime
);
exportExcel
.
setCreateUser
(
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
()));
exportExcel
.
setCreateName
(
map
.
get
(
"userName"
).
toString
());
exportExcel
.
setExportUrl
(
filePath1
);
exportExcel
.
setFileName
(
fileName
);
workbook
=
new
XSSFWorkbook
();
workbook
=
new
XSSFWorkbook
();
os
=
new
FileOutputStream
(
filePath1
);
os
=
new
FileOutputStream
(
filePath1
);
//创建工作表
//创建工作表
...
@@ -182,12 +192,6 @@ public class ExportService extends BaseController {
...
@@ -182,12 +192,6 @@ public class ExportService extends BaseController {
}
}
}
}
workbook
.
write
(
os
);
workbook
.
write
(
os
);
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
);
exportExcelMapper
.
insert
(
exportExcel
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"文件出错!"
+
e
.
getMessage
(),
e
);
log
.
error
(
"文件出错!"
+
e
.
getMessage
(),
e
);
...
...
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