mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
计算启动金额
This commit is contained in:
@@ -71,8 +71,7 @@ public class PileRemoteService {
|
||||
*
|
||||
* @param pileSn 充电桩sn
|
||||
*/
|
||||
public void remoteStartCharging(String pileSn, String connectorCode, String transactionCode, BigDecimal accountBalance) {
|
||||
// String s = "550314127823050120180619144446808800000000000101000000100000057300000000D14B0A54A0860100";
|
||||
public void remoteStartCharging(String pileSn, String connectorCode, String transactionCode, BigDecimal chargeAmount) {
|
||||
if (StringUtils.isEmpty(pileSn) || StringUtils.isEmpty(connectorCode)) {
|
||||
log.warn("远程启动充电, 充电桩编号和枪口号不能为空");
|
||||
return;
|
||||
@@ -82,7 +81,7 @@ public class PileRemoteService {
|
||||
.pileSn(pileSn)
|
||||
.connectorCode(connectorCode)
|
||||
.transactionCode(transactionCode)
|
||||
.chargeAmount(accountBalance)
|
||||
.chargeAmount(chargeAmount)
|
||||
.build();
|
||||
ykcPushCommandService.pushStartChargingCommand(startChargingCommand);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单推款记录
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user