This commit is contained in:
BOOL\25024
2024-01-19 11:03:51 +08:00
3 changed files with 177 additions and 161 deletions

View File

@@ -299,11 +299,14 @@ public class PileStationInfoController extends BaseController {
public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) { public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
logger.info("推送第三方平台充电站信息 params:{}", JSONObject.toJSONString(dto)); logger.info("推送第三方平台充电站信息 params:{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response = null; RestApiResponse<?> response = null;
List<String> types = dto.getThirdPartyTypes();
try { try {
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) { if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
} }
String result = ""; String result = "";
for (String type : types) {
dto.setThirdPartyType(type);
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) { if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) {
// 推送联联 // 推送联联
// result = lianLianService.pushStationInfo(dto); // result = lianLianService.pushStationInfo(dto);
@@ -333,6 +336,7 @@ public class PileStationInfoController extends BaseController {
// result = huaWeiService.notificationOperationSystemInfo(dto); // result = huaWeiService.notificationOperationSystemInfo(dto);
// } // }
response = new RestApiResponse<>(result); response = new RestApiResponse<>(result);
}
}catch (BusinessException e) { }catch (BusinessException e) {
logger.error("推送第三方平台充电站信息 error",e); logger.error("推送第三方平台充电站信息 error",e);
response = new RestApiResponse<>(e.getCode(), e.getMessage()); response = new RestApiResponse<>(e.getCode(), e.getMessage());

View File

@@ -41,12 +41,14 @@ import com.jsowell.thirdparty.yongchengboche.service.YCBCService;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
@@ -689,14 +691,15 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
// 联联平台 推送订单信息 notification_orderInfo // 联联平台 推送订单信息 notification_orderInfo
try { try {
// 查询该站点是否推送第三方平台 // 查询该站点是否推送第三方平台
ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); // ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(orderBasicInfo.getStationId())); // relation.setStationId(Long.parseLong(orderBasicInfo.getStationId()));
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation); List<ThirdPartyStationRelationVO> relationInfoList = thirdPartyStationRelationService.getRelationInfoList(orderBasicInfo.getStationId());
// ThirdPartySettingInfo infoByStationId = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(stationId)); // ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
if (Objects.isNull(relationInfo)) { if (CollectionUtils.isEmpty(relationInfoList)) {
return; return;
} }
String thirdPartyType = relationInfo.getThirdPartyType(); for (ThirdPartyStationRelationVO relationVO : relationInfoList) {
String thirdPartyType = relationVO.getThirdPartyType();
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) {
// 联联平台 // 联联平台
// 推送停止充电结果 // 推送停止充电结果
@@ -741,6 +744,8 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
log.info("甬城泊车平台 推送充电订单信息 result:{}", result); log.info("甬城泊车平台 推送充电订单信息 result:{}", result);
} }
} }
}
// 调用相关接口 // 调用相关接口
} catch (Exception e) { } catch (Exception e) {
log.error("第三方平台 推送订单信息发生异常", e); log.error("第三方平台 推送订单信息发生异常", e);

View File

@@ -31,10 +31,12 @@ import com.jsowell.thirdparty.yongchengboche.service.YCBCService;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@@ -341,21 +343,24 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
// return null; // return null;
// } // }
// 状态不一样,传给第三方平台 // 状态不一样,传给第三方平台
// ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
// if (StringUtils.isBlank(String.valueOf(pileBasicInfo.getStationId()))) {
// return;
// }
// relation.setStationId(pileBasicInfo.getStationId());
// 查询该站点是否推送第三方平台 // 查询该站点是否推送第三方平台
ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(pileBasicInfo.getStationId()));
if (StringUtils.isBlank(String.valueOf(pileBasicInfo.getStationId()))) { // ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
return; if (CollectionUtils.isEmpty(list)) {
}
relation.setStationId(pileBasicInfo.getStationId());
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
if (Objects.isNull(relationInfo)) {
return; return;
} }
String pileConnectorCode = pileSn + connectorCode; String pileConnectorCode = pileSn + connectorCode;
// 将枪口状态转换成对接平台的状态 // 将枪口状态转换成对接平台的状态
String changedStatus = changeConnectorStatus(connectorStatus, realTimeMonitorData.getPutGunType()); String changedStatus = changeConnectorStatus(connectorStatus, realTimeMonitorData.getPutGunType());
for (ThirdPartyStationRelationVO vo : list) {
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), relationInfo.getThirdPartyType())) { String thirdPartyType = vo.getThirdPartyType();
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) {
// 联联 // 联联
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
if (orderInfo == null) { if (orderInfo == null) {
@@ -371,12 +376,12 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
// 推送充电状态 // 推送充电状态
lianLianService.pushChargeStatus(orderInfo.getOrderCode()); lianLianService.pushChargeStatus(orderInfo.getOrderCode());
} }
if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), relationInfo.getThirdPartyType())) { if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) {
// 中电联 // 中电联
// log.info("推送中电联平台实时数据 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus); // log.info("推送中电联平台实时数据 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus);
zdlService.notificationStationStatus(pileConnectorCode, changedStatus); zdlService.notificationStationStatus(pileConnectorCode, changedStatus);
} }
if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), relationInfo.getThirdPartyType())) { if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), thirdPartyType)) {
// 先判断缓存中是否有数据 // 先判断缓存中是否有数据
String redisKey = CacheConstants.JIANGSU_PUSH_PILE_STATUS + pileConnectorCode; String redisKey = CacheConstants.JIANGSU_PUSH_PILE_STATUS + pileConnectorCode;
Object cacheObject = redisCache.getCacheObject(redisKey); Object cacheObject = redisCache.getCacheObject(redisKey);
@@ -400,7 +405,7 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
// log.info("推送江苏省平台实时数据 result:{}", result); // log.info("推送江苏省平台实时数据 result:{}", result);
} }
if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), relationInfo.getThirdPartyType())) { if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), thirdPartyType)) {
// 新电途平台 // 新电途平台
log.info("新电途平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus); log.info("新电途平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus);
String result1 = xdtService.notificationStationStatus(pileConnectorCode, changedStatus); String result1 = xdtService.notificationStationStatus(pileConnectorCode, changedStatus);
@@ -413,7 +418,7 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
String result = xdtService.notificationEquipChargeStatus(orderInfo.getOrderCode()); String result = xdtService.notificationEquipChargeStatus(orderInfo.getOrderCode());
log.info("推送新电途平台 充电状态 result:{}", result); log.info("推送新电途平台 充电状态 result:{}", result);
} }
if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), relationInfo.getThirdPartyType())) { if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), thirdPartyType)) {
// 华为平台 // 华为平台
huaWeiService.notificationStationStatus(pileConnectorCode, changedStatus); huaWeiService.notificationStationStatus(pileConnectorCode, changedStatus);
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
@@ -423,7 +428,7 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
huaWeiService.notificationEquipChargeStatus(orderInfo.getOrderCode()); huaWeiService.notificationEquipChargeStatus(orderInfo.getOrderCode());
} }
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) { if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) {
// 甬城泊车 // 甬城泊车
// log.info("推送甬城泊车平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus); // log.info("推送甬城泊车平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus);
// 设备状态变化推送 notification_stationStatus // 设备状态变化推送 notification_stationStatus
@@ -440,6 +445,8 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
// log.info("推送甬城泊车充电订单状态 result:{}", result2); // log.info("推送甬城泊车充电订单状态 result:{}", result2);
} }
} }
}
} catch (Exception e) { } catch (Exception e) {
log.error("推送第三方平台 实时数据 异常", e); log.error("推送第三方平台 实时数据 异常", e);
} }