Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
20d932bd
Commit
20d932bd
authored
Jul 30, 2019
by
季圣华
Browse files
解决导出excel的报错
parent
5e1a899f
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
20d932bd
...
...
@@ -553,16 +553,13 @@ public class DepotItemController {
* @return
*/
@GetMapping
(
value
=
"/exportExcel"
)
public
BaseResponseInfo
exportExcel
(
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
public
void
exportExcel
(
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"pageSize"
)
Integer
pageSize
,
@RequestParam
(
"projectId"
)
Integer
projectId
,
@RequestParam
(
"monthTime"
)
String
monthTime
,
@RequestParam
(
"headIds"
)
String
headIds
,
@RequestParam
(
"materialIds"
)
String
materialIds
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
String
message
=
"成功"
;
HttpServletRequest
request
,
HttpServletResponse
response
)
{
try
{
List
<
DepotItemVo4WithInfoEx
>
dataList
=
depotItemService
.
findByAll
(
headIds
,
materialIds
,
(
currentPage
-
1
)*
pageSize
,
pageSize
);
//存放数据json数组
...
...
@@ -604,16 +601,9 @@ public class DepotItemController {
}
File
file
=
ExcelUtils
.
exportObjectsWithoutTitle
(
title
,
names
,
title
,
objects
);
ExportExecUtil
.
showExec
(
file
,
file
.
getName
()
+
"-"
+
monthTime
,
response
);
res
.
code
=
200
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
message
=
"导出失败"
;
res
.
code
=
500
;
}
/**
* 2019-01-15response已经返回,finally部分完全没必要
* */
return
res
;
}
/**
...
...
src/main/java/com/jsh/erp/controller/SupplierController.java
View file @
20d932bd
...
...
@@ -292,15 +292,12 @@ public class SupplierController {
* @return
*/
@GetMapping
(
value
=
"/exportExcel"
)
public
BaseResponseInfo
exportExcel
(
@RequestParam
(
"supplier"
)
String
supplier
,
public
void
exportExcel
(
@RequestParam
(
"supplier"
)
String
supplier
,
@RequestParam
(
"type"
)
String
type
,
@RequestParam
(
"phonenum"
)
String
phonenum
,
@RequestParam
(
"telephone"
)
String
telephone
,
@RequestParam
(
"description"
)
String
description
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
String
message
=
"成功"
;
HttpServletRequest
request
,
HttpServletResponse
response
)
{
try
{
List
<
Supplier
>
dataList
=
supplierService
.
findByAll
(
supplier
,
type
,
phonenum
,
telephone
,
description
);
String
[]
names
=
{
"名称"
,
"类型"
,
"联系人"
,
"电话"
,
"电子邮箱"
,
"预收款"
,
"期初应收"
,
"期初应付"
,
"备注"
,
"传真"
,
"手机"
,
"地址"
,
"纳税人识别号"
,
"开户行"
,
"账号"
,
"税率"
,
"状态"
};
...
...
@@ -331,16 +328,9 @@ public class SupplierController {
}
File
file
=
ExcelUtils
.
exportObjectsWithoutTitle
(
title
,
names
,
title
,
objects
);
ExportExecUtil
.
showExec
(
file
,
file
.
getName
(),
response
);
res
.
code
=
200
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
message
=
"导出失败"
;
res
.
code
=
500
;
}
finally
{
map
.
put
(
"message"
,
message
);
res
.
data
=
map
;
}
return
res
;
}
/**
...
...
Write
Preview
Supports
Markdown
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