批量发货导出

This commit is contained in:
liupopo
2024-02-04 11:30:44 +08:00
parent 729c4ae694
commit 51cc83b810

View File

@@ -31,12 +31,13 @@ public class OrdertoolsService {
ResultBean<FileUploadResult> fub = fileUploadComponent.uploadFile(file, "zfdd"); ResultBean<FileUploadResult> fub = fileUploadComponent.uploadFile(file, "zfdd");
String filePath = fub.getData().getFilePath(); String filePath = fub.getData().getFilePath();
String fp = fileUploadComponent.getUploadPath() + filePath; String fp = fileUploadComponent.getUploadPath() + filePath;
String outFilePath = "/zfdd/fhd" + System.currentTimeMillis() + ".xlsx"; String outFilePath = "zfdd/fhd" + System.currentTimeMillis() + ".xlsx";
String outFileName = fileUploadComponent.getUploadPath() + outFilePath; String outFileName = fileUploadComponent.getUploadPath() + outFilePath;
String outFileUrl = fileUploadComponent.getUrlPrefix() + outFilePath; String outFileUrl = fileUploadComponent.getUrlPrefix() + outFilePath;
List<WxOrderIn> inList = new ArrayList<>(); List<WxOrderIn> inList = new ArrayList<>();
ExcelReaderBuilder read = EasyExcel.read(fp, WxOrderIn.class, createReadListener(inList)); ExcelReaderBuilder read = EasyExcel.read(fp, WxOrderIn.class, createReadListener(inList));
read.sheet().doRead();
List<ToImportOrderExcel> toList = new ArrayList<>(); List<ToImportOrderExcel> toList = new ArrayList<>();
inList.forEach(inObj -> { inList.forEach(inObj -> {
@@ -47,12 +48,9 @@ public class OrdertoolsService {
toObj.setGoodsNames(ordOrderService.orderGoodsNames(inObj.getMerchantOrderNo())); toObj.setGoodsNames(ordOrderService.orderGoodsNames(inObj.getMerchantOrderNo()));
toList.add(toObj); toList.add(toObj);
}); });
EasyExcel.write(outFileName, ToImportOrderExcel.class).sheet("发货单").doWrite(toList);
// ArrayList EasyExcel.write(response.getOutputStream(), ReserveCustomerExcel.class).sheet("预约单明细").doWrite(list); return outFileUrl;
read.sheet().doRead();
return "";
} }
private ReadListener<WxOrderIn> createReadListener(List<WxOrderIn> inList) { private ReadListener<WxOrderIn> createReadListener(List<WxOrderIn> inList) {