Commit b0b2e279 authored by yanzg's avatar yanzg

导出数据

parent fc9cb9c9
...@@ -3,6 +3,7 @@ package com.yanzuoguang.cloud.excel; ...@@ -3,6 +3,7 @@ package com.yanzuoguang.cloud.excel;
import com.yanzuoguang.cloud.helper.HttpFileHelper; import com.yanzuoguang.cloud.helper.HttpFileHelper;
import com.yanzuoguang.excel.*; import com.yanzuoguang.excel.*;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.util.helper.StringHelper; import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.thread.ThreadHelper; import com.yanzuoguang.util.thread.ThreadHelper;
...@@ -68,11 +69,16 @@ public class ExcelHttp<T extends Object> extends ExcelConsole<T> { ...@@ -68,11 +69,16 @@ public class ExcelHttp<T extends Object> extends ExcelConsole<T> {
boolean isDown = file.exists(); boolean isDown = file.exists();
if (isDown) { if (isDown) {
// 下载文件
HttpFileHelper.localToDown(this.getFileName(), downFileName, response); HttpFileHelper.localToDown(this.getFileName(), downFileName, response);
} else { } else {
// 返回文件名和生成的文件大小
// 假如连续1分钟返回文件大小为0,则说明性能存在问题,或者是其他线程已经删除文件
ExportTempRes res = new ExportTempRes(); ExportTempRes res = new ExportTempRes();
res.setFileName(fileName); res.setFileName(fileName);
res.setSize(fileTemp.length()); res.setSize(fileTemp.length());
// 输出结果
response.getWriter().print(JsonHelper.serialize(res));
} }
return isDown; return isDown;
} }
......
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