huangfuli 3 lat temu
rodzic
commit
72384cbd09

+ 5 - 5
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/view/ExportVView.java

@@ -90,11 +90,11 @@ public class ExportVView {
     /**
      * 毛重
      */
-    private Float grossWeight;
+    private String grossWeight;
     /**
      * 皮重
      */
-    private Float tare;
+    private String tare;
     /**
      * 扣重
      */
@@ -102,7 +102,7 @@ public class ExportVView {
     /**
      * 净重
      */
-    private Float netWeight;
+    private String netWeight;
     /**
      * 扣单价
      */
@@ -118,11 +118,11 @@ public class ExportVView {
     /**
      * 应付金额(元/吨)
      */
-    private Float amountIngPayable;
+    private String amountIngPayable;
     /**
      * 实付金额(元/吨)
      */
-    private Float amountEdPayable;
+    private String amountEdPayable;
     /**
      * 姓名
      */

+ 27 - 7
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseBaseInfoServiceImpl.java

@@ -1492,6 +1492,24 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         // 下styleDetailTitle
         styleDetail.setBorderBottom(HSSFCellStyle.BORDER_THIN);
 
+        HSSFCellStyle contextstyle = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleDetail.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        styleDetail.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleDetail.setWrapText(true);
+        // 设置单元格字体
+        styleDetail.setFont(fontDetail);
+        // 右边框
+        styleDetail.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        styleDetail.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        styleDetail.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        styleDetail.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+
         HSSFCellStyle styleDetailYellow = wb.createCellStyle();
         // 指定单元格居中对齐
         styleDetailYellow.setAlignment(HSSFCellStyle.ALIGN_CENTER);
@@ -1823,16 +1841,18 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                 cell.setCellValue(new Formatter().format("%.3f", editFloat(exportVView.getNetWeightPrice())).toString());
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(20);
-                cell.setCellValue(new Formatter().format("%.2f", editFloat(exportVView.getGrossWeight())).toString());
+                HSSFDataFormat df = wb.createDataFormat(); // 此处设置数据格式
+                contextstyle.setDataFormat(df.getBuiltinFormat("#,##0.00"));//保留两位小数点
+                cell.setCellValue(Double.parseDouble(exportVView.getGrossWeight()));
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(21);
-                cell.setCellValue(new Formatter().format("%.2f", editFloat(exportVView.getTare())).toString());
+                cell.setCellValue(Double.parseDouble(exportVView.getTare()));
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(22);
                 cell.setCellValue(new Formatter().format("%.2f", editFloat(exportVView.getBuckleWeight())).toString());
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(23);
-                cell.setCellValue(new Formatter().format("%.2f", editFloat(exportVView.getNetWeight())).toString());
+                cell.setCellValue(Double.parseDouble(exportVView.getNetWeight()));
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(24);
                 cell.setCellValue(new Formatter().format("%.2f", editFloat(exportVView.getUnitDeduction())).toString());
@@ -1841,13 +1861,13 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                 cell.setCellValue(new Formatter().format("%.3f", editFloat(exportVView.getPureWeightPrice())).toString());
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(26);
-                cell.setCellValue(new Formatter().format("%.2f", editFloat(exportVView.getPureWeight())).toString());
+                cell.setCellValue(editFloat(exportVView.getPureWeight()));
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(27);
-                cell.setCellValue(new Formatter().format("%.2f", editFloat(exportVView.getAmountIngPayable())).toString());
+                cell.setCellValue(Double.parseDouble(exportVView.getAmountIngPayable()));
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(28);
-                cell.setCellValue(new Formatter().format("%.2f", editFloat(exportVView.getAmountEdPayable())).toString());
+                cell.setCellValue(Double.parseDouble(exportVView.getAmountEdPayable()));
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(29);
                 cell.setCellValue(editString(exportVView.getCustomerName()));
@@ -1879,7 +1899,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                     + UUID.randomUUID().toString().replaceAll("-", "");
 
             path = tempPath + excelPath + '/' + "合同信息"
-                    + ".xls";
+                    + ".xlsx";
 
         } catch (Exception e) {
             log.debug(e.getMessage());