Browse Source

批量发货导出

master
liupopo 1 year ago
parent
commit
51cc83b810
  1. 10
      src/main/java/com/yxt/yythmall/adminapi/ordertools/OrdertoolsService.java

10
src/main/java/com/yxt/yythmall/adminapi/ordertools/OrdertoolsService.java

@ -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) {

Loading…
Cancel
Save