Browse Source

商品调价单导入调整

郭齐峰 1 year ago
parent
commit
216ba250a3

+ 10 - 0
src/custom/restcontroller/webmanage/sale/itempriceadjust/ItempriceadjustItemprice.java

@@ -10,7 +10,9 @@ import common.annotation.CACHEING;
 import common.annotation.CACHEING_CLEAN;
 import common.data.*;
 import org.apache.commons.lang.StringUtils;
+import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.CellType;
+import org.apache.poi.ss.usermodel.DataFormat;
 import org.apache.poi.xssf.usermodel.*;
 import restcontroller.R;
 import restcontroller.system.attachment.Attachment;
@@ -430,6 +432,14 @@ public class ItempriceadjustItemprice extends Controller {
 
         XSSFSheet sheet = excelFactory.getXssfWorkbook().createSheet("Sheet1");
         XSSFWorkbook xssfFWorkbook = excelFactory.getXssfWorkbook();
+
+        CellStyle style = xssfFWorkbook.createCellStyle();
+        // 设置为文本格式,防止身份证号变成科学计数法
+        DataFormat format = xssfFWorkbook.createDataFormat();
+        style.setDataFormat(format.getFormat("@"));
+        // 对单独某一列进行样式赋值,第一个参数为列数,第二个参数为样式
+        sheet.setDefaultColumnStyle(0, style);
+
         ExportExcel.setBatchDetailSheetColumn1(sheet);// 设置工作薄列宽
         XSSFCellStyle titleCellStyle1 = ExportExcel.createTitleCellStyle1(xssfFWorkbook);
         XSSFCellStyle titleCellStyle2 = ExportExcel.createTitleCellStyle2(xssfFWorkbook);