电单车支付成功回调

This commit is contained in:
Guoqs
2024-09-12 13:51:43 +08:00
parent 1b97605bb4
commit 098355960f
5 changed files with 43 additions and 39 deletions

View File

@@ -50,6 +50,9 @@ public class PileRemoteService {
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Autowired
private EBikeSendCommandService eBikeSendCommandService;
@Value("${remoteUpdate.server}") @Value("${remoteUpdate.server}")
private String serverAddress; private String serverAddress;
@@ -108,6 +111,25 @@ public class PileRemoteService {
ykcPushCommandService.pushStartChargingCommand(startChargingCommand); ykcPushCommandService.pushStartChargingCommand(startChargingCommand);
} }
/**
* 电单车远程启动充电
*/
public void remoteStartChargingEBike(String pileSn, String connectorCode, String transactionCode, BigDecimal chargeAmount) {
if (StringUtils.isEmpty(pileSn) || StringUtils.isEmpty(connectorCode)) {
log.warn("远程启动充电, 充电桩编号和枪口号不能为空");
return;
}
log.info("【=====平台下发指令=====】: 电单车远程启动充电, 桩号:{}, 枪口号:{}", pileSn, connectorCode);
StartChargingCommand startChargingCommand = StartChargingCommand.builder()
.pileSn(pileSn)
.connectorCode(connectorCode)
.transactionCode(transactionCode)
.chargeAmount(chargeAmount)
.build();
// ykcPushCommandService.pushStartChargingCommand(startChargingCommand);
eBikeSendCommandService.sendStartChargingCommand(startChargingCommand);
}
/** /**
* 远程停止充电 * 远程停止充电
*/ */

View File

@@ -3,8 +3,6 @@ package com.jsowell.pile.service.impl;
import com.jsowell.common.enums.ykc.PileChannelEntity; import com.jsowell.common.enums.ykc.PileChannelEntity;
import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.RandomUtil; import com.jsowell.common.util.RandomUtil;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.id.IdUtils;
import com.jsowell.pile.domain.ebike.AbsEBikeMessage; import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
import com.jsowell.pile.domain.ebike.serversend.EBikeMessageCmd82; import com.jsowell.pile.domain.ebike.serversend.EBikeMessageCmd82;
import com.jsowell.pile.domain.ykcCommond.StartChargingCommand; import com.jsowell.pile.domain.ykcCommond.StartChargingCommand;
@@ -35,9 +33,9 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
String pileSn = command.getPileSn(); String pileSn = command.getPileSn();
String connectorCode = command.getConnectorCode(); String connectorCode = command.getConnectorCode();
String transactionCode = command.getTransactionCode(); String transactionCode = command.getTransactionCode();
if (StringUtils.isBlank(transactionCode)) { // if (StringUtils.isBlank(transactionCode)) {
transactionCode = IdUtils.generateTransactionCode(pileSn, connectorCode); // transactionCode = IdUtils.generateTransactionCode(pileSn, connectorCode);
} // }
// 组装参数 // 组装参数
EBikeMessageCmd82 message = new EBikeMessageCmd82(); EBikeMessageCmd82 message = new EBikeMessageCmd82();

View File

