diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/UploadRealTimeMonitorHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/UploadRealTimeMonitorHandler.java index 0448a2ff3..973b3b085 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/UploadRealTimeMonitorHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/UploadRealTimeMonitorHandler.java @@ -358,12 +358,6 @@ public class UploadRealTimeMonitorHandler extends AbstractYkcHandler { // 异步推送第三方平台实时数据V2 CompletableFuture.runAsync(() -> { try { - log.info("thirdpartyTaskExecutor状态:活跃线程数={}, 队列大小={}, 任务总数={}, 拒绝任务数={}", - thirdpartyTaskExecutor.getActiveCount(), - thirdpartyTaskExecutor.getThreadPoolExecutor().getQueue().size(), - thirdpartyTaskExecutor.getThreadPoolExecutor().getTaskCount(), - thirdpartyTaskExecutor.getThreadPoolExecutor().getRejectedExecutionHandler().toString()); - commonService.pushRealTimeInfoV2(pileSn, connectorCode, connectorStatus, realTimeMonitorData, transactionCode); // log.info("统一推送第三方平台实时数据V2 success, pileSn:{}, connectorCode:{}, connectorStatus:{}, realTimeMonitorData:{}, transactionCode:{}", pileSn, connectorCode, connectorStatus, realTimeMonitorData, transactionCode); } catch (Exception 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 0cc8f9738..2fe8d7939 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 @@ -419,42 +419,43 @@ public class CommonService { String stationId = String.valueOf(pileBasicInfo.getStationId()); // 查询该站点是否推送第三方平台 List thirdPartySecretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId); - - log.info("推送实时数据到第三方平台 stationId:{}, thirdPartySecretInfoVOS:{}", stationId, thirdPartySecretInfoVOS); - if (CollectionUtils.isEmpty(thirdPartySecretInfoVOS)) { return; } - - // 推送 - for (ThirdPartySecretInfoVO thirdPartySecretInfoVO : thirdPartySecretInfoVOS) { - NotificationDTO dto = new NotificationDTO(); - dto.setStationId(stationId); - dto.setPileConnectorCode(pileConnectorCode); - dto.setStatus(changedStatus); - dto.setPlatformType(thirdPartySecretInfoVO.getPlatformType()); - - notificationService.notificationStationStatus(dto); - - log.info("交易流水号transactionCode:{}", transactionCode); - // 查询订单信息 - OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); - // 新运有三个平台,当这个transactionCode为null或orderInfo为null时,这里就不会继续推送其它两家平台,直接return了 - // 也就是说,只要这台桩没有订单,为空闲状态,就只推送一家平台循环就终止了 - - //判断transactionCode和orderInfo是否为空,为空就不推送充电状态 - if (Strings.isEmpty(transactionCode)){ -// return; - continue; + OrderBasicInfo orderInfo = new OrderBasicInfo(); + if(Constants.ILLEGAL_TRANSACTION_CODE.equals(transactionCode)){ + //表示为非法交易流水号"00000000000000000000000000000000",不推送充电状态 + orderInfo = null; + }else{ + // 查询订单信息,避免每个平台都查询一次 + if (transactionCode != null) { + orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); } - if (Objects.isNull(orderInfo)) { - continue; - } - dto.setOrderCode(orderInfo.getOrderCode()); - notificationService.notificationConnectorChargeStatus(dto); - } + for (ThirdPartySecretInfoVO thirdPartySecretInfoVO : thirdPartySecretInfoVOS) { + try { + NotificationDTO dto = new NotificationDTO(); + dto.setStationId(stationId); + dto.setPileConnectorCode(pileConnectorCode); + dto.setStatus(changedStatus); + dto.setPlatformType(thirdPartySecretInfoVO.getPlatformType()); + + // 先推送站点状态 + notificationService.notificationStationStatus(dto); + + // 如果有订单信息,推送充电状态 + if (orderInfo != null) { + dto.setOrderCode(orderInfo.getOrderCode()); + notificationService.notificationConnectorChargeStatus(dto); + } else { + log.info("无订单信息,仅推送站点状态,平台类型:{}", thirdPartySecretInfoVO.getPlatformType()); + } + } catch (Exception e) { + log.error("推送实时数据到平台失败,平台类型:{},错误信息:{}", + thirdPartySecretInfoVO.getPlatformType(), e.getMessage(), e); + } + } }