From 37a47ad1936437be603ccdf875cb71a0bc919b61 Mon Sep 17 00:00:00 2001 From: yuyang Date: Fri, 4 Mar 2022 10:40:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E7=94=B5=E8=B4=B9=E5=A4=A7?= =?UTF-8?q?=E4=BA=8E=E6=80=BB=E9=87=91=E9=A2=9D=EF=BC=8C=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E8=B4=B9=E5=87=BA=E7=8E=B0=E8=B4=9F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xhpc/order/api/XhpcPileOrderController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java index 0711bcc7..b70aeec1 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java @@ -308,8 +308,14 @@ public class XhpcPileOrderController extends BaseController { powerPrice=powerPrice.add(multiply); } powerPrice =powerPrice.setScale(2,BigDecimal.ROUND_HALF_UP); + //总服务费 BigDecimal servicePrice = money.subtract(powerPrice); + //防止出现负数 + if(powerPrice.compareTo(money)>0){ + powerPrice =money; + servicePrice = money.subtract(powerPrice); + } //剩余的电费 BigDecimal surplusPowerPrice = powerPrice; //剩余的服务费