refactor(coal): 提升仓库收货单相关计算精度

- 将 NumberUtils.round2 方法替换为 NumberUtils.round4,提高计算精度到小数点后四位- 修改 BigDecimal 设置小数位数的方法,从 setScale(2, RoundingMode.HALF_UP) 改为 setScale(4, RoundingMode.HALF_UP)
This commit is contained in:
2025-04-16 21:46:33 +08:00
parent b84ddc5118
commit f658e98e55

View File

@@ -195,13 +195,13 @@ public class WarehouseReceiptService
if (!receipt0.getDetail().isEmpty()) {
receipt0.setNumber(
NumberUtils.round2(
NumberUtils.round4(
receipt0.getDetail().stream()
.map(WarehouseReceiptDetailEntity::getNumber)
.reduce(0.0, Double::sum)));
receipt0.setAmount(
NumberUtils.round2(
NumberUtils.round4(
receipt0.getDetail().stream()
.map(WarehouseReceiptDetailEntity::getAmount)
.reduce(0.0, Double::sum)));
@@ -260,7 +260,7 @@ public class WarehouseReceiptService
BigDecimal.valueOf(
ObjectUtils.defaultIfNull(
warehouseReceiptDetailEntity.getNumber(), 0.0))
.setScale(2, RoundingMode.HALF_UP)
.setScale(4, RoundingMode.HALF_UP)
.doubleValue());
warehouseReceiptDetailEntity.setAmount(