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,