From 1528ae3a1d9aadc7f0e70e236d408f931a16007e Mon Sep 17 00:00:00 2001 From: Lemon Date: Thu, 21 Sep 2023 10:55:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=8D=A0=E6=A1=A9?= =?UTF-8?q?=E8=B4=B9=E7=94=A8=E8=AE=BE=E7=BD=AE=E9=98=88=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pile/service/impl/OrderPileOccupyServiceImpl.java | 9 +++++++++ .../java/com/jsowell/pile/vo/web/BillingTemplateVO.java | 3 +++ .../resources/mapper/pile/PileBillingTemplateMapper.xml | 1 + 3 files changed, 13 insertions(+) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderPileOccupyServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderPileOccupyServiceImpl.java index a8c0305d1..9c7f6d0f0 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderPileOccupyServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderPileOccupyServiceImpl.java @@ -43,6 +43,7 @@ import java.math.BigDecimal; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; @Slf4j @@ -315,6 +316,14 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService { // 需要计费的时间 BigDecimal time = totalOccupyTime.subtract(totalFreeTime); resultAmount = time.multiply(occupyFee); + BigDecimal maxOccupyFee = billingTemplate.getMaxOccupyFee(); + if (Objects.isNull(maxOccupyFee)) { + maxOccupyFee = new BigDecimal("100"); + } + if (resultAmount.compareTo(maxOccupyFee) > 0) { + // 计算出来的费用高于计费模板中设置的最高占桩费用,设置占桩费为计费模板中的费用 + resultAmount = maxOccupyFee; + } log.info("计算占桩订单金额 end:{}", JSON.toJSONString(orderPileOccupy)); return resultAmount; } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/BillingTemplateVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/BillingTemplateVO.java index d1282358b..258b59507 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/BillingTemplateVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/BillingTemplateVO.java @@ -49,6 +49,9 @@ public class BillingTemplateVO { // 占桩费率(单位:元/分钟) private BigDecimal occupyFee; + // 最高占桩费用 + private BigDecimal maxOccupyFee; + // 停车免费描述 private String parkFeeDescribe; diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileBillingTemplateMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileBillingTemplateMapper.xml index 544dd4bd9..58ebe27ad 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileBillingTemplateMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileBillingTemplateMapper.xml @@ -512,6 +512,7 @@ t2.type as deviceType, t2.free_time as freeTime, t2.occupy_fee as occupyFee, + t2.max_occupy_fee as maxOccupyFee, t1.park_fee_describe as parkFeeDescribe, t2.publish_time as publishTime, t3.electricity_price AS sharpElectricityPrice,