瀏覽代碼

Merge branch 'hotfix' into publish

DYH2020 2 年之前
父節點
當前提交
5c2743e1e3

+ 2 - 2
src/main/java/com/ywt/mg/services/CheckUpOrderService.java

@@ -192,7 +192,7 @@ public class CheckUpOrderService {
             }
             int size = list.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
 
         } catch (Exception e) {
             logger.error("/checkUp/downloadCheckUpOrderList(): {}", e.getMessage(), e);
@@ -300,7 +300,7 @@ public class CheckUpOrderService {
             }
             int size = checkUpOrderList.size();
             List<ExcelCollectPojo> itemList = new ArrayList<>();
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
         } catch (Exception e) {
             logger.error("/checkUp/downloadCheckUpOrderBillList(): {}", e.getMessage(), e);
             e.printStackTrace();

+ 4 - 2
src/main/java/com/ywt/mg/services/DepositService.java

@@ -240,8 +240,9 @@ public class DepositService {
                 }
 
             }
+            int total = list.getTotal();
             List<ExcelCollectPojo> itemList = new ArrayList<>();
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, total);
         } catch (Exception e) {
             logger.error("/deposit/downloadDepositList(): {}", e.getMessage(), e);
             e.printStackTrace();
@@ -368,8 +369,9 @@ public class DepositService {
                 }
 
             }
+            int total = depositPageList.getTotal();
             List<ExcelCollectPojo> itemList = new ArrayList<>();
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, total);
         } catch (Exception e) {
             logger.error("/deposit/downloadDepositBillList(): {}", e.getMessage(), e);
             e.printStackTrace();

+ 16 - 15
src/main/java/com/ywt/mg/services/DownloadRecordService.java

@@ -1,8 +1,5 @@
 package com.ywt.mg.services;
 
-import com.ywt.gapi.ResultCode;
-import com.ywt.gapi.base.file.ReadFileRequest;
-import com.ywt.gapi.base.file.ReadFileResponse;
 import com.ywt.mg.configs.Constants;
 import com.ywt.mg.core.PagedList;
 import com.ywt.mg.core.SqlHelper;
@@ -13,29 +10,24 @@ import com.ywt.mg.domain.models.ConstantDef;
 import com.ywt.mg.domain.models.ExcelDataMap;
 import com.ywt.mg.domain.models.ExcelStyleMap;
 import com.ywt.mg.domain.models.enums.DownloadRecordStatusEnum;
-import com.ywt.mg.domain.models.enums.TosEnum;
 import com.ywt.mg.domain.models.pojo.CustomExcelItem;
 import com.ywt.mg.domain.models.pojo.ExcelCollectPojo;
 import com.ywt.mg.domain.ywtDrugEntities.Pharmacy;
-import com.ywt.mg.domain.ywtDrugEntities.PharmacyRepository;
 import com.ywt.mg.params.downloadRecord.DownloadFileRequest;
 import com.ywt.mg.params.downloadRecord.QueryDownloadRecordListRequest;
-import com.ywt.mg.params.offline.DownloadOfflineListNewRequest;
 import com.ywt.mg.web.BaseResponse;
 import com.ywt.mg.web.DataResponse;
 import com.ywt.mg.web.PageDataResponse;
+import com.ywt.mg.web.common.ExcelDownloadSrvOld;
 import com.ywt.mg.web.common.ExcelDownloadSrv;
 import com.ywt.mg.web.common.FileSrv;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.stereotype.Service;
-import sun.rmi.runtime.Log;
-import sun.security.provider.MD5;
 
 import javax.servlet.http.HttpServletResponse;
-import java.io.OutputStream;
+import java.io.*;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -63,6 +55,10 @@ public class DownloadRecordService {
     private FileSrv fileSrv;
 
     @Autowired
+    private ExcelDownloadSrv excelDownloadSrvOld;
+
+
+    @Autowired
     private ExcelDownloadSrv excelDownloadSrv;
 
     /**
@@ -327,7 +323,7 @@ public class DownloadRecordService {
      * @param itemList         统计map
      * @throws Exception
      */
-    public void createFileAndUploadOssAndSaveToDataBase(String fileName, int downloadRecordId, ExcelDataMap map, List<ExcelCollectPojo> itemList) throws Exception {
+    public void createFileAndUploadOssAndSaveToDataBase(String fileName, int downloadRecordId, ExcelDataMap map, List<ExcelCollectPojo> itemList, int size) throws Exception {
         // 前缀(路径)
         String preLocalPath = ConstantDef.LOCAL_DOWNLOAD_FILE_PATH;
         // 后缀(下载时间和格式)
@@ -337,8 +333,13 @@ public class DownloadRecordService {
 
         // 生成本地文件
         ExcelStyleMap excelStyleMap = new ExcelStyleMap(new String[]{});
-        OutputStream ba = excelDownloadSrv.generateAndReturnExcelFileWithNoStyleAndCollectLocal(fileName, localPath, map, excelStyleMap, itemList);
-
+        /*
+        // ------ start test ----------
+         OutputStream ba = excelDownloadSrvNew.generateAndReturnExcelByteArrayOutputStreamWithStyleAndCollect(fileName, localPath, map, excelStyleMap, itemList, size);
+         excelDownloadSrv.outputStreamToFile(localPath, ba);
+         // ------ test end ----------
+         */
+        OutputStream ba = excelDownloadSrv.generateAndReturnExcelByteArrayOutputStreamWithStyleAndCollect(fileName, localPath, map, excelStyleMap, itemList, size);
         // 本地文件上传到oss,文件名带后缀
         String ossPath = String.format(ConstantDef.BIG_DATA_EXCEL_FILE_PATH, FormatUtil.formatDate(new Date(), "yyyy-MM"));
         String ossFileName = fileName + suffixFormat;
@@ -364,7 +365,7 @@ public class DownloadRecordService {
      * @param itemList         统计map
      * @throws Exception
      */
-    public void createMealFileAndUploadOssAndSaveToDataBase(String fileName, int downloadRecordId, ExcelDataMap map, List<CustomExcelItem> itemList) throws Exception {
+    public void createMealFileAndUploadOssAndSaveToDataBase(String fileName, int downloadRecordId, ExcelDataMap map, List<CustomExcelItem> itemList, int size) throws Exception {
         // 前缀(路径)
         String preLocalPath = ConstantDef.LOCAL_DOWNLOAD_FILE_PATH;
         // 后缀(下载时间和格式)
@@ -374,7 +375,7 @@ public class DownloadRecordService {
 
         // 生成本地文件
         ExcelStyleMap excelStyleMap = new ExcelStyleMap(new String[]{});
-        OutputStream ba = excelDownloadSrv.generateAndReturnMealExcelFileWithNoStyleAndCollectLocal(fileName, localPath, map, excelStyleMap, itemList);
+        OutputStream ba = excelDownloadSrv.generateAndReturnExcelByteArrayOutputStreamWithStyle(fileName, localPath, map, excelStyleMap, itemList);
 
         // 本地文件上传到oss,文件名带后缀
         String ossPath = String.format(ConstantDef.BIG_DATA_EXCEL_FILE_PATH, FormatUtil.formatDate(new Date(), "yyyy-MM"));

+ 12 - 12
src/main/java/com/ywt/mg/services/MealOrderService.java

@@ -17,7 +17,7 @@ import com.ywt.mg.domain.models.nutrimeal.MealOrderInfo;
 import com.ywt.mg.domain.models.pojo.CustomExcelItem;
 import com.ywt.mg.domain.models.pojo.ExcelCollectPojo;
 import com.ywt.mg.params.mealOrder.MealOrderListRequest;
-import com.ywt.mg.web.common.ExcelDownloadSrv;
+import com.ywt.mg.web.common.ExcelDownloadSrvOld;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -414,7 +414,7 @@ public class MealOrderService {
 //         downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
             List<CustomExcelItem> itemList = getStatisticsData(userMealOrderViews, shopList);
             downloadRecordService.createMealFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map,
-                    needStat ? itemList : null);
+                    needStat ? itemList : null, size);
 
         } catch (Exception e) {
             logger.error("/mealOrder/downloadMealOrderList(): {}", e.getMessage(), e);
@@ -622,23 +622,23 @@ public class MealOrderService {
         }
         if (customExcelItemList.size() > 0) {
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows,
-                    "备注(单位:元):", ExcelDownloadSrv.getCellFormat4StatRemarkWithNoSetBorder()));
+                    "备注(单位:元):", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 1,
-                    "1、支付总额=微信支付总额+金币支付总额+现场支付总额;", ExcelDownloadSrv.getCellFormat4StatRemarkWithNoSetBorder()));
+                    "1、支付总额=微信支付总额+金币支付总额+现场支付总额;", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 2,
-                    "2、退款总额=微信退款总额+金币退款总额+现场退款总额;", ExcelDownloadSrv.getCellFormat4StatRemarkWithNoSetBorder()));
+                    "2、退款总额=微信退款总额+金币退款总额+现场退款总额;", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 3,
-                    "3、实际支付总额=微信实际支付总额+金币实际支付总额+现场实际支付总额=支付总额-退款总额;", ExcelDownloadSrv.getCellFormat4StatRemarkWithNoSetBorder()));
+                    "3、实际支付总额=微信实际支付总额+金币实际支付总额+现场实际支付总额=支付总额-退款总额;", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 4,
-                    "4、总成本=微信点单成本+金币点单成本+现场点单成本(也等于各个菜品成本价乘以份数的相加的总额);", ExcelDownloadSrv.getCellFormat4StatRemarkWithNoSetBorder()));
+                    "4、总成本=微信点单成本+金币点单成本+现场点单成本(也等于各个菜品成本价乘以份数的相加的总额);", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 5,
-                    "5、微信点单成本:支付方式是“微信支付”的订单,其各个菜品成本价乘以份数的相加的总额(不包含退款订单);", ExcelDownloadSrv.getCellFormat4StatRemarkWithNoSetBorder()));
+                    "5、微信点单成本:支付方式是“微信支付”的订单,其各个菜品成本价乘以份数的相加的总额(不包含退款订单);", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 6,
-                    "   金币点单成本:支付方式是“微信+金币”的订单,其各个菜品成本价乘以份数的相加的总额(不包含退款订单);", ExcelDownloadSrv.getCellFormat4StatRemarkWithNoSetBorder()));
+                    "   金币点单成本:支付方式是“微信+金币”的订单,其各个菜品成本价乘以份数的相加的总额(不包含退款订单);", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 7,
-                    "   现场点单成本:支付方式是“现场支付”的订单,其各个菜品成本价乘以份数的相加的总额(不包含退款订单);", ExcelDownloadSrv.getCellFormat4StatRemarkWithNoSetBorder()));
+                    "   现场点单成本:支付方式是“现场支付”的订单,其各个菜品成本价乘以份数的相加的总额(不包含退款订单);", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 8,
-                    "6、2元洗碗费总额:支付方式是“微信+金币”的订单,其微信支付部分的总额(不包含退款订单)。", ExcelDownloadSrv.getCellFormat4StatRemarkWithNoSetBorder()));
+                    "6、2元洗碗费总额:支付方式是“微信+金币”的订单,其微信支付部分的总额(不包含退款订单)。", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
         }
         return customExcelItemList;
     }
@@ -815,7 +815,7 @@ public class MealOrderService {
             }
             int size = list.size();
             List<ExcelCollectPojo> itemList = new ArrayList<>();
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
 
         } catch (Exception e) {
             logger.error("/mealOrder/downloadMealOrderBillsList(): {}", e.getMessage(), e);

+ 1 - 1
src/main/java/com/ywt/mg/services/NatOrderService.java

@@ -215,7 +215,7 @@ public class NatOrderService {
             }
             int size = list.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
 
         } catch (Exception e) {
             logger.error("/natOrder/downloadNatOrderList: {}", e.getMessage(), e);

+ 1 - 1
src/main/java/com/ywt/mg/services/OfflineNewService.java

@@ -340,7 +340,7 @@ public class OfflineNewService {
             int size = offlineList.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal);
             // 创建文件 并且上传到 OSS,最后保存到本地数据库
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
         } catch (Exception e) {
             logger.error("/offline/downloadOfflineList(): {}", e.getMessage(), e);
             e.printStackTrace();

+ 2 - 2
src/main/java/com/ywt/mg/services/OutpatientOrderService.java

@@ -364,7 +364,7 @@ public class OutpatientOrderService {
             }
             int size = list.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
         } catch (Exception e) {
             logger.error("/outPatient/downloadOutPatientOrderList(): {}", e.getMessage(), e);
             e.printStackTrace();
@@ -515,7 +515,7 @@ public class OutpatientOrderService {
             }
             int size = outpatientOrderList.size();
             List<ExcelCollectPojo> itemList = new ArrayList<>();
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
         } catch (Exception e) {
             logger.error("/registeredOrder/downloadRegisteredOrderList: {}", e.getMessage(), e);
             e.printStackTrace();

+ 1 - 1
src/main/java/com/ywt/mg/services/PharmacyService.java

@@ -474,7 +474,7 @@ public class PharmacyService {
                     posPay, posRefundTotal,
                     medicalInsurancePay, medicalInsuranceRefundTotal,
                     icbcPay, icbcRefundTotal);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
 
         } catch (Exception e) {
             logger.error("/pharmacy/downloadPrescriptionlist(): {}", e.getMessage(), e);

+ 2 - 2
src/main/java/com/ywt/mg/services/PrescriptionServices.java

@@ -459,7 +459,7 @@ public class PrescriptionServices {
                     posPay, posRefundTotal,
                     medicalInsurancePay, medicalInsuranceRefundTotal,
                     icbcPay, icbcRefundTotal);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
 
 
         } catch (Exception e) {
@@ -863,7 +863,7 @@ public class PrescriptionServices {
             }
             int size = list.size();
             List<ExcelCollectPojo> itemList = new ArrayList<>();
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
         } catch (Exception e) {
             logger.error("/prescription/downloadPrescriptionDrugList(): {}", e.getMessage(), e);
             e.printStackTrace();

+ 3 - 2
src/main/java/com/ywt/mg/services/RegisteredOrderService.java

@@ -433,7 +433,7 @@ public class RegisteredOrderService {
             }
             int size = registeredOrderList.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
 
         } catch (Exception e) {
             logger.error("/registeredOrder/downloadRegisteredOrderList: {}", e.getMessage(), e);
@@ -639,8 +639,9 @@ public class RegisteredOrderService {
                 }
 
             }
+            int size =  registeredOrderList.size();
             List<ExcelCollectPojo> itemList = new ArrayList<>();
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
 
         } catch (Exception e) {
             logger.error("/registeredOrder/downloadRegisteredOrderBillsList: {}", e.getMessage(), e);

+ 231 - 148
src/main/java/com/ywt/mg/web/common/ExcelDownloadSrv.java

@@ -8,27 +8,22 @@ import com.ywt.mg.domain.models.ExcelStyleMap;
 import com.ywt.mg.domain.models.pojo.CustomExcelItem;
 import com.ywt.mg.domain.models.pojo.ExcelCollectPojo;
 import jxl.Workbook;
-import jxl.format.*;
 import jxl.format.Alignment;
 import jxl.format.Border;
 import jxl.format.BorderLineStyle;
 import jxl.format.Colour;
 import jxl.format.VerticalAlignment;
+import jxl.format.*;
 import jxl.write.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
 
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
+import java.io.*;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author daiyihua
@@ -40,6 +35,9 @@ import java.util.List;
 public class ExcelDownloadSrv {
     private final Logger logger = LoggerFactory.getLogger(getClass().getName());
 
+    // 每个单元格最多存放多少行数据
+    private final int SHEET_MAX_SIZE = 6000;
+
     /**
      * 下载excel 时 设置 httpServletResponse
      */
@@ -89,24 +87,13 @@ public class ExcelDownloadSrv {
         if (data == null || data.isEmpty()) {
             throw new AppMessageException("数据为空");
         }
-        try (OutputStream out = ExcelDownloadSrv.setHttpServletResponse(httpServletResponse, fileName + ".xls").getOutputStream()) {
+        try (OutputStream out = ExcelDownloadSrvOld.setHttpServletResponse(httpServletResponse, fileName + ".xls").getOutputStream()) {
             // 创建写工作簿对象
             WritableWorkbook workbook = Workbook.createWorkbook(out);
             // 工作表
             WritableSheet sheet = workbook.createSheet(fileName, 0);
-            //表头格式
-            WritableCellFormat cellFormat = ExcelDownloadSrv.getWritableCellFormat();
-            //数据行格式
-            // 设置背景、字体颜色、对齐方式等等;
-            WritableFont font2 = new WritableFont(WritableFont.ARIAL, 14, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
-            WritableCellFormat cellFormat2 = new WritableCellFormat(font2);
-            //设置文字居中对齐方式;
-            cellFormat2.setAlignment(Alignment.CENTRE);
-            //设置垂直居中;
-            cellFormat2.setVerticalAlignment(VerticalAlignment.CENTRE);
-            cellFormat2.setBackground(Colour.WHITE);
-            cellFormat2.setBorder(Border.ALL, BorderLineStyle.THIN);
-            cellFormat2.setWrap(true);
+            // 获取带样式的cell
+            WritableCellFormat cellFormat = getWritableCellFormat();
             //给sheet电子版中所有的列设置默认的列的宽度;
             sheet.getSettings().setDefaultColumnWidth(20);
             sheet.getSettings().setDefaultRowHeight(30 * 20);
@@ -134,7 +121,7 @@ public class ExcelDownloadSrv {
                 sheet.addCell(label);
                 List<String> colData = data.get(key);
                 for (int i = 0; i < colData.size(); i++) {
-                    Label lb = new Label(headerColumn, i + 1, Checker.getStringValue(colData.get(i)), cellFormat2);
+                    Label lb = new Label(headerColumn, i + 1, Checker.getStringValue(colData.get(i)), cellFormat);
                     sheet.addCell(lb);
                 }
                 headerColumn++;
@@ -163,7 +150,7 @@ public class ExcelDownloadSrv {
         if (data == null || data.isEmpty()) {
             throw new AppMessageException("数据为空");
         }
-        try (OutputStream out = ExcelDownloadSrv.setHttpServletResponse(httpServletResponse, fileName + ".xls").getOutputStream()) {
+        try (OutputStream out = ExcelDownloadSrvOld.setHttpServletResponse(httpServletResponse, fileName + ".xls").getOutputStream()) {
             // 创建写工作簿对象
             WritableWorkbook workbook = Workbook.createWorkbook(out);
             // 工作表
@@ -221,7 +208,7 @@ public class ExcelDownloadSrv {
         if (data == null || data.isEmpty()) {
             throw new AppMessageException("数据为空");
         }
-        try (OutputStream out = ExcelDownloadSrv.setHttpServletResponse(httpServletResponse, fileName + ".xls").getOutputStream()) {
+        try (OutputStream out = ExcelDownloadSrvOld.setHttpServletResponse(httpServletResponse, fileName + ".xls").getOutputStream()) {
             // 创建写工作簿对象
             WritableWorkbook workbook = Workbook.createWorkbook(out);
             // 工作表
@@ -282,13 +269,13 @@ public class ExcelDownloadSrv {
     /**
      * 通用的生成 Excel 文件(包含汇总)并以流返回(一点样式也没有)
      *
-     * @param fileName            excel 文件名
-     * @param data                需要填充的数据,key 是列名,value 是每一列的数据组成的 list, 类型必须是 {@link String}
+     * @param fileName excel 文件名
+     * @param data     需要填充的数据,key 是列名,value 是每一列的数据组成的 list, 类型必须是 {@link String}
      * @throws AppMessageException 业务层异常抛出,如传入数据为空
      * @author Walker, added on 06/27/2019.
      */
-    public OutputStream  generateAndReturnExcelFileWithNoStyleAndCollectLocal(String fileName, String path, ExcelDataMap data, ExcelStyleMap excelStyleMap,
-                                                                       List<ExcelCollectPojo> collectList) throws AppMessageException {
+    public OutputStream generateAndReturnExcelByteArrayOutputStreamWithStyleAndCollect(String fileName, String path, ExcelDataMap data, ExcelStyleMap excelStyleMap,
+                                                                                       List<ExcelCollectPojo> collectList, int size) throws AppMessageException {
 
         OutputStream ba = null;
         ba = new ByteArrayOutputStream();
@@ -297,76 +284,104 @@ public class ExcelDownloadSrv {
             throw new AppMessageException("数据为空");
         }
         try {
-//            File file = new File(path);
-            // 创建写工作簿对象
-//            WritableWorkbook workbook = Workbook.createWorkbook(file);
+            // 创建工作表格
             workbook = Workbook.createWorkbook(ba);
-            // 工作表
-            WritableSheet sheet = workbook.createSheet(fileName, 0);
-
-            //表头格式
-            WritableCellFormat cellFormat = ExcelDownloadSrv.getWritableCellFormat();
-            //数据行格式
-            // 设置背景、字体颜色、对齐方式等等;
-            WritableFont font2 = new WritableFont(WritableFont.ARIAL, 14, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
-            WritableCellFormat cellFormat2 = new WritableCellFormat(font2);
-            //设置文字居中对齐方式;
-            cellFormat2.setAlignment(Alignment.CENTRE);
-            //设置垂直居中;
-            cellFormat2.setVerticalAlignment(VerticalAlignment.CENTRE);
-            cellFormat2.setBackground(Colour.WHITE);
-            cellFormat2.setBorder(Border.ALL, BorderLineStyle.THIN);
-            cellFormat2.setWrap(true);
-            //给sheet电子版中所有的列设置默认的列的宽度;
-            sheet.getSettings().setDefaultColumnWidth(20);
-            sheet.getSettings().setDefaultRowHeight(30 * 20);
-
-            //单独应用样式
-            if (excelStyleMap != null) {
-                for (String column : excelStyleMap.keySet()) {
-                    // 指定列宽
-                    int styleColumnWidth = excelStyleMap.getIntValueSafely(column, ExcelStyleMap.STYLE_COLUMN_WIDTH, 0);
-                    List<String> columns = new ArrayList<>(data.keySet());
-                    for (int i = 0; i < columns.size(); i++) {
-                        if (columns.get(i).equals(column)) {
-                            sheet.setColumnView(i, styleColumnWidth);
+            int listSize = 0;
+            if (data.size() > 0) {
+                Set<String> s1 = data.keySet();
+                //开始根据键找值
+                for (String key : s1) {
+                    List<String> value = data.get(key);
+                    if (!Checker.isNone(value)) {
+                        int dataItemSize = value.size();
+                        if (listSize < dataItemSize) {
+                            listSize = dataItemSize;
                         }
                     }
                 }
             }
-//            // 设置格式(实线)
-//            WritableCellFormat cellFormat = new WritableCellFormat();
-//            //给sheet电子版中所有的列设置默认的列的宽度;
-//            sheet.getSettings().setDefaultColumnWidth(20);
-//            sheet.getSettings().setDefaultRowHeight(35 * 20);
-            //行号
-            int firstRow = 0;
-            //填充表头
-            int headerColumn = 0;
-            for (String key : data.keySet()) {
-                Label label = new Label(headerColumn, firstRow, key, cellFormat);
-                sheet.addCell(label);
-                List<String> colData = data.get(key);
-                for (int i = 0; i < colData.size(); i++) {
-                    Label lb = new Label(headerColumn, i + 1, Checker.getStringValue(colData.get(i)), cellFormat);
-                    sheet.addCell(lb);
+
+            // 单元数
+            int sheetAmount = 0;
+            // 每个单元表格存放最大的行数,当list总数超过每个sheet所设置的最大值时,要注意分成多个sheet来存储
+            int sheetMaxSize = SHEET_MAX_SIZE;
+            if (listSize < sheetMaxSize) {
+                sheetAmount = 1;
+            } else {
+                if (listSize % sheetMaxSize == 0) {
+                    sheetAmount = listSize / sheetMaxSize;
+                } else {
+                    sheetAmount = listSize / sheetMaxSize + 1;
                 }
-                headerColumn++;
             }
-            // 添加汇总
-            if (!Checker.isNone(collectList)) {
-                for (ExcelCollectPojo pojo : collectList) {
-                    String[] dataArr = pojo.getDataArr();
-                    for (int i = 0, j = dataArr.length; i < j; i++) {
-                        Label lb = new Label(pojo.getCol() + i, pojo.getRow(), dataArr[i], cellFormat);
-                        sheet.addCell(lb);
+
+            // 工作表
+            for (int i = 0; i < sheetAmount; i++) {
+                // 当前页数(从0开始)
+                int currentSheetIndex = i;
+                // 当前页数(从1开始)
+                int sheetIndex = currentSheetIndex + 1;
+                WritableSheet sheet = workbook.createSheet(fileName + sheetIndex, currentSheetIndex);
+                // 获取带样式的cell
+                WritableCellFormat cellFormat = getWritableCellFormat();
+                //给sheet电子版中所有的列设置默认的列的宽度;
+                sheet.getSettings().setDefaultColumnWidth(20);
+                sheet.getSettings().setDefaultRowHeight(30 * 20);
+
+                // 当前页数所对应的行数
+                int currentSheetRowAmount = 0;
+                if (listSize < sheetMaxSize * sheetIndex) {
+                    currentSheetRowAmount = listSize - sheetMaxSize * currentSheetIndex;
+                } else {
+                    currentSheetRowAmount = sheetMaxSize;
+                }
+                // 单独应用样式
+                if (excelStyleMap != null) {
+                    for (String column : excelStyleMap.keySet()) {
+                        // 指定列宽
+                        int styleColumnWidth = excelStyleMap.getIntValueSafely(column, ExcelStyleMap.STYLE_COLUMN_WIDTH, 0);
+                        List<String> columns = new ArrayList<>(data.keySet());
+                        for (int j = 0, columnsSize = columns.size(); j < columnsSize; j++) {
+                            if (columns.get(j).equals(column)) {
+                                sheet.setColumnView(j, styleColumnWidth);
+                            }
+                        }
                     }
                 }
+                // 第一行
+                int firstRow = 0;
+                //填充表头
+                int headerColumn = 0;
+                for (String key : data.keySet()) {
+                    Label label = new Label(headerColumn, firstRow, key, cellFormat);
+                    sheet.addCell(label);
+                    List<String> colData = data.get(key);
+                    if(!Checker.isNone(colData)) {
+                        for (int q = 0; q < currentSheetRowAmount; q++) {
+                            int e = sheetMaxSize * currentSheetIndex;
+                            Label lb = new Label(headerColumn, q + 1, Checker.getStringValue(colData.get(e + q)), cellFormat);
+                            sheet.addCell(lb);
+                        }
+                    }
+                    headerColumn++;
+                }
+                // 最后一页,添加汇总,同时关闭流
+                if (currentSheetIndex == sheetAmount - 1) {
+                    if (!Checker.isNone(collectList)) {
+                        for (ExcelCollectPojo pojo : collectList) {
+                            String[] dataArr = pojo.getDataArr();
+                            for (int r = 0, j = dataArr.length; r < j; r++) {
+                                Label lb2 = new Label(pojo.getCol() + r, pojo.getRow() - sheetMaxSize * currentSheetIndex, dataArr[r], cellFormat);
+                                sheet.addCell(lb2);
+                            }
+                        }
+                    }
+                    // 写入流
+                    workbook.write();
+                    //关闭流
+                    workbook.close();
+                }
             }
-            //开始执行写入操作
-            workbook.write();
-            //关闭流
-            workbook.close();
             if (ba != null) {
                 try {
                     ba.close();
@@ -375,7 +390,7 @@ public class ExcelDownloadSrv {
                 }
             }
         } catch (Exception e) {
-            logger.error("ExcelDownloadSrv#generateAndReturnExcelFileWithNoStyleAndCollectLocal(fileName={}, path={} ):\n {}",
+            logger.error("ExcelDownloadSrv#generateAndReturnExcelByteArrayOutputStreamWithStyleAndCollect(fileName={}, path={} ):\n {}",
                     fileName, path, e.getMessage(), e);
         }
         return ba;
@@ -409,15 +424,15 @@ public class ExcelDownloadSrv {
 
 
     /**
-     * 通用的生成 Excel 文件(包含汇总)并以流返回(一点样式也没有)
+     * 通用的生成 Excel 字节流(包含汇总)并以流返回(一点样式也没有)
      *
-     * @param fileName            excel 文件名
-     * @param data                需要填充的数据,key 是列名,value 是每一列的数据组成的 list, 类型必须是 {@link String}
+     * @param fileName excel 文件名
+     * @param data     需要填充的数据,key 是列名,value 是每一列的数据组成的 list, 类型必须是 {@link String}
      * @throws AppMessageException 业务层异常抛出,如传入数据为空
      * @author Walker, added on 06/27/2019.
      */
-    public OutputStream generateAndReturnMealExcelFileWithNoStyleAndCollectLocal(String fileName, String path, ExcelDataMap data, ExcelStyleMap excelStyleMap,
-                                                                     List<CustomExcelItem> collectList) throws AppMessageException {
+    public OutputStream generateAndReturnExcelByteArrayOutputStreamWithStyle(String fileName, String path, ExcelDataMap data, ExcelStyleMap excelStyleMap,
+                                                                             List<CustomExcelItem> collectList) throws AppMessageException {
         if (data == null || data.isEmpty()) {
             throw new AppMessageException("数据为空");
         }
@@ -425,67 +440,100 @@ public class ExcelDownloadSrv {
         ba = new ByteArrayOutputStream();
         WritableWorkbook workbook = null;
         try {
-//            File file = new File(path);
-            // 创建写工作簿对象
-             workbook = Workbook.createWorkbook(ba);
-            // 工作表
-            WritableSheet sheet = workbook.createSheet(fileName, 0);
-            //表头格式
-            WritableCellFormat cellFormat = ExcelDownloadSrv.getWritableCellFormat();
-            //数据行格式
-            // 设置背景、字体颜色、对齐方式等等;
-            WritableFont font2 = new WritableFont(WritableFont.ARIAL, 14, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
-            WritableCellFormat cellFormat2 = new WritableCellFormat(font2);
-            //设置文字居中对齐方式;
-            cellFormat2.setAlignment(Alignment.CENTRE);
-            //设置垂直居中;
-            cellFormat2.setVerticalAlignment(VerticalAlignment.CENTRE);
-            cellFormat2.setBackground(Colour.WHITE);
-            cellFormat2.setBorder(Border.ALL, BorderLineStyle.THIN);
-            cellFormat2.setWrap(true);
-            //给sheet电子版中所有的列设置默认的列的宽度;
-            sheet.getSettings().setDefaultColumnWidth(20);
-            sheet.getSettings().setDefaultRowHeight(30 * 20);
-            //单独应用样式
-            if (excelStyleMap != null) {
-                for (String column : excelStyleMap.keySet()) {
-                    // 指定列宽
-                    int styleColumnWidth = excelStyleMap.getIntValueSafely(column, ExcelStyleMap.STYLE_COLUMN_WIDTH, 0);
-                    List<String> columns = new ArrayList<>(data.keySet());
-                    for (int i = 0; i < columns.size(); i++) {
-                        if (columns.get(i).equals(column)) {
-                            sheet.setColumnView(i, styleColumnWidth);
+            // 创建工作表格
+            workbook = Workbook.createWorkbook(ba);
+
+            int listSize = 0;
+            if (data.size() > 0) {
+                Set<String> s1 = data.keySet();
+                //开始根据键找值
+                for (String key : s1) {
+                    List<String> value = data.get(key);
+                    if (!Checker.isNone(value)) {
+                        int dataItemSize = value.size();
+                        if (listSize < dataItemSize) {
+                            listSize = dataItemSize;
                         }
                     }
                 }
             }
-
-            //行号
-            int firstRow = 0;
-            //填充表头
-            int headerColumn = 0;
-            for (String key : data.keySet()) {
-                Label label = new Label(headerColumn, firstRow, key, cellFormat);
-                sheet.addCell(label);
-                List<String> colData = data.get(key);
-                for (int i = 0; i < colData.size(); i++) {
-                    Label lb = new Label(headerColumn, i + 1, Checker.getStringValue(colData.get(i)), cellFormat2);
-                    sheet.addCell(lb);
+            // 单元数
+            int sheetAmount = 0;
+            // 每个单元表格存放最大的行数,当list总数超过每个sheet所设置的最大值时,要注意分成多个sheet来存储
+            int sheetMaxSize = SHEET_MAX_SIZE;
+            if (listSize < sheetMaxSize) {
+                sheetAmount = 1;
+            } else {
+                if (listSize % sheetMaxSize == 0) {
+                    sheetAmount = listSize / sheetMaxSize;
+                } else {
+                    sheetAmount = listSize / sheetMaxSize + 1;
                 }
-                headerColumn++;
             }
-            // 添加汇总
-            if (!Checker.isNone(collectList)) {
-                for (CustomExcelItem item : collectList) {
-                        sheet.addCell(new Label(item.getColumn(), item.getRow(), item.getContent(),
-                                item.getCellFormat() == null ? cellFormat2 : item.getCellFormat()));
+            // 工作表
+            for (int i = 0; i < sheetAmount; i++) {
+                // 当前页数(从0开始)
+                int currentSheetIndex = i;
+                // 当前页数(从1开始)
+                int sheetIndex = currentSheetIndex + 1;
+                WritableSheet sheet = workbook.createSheet(fileName + sheetIndex, currentSheetIndex);
+                // 获取带样式的cell
+                WritableCellFormat cellFormat = getWritableCellFormat();
+                //给sheet电子版中所有的列设置默认的列的宽度;
+                sheet.getSettings().setDefaultColumnWidth(20);
+                sheet.getSettings().setDefaultRowHeight(30 * 20);
 
+                // 当前页数所对应的行数
+                int currentSheetRowAmount = 0;
+                if (listSize < sheetMaxSize * sheetIndex) {
+                    currentSheetRowAmount = listSize - sheetMaxSize * currentSheetIndex;
+                } else {
+                    currentSheetRowAmount = sheetMaxSize;
+                }
+                // 单独应用样式
+                if (excelStyleMap != null) {
+                    for (String column : excelStyleMap.keySet()) {
+                        // 指定列宽
+                        int styleColumnWidth = excelStyleMap.getIntValueSafely(column, ExcelStyleMap.STYLE_COLUMN_WIDTH, 0);
+                        List<String> columns = new ArrayList<>(data.keySet());
+                        for (int j = 0, columnsSize = columns.size(); j < columnsSize; j++) {
+                            if (columns.get(j).equals(column)) {
+                                sheet.setColumnView(j, styleColumnWidth);
+                            }
+                        }
+                    }
+                }
+                // 第一行
+                int firstRow = 0;
+                // 填充表头
+                int headerColumn = 0;
+                for (String key : data.keySet()) {
+                    Label label = new Label(headerColumn, firstRow, key, cellFormat);
+                    sheet.addCell(label);
+                    List<String> colData = data.get(key);
+                    if(!Checker.isNone(colData)) {
+                        for (int q = 0; q < currentSheetRowAmount; q++) {
+                            // 之前所有页的数据汇总数量
+                            int beforePageAllAmount = sheetMaxSize * currentSheetIndex;
+                            Label lb = new Label(headerColumn, q + 1, Checker.getStringValue(colData.get(beforePageAllAmount + q)), cellFormat);
+                            sheet.addCell(lb);
+                        }
+                    }
+                    headerColumn++;
+                }
+                // 最后一页,添加汇总,同时关闭流
+                if (currentSheetIndex == sheetAmount - 1) {
+                    if (!Checker.isNone(collectList)) {
+                        for (CustomExcelItem item : collectList) {
+                            sheet.addCell(new Label(item.getColumn(), item.getRow() - sheetMaxSize * currentSheetIndex, item.getContent(), item.getCellFormat() == null ? cellFormat : item.getCellFormat()));
+                        }
+                    }
+                    // 写入流
+                    workbook.write();
+                    // 关闭流
+                    workbook.close();
                 }
             }
-            //开始执行写入操作
-            workbook.write();
-            //关闭流
-            workbook.close();
             if (ba != null) {
                 try {
                     ba.close();
@@ -494,9 +542,44 @@ public class ExcelDownloadSrv {
                 }
             }
         } catch (Exception e) {
-            logger.error("ExcelDownloadSrv#generateAndReturnExcelFileWithNoStyleAndCollectLocal(fileName={}, path={} ):\n {}",
+            logger.error("ExcelDownloadSrv#generateAndReturnExcelByteArrayOutputStreamWithStyleAndCollect(fileName={}, path={} ):\n {}",
                     fileName, path, e.getMessage(), e);
         }
         return ba;
     }
+
+    /**
+     * OutputStream 转化成 File
+     * @param localPath 对应本地文件路径
+     * @param ba 文件流 {@link OutputStream}
+     */
+    public void outputStreamToFile(String localPath, OutputStream ba) {
+
+        File file = new File(localPath);
+        //选择流
+        FileOutputStream fos = null;
+        ByteArrayInputStream bais = null;
+        try {
+            bais = new ByteArrayInputStream(((ByteArrayOutputStream) ba).toByteArray());
+            fos = new FileOutputStream(file);
+            int temp;
+            byte[] bt = new byte[1024 * 10];
+            while ((temp = bais.read(bt)) != -1) {
+                fos.write(bt, 0, temp);
+            }
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            //关流
+            try {
+                if (null != fos) {
+                    fos.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
 }

+ 686 - 0
src/main/java/com/ywt/mg/web/common/ExcelDownloadSrvOld.java

@@ -0,0 +1,686 @@
+package com.ywt.mg.web.common;
+
+import com.ywt.mg.core.exceptions.AppMessageException;
+import com.ywt.mg.core.utils.Checker;
+import com.ywt.mg.core.utils.ExcelHelper;
+import com.ywt.mg.domain.models.ExcelDataMap;
+import com.ywt.mg.domain.models.ExcelStyleMap;
+import com.ywt.mg.domain.models.pojo.CustomExcelItem;
+import com.ywt.mg.domain.models.pojo.ExcelCollectPojo;
+import jxl.Workbook;
+import jxl.format.Alignment;
+import jxl.format.Border;
+import jxl.format.BorderLineStyle;
+import jxl.format.Colour;
+import jxl.format.VerticalAlignment;
+import jxl.format.*;
+import jxl.write.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author daiyihua
+ * @create 2022-08-23 下午3:52
+ * @desc excel 下载里面抽出来的一些代码
+ **/
+
+@Service
+public class ExcelDownloadSrvOld {
+    private final Logger logger = LoggerFactory.getLogger(getClass().getName());
+
+    /**
+     * 下载excel 时 设置 httpServletResponse
+     */
+    public static HttpServletResponse setHttpServletResponse(HttpServletResponse httpServletResponse, String filename) throws IOException {
+        httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes(), "iso-8859-1"));
+        httpServletResponse.setContentType("application/vnd.ms-excel;charset=UTF-8");
+        httpServletResponse.setHeader("Pragma", "no-cache");
+        httpServletResponse.setHeader("Cache-Control", "no-cache");
+        httpServletResponse.setDateHeader("Expires", 0);
+        return httpServletResponse;
+    }
+
+    /**
+     * 得到已经设置好的excel模版
+     *
+     * @return
+     */
+    public static WritableCellFormat getWritableCellFormat() throws WriteException {
+        //设置字体;
+        WritableFont font = new WritableFont(WritableFont.ARIAL, 14, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
+
+        WritableCellFormat cellFormat = new WritableCellFormat(font);
+        //设置背景颜色;
+        cellFormat.setBackground(Colour.WHITE);
+        //设置边框;
+        cellFormat.setBorder(Border.ALL, BorderLineStyle.DASH_DOT);
+        //设置自动换行;
+        cellFormat.setWrap(true);
+        //设置文字居中对齐方式;
+        cellFormat.setAlignment(Alignment.CENTRE);
+        //设置垂直居中;
+        cellFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
+        return cellFormat;
+    }
+
+    /**
+     * 通用的生成 Excel 文件并以流返回
+     *
+     * @param fileName            excel 文件名
+     * @param data                需要填充的数据,key 是列名,value 是每一列的数据组成的 list, 类型必须是 {@link String}
+     * @param httpServletResponse resp
+     * @throws AppMessageException 业务层异常抛出,如传入数据为空
+     * @author Walker, added on 06/27/2019.
+     */
+    public void generateAndReturnExcelFile(String fileName, ExcelDataMap data, ExcelStyleMap excelStyleMap,
+                                           HttpServletResponse httpServletResponse) throws AppMessageException {
+        if (data == null || data.isEmpty()) {
+            throw new AppMessageException("数据为空");
+        }
+        try (OutputStream out = ExcelDownloadSrvOld.setHttpServletResponse(httpServletResponse, fileName + ".xls").getOutputStream()) {
+            // 创建写工作簿对象
+            WritableWorkbook workbook = Workbook.createWorkbook(out);
+            // 工作表
+            WritableSheet sheet = workbook.createSheet(fileName, 0);
+            //表头格式
+            WritableCellFormat cellFormat = ExcelDownloadSrvOld.getWritableCellFormat();
+            //数据行格式
+            // 设置背景、字体颜色、对齐方式等等;
+            WritableFont font2 = new WritableFont(WritableFont.ARIAL, 14, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
+            WritableCellFormat cellFormat2 = new WritableCellFormat(font2);
+            //设置文字居中对齐方式;
+            cellFormat2.setAlignment(Alignment.CENTRE);
+            //设置垂直居中;
+            cellFormat2.setVerticalAlignment(VerticalAlignment.CENTRE);
+            cellFormat2.setBackground(Colour.WHITE);
+            cellFormat2.setBorder(Border.ALL, BorderLineStyle.THIN);
+            cellFormat2.setWrap(true);
+            //给sheet电子版中所有的列设置默认的列的宽度;
+            sheet.getSettings().setDefaultColumnWidth(20);
+            sheet.getSettings().setDefaultRowHeight(30 * 20);
+
+            //单独应用样式
+            if (excelStyleMap != null) {
+                for (String column : excelStyleMap.keySet()) {
+                    // 指定列宽
+                    int styleColumnWidth = excelStyleMap.getIntValueSafely(column, ExcelStyleMap.STYLE_COLUMN_WIDTH, 0);
+                    List<String> columns = new ArrayList<>(data.keySet());
+                    for (int i = 0; i < columns.size(); i++) {
+                        if (columns.get(i).equals(column)) {
+                            sheet.setColumnView(i, styleColumnWidth);
+                        }
+                    }
+                }
+            }
+
+            //行号
+            int firstRow = 0;
+            //填充表头
+            int headerColumn = 0;
+            for (String key : data.keySet()) {
+                Label label = new Label(headerColumn, firstRow, key, cellFormat);
+                sheet.addCell(label);
+                List<String> colData = data.get(key);
+                for (int i = 0; i < colData.size(); i++) {
+                    Label lb = new Label(headerColumn, i + 1, Checker.getStringValue(colData.get(i)), cellFormat2);
+                    sheet.addCell(lb);
+                }
+                headerColumn++;
+            }
+            //开始执行写入操作
+            workbook.write();
+            //关闭流
+            workbook.close();
+        } catch (Exception e) {
+            logger.error("ExcelDownloadSrv#generateAndReturnExcelFile(fileName={}):\n {}",
+                    fileName, e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 通用的生成 Excel 文件并以流返回
+     *
+     * @param fileName            excel 文件名
+     * @param data                需要填充的数据,key 是列名,value 是每一列的数据组成的 list, 类型必须是 {@link String}
+     * @param httpServletResponse resp
+     * @throws AppMessageException 业务层异常抛出,如传入数据为空
+     * @author Walker, added on 06/27/2019.
+     */
+    public void generateAndReturnExcelFileWithNoStyle(String fileName, ExcelDataMap data, ExcelStyleMap excelStyleMap,
+                                                      HttpServletResponse httpServletResponse) throws AppMessageException {
+        if (data == null || data.isEmpty()) {
+            throw new AppMessageException("数据为空");
+        }
+        try (OutputStream out = ExcelDownloadSrvOld.setHttpServletResponse(httpServletResponse, fileName + ".xls").getOutputStream()) {
+            // 创建写工作簿对象
+            WritableWorkbook workbook = Workbook.createWorkbook(out);
+            // 工作表
+            WritableSheet sheet = workbook.createSheet(fileName, 0);
+
+            //单独应用样式
+            if (excelStyleMap != null) {
+                for (String column : excelStyleMap.keySet()) {
+                    // 指定列宽
+                    int styleColumnWidth = excelStyleMap.getIntValueSafely(column, ExcelStyleMap.STYLE_COLUMN_WIDTH, 0);
+                    List<String> columns = new ArrayList<>(data.keySet());
+                    for (int i = 0; i < columns.size(); i++) {
+                        if (columns.get(i).equals(column)) {
+                            sheet.setColumnView(i, styleColumnWidth);
+                        }
+                    }
+                }
+            }
+
+            //行号
+            int firstRow = 0;
+            //填充表头
+            int headerColumn = 0;
+            for (String key : data.keySet()) {
+                Label label = new Label(headerColumn, firstRow, key);
+                sheet.addCell(label);
+                List<String> colData = data.get(key);
+                for (int i = 0; i < colData.size(); i++) {
+                    Label lb = new Label(headerColumn, i + 1, Checker.getStringValue(colData.get(i)));
+                    sheet.addCell(lb);
+                }
+                headerColumn++;
+            }
+            //开始执行写入操作
+            workbook.write();
+            //关闭流
+            workbook.close();
+        } catch (Exception e) {
+            logger.error("ExcelDownloadSrv#generateAndReturnExcelFile(fileName={} ):\n {}",
+                    fileName, e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 通用的生成 Excel 文件(包含汇总)并以流返回
+     *
+     * @param fileName            excel 文件名
+     * @param data                需要填充的数据,key 是列名,value 是每一列的数据组成的 list, 类型必须是 {@link String}
+     * @param httpServletResponse resp
+     * @throws AppMessageException 业务层异常抛出,如传入数据为空
+     * @author Walker, added on 06/27/2019.
+     */
+    public void generateAndReturnExcelFileWithNoStyleAndCollect(String fileName, ExcelDataMap data, ExcelStyleMap excelStyleMap,
+                                                                List<ExcelCollectPojo> collectList, HttpServletResponse httpServletResponse) throws AppMessageException {
+        if (data == null || data.isEmpty()) {
+            throw new AppMessageException("数据为空");
+        }
+        try (OutputStream out = ExcelDownloadSrvOld.setHttpServletResponse(httpServletResponse, fileName + ".xls").getOutputStream()) {
+            // 创建写工作簿对象
+            WritableWorkbook workbook = Workbook.createWorkbook(out);
+            // 工作表
+            WritableSheet sheet = workbook.createSheet(fileName, 0);
+            //单独应用样式
+            if (excelStyleMap != null) {
+                for (String column : excelStyleMap.keySet()) {
+                    // 指定列宽
+                    int styleColumnWidth = excelStyleMap.getIntValueSafely(column, ExcelStyleMap.STYLE_COLUMN_WIDTH, 0);
+                    List<String> columns = new ArrayList<>(data.keySet());
+                    for (int i = 0; i < columns.size(); i++) {
+                        if (columns.get(i).equals(column)) {
+                            sheet.setColumnView(i, styleColumnWidth);
+                        }
+                    }
+                }
+            }
+            // 设置格式(实线)
+            WritableCellFormat cellFormat = ExcelHelper.getThinWritableCellFormat();
+            //给sheet电子版中所有的列设置默认的列的宽度;
+            sheet.getSettings().setDefaultColumnWidth(20);
+            sheet.getSettings().setDefaultRowHeight(35 * 20);
+            //行号
+            int firstRow = 0;
+            //填充表头
+            int headerColumn = 0;
+            for (String key : data.keySet()) {
+                Label label = new Label(headerColumn, firstRow, key, cellFormat);
+                sheet.addCell(label);
+                List<String> colData = data.get(key);
+                for (int i = 0; i < colData.size(); i++) {
+                    Label lb = new Label(headerColumn, i + 1, Checker.getStringValue(colData.get(i)), cellFormat);
+                    sheet.addCell(lb);
+                }
+                headerColumn++;
+            }
+            // 添加汇总
+            if (!Checker.isNone(collectList)) {
+                for (ExcelCollectPojo pojo : collectList) {
+                    String[] dataArr = pojo.getDataArr();
+                    for (int i = 0, j = dataArr.length; i < j; i++) {
+                        Label lb = new Label(pojo.getCol() + i, pojo.getRow(), dataArr[i], cellFormat);
+                        sheet.addCell(lb);
+                    }
+                }
+            }
+
+            //开始执行写入操作
+            workbook.write();
+            //关闭流
+            workbook.close();
+        } catch (Exception e) {
+            logger.error("ExcelDownloadSrv#generateAndReturnExcelFile(fileName={} ):\n {}",
+                    fileName, e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 通用的生成 Excel 文件(包含汇总)并以流返回(一点样式也没有)
+     *
+     * @param fileName            excel 文件名
+     * @param data                需要填充的数据,key 是列名,value 是每一列的数据组成的 list, 类型必须是 {@link String}
+     * @throws AppMessageException 业务层异常抛出,如传入数据为空
+     * @author Walker, added on 06/27/2019.
+     * 参考{@link ExcelDownloadSrv#generateAndReturnExcelByteArrayOutputStreamWithStyleAndCollect(String, String, ExcelDataMap, ExcelStyleMap, List, int)}
+     */
+    public OutputStream  generateAndReturnExcelByteArrayOutputStreamWithStyleAndCollect(String fileName, String path, ExcelDataMap data, ExcelStyleMap excelStyleMap,
+                                                                       List<ExcelCollectPojo> collectList, int size) throws AppMessageException {
+
+        OutputStream ba = null;
+        ba = new ByteArrayOutputStream();
+        WritableWorkbook workbook = null;
+        if (data == null || data.isEmpty()) {
+            throw new AppMessageException("数据为空");
+        }
+        try {
+//            File file = new File(path);
+            // 创建写工作簿对象
+//            WritableWorkbook workbook = Workbook.createWorkbook(file);
+            workbook = Workbook.createWorkbook(ba);
+
+            int list = size;
+            int a = 0;
+            if(list < 60000){
+                a = 1;
+            } else {
+                if (list % 60000 == 0) {
+                    a = list / 60000;
+                } else {
+                    a = list / 60000 + 1;
+                }
+            }
+
+            // 工作表
+            for (int i = 0; i < a; i++) {
+                int page = i + 1;
+                WritableSheet sheet = workbook.createSheet(fileName + page, 0);
+                WritableCellFormat cellFormat = ExcelDownloadSrvOld.getWritableCellFormat();
+                //数据行格式
+                // 设置背景、字体颜色、对齐方式等等;
+                WritableFont font2 = new WritableFont(WritableFont.ARIAL, 14, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
+                WritableCellFormat cellFormat2 = new WritableCellFormat(font2);
+                //设置文字居中对齐方式;
+                cellFormat2.setAlignment(Alignment.CENTRE);
+                //设置垂直居中;
+                cellFormat2.setVerticalAlignment(VerticalAlignment.CENTRE);
+                cellFormat2.setBackground(Colour.WHITE);
+                cellFormat2.setBorder(Border.ALL, BorderLineStyle.THIN);
+                cellFormat2.setWrap(true);
+                //给sheet电子版中所有的列设置默认的列的宽度;
+                sheet.getSettings().setDefaultColumnWidth(20);
+                sheet.getSettings().setDefaultRowHeight(30 * 20);
+                int firstRow = 0;
+                //填充表头
+                int headerColumn = 0;
+//                int headerColumn2 = 0;
+//                int headerColumn3 = 0;
+                for (String key : data.keySet()) {
+                    Label label = new Label(headerColumn, firstRow, key, cellFormat);
+                    sheet.addCell(label);
+//                    Label label2 = new Label(headerColumn2, firstRow, key, cellFormat);
+//                sheet2.addCell(label2);
+//                Label label3 = new Label(headerColumn3, firstRow, key, cellFormat);
+//                sheet3.addCell(label3);
+                    List<String> colData = data.get(key);
+                    int b = 0;
+                    int c = i+1;
+                    if(size < 60000* c){
+                        b = size - 60000*i;
+                    } else{
+                        b = 60000;
+                    }
+                    for (int q = 0; q < b; q++) {
+                        int e = 60000 * i;
+                        Label lb = new Label(headerColumn, q + 1, Checker.getStringValue(colData.get(e + q)), cellFormat);
+                        sheet.addCell(lb);
+//                    sheet2.addCell(lb);
+                    }
+//                for (int q = 0; q < 2; q++) {
+//                    Label lb = new Label(headerColumn2, q + 1, Checker.getStringValue(colData.get(2 + q)), cellFormat);
+//                    sheet2.addCell(lb);
+//                }
+//                for (int q = 0; q < 2; q++) {
+//                    Label lb = new Label(headerColumn3, q + 1, Checker.getStringValue(colData.get(4 + q)), cellFormat);
+//                    sheet3.addCell(lb);
+//                }
+                    headerColumn++;
+//                headerColumn2++;
+//                headerColumn3++;
+                }
+                if (i == a - 1) {
+                    if (!Checker.isNone(collectList)) {
+                        for (ExcelCollectPojo pojo : collectList) {
+                            String[] dataArr = pojo.getDataArr();
+                            for (int r = 0, j = dataArr.length; r < j; r++) {
+//                        Label lb = new Label(pojo.getCol() + i, pojo.getRow(), dataArr[i], cellFormat);
+//                        sheet.addCell(lb);
+                                Label lb2 = new Label(pojo.getCol() + r, pojo.getRow(), dataArr[r], cellFormat);
+                                sheet.addCell(lb2);
+                            }
+                        }
+                    }
+                }
+
+
+//            WritableSheet sheet = workbook.createSheet(fileName, 0);
+//            WritableSheet sheet2 = workbook.createSheet(fileName + "2", 1);
+//            WritableSheet sheet3 = workbook.createSheet(fileName + "3", 2);
+//
+//            //表头格式
+//            WritableCellFormat cellFormat = ExcelDownloadSrv.getWritableCellFormat();
+//            //数据行格式
+//            // 设置背景、字体颜色、对齐方式等等;
+//            WritableFont font2 = new WritableFont(WritableFont.ARIAL, 14, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
+//            WritableCellFormat cellFormat2 = new WritableCellFormat(font2);
+//            //设置文字居中对齐方式;
+//            cellFormat2.setAlignment(Alignment.CENTRE);
+//            //设置垂直居中;
+//            cellFormat2.setVerticalAlignment(VerticalAlignment.CENTRE);
+//            cellFormat2.setBackground(Colour.WHITE);
+//            cellFormat2.setBorder(Border.ALL, BorderLineStyle.THIN);
+//            cellFormat2.setWrap(true);
+//            //给sheet电子版中所有的列设置默认的列的宽度;
+//            sheet.getSettings().setDefaultColumnWidth(20);
+//            sheet.getSettings().setDefaultRowHeight(30 * 20);
+//            sheet2.getSettings().setDefaultColumnWidth(20);
+//            sheet2.getSettings().setDefaultRowHeight(30 * 20);
+//            sheet3.getSettings().setDefaultColumnWidth(20);
+//            sheet3.getSettings().setDefaultRowHeight(30 * 20);
+
+//            //单独应用样式
+//            if (excelStyleMap != null) {
+//                for (String column : excelStyleMap.keySet()) {
+//                    // 指定列宽
+//                    int styleColumnWidth = excelStyleMap.getIntValueSafely(column, ExcelStyleMap.STYLE_COLUMN_WIDTH, 0);
+//                    List<String> columns = new ArrayList<>(data.keySet());
+//                    for (int i = 0; i <1; i++) {
+//                        if (columns.get(i).equals(column)) {
+//                            sheet.setColumnView(i, styleColumnWidth);
+//                        }
+//                    }
+//
+//                }
+//            }
+//            // 设置格式(实线)
+//            WritableCellFormat cellFormat = new WritableCellFormat();
+//            //给sheet电子版中所有的列设置默认的列的宽度;
+//            sheet.getSettings().setDefaultColumnWidth(20);
+//            sheet.getSettings().setDefaultRowHeight(35 * 20);
+                //行号
+//            int firstRow = 0;
+//            //填充表头
+//            int headerColumn = 0;
+//            int headerColumn2 = 0;
+//            int headerColumn3 = 0;
+//            for (String key : data.keySet()) {
+//                Label label = new Label(headerColumn, firstRow, key, cellFormat);
+//                sheet.addCell(label);
+//                Label label2 = new Label(headerColumn2, firstRow, key, cellFormat);
+//                sheet2.addCell(label2);
+//                Label label3 = new Label(headerColumn3, firstRow, key, cellFormat);
+//                sheet2.addCell(label3);
+//                List<String> colData = data.get(key);
+//                for (int i = 0; i < 2; i++) {
+//                    Label lb = new Label(headerColumn, i + 1, Checker.getStringValue(colData.get(i)), cellFormat);
+//                    sheet.addCell(lb);
+////                    sheet2.addCell(lb);
+//                }
+//                for (int q = 0; q < 2; q++) {
+//                    Label lb = new Label(headerColumn2, q + 1, Checker.getStringValue(colData.get(2 + q)), cellFormat);
+//                    sheet2.addCell(lb);
+//                }
+//                for (int q = 0; q < 2; q++) {
+//                    Label lb = new Label(headerColumn3, q + 1, Checker.getStringValue(colData.get(4 + q)), cellFormat);
+//                    sheet3.addCell(lb);
+//                }
+//                headerColumn++;
+//                headerColumn2++;
+//                headerColumn3++;
+//            }
+                // 添加汇总
+//            if (!Checker.isNone(collectList)) {
+//                for (ExcelCollectPojo pojo : collectList) {
+//                    String[] dataArr = pojo.getDataArr();
+//                    for (int i = 0, j = dataArr.length; i < j; i++) {
+////                        Label lb = new Label(pojo.getCol() + i, pojo.getRow(), dataArr[i], cellFormat);
+////                        sheet.addCell(lb);
+//                        Label lb2 = new Label(pojo.getCol() + i, pojo.getRow(), dataArr[i], cellFormat);
+//                        sheet2.addCell(lb2);
+//                    }
+//                }
+//            }
+                //开始执行写入操作
+                if (i == a - 1) {
+                    workbook.write();
+                    //关闭流
+                    workbook.close();
+                }
+
+            }
+
+            if (ba != null) {
+                try {
+                    ba.close();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        } catch (Exception e) {
+            logger.error("ExcelDownloadSrv#generateAndReturnExcelByteArrayOutputStreamWithStyleAndCollect(fileName={}, path={} ):\n {}",
+                    fileName, path, e.getMessage(), e);
+        }
+        return ba;
+
+    }
+
+    /**
+     * 订单统计中备注的样式(没有边框样式)
+     */
+    public static WritableCellFormat getCellFormat4StatRemarkWithNoSetBorder() {
+        //设置字体;
+        WritableFont font = new WritableFont(WritableFont.ARIAL, 14, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.DEFAULT_BACKGROUND);
+
+        WritableCellFormat cellFormat = new WritableCellFormat(font);
+        try {
+            //设置背景颜色;
+            cellFormat.setBackground(Colour.WHITE);
+            //设置边框;
+            // cellFormat.setBorder(Border.ALL, BorderLineStyle.THIN);
+            //设置自动换行;
+//            cellFormat.setWrap(true);
+            //设置文字居中对齐方式;
+            cellFormat.setAlignment(Alignment.LEFT);
+            //设置垂直居中;
+            cellFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
+            return cellFormat;
+        } catch (WriteException e) {
+            return null;
+        }
+    }
+
+
+    /**
+     * 通用的生成 Excel 文件(包含汇总)并以流返回(一点样式也没有)
+     *
+     * @param fileName            excel 文件名
+     * @param data                需要填充的数据,key 是列名,value 是每一列的数据组成的 list, 类型必须是 {@link String}
+     * @throws AppMessageException 业务层异常抛出,如传入数据为空
+     * @author Walker, added on 06/27/2019.
+     * 参考{@link ExcelDownloadSrv#generateAndReturnExcelByteArrayOutputStreamWithStyle(String, String, ExcelDataMap, ExcelStyleMap, List)}
+     */
+    public OutputStream generateAndReturnExcelByteArrayOutputStreamWithStyle(String fileName, String path, ExcelDataMap data, ExcelStyleMap excelStyleMap,
+                                                                     List<CustomExcelItem> collectList, int size) throws AppMessageException {
+        if (data == null || data.isEmpty()) {
+            throw new AppMessageException("数据为空");
+        }
+        OutputStream ba = null;
+        ba = new ByteArrayOutputStream();
+        WritableWorkbook workbook = null;
+        try {
+//            File file = new File(path);
+            workbook = Workbook.createWorkbook(ba);
+
+            int list = size;
+            int a = 0;
+            if(list < 60000){
+                a = 1;
+            } else {
+                if (list % 60000 == 0) {
+                    a = list / 60000;
+                } else {
+                    a = list / 60000 + 1;
+                }
+            }
+
+            for (int i = 0; i < a; i++) {
+                int page = i + 1;
+
+                WritableSheet sheet = workbook.createSheet(fileName + page, 0);
+                WritableCellFormat cellFormat = ExcelDownloadSrvOld.getWritableCellFormat();
+                //数据行格式
+                // 设置背景、字体颜色、对齐方式等等;
+                WritableFont font2 = new WritableFont(WritableFont.ARIAL, 14, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
+                WritableCellFormat cellFormat2 = new WritableCellFormat(font2);
+                //设置文字居中对齐方式;
+                cellFormat2.setAlignment(Alignment.CENTRE);
+                //设置垂直居中;
+                cellFormat2.setVerticalAlignment(VerticalAlignment.CENTRE);
+                cellFormat2.setBackground(Colour.WHITE);
+                cellFormat2.setBorder(Border.ALL, BorderLineStyle.THIN);
+                cellFormat2.setWrap(true);
+                //给sheet电子版中所有的列设置默认的列的宽度;
+                sheet.getSettings().setDefaultColumnWidth(20);
+                sheet.getSettings().setDefaultRowHeight(30 * 20);
+                int firstRow = 0;
+                //填充表头
+                int headerColumn = 0;
+
+                int b = 0;
+                int c = i+1;
+                if(size < 60000* c){
+                    b = size - 60000*i;
+                } else{
+                    b = 60000;
+                }
+
+                for (String key : data.keySet()) {
+                    Label label = new Label(headerColumn, firstRow, key, cellFormat);
+                    sheet.addCell(label);
+                    List<String> colData = data.get(key);
+                    for (int q = 0; q < b; q++) {
+                        int e = 60000 * i;
+                        Label lb = new Label(headerColumn, q + 1, Checker.getStringValue(colData.get(e + q)), cellFormat);
+                        sheet.addCell(lb);
+                    }
+                    headerColumn++;
+                }
+                // 添加汇总
+                if (i == a - 1) {
+                    if (!Checker.isNone(collectList)) {
+                        for (CustomExcelItem item : collectList) {
+                            sheet.addCell(new Label(item.getColumn(), item.getRow(), item.getContent(),
+                                    item.getCellFormat() == null ? cellFormat2 : item.getCellFormat()));
+
+
+                        }
+                    }
+                }
+
+                if (i == a - 1){
+                    workbook.write();
+                    //关闭流
+                    workbook.close();
+                }
+            }
+//            // 工作表
+//            WritableSheet sheet = workbook.createSheet(fileName, 0);
+//            //表头格式
+//            WritableCellFormat cellFormat = ExcelDownloadSrv.getWritableCellFormat();
+//            //数据行格式
+//            // 设置背景、字体颜色、对齐方式等等;
+//            WritableFont font2 = new WritableFont(WritableFont.ARIAL, 14, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
+//            WritableCellFormat cellFormat2 = new WritableCellFormat(font2);
+//            //设置文字居中对齐方式;
+//            cellFormat2.setAlignment(Alignment.CENTRE);
+//            //设置垂直居中;
+//            cellFormat2.setVerticalAlignment(VerticalAlignment.CENTRE);
+//            cellFormat2.setBackground(Colour.WHITE);
+//            cellFormat2.setBorder(Border.ALL, BorderLineStyle.THIN);
+//            cellFormat2.setWrap(true);
+//            //给sheet电子版中所有的列设置默认的列的宽度;
+//            sheet.getSettings().setDefaultColumnWidth(20);
+//            sheet.getSettings().setDefaultRowHeight(30 * 20);
+            //单独应用样式
+//            if (excelStyleMap != null) {
+//                for (String column : excelStyleMap.keySet()) {
+//                    // 指定列宽
+//                    int styleColumnWidth = excelStyleMap.getIntValueSafely(column, ExcelStyleMap.STYLE_COLUMN_WIDTH, 0);
+//                    List<String> columns = new ArrayList<>(data.keySet());
+//                    for (int i = 0; i < columns.size(); i++) {
+//                        if (columns.get(i).equals(column)) {
+//                            sheet.setColumnView(i, styleColumnWidth);
+//                        }
+//                    }
+//                }
+//            }
+
+            //行号
+//            int firstRow = 0;
+//            //填充表头
+//            int headerColumn = 0;
+//            for (String key : data.keySet()) {
+//                Label label = new Label(headerColumn, firstRow, key, cellFormat);
+//                sheet.addCell(label);
+//                List<String> colData = data.get(key);
+//                for (int i = 0; i < colData.size(); i++) {
+//                    Label lb = new Label(headerColumn, i + 1, Checker.getStringValue(colData.get(i)), cellFormat2);
+//                    sheet.addCell(lb);
+//                }
+//                headerColumn++;
+//            }
+//            // 添加汇总
+//            if (!Checker.isNone(collectList)) {
+//                for (CustomExcelItem item : collectList) {
+//                        sheet.addCell(new Label(item.getColumn(), item.getRow(), item.getContent(),
+//                                item.getCellFormat() == null ? cellFormat2 : item.getCellFormat()));
+//
+//                }
+//            }
+            //开始执行写入操作
+
+
+            if (ba != null) {
+                try {
+                    ba.close();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        } catch (Exception e) {
+            logger.error("ExcelDownloadSrv#generateAndReturnExcelByteArrayOutputStreamWithStyleAndCollect(fileName={}, path={} ):\n {}",
+                    fileName, path, e.getMessage(), e);
+        }
+        return ba;
+    }
+}

+ 0 - 32
src/main/java/com/ywt/mg/web/controllers/OfflineController.java

@@ -2,51 +2,19 @@ package com.ywt.mg.web.controllers;
 
 
 import com.ywt.mg.core.MGRight;
-import com.ywt.mg.core.MGRightTypeDef;
-import com.ywt.mg.core.PagedList;
-import com.ywt.mg.core.utils.AsyncUtil;
 import com.ywt.mg.core.utils.Checker;
-import com.ywt.mg.core.utils.CollectionUtil;
-import com.ywt.mg.core.utils.FormatUtil;
 import com.ywt.mg.core.utils.serializers.JsonSerializer;
-import com.ywt.mg.domain.entities.*;
 import com.ywt.mg.domain.models.ConstantDef;
-import com.ywt.mg.domain.models.ExcelDataMap;
-import com.ywt.mg.domain.models.ExcelStyleMap;
-import com.ywt.mg.domain.models.enums.DownloadRecordStatusEnum;
-import com.ywt.mg.domain.models.enums.OfflineConsultationSourceEnum;
 import com.ywt.mg.domain.models.enums.PaymentStatusEnum;
-import com.ywt.mg.domain.models.enums.RefundStatusEnum;
-import com.ywt.mg.domain.models.pojo.ExcelCollectPojo;
 import com.ywt.mg.params.offline.DownloadOfflineListNewRequest;
 import com.ywt.mg.services.*;
 import com.ywt.mg.web.BaseResponse;
-import com.ywt.mg.web.DataResponse;
-import com.ywt.mg.web.PageDataResponse;
-import com.ywt.mg.web.common.ExcelDownloadSrv;
-import com.ywt.mg.web.common.FileSrv;
-import jxl.Workbook;
-import jxl.format.Alignment;
-import jxl.format.Border;
-import jxl.format.BorderLineStyle;
-import jxl.format.Colour;
-import jxl.format.*;
-import jxl.format.VerticalAlignment;
-import jxl.write.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.OutputStream;
-import java.util.*;
 
 /**
  * 线下就诊相关方法类(公司后台查询所有的,通过hospital_id来区分,公司后台hospital_id = -1)