Commit f96ee9d9 authored by yanzg's avatar yanzg

合并空行BUG

parent e5a05a84
......@@ -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) {
......
......@@ -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;
/**
* 服务器保存路径
......
......@@ -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;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment