From 16a2b7a85d1ea7888dbc2ee3d23934032c05f3e6 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 23 四月 2026 14:06:59 +0800
Subject: [PATCH] 导出销售台账送货单

---
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java |  435 ++++++++++++++++++++++++++++++++----------------------
 1 files changed, 258 insertions(+), 177 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index 53dfed7..3b6ea8c 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -46,10 +46,15 @@
 import com.ruoyi.sales.pojo.*;
 import com.ruoyi.sales.service.ISalesLedgerProductService;
 import com.ruoyi.sales.service.ISalesLedgerService;
+import com.ruoyi.sales.vo.ShippingNoteVo;
 import com.ruoyi.stock.mapper.StockInventoryMapper;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.io.FilenameUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -228,210 +233,210 @@
 
     @Override
     public void exportShippingNote(HttpServletResponse response, List<Long> ids) {
-        log.info("寮�濮嬪鍑洪�佽揣鍗曪紝鍙拌处ID鍒楄〃: {}", ids);
-
-        // 鍙傛暟鏍¢獙
-        if (ids == null || ids.isEmpty()) {
-            throw new BaseException("璇烽�夋嫨瑕佸鍑虹殑閿�鍞彴璐�");
-        }
-
-        List<SalesLedger> salesLedgerList = salesLedgerMapper.selectList(
-                Wrappers.<SalesLedger>lambdaQuery()
-                        .in(SalesLedger::getId, ids)
-        );
-
-        if (salesLedgerList.isEmpty()) {
-            throw new BaseException("鏈壘鍒板搴旈攢鍞彴璐︽暟鎹�");
-        }
-
-        // 鏍规嵁閿�鍞彴璐︽暟閲忓喅瀹氬鍑烘柟寮�
-        if (salesLedgerList.size() == 1) {
-            // 鍗曚釜閿�鍞彴璐︼紝鐩存帴瀵煎嚭xlsx鏂囦欢
-            exportSingleShippingNote(response, salesLedgerList.get(0));
-        } else {
-            // 澶氫釜閿�鍞彴璐︼紝鐢熸垚鍘嬬缉鍖�
-            exportBatchShippingNote(response, salesLedgerList);
-        }
-    }
-    
-    /**
-     * 瀵煎嚭鍗曚釜閫佽揣鍗�
-     */
-    private void exportSingleShippingNote(HttpServletResponse response, SalesLedger ledger) {
         try {
-            // 璁剧疆鍝嶅簲澶�
-            String fileName = String.format("閫佽揣鍗昣%s.xlsx",
-                    Optional.ofNullable(ledger.getSalesContractNo()).orElse(String.valueOf(ledger.getId())));
+            List<SalesLedger> ledgerList = salesLedgerMapper.selectBatchIds(ids);
+            String fileName = "閫佽揣鍗�.xlsx";
             response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
             response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
             response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
 
-            // 鏌ヨ鏄庣粏
-            SalesLedgerProduct cond = new SalesLedgerProduct();
-            cond.setSalesLedgerId(ledger.getId());
-            List<SalesLedgerProduct> productList = salesLedgerProductServiceImpl.selectSalesLedgerProductList(cond);
+            // 鍥哄畾浣跨敤 XSSFWorkbook
+            XSSFWorkbook workbook = new XSSFWorkbook();
 
-            // 鑷姩搴忓彿+鐗╂枡缂栫爜璧嬪��
-            for (int i = 0; i < productList.size(); i++) {
-                SalesLedgerProduct product = productList.get(i);
-                if (product != null) {
-                    product.setSerialNumber(i + 1);
-                    product.setOrderNo(ledger.getSalesContractNo());
-                    Long productModelId = product.getProductModelId();
-                    if (productModelId != null) {
-                        ProductModel productModel = productModelMapper.selectById(productModelId);
-                        if (productModel != null) {
-                            product.setMaterialCode(productModel.getMaterialCode());
-                        }
-                    }
+            for (SalesLedger ledger : ledgerList) {
+                XSSFSheet sheet = workbook.createSheet(ledger.getSalesContractNo());
+
+                sheet.setColumnWidth(0, 2500);
+                sheet.setColumnWidth(1, 4000);
+                sheet.setColumnWidth(2, 9000);
+                sheet.setColumnWidth(3, 2500);
+                sheet.setColumnWidth(4, 3000);
+                sheet.setColumnWidth(5, 4500);
+                sheet.setColumnWidth(6, 3500);
+
+                // 鏍峰紡
+                CellStyle companyTitle = createBaseStyle(workbook, "瀹嬩綋", (short) 20, true, true);
+                CellStyle billTitle = createBaseStyle(workbook, "瀹嬩綋", (short) 18, true, true);
+                CellStyle headerStyle = createBorderStyle(workbook, "瀹嬩綋", (short) 12, true, true);
+                CellStyle dataCenterStyle = createBorderStyle(workbook, "瀹嬩綋", (short) 11, false, true);
+                CellStyle noBorder = createNoBorderStyle(workbook);
+                CellStyle dashStyle = createDashBottomStyle(workbook);
+
+                // 鏍囬
+                Row row0 = sheet.createRow(0);
+                row0.createCell(0).setCellValue("婀栧崡楣忓垱鐢靛瓙鏈夐檺鍏徃");
+                sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
+                fillMergeRange(sheet, 0, 0, 0, 6, companyTitle);
+
+                Row row1 = sheet.createRow(1);
+                row1.createCell(0).setCellValue("閫� 璐� 鍗�");
+                sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 6));
+                fillMergeRange(sheet, 1, 1, 0, 6, billTitle);
+
+                Customer customer = customerMapper.selectById(ledger.getCustomerId());
+
+                Row row2 = sheet.createRow(2);
+                row2.createCell(0).setCellValue("瀹㈡埛鍚嶇О锛�" + ledger.getCustomerName());
+                row2.createCell(4).setCellValue("鍗曟嵁缂栧彿锛�" + ledger.getSalesContractNo());
+
+                Row row3 = sheet.createRow(3);
+                row3.createCell(0).setCellValue("閫佽揣鍦板潃锛�" + customer.getCompanyAddress());
+                row3.createCell(4).setCellValue("閫佽揣鏃ユ湡锛�" + formatDate(LocalDate.now()));
+
+                Row row4 = sheet.createRow(4);
+                row4.createCell(0).setCellValue("鑱旂郴鏂瑰紡锛�" + customer.getContactPerson() + " " + customer.getContactPhone());
+                row4.createCell(4).setCellValue("鑱旂郴鐢佃瘽锛�" + customer.getCompanyPhone());
+
+                Row row5 = sheet.createRow(5);
+                row5.createCell(0).setCellValue("閫佽揣鍗曚綅锛氭箹鍗楅箯鍒涚數瀛愭湁闄愬叕鍙�");
+                Row row6 = sheet.createRow(6);
+                row6.createCell(0).setCellValue("鍦板潃锛氭箹鍗楃渷鑰掗槼甯傚垱鏂板垱涓氬洯A1鏍�");
+                Row row7 = sheet.createRow(7);
+                row7.createCell(0).setCellValue("璐х墿璇︾粏淇℃伅锛�");
+
+                // 琛ㄥご
+                int tableStart = 8;
+                Row headerRow = sheet.createRow(tableStart);
+                String[] headers = {"搴忓彿", "鐗╂枡缂栧彿", "鍝佸悕/瑙勬牸", "鍗曚綅", "鏁伴噺", "璁㈠崟鍙�", "鍏卞洓鑱�"};
+                for (int i = 0; i < headers.length; i++) {
+                    Cell hc = headerRow.createCell(i);
+                    hc.setCellValue(headers[i]);
+                    hc.setCellStyle(i == 6 ? noBorder : headerStyle);
                 }
-            }
 
-            // 鍏宠仈瀹㈡埛淇℃伅
-            Customer customer = customerMapper.selectById(ledger.getCustomerId());
-
-            // 璁$畻鎬诲悎璁�
-            BigDecimal totalQuantity = BigDecimal.ZERO;
-            for (SalesLedgerProduct product : productList) {
-                totalQuantity = totalQuantity.add(product.getQuantity() == null ? BigDecimal.ZERO : product.getQuantity());
-            }
-
-            // 缁勮椤堕儴闈欐�佹暟鎹�
-            Map<String, Object> dataMap = new HashMap<>();
-            dataMap.put("customerName", ledger.getCustomerName());
-            dataMap.put("companyAddress", customer.getCompanyAddress());
-            dataMap.put("contactPerson", customer.getContactPerson());
-            dataMap.put("contactPhone", customer.getContactPhone());
-            dataMap.put("companyPhone", customer.getCompanyPhone());
-            dataMap.put("salesContractNo", ledger.getSalesContractNo());
-            dataMap.put("deliveryDate", formatDate(LocalDate.now()));
-            dataMap.put("totalQuantity", totalQuantity);
-
-            // 浣跨敤妯℃澘鐢熸垚Excel
-            InputStream templateIs = this.getClass().getResourceAsStream("/static/shipping-note.xlsx");
-            if (templateIs == null) {
-                throw new BaseException("妯℃澘鏂囦欢涓嶅瓨鍦�");
-            }
-
-            ExcelWriter writer = EasyExcel.write(response.getOutputStream()).withTemplate(templateIs).build();
-            WriteSheet sheet = EasyExcel.writerSheet().build();
-
-            // 鍏堝~鍏呮暟鎹紙鍖呮嫭鍚堣锛�
-            writer.fill(dataMap, sheet);
-
-            // 鍐嶅~鍏呬骇鍝佸垪琛�
-            if (!productList.isEmpty()) {
-                FillConfig fillConfig = FillConfig.builder()
-                        .forceNewRow(Boolean.TRUE)
-                        .build();
-                writer.fill(productList, fillConfig, sheet);
-            }
-
-            writer.finish();
-            templateIs.close();
-        } catch (BaseException e) {
-            log.error("瀵煎嚭澶辫触:{}", e.getMessage(), e);
-            throw e;
-        } catch (Exception e) {
-            log.error("瀵煎嚭寮傚父", e);
-            throw new BaseException("瀵煎嚭澶辫触锛�" + e.getMessage());
-        }
-    }
-    
-    /**
-     * 鎵归噺瀵煎嚭閫佽揣鍗曚负鍘嬬缉鍖�
-     */
-    private void exportBatchShippingNote(HttpServletResponse response, List<SalesLedger> salesLedgerList) {
-        // 璁剧疆鍝嶅簲澶�
-        response.setContentType("application/zip");
-        response.setHeader("Content-Disposition", "attachment;filename=閫佽揣鍗�.zip");
-        response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
-
-        try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) {
-
-            for (SalesLedger ledger : salesLedgerList) {
-                log.info("澶勭悊鍚堝悓鍙�: {}", ledger.getSalesContractNo());
-
-                // 鏌ヨ鏄庣粏
+                // 鏌ヨ鍟嗗搧
                 SalesLedgerProduct cond = new SalesLedgerProduct();
                 cond.setSalesLedgerId(ledger.getId());
                 List<SalesLedgerProduct> productList = salesLedgerProductServiceImpl.selectSalesLedgerProductList(cond);
 
-                // 鑷姩搴忓彿+鐗╂枡缂栫爜璧嬪��
-                for (int i = 0; i < productList.size(); i++) {
-                    SalesLedgerProduct product = productList.get(i);
-                    if (product != null) {
-                        product.setSerialNumber(i + 1);
-                        product.setOrderNo(ledger.getSalesContractNo());
-                        Long productModelId = product.getProductModelId();
-                        if (productModelId != null) {
-                            ProductModel productModel = productModelMapper.selectById(productModelId);
-                            if (productModel != null) {
-                                product.setMaterialCode(productModel.getMaterialCode());
-                            }
-                        }
-                    }
-                }
-
-                // 鍏宠仈瀹㈡埛淇℃伅
-                Customer customer = customerMapper.selectById(ledger.getCustomerId());
-
-                // 璁$畻鎬诲悎璁�
                 BigDecimal totalQuantity = BigDecimal.ZERO;
                 for (SalesLedgerProduct product : productList) {
                     totalQuantity = totalQuantity.add(product.getQuantity() == null ? BigDecimal.ZERO : product.getQuantity());
                 }
 
-                // 缁勮椤堕儴闈欐�佹暟鎹�
-                Map<String, Object> dataMap = new HashMap<>();
-                dataMap.put("customerName", ledger.getCustomerName());
-                dataMap.put("companyAddress", customer.getCompanyAddress());
-                dataMap.put("contactPerson", customer.getContactPerson());
-                dataMap.put("contactPhone", customer.getContactPhone());
-                dataMap.put("companyPhone", customer.getCompanyPhone());
-                dataMap.put("salesContractNo", ledger.getSalesContractNo());
-                dataMap.put("deliveryDate", formatDate(LocalDate.now()));
-                dataMap.put("totalQuantity", totalQuantity);
+                int currentRow = tableStart + 1;
+                String[] fourNames = {"瀛樻牴", "鍥炲崟", "瀹㈡埛", "浠撳簱"};
+                int minDataRow = 5;
+                int totalNeedRow = Math.max(minDataRow, fourNames.length);
 
-                ByteArrayOutputStream bos = new ByteArrayOutputStream();
-                InputStream templateIs = this.getClass().getResourceAsStream("/static/shipping-note.xlsx");
+                // 鏁版嵁琛� + 鍥哄畾鍥涜仈琛�
+                for (int i = 0; i < totalNeedRow; i++) {
+                    SalesLedgerProduct p = i < productList.size() ? productList.get(i) : null;
+                    Row dataRow = sheet.createRow(currentRow);
 
-                ExcelWriter writer = EasyExcel.write(bos).withTemplate(templateIs).build();
-                WriteSheet sheet = EasyExcel.writerSheet().build();
+                    // 鍓�6鍒楄祴鍊�
+                    if (p != null) {
+                        String materialCode = "";
+                        if (p.getProductModelId() != null) {
+                            ProductModel m = productModelMapper.selectById(p.getProductModelId());
+                            if (m != null) {
+                                materialCode = m.getMaterialCode();
+                            }
+                        }
+                        dataRow.createCell(0).setCellValue(i + 1);
+                        dataRow.createCell(1).setCellValue(materialCode);
+                        dataRow.createCell(2).setCellValue(p.getProductCategory() + "/" + p.getSpecificationModel());
+                        dataRow.createCell(3).setCellValue(p.getUnit());
+                        dataRow.createCell(4).setCellValue(p.getQuantity() == null ? 0 : p.getQuantity().doubleValue());
+                        dataRow.createCell(5).setCellValue(ledger.getSalesContractNo());
+                    } else {
+                        for (int c = 0; c <= 5; c++) {
+                            dataRow.createCell(c);
+                        }
+                    }
 
-                // 鍏堝~鍏呮暟鎹紙鍖呮嫭鍚堣锛�
-                writer.fill(dataMap, sheet);
-                
-                // 鍐嶅~鍏呬骇鍝佸垪琛�
-                if (!productList.isEmpty()) {
-                    FillConfig fillConfig = FillConfig.builder()
-                            .forceNewRow(Boolean.TRUE)
-                            .build();
-                    writer.fill(productList, fillConfig, sheet);
+                    // 鍓�6鍒楁牱寮�
+                    for (int c = 0; c <= 5; c++) {
+                        dataRow.getCell(c).setCellStyle(dataCenterStyle);
+                    }
+
+                    // 鍏卞洓鑱斿垪
+                    Cell fourCell = dataRow.createCell(6);
+                    if (i < fourNames.length) {
+                        fourCell.setCellValue(fourNames[i]);
+                        fourCell.setCellStyle(dashStyle);
+                    } else {
+                        fourCell.setCellStyle(noBorder);
+                    }
+
+                    currentRow++;
                 }
 
-                writer.finish();
-                templateIs.close();
+                // 鍚堣琛�
+                Row totalRow = sheet.createRow(currentRow);
+                sheet.addMergedRegion(new CellRangeAddress(currentRow, currentRow, 0, 3));
+                totalRow.createCell(0).setCellValue("鍚堣");
+                totalRow.createCell(4).setCellValue(totalQuantity.doubleValue());
+                fillMergeRange(sheet, currentRow, currentRow, 0, 5, dataCenterStyle);
+                totalRow.createCell(6).setCellStyle(noBorder);
 
-                // 鎵撳寘ZIP
-                String excelName = String.format("閫佽揣鍗昣%s.xlsx",
-                        Optional.ofNullable(ledger.getSalesContractNo()).orElse(String.valueOf(ledger.getId())));
-                ZipEntry entry = new ZipEntry(excelName);
-                zos.putNextEntry(entry);
-                zos.write(bos.toByteArray());
-                zos.closeEntry();
-                bos.close();
+                // 澶囨敞
+                currentRow++;
+                Row remarkRow = sheet.createRow(currentRow);
+                remarkRow.createCell(0).setCellValue("澶囨敞锛氳吹鍙稿湪鏀惰揣鍚庤鍗冲埢鏍稿疄鏁伴噺鍙婂搧璐紝鑻ユ湁寮傝锛岃鍦�3鏃ュ唴鎻愬嚭锛屽惁鍒欒涓烘敹鍙椼��");
+                sheet.addMergedRegion(new CellRangeAddress(currentRow, currentRow, 0, 6));
+
+                currentRow++;
+                Row sign1 = sheet.createRow(currentRow);
+                sign1.createCell(0).setCellValue("閫佽揣鍗曚綅锛堢绔狅級锛�");
+                sign1.createCell(5).setCellValue("鏀惰揣鍗曚綅锛�");
+
+                currentRow++;
+                Row sign2 = sheet.createRow(currentRow);
+                sign2.createCell(0).setCellValue("閫佽揣浜猴細");
+                sign2.createCell(5).setCellValue("鏀惰揣浜猴細");
             }
 
-            zos.finish();
-            log.info("鎵归噺瀵煎嚭瀹屾垚锛屽叡{}浠介�佽揣鍗�", salesLedgerList.size());
+            workbook.write(response.getOutputStream());
+            workbook.close();
 
-        } catch (BaseException e) {
-            log.error("瀵煎嚭澶辫触:{}", e.getMessage(), e);
-            throw e;
         } catch (Exception e) {
-            log.error("瀵煎嚭寮傚父", e);
-            throw new BaseException("瀵煎嚭澶辫触锛�" + e.getMessage());
+            log.error("鎵归噺瀵煎嚭閫佽揣鍗曞紓甯�", e);
+            throw new BaseException("鎵归噺瀵煎嚭澶辫触");
+        }
+    }
+
+    // 宸ュ叿绫讳笉鍔�
+    private CellStyle createBaseStyle(Workbook workbook, String fontName, short fontSize, boolean bold, boolean center) {
+        CellStyle style = workbook.createCellStyle();
+        Font font = workbook.createFont();
+        font.setFontName(fontName);
+        font.setFontHeightInPoints(fontSize);
+        font.setBold(bold);
+        style.setFont(font);
+        if (center) {
+            style.setAlignment(HorizontalAlignment.CENTER);
+            style.setVerticalAlignment(VerticalAlignment.CENTER);
+        }
+        return style;
+    }
+
+    private CellStyle createBorderStyle(Workbook workbook, String fontName, short fontSize, boolean bold, boolean center) {
+        CellStyle style = createBaseStyle(workbook, fontName, fontSize, bold, center);
+        style.setBorderTop(BorderStyle.THIN);
+        style.setBorderBottom(BorderStyle.THIN);
+        style.setBorderLeft(BorderStyle.THIN);
+        style.setBorderRight(BorderStyle.THIN);
+        return style;
+    }
+
+    private CellStyle createNoBorderStyle(Workbook workbook) {
+        return createBaseStyle(workbook, "瀹嬩綋", (short) 11, false, false);
+    }
+
+    private CellStyle createDashBottomStyle(Workbook workbook) {
+        CellStyle style = createNoBorderStyle(workbook);
+        style.setBorderBottom(BorderStyle.DASHED);
+        return style;
+    }
+
+    private void fillMergeRange(Sheet sheet, int startR, int endR, int startC, int endC, CellStyle style) {
+        for (int r = startR; r <= endR; r++) {
+            Row row = sheet.getRow(r) == null ? sheet.createRow(r) : sheet.getRow(r);
+            for (int c = startC; c <= endC; c++) {
+                Cell cell = row.getCell(c) == null ? row.createCell(c) : row.getCell(c);
+                cell.setCellStyle(style);
+            }
         }
     }
 
