|
|
@ -3,6 +3,7 @@ package com.yxt.supervise.report.biz.reportinventory; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.io.FileUtil; |
|
|
|
import cn.hutool.core.thread.ThreadUtil; |
|
|
|
import cn.hutool.core.util.ZipUtil; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
@ -154,15 +155,52 @@ public class ReportInventoryService { |
|
|
|
*/ |
|
|
|
public List<String> xlsxMdspkc() { |
|
|
|
List<String> urlList = new ArrayList<>(); |
|
|
|
|
|
|
|
String currDay = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
String allUrl = xlsxMdspkcAll(currDay); |
|
|
|
urlList.add(allUrl); |
|
|
|
|
|
|
|
List<StoreVo> storeList = gdInventoryMapper.groupByStore(); |
|
|
|
for (StoreVo v : storeList) { |
|
|
|
String url = xlsxMdspkcOfCodeDay(v.getWarehouseCode(), v.getWarehouseName(), currDay); |
|
|
|
urlList.add(url); |
|
|
|
} |
|
|
|
|
|
|
|
zipStoreFile(currDay); |
|
|
|
return urlList; |
|
|
|
} |
|
|
|
|
|
|
|
private void zipStoreFile(String day) { |
|
|
|
String sourceDir = uploadPath + "gd36524/" + day; |
|
|
|
String targetFile = uploadPath + "gd36524/" + "门店商品库存" + day + "(分门店).zip"; |
|
|
|
ZipUtil.zip(sourceDir, targetFile); |
|
|
|
} |
|
|
|
|
|
|
|
public String xlsxMdspkcAll(String day) { |
|
|
|
|
|
|
|
String dayPath = uploadPath + "gd36524/"; |
|
|
|
FileUtil.mkdir(dayPath); |
|
|
|
|
|
|
|
String fileName = "gd36524/" + "门店商品库存" + day + ".xlsx"; |
|
|
|
String filePath = uploadPath + fileName; |
|
|
|
String fileUrl = urlPrefix + fileName; |
|
|
|
|
|
|
|
List<GdInventory2Excel> listOk = gdInventoryMapper.xlsxInventoryOk(); |
|
|
|
List<GdInventory2Excel> listYc = gdInventoryMapper.xlsxInventoryYc(); |
|
|
|
|
|
|
|
try (ExcelWriter excelWriter = EasyExcel.write(filePath).build()) { |
|
|
|
if (listOk != null && !listOk.isEmpty()) { |
|
|
|
WriteSheet writeSheet0 = EasyExcel.writerSheet(0, "商品库存").head(GdInventory2Excel.class).build(); |
|
|
|
excelWriter.write(listOk, writeSheet0); |
|
|
|
} |
|
|
|
if (listYc != null && !listYc.isEmpty()) { |
|
|
|
WriteSheet writeSheet1 = EasyExcel.writerSheet(1, "烟草库存").head(GdInventory2Excel.class).build(); |
|
|
|
excelWriter.write(listYc, writeSheet1); |
|
|
|
} |
|
|
|
} |
|
|
|
return fileUrl; |
|
|
|
} |
|
|
|
|
|
|
|
public String xlsxMdspkcOfCodeDay(String storeCode, String storeName, String day) { |
|
|
|
|
|
|
|
String dayPath = uploadPath + "gd36524/" + day; |
|
|
|