@@ -121,9 +121,6 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
@Autowired @Autowired
private AdapayCallbackRecordService adapayCallbackRecordService; private AdapayCallbackRecordService adapayCallbackRecordService;
@Autowired
private WechatPayService wechatPayService;
@Autowired @Autowired
private OrderAbnormalRecordService orderAbnormalRecordService; private OrderAbnormalRecordService orderAbnormalRecordService;
@@ -181,18 +178,14 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
@Autowired @Autowired
private ClearingBillInfoService clearingBillInfoService; private ClearingBillInfoService clearingBillInfoService;
@Autowired
private PileMsgRecordService pileMsgRecordService;
@Autowired @Autowired
private ClearingBillDetailService clearingBillDetailService; private ClearingBillDetailService clearingBillDetailService;
@Autowired
private ThirdPartyStationRelationService thirdPartyStationRelationService;
@Autowired @Autowired
private IThirdpartySnRelationService snRelationService; private IThirdpartySnRelationService snRelationService;
@Override @Override
public int deleteByPrimaryKey(Integer id) { public int deleteByPrimaryKey(Integer id) {
return orderBasicInfoMapper.deleteByPrimaryKey(id); return orderBasicInfoMapper.deleteByPrimaryKey(id);
@@ -3128,17 +3121,6 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
} }
} }
} }
// 判断该桩所在的站点是否推送了第三方站点(需要我方平台发送启动指令的,如:华为平台)
// List<ThirdPartyStationRelationVO> relationInfoList = thirdPartyStationRelationService.getRelationInfoList(orderInfo.getStationId());
// if (CollectionUtils.isNotEmpty(relationInfoList)) {
// for (ThirdPartyStationRelationVO vo : relationInfoList) {
// String startMode = vo.getStartMode();
// if (StringUtils.equals(Constants.ONE, startMode)) {
// // 无需发送启机指令,在汇付回调中发送
// sendStartCharging = false;
// }
// }
// }
// 修改订单 // 修改订单
orderInfo.setPayMode(dto.getPayMode()); orderInfo.setPayMode(dto.getPayMode());
@@ -3152,16 +3134,29 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
if (sendStartCharging) { if (sendStartCharging) {
String pileSn = orderInfo.getPileSn(); String pileSn = orderInfo.getPileSn();
String pileConnectorCode = orderInfo.getPileConnectorCode();
// 获取桩信息
PileConnectorDetailVO pileConnectorDetailVO = pileBasicInfoService.queryPileConnectorDetail(pileConnectorCode);
if (pileConnectorDetailVO == null) {
logger.error("订单:{}支付成功, 启动充电失败, 桩信息为空, pileSn:{}", dto.getOrderCode(), pileSn);
return;
}
// 发送启动充电指令前,再次下发计费模板 // 发送启动充电指令前,再次下发计费模板
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn); BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
if (billingTemplateVO != null) { if (billingTemplateVO != null && !StringUtils.equals(pileConnectorDetailVO.getChargePortType(), Constants.THREE)) {
logger.info("发送启动充电指令前,再次下发计费模板, orderCode:{}, 计费模板:{}", orderInfo.getOrderCode(), JSON.toJSONString(billingTemplateVO)); logger.info("发送启动充电指令前,再次下发计费模板, orderCode:{}, 计费模板:{}", orderInfo.getOrderCode(), JSON.toJSONString(billingTemplateVO));
pileRemoteService.publishPileBillingTemplate(pileSn, billingTemplateVO); pileRemoteService.publishPileBillingTemplate(pileSn, billingTemplateVO);
} }
// 获取启动金额 // 获取启动金额
BigDecimal chargeAmount = computeChargeAmount(orderInfo.getMerchantId(), orderInfo.getStationId(), orderInfo.getMemberId(), orderInfo.getPayAmount()); BigDecimal chargeAmount = computeChargeAmount(orderInfo.getMerchantId(), orderInfo.getStationId(), orderInfo.getMemberId(), orderInfo.getPayAmount());
// 发送启动指令 // 发送启动指令
if (StringUtils.equals(pileConnectorDetailVO.getChargePortType(), Constants.THREE)) {
// 电单车桩
pileRemoteService.remoteStartChargingEBike(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), chargeAmount);
} else {
// 电动汽车桩
pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), chargeAmount); pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), chargeAmount);
}
logger.info("订单:{}支付成功, 发送启动指令", dto.getOrderCode()); logger.info("订单:{}支付成功, 发送启动指令", dto.getOrderCode());
} }

View File

@@ -326,17 +326,6 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
return pileInfoVOS; return pileInfoVOS;
} }
/**
* 查询充电桩信息
* 后管使用,带权限过滤
* @param dto 前台参数
* @return 充电桩信息集合
*/
public List<PileDetailVO> queryPileInfosV2(QueryPileDTO dto) {
return null;
}
/** /**
* 查询充电桩列表 * 查询充电桩列表
* 后管使用,带权限过滤 * 后管使用,带权限过滤

View File

@@ -63,7 +63,7 @@ public class PileInfoVO {
/** /**
* 充电接口类型 1-快充2-慢充3-电单车 * 充电接口类型 1-快充2-慢充3-电单车
*/ */
private String chargePortType; // private String chargePortType;
/** /**
* 枪口编号 * 枪口编号