diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/RemoteStartChargingRequestHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/RemoteStartChargingRequestHandler.java index 3c322b73a..8d0ea37ca 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/RemoteStartChargingRequestHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/RemoteStartChargingRequestHandler.java @@ -113,7 +113,8 @@ public class RemoteStartChargingRequestHandler extends AbstractYkcHandler { } try { // 启动结果回复 - commonService.commonPushStartChargeResult(orderInfo); +// commonService.commonPushStartChargeResult(orderInfo); + commonService.commonPushStartChargeResultV2(orderInfo); } catch (Exception e) { e.printStackTrace(); } @@ -121,7 +122,7 @@ public class RemoteStartChargingRequestHandler extends AbstractYkcHandler { if (StringUtils.equals(startResult, Constants.DOUBLE_ZERO)) { try { Thread.sleep(500); - commonService.commonPushOrderInfo(orderInfo); + commonService.commonPushOrderInfoV2(orderInfo); } catch (Exception e) { log.error("统一推送第三方平台订单信息error, ", e); } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java index 6d934dd98..e5e691066 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java @@ -545,6 +545,23 @@ public class CommonService { } } + public void commonPushStartChargeResultV2(OrderBasicInfo orderBasicInfo) { + String stationId = orderBasicInfo.getStationId(); + // 查询该站点是否推送第三方平台 + List relationInfoList = thirdpartySecretInfoService.queryStationToPlatformList(stationId); + // ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation); + if (CollectionUtils.isEmpty(relationInfoList)) { + return; + } + for (ThirdPartySecretInfoVO relationVO : relationInfoList) { + NotificationDTO dto = new NotificationDTO(); + dto.setStationId(stationId); + dto.setPlatformType(relationVO.getPlatformType()); + dto.setOrderCode(orderBasicInfo.getOrderCode()); + notificationService.commonPushStartChargeResult(dto); + } + } + /** * 统一推送告警信息 * @param pileConnectorCode diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java index 2c97c5e80..eaf2733e7 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java @@ -173,6 +173,34 @@ public class NotificationService { } } + public void commonPushStartChargeResult(NotificationDTO dto) { + String stationId = dto.getStationId(); + String orderCode = dto.getOrderCode(); + String platformType = dto.getPlatformType(); + if (StringUtils.isBlank(stationId) || StringUtils.isBlank(orderCode)) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } + // 通过stationId 查询该站点需要对接的平台配置 + List secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId); + if (CollectionUtils.isEmpty(secretInfoVOS)) { + return; + } + // 调用相应平台的处理方法 + for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) { + if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) { + // 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue + continue; + } + try { + // 根据平台类型获取Service + ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType()); + platformService.notificationStartChargeResult(orderCode); + } catch (Exception e) { + logger.error("充电订单信息推送error", e); + } + } + } + /** * 站点功率信息推送 * notification_orderInfo/notification_charge_order_info