This commit is contained in:
Lemon
2025-07-24 15:08:03 +08:00
11 changed files with 464 additions and 90 deletions

View File

@@ -419,42 +419,43 @@ public class CommonService {
String stationId = String.valueOf(pileBasicInfo.getStationId());
// 查询该站点是否推送第三方平台
List<ThirdPartySecretInfoVO> 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);
}
}
}