订单支付成功 支付回调

This commit is contained in:
2023-07-11 17:01:15 +08:00
parent 387af25a40
commit 5246c620d5
3 changed files with 55 additions and 23 deletions

View File

@@ -291,4 +291,12 @@ public interface IOrderBasicInfoService {
Map<String, Object> payOrder(PayOrderDTO dto) throws Exception;
void batchRefund(QueryOrderDTO dto);
/**
* 订单支付成功 支付回调
* 支付成功后掉用这个方法
* 1. 修改订单支付状态
* 2. 发送启动充电指令
*/
void payOrderSuccessCallback(PayOrderSuccessCallbackDTO dto);
}

View File

@@ -2244,7 +2244,8 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
* 1. 修改订单支付状态
* 2. 发送启动充电指令
*/
private void payOrderSuccessCallback(PayOrderSuccessCallbackDTO dto) {
@Override
public void payOrderSuccessCallback(PayOrderSuccessCallbackDTO dto) {
OrderBasicInfo orderInfo = this.getOrderInfoByOrderCode(dto.getOrderCode());
BigDecimal payAmount = dto.getPayAmount();
@@ -2256,26 +2257,49 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
this.updateOrderBasicInfo(orderInfo);
// 如果是鉴权卡启动或者vin启动不发启动充电指令
if (!(StringUtils.equals(dto.getStartMode(), StartModeEnum.AUTH_CARD.getValue())
|| StringUtils.equals(dto.getStartMode(), StartModeEnum.VIN_CODE.getValue()))) {
// if (!(StringUtils.equals(dto.getStartMode(), StartModeEnum.AUTH_CARD.getValue())
// || StringUtils.equals(dto.getStartMode(), StartModeEnum.VIN_CODE.getValue()))) {
//
// if (StringUtils.equals(orderInfo.getStartType(), StartTypeEnum.NOW.getValue())) { // 立即启动充电
// String pileSn = orderInfo.getPileSn();
// // 发送启动充电指令前,再次下发计费模板
// BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
// if (billingTemplateVO != null) {
// pileRemoteService.publishPileBillingTemplate(pileSn, billingTemplateVO);
// }
// // 发送启动指令
// pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), orderInfo.getPayAmount());
// } else { // 预约充电
// // 修改枪口状态为 占用预约
//
// // 下发修改充电桩设置指令
//
// }
// }
if (StringUtils.equals(orderInfo.getStartType(), StartTypeEnum.NOW.getValue())) { // 立即启动充电
String pileSn = orderInfo.getPileSn();
// 发送启动充电指令前,再次下发计费模板
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
if (billingTemplateVO != null) {
pileRemoteService.publishPileBillingTemplate(pileSn, billingTemplateVO);
}
// 发送启动指令
pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), orderInfo.getPayAmount());
} else { // 预约充电
// 修改枪口状态为 占用预约
// 是否发送启动指令
boolean sendStartCharging = true;
// 下发修改充电桩设置指令
}
if (StartModeEnum.AUTH_CARD.getValue().equals(dto.getStartMode())) {
sendStartCharging = false;
} else if (StartModeEnum.VIN_CODE.getValue().equals(dto.getStartMode())) {
sendStartCharging = false;
} else if (StartTypeEnum.APPOINTMENT.getValue().equals(orderInfo.getStartType())) {
sendStartCharging = false;
}
if (sendStartCharging) {
String pileSn = orderInfo.getPileSn();
// 发送启动充电指令前,再次下发计费模板
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
if (billingTemplateVO != null) {
pileRemoteService.publishPileBillingTemplate(pileSn, billingTemplateVO);
}
// 发送启动指令
pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), orderInfo.getPayAmount());
}
}
/**