@@ -441,6 +446,82 @@
         }
         return date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
     }
+    
+    /**
+     * 璁剧疆鍗曞厓鏍兼牱寮�
+     */
+    private void setCellStyle(Cell cell, boolean isHeader, boolean isTitle) {
+        Workbook workbook = cell.getSheet().getWorkbook();
+        CellStyle style = workbook.createCellStyle();
+        
+        // 璁剧疆瀵归綈鏂瑰紡
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);
+        
+        // 璁剧疆杈规
+        style.setBorderTop(BorderStyle.THIN);
+        style.setBorderBottom(BorderStyle.THIN);
+        style.setBorderLeft(BorderStyle.THIN);
+        style.setBorderRight(BorderStyle.THIN);
+        
+        // 璁剧疆瀛椾綋
+        Font font = workbook.createFont();
+        font.setFontName("瀹嬩綋");
+        if (isTitle) {
+            font.setFontHeightInPoints((short) 16);
+            font.setBold(true);
+        } else if (isHeader) {
+            font.setFontHeightInPoints((short) 12);
+            font.setBold(true);
+        } else {
+            font.setFontHeightInPoints((short) 11);
+        }
+        style.setFont(font);
+        
+        cell.setCellStyle(style);
+    }
+    
+    
+    /**
+     * 閫佽揣鍗曟牱寮忓鐞嗗櫒
+     */
+    public static class ShippingNoteStyleHandler implements com.alibaba.excel.write.handler.CellWriteHandler {
+        @Override
+        public void beforeCellCreate(com.alibaba.excel.write.metadata.holder.WriteSheetHolder writeSheetHolder, com.alibaba.excel.write.metadata.holder.WriteTableHolder writeTableHolder, org.apache.poi.ss.usermodel.Row row, com.alibaba.excel.metadata.Head head, Integer columnIndex, Integer relativeRowIndex, Boolean isHead) {
+        }
+        
+//        @Override
+//        public void afterCellDispose(com.alibaba.excel.write.metadata.holder.WriteSheetHolder writeSheetHolder, com.alibaba.excel.write.metadata.holder.WriteTableHolder writeTableHolder, org.apache.poi.ss.usermodel.Cell cell, com.alibaba.excel.metadata.Head head, Integer relativeRowIndex, Boolean isHead) {
+//            org.apache.poi.ss.usermodel.Workbook workbook = writeSheetHolder.getSheet().getWorkbook();
+//            org.apache.poi.ss.usermodel.Sheet sheet = writeSheetHolder.getSheet();
+//
+//            // 璁剧疆鍒楀
+//            sheet.setColumnWidth(0, 6000); // 搴忓彿
+//            sheet.setColumnWidth(1, 6000); // 鐗╂枡缂栧彿
+//            sheet.setColumnWidth(2, 10000); // 鍝佸悕/瑙勬牸
+//            sheet.setColumnWidth(3, 4000); // 鍗曚綅
+//            sheet.setColumnWidth(4, 4000); // 鏁伴噺
+//            sheet.setColumnWidth(5, 6000); // 璁㈠崟鍙�
+//            sheet.setColumnWidth(6, 4000); // 鍏卞洓鑱�
+//
+//            // 璁剧疆鍗曞厓鏍兼牱寮�
+//            org.apache.poi.ss.usermodel.CellStyle style = workbook.createCellStyle();
+//            style.setAlignment(org.apache.poi.ss.usermodel.HorizontalAlignment.CENTER);
+//            style.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+//            style.setBorderTop(org.apache.poi.ss.usermodel.BorderStyle.THIN);
+//            style.setBorderBottom(org.apache.poi.ss.usermodel.BorderStyle.THIN);
+//            style.setBorderLeft(org.apache.poi.ss.usermodel.BorderStyle.THIN);
+//            style.setBorderRight(org.apache.poi.ss.usermodel.BorderStyle.THIN);
+//
+//            // 璁剧疆瀛椾綋
+//            org.apache.poi.ss.usermodel.Font font = workbook.createFont();
+//            font.setFontName("瀹嬩綋");
+//            font.setFontHeightInPoints((short) 11);
+//            style.setFont(font);
+//
+//            cell.setCellStyle(style);
+//        }
+    }
 
     @Override
     public List<Map<String, Object>> getSalesNo() {

--
Gitblit v1.9.3