update 结束充电时判断该桩是否对接第三方平台,调用统一停机指令

This commit is contained in:
Lemon
2024-04-07 09:25:30 +08:00
parent 81f15e3dc0
commit ae07f5d743

View File

@@ -317,29 +317,44 @@ public class OrderService {
if (!StringUtils.equals(orderInfo.getMemberId(), dto.getMemberId())) {
throw new BusinessException(ReturnCodeEnum.CODE_ORDER_MEMBER_NOT_MATCH_ERROR);
}
// 判断该桩所在的站点是否推送了第三方站点(需要我方平台发送启动指令的,如:华为平台)
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)) {
// 启动类型为 1 的即为对接了类似华为平台,需要调用第三方平台的统一停止充电接口
ThirdPartyCommonStopChargeDTO commonStopChargeDTO = new ThirdPartyCommonStopChargeDTO();
commonStopChargeDTO.setThirdPartyType(vo.getThirdPartyType());
commonStopChargeDTO.setOrderBasicInfo(orderInfo);
// 调用统一停止充电接口
String result = commonService.commonStopCharge(commonStopChargeDTO);
log.info("订单:{}调用第三方平台统一停止充电接口,调用结果 SuccStat:{}", orderInfo.getOrderCode(), result);
}else {
// 发送停止指令
pileRemoteService.remoteStopCharging(orderInfo.getPileSn(), orderInfo.getConnectorCode(), orderInfo.getTransactionCode());
}
// 判断该桩是否推送了第三方站点(需要我方平台发送启动指令的,如:华为平台)
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(orderInfo.getStationId(), orderInfo.getPileSn(), null);
if (CollectionUtils.isNotEmpty(list)) {
for (ThirdPartySnRelationVO vo : list) {
ThirdPartyCommonStopChargeDTO commonStopChargeDTO = new ThirdPartyCommonStopChargeDTO();
commonStopChargeDTO.setThirdPartyType(vo.getThirdPartyType());
commonStopChargeDTO.setOrderBasicInfo(orderInfo);
// 调用统一停止充电接口
String result = commonService.commonStopCharge(commonStopChargeDTO);
log.info("订单:{} 调用统一停止充电接口, result:{}", orderInfo, result);
}
}else {
// 发送停止指令
pileRemoteService.remoteStopCharging(orderInfo.getPileSn(), orderInfo.getConnectorCode(), orderInfo.getTransactionCode());
}
// 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)) {
// // 启动类型为 1 的即为对接了类似华为平台,需要调用第三方平台的统一停止充电接口
// ThirdPartyCommonStopChargeDTO commonStopChargeDTO = new ThirdPartyCommonStopChargeDTO();
// commonStopChargeDTO.setThirdPartyType(vo.getThirdPartyType());
// commonStopChargeDTO.setOrderBasicInfo(orderInfo);
// // 调用统一停止充电接口
// String result = commonService.commonStopCharge(commonStopChargeDTO);
// log.info("订单:{}调用第三方平台统一停止充电接口,调用结果 SuccStat:{}", orderInfo.getOrderCode(), result);
// }else {
// // 发送停止指令
// pileRemoteService.remoteStopCharging(orderInfo.getPileSn(), orderInfo.getConnectorCode(), orderInfo.getTransactionCode());
// }
// }
// }else {
// // 发送停止指令
// pileRemoteService.remoteStopCharging(orderInfo.getPileSn(), orderInfo.getConnectorCode(), orderInfo.getTransactionCode());
// }
// 发送停止指令
// pileRemoteService.remoteStopCharging(orderInfo.getPileSn(), orderInfo.getConnectorCode(), orderInfo.getTransactionCode());
log.info("订单号:{}发送停机指令成功", dto.getOrderCode());