Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
f96ee9d9
Commit
f96ee9d9
authored
Jun 02, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合并空行BUG
parent
e5a05a84
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
7 deletions
+26
-7
ExcelHttp.java
.../src/main/java/com/yanzuoguang/cloud/excel/ExcelHttp.java
+6
-4
ExportData.java
...il-db/src/main/java/com/yanzuoguang/excel/ExportData.java
+6
-3
ExportTempRes.java
...db/src/main/java/com/yanzuoguang/excel/ExportTempRes.java
+14
-0
No files found.
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/excel/ExcelHttp.java
View file @
f96ee9d9
...
...
@@ -73,8 +73,8 @@ public class ExcelHttp<T extends Object> extends ExcelConsole<T> {
String
fileNameRow
=
this
.
getFileNameRow
();
File
fileRow
=
new
File
(
fileNameRow
);
boolean
isDown
=
file
.
exists
();
if
(
isDown
)
{
boolean
ok
=
file
.
exists
();
if
(
ok
&&
config
.
getExportType
()
!=
ExportData
.
EXPORT_TYPE_WAIT
)
{
// 下载文件
HttpFileHelper
.
localToDown
(
this
.
getFileName
(),
downFileName
,
response
);
}
else
{
...
...
@@ -84,11 +84,12 @@ public class ExcelHttp<T extends Object> extends ExcelConsole<T> {
res
.
setFileName
(
config
.
getFileName
());
res
.
setSize
(
fileTemp
.
length
());
res
.
setRow
(
StringHelper
.
toLong
(
FileHelper
.
readFile
(
fileRow
,
"utf-8"
)));
res
.
setOk
(
ok
);
// 输出结果
response
.
setContentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
response
.
getWriter
().
print
(
JsonHelper
.
serialize
(
res
));
}
return
isDown
;
return
ok
;
}
/**
...
...
@@ -116,7 +117,8 @@ public class ExcelHttp<T extends Object> extends ExcelConsole<T> {
ExcelHttp
<
M
>
excel
=
new
ExcelHttp
<>(
config
);
boolean
isDown
=
false
;
try
{
if
(
config
.
getExportType
()
==
ExportData
.
EXPORT_TYPE_COMMON
)
{
int
type
=
StringHelper
.
toInt
(
config
.
getExportType
());
if
(
type
==
ExportData
.
EXPORT_TYPE_COMMON
)
{
// 普通模式生成文件并下载
releaseExcel
(
req
,
excelDao
,
excel
);
}
else
if
(
isEmptyFile
)
{
...
...
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExportData.java
View file @
f96ee9d9
...
...
@@ -17,8 +17,11 @@ public class ExportData {
@ApiModelProperty
(
notes
=
"普通导出模式"
)
public
static
final
int
EXPORT_TYPE_COMMON
=
0
;
@ApiModelProperty
(
notes
=
"等待下载模式"
)
public
static
final
int
EXPORT_TYPE_WAIT_DOWN
=
1
;
@ApiModelProperty
(
notes
=
"等待下载"
)
public
static
final
int
EXPORT_TYPE_WAIT
=
1
;
@ApiModelProperty
(
notes
=
"下载文件"
)
public
static
final
int
EXPORT_TYPE_DOWN
=
2
;
@ApiModelProperty
(
notes
=
"行默认高度"
)
public
static
final
short
ROW_HEIGHT_UNIT
=
10
;
...
...
@@ -42,7 +45,7 @@ public class ExportData {
* 第一次请求会返回导出路径,后续几次会返回正在生成中,并且返回文件的大小,当生成完成后最后一次会下载文件)
*/
@ApiModelProperty
(
notes
=
"导出类型,0-实时导出,1-等待生成文件后下载(该类型需要请求多次:"
+
"第一次请求会返回导出路径,后续几次会返回正在生成中,并且返回文件的大小,当生成完成后最后一次会下载文件)"
,
required
=
true
)
"第一次请求会返回导出路径,后续几次会返回正在生成中,并且返回文件的大小,当生成完成后最后一次会下载文件)
,2-下载文件
"
,
required
=
true
)
private
int
exportType
;
/**
* 服务器保存路径
...
...
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExportTempRes.java
View file @
f96ee9d9
...
...
@@ -28,6 +28,12 @@ public class ExportTempRes extends BaseVo {
@ApiModelProperty
(
notes
=
"已生成文件行数"
)
private
long
row
;
/**
* 是否可以下载文件
*/
@ApiModelProperty
(
notes
=
"是否可以下载文件"
)
private
boolean
ok
;
public
String
getFileName
()
{
return
fileName
;
}
...
...
@@ -51,4 +57,12 @@ public class ExportTempRes extends BaseVo {
public
void
setRow
(
long
row
)
{
this
.
row
=
row
;
}
public
boolean
isOk
()
{
return
ok
;
}
public
void
setOk
(
boolean
ok
)
{
this
.
ok
=
ok
;
}
}
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