新增 占桩费用设置阈值

This commit is contained in:
Lemon
2023-09-21 10:55:49 +08:00
parent c639a3c00f
commit 1528ae3a1d
3 changed files with 13 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -49,6 +49,9 @@ public class BillingTemplateVO {
// 占桩费率(单位:元/分钟)
private BigDecimal occupyFee;
// 最高占桩费用
private BigDecimal maxOccupyFee;
// 停车免费描述
private String parkFeeDescribe;