diff --git a/main/java/shkd/repc/recon/formplugin/ContractFormPlugin.java b/main/java/shkd/repc/recon/formplugin/ContractFormPlugin.java index 89ad1ae..c6e2879 100644 --- a/main/java/shkd/repc/recon/formplugin/ContractFormPlugin.java +++ b/main/java/shkd/repc/recon/formplugin/ContractFormPlugin.java @@ -47,6 +47,7 @@ import javax.script.ScriptException; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; +import java.math.RoundingMode; import java.net.URL; import java.net.URLConnection; import java.util.*; @@ -384,6 +385,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadLis } break; case 8: + //todo:保留几位有效数字 Cell cell1 = row.getCell(6); Cell cell2 = row.getCell(7); if (cell1 != null && cell2 != null && StringUtils.isNotEmpty(cell1.toString()) && StringUtils.isNotEmpty(cell2.toString())) { @@ -391,7 +393,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadLis try { double value1 = cell1.getNumericCellValue(); double value2 = cell2.getNumericCellValue(); - results = BigDecimal.valueOf(value1 * value2); + results = BigDecimal.valueOf(value1 * value2).setScale(3, RoundingMode.HALF_UP); contractsummarylist.set("qeug_amounttotal", results); // 合计金额 } catch (Exception e) { this.getView().showErrorNotification("清单汇总识别--生成明细失败:" + e.getMessage());