|
@@ -37,10 +37,10 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.FastByteArrayOutputStream;
|
|
|
import javax.imageio.ImageIO;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
-import java.io.File;
|
|
|
-import java.io.FileOutputStream;
|
|
|
-import java.io.IOException;
|
|
|
+import java.io.*;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@@ -263,7 +263,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String exportDetail(OrderRequest orderRequest) {
|
|
|
+ public void exportDetail(OrderRequest orderRequest,HttpServletResponse response) {
|
|
|
Workbook workbook = null;
|
|
|
File file = null;
|
|
|
try {
|
|
@@ -276,9 +276,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
return page.getRecords().stream().map(this::orderChangeOrderExport).collect(Collectors.toList());
|
|
|
},null);
|
|
|
if (null != workbook) {
|
|
|
- file = FileUtils.getFile(GlobalUtils.getTempBaseDir(), String.format("%s-%s.xlsx", "订单详情", System.currentTimeMillis() + ""));
|
|
|
- FileOutputStream allListingFileOutputStream = new FileOutputStream(file);
|
|
|
- workbook.write(allListingFileOutputStream);
|
|
|
+ String fileName = String.format("%s.xls", "订单详情");
|
|
|
+ ExcelUtils.downLoadExcel(fileName,response,workbook);
|
|
|
} else {
|
|
|
throw new CustomException("表格数据为空");
|
|
|
}
|
|
@@ -294,7 +293,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return file.getName();
|
|
|
}
|
|
|
|
|
|
public OrderExport orderChangeOrderExport(Order order){
|
|
@@ -330,20 +328,19 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String reportExport(Date startTime, Date endTime, Integer type) {
|
|
|
+ public void reportExport(Date startTime, Date endTime, Integer type, HttpServletResponse response) {
|
|
|
Workbook workbook = null;
|
|
|
File file = null;
|
|
|
try {
|
|
|
- ExportParams params = new ExportParams(null, "订单明细");
|
|
|
+ ExportParams params = new ExportParams(null, "订单统计");
|
|
|
workbook = ExcelExportUtil.exportBigExcel(params, OrderReport.class,
|
|
|
(o, i) -> {
|
|
|
CommonPage<OrderReport> list = this.orderReportList(i,30,startTime,endTime,type);
|
|
|
return new ArrayList<>(list.getRecords());
|
|
|
},null);
|
|
|
if (null != workbook) {
|
|
|
- file = FileUtils.getFile(GlobalUtils.getTempBaseDir(), String.format("%s-%s.xlsx", "订单明细", System.currentTimeMillis() + ""));
|
|
|
- FileOutputStream allListingFileOutputStream = new FileOutputStream(file);
|
|
|
- workbook.write(allListingFileOutputStream);
|
|
|
+ String fileName = String.format("%s.xls", "订单统计");
|
|
|
+ ExcelUtils.downLoadExcel(fileName,response,workbook);
|
|
|
} else {
|
|
|
throw new CustomException("表格数据为空");
|
|
|
}
|
|
@@ -359,7 +356,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return file.getName();
|
|
|
}
|
|
|
|
|
|
/**
|