From 511479b70e2c56f6effa028c56d4d35115618624 Mon Sep 17 00:00:00 2001 From: Vayne Date: Tue, 18 Apr 2023 18:47:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A4=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jnpf/collection/controller/CollectionController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/collection/controller/CollectionController.java b/SC-boot/linkage-scm/src/main/java/jnpf/collection/controller/CollectionController.java index 8fb641e6..4fe11e1b 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/collection/controller/CollectionController.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/collection/controller/CollectionController.java @@ -49,6 +49,7 @@ import javax.validation.Valid; import java.io.FileOutputStream; import java.io.IOException; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; import java.util.stream.Collectors; import org.springframework.util.CollectionUtils; @@ -214,7 +215,7 @@ public class CollectionController { List poundlist1 = new ArrayList<>(); for (PoundlistEntity pound : poundlist){ if (pound.getSalesPrice()!=null && pound.getSettlement()!=null) { - amount = amount.add(pound.getSalesPrice().multiply(pound.getSettlement())); + amount = amount.add(pound.getSalesPrice().multiply(pound.getSettlement())).setScale(2, RoundingMode.HALF_UP); if (amount.compareTo(sum) < 1) { poundlist1.add(pound); }else{ @@ -235,8 +236,8 @@ public class CollectionController { collectionEntity.setStatus("2"); collectionEntity.setBusinessDate(new Date()); collectionService.updateById(collectionEntity); - return ActionResult.success("认款成功"); } + return ActionResult.success("认款成功"); } } return ActionResult.fail("请选择一条数据");