计算启动金额

This commit is contained in:
2023-12-06 10:40:46 +08:00
parent 3a0eae4aeb
commit 4ce6d3d7d6
2 changed files with 18 additions and 4 deletions

View File

@@ -3049,12 +3049,27 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
if (billingTemplateVO != null) {
pileRemoteService.publishPileBillingTemplate(pileSn, billingTemplateVO);
}
// 获取启动金额
BigDecimal chargeAmount = computeChargeAmount(orderInfo.getMerchantId(), orderInfo.getStationId(), orderInfo.getMemberId(), orderInfo.getPayAmount());
// 发送启动指令
pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), orderInfo.getPayAmount());
pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), chargeAmount);
logger.info("订单:{}支付成功, 发送启动指令", dto.getOrderCode());
}
}
// 计算启动金额
private BigDecimal computeChargeAmount(String merchantId, String stationId, String memberId, BigDecimal payAmount) {
// 默认折扣100%
BigDecimal discount = BigDecimal.ONE;
// TODO 如果member享受会员价则获取到该会员在此站点的折扣
// 启动金额 = 支付金额 ➗ 折扣 保留两位小数
BigDecimal chargeAmount = payAmount.divide(discount, 2, RoundingMode.DOWN);
return chargeAmount;
}
/**
* 查询订单推款记录
*