update 第三方平台推送方法 由通过站点id查询配置密钥改为通过对应第三方平台类型查询

This commit is contained in:
Lemon
2024-04-19 15:22:31 +08:00
parent 646e88b057
commit 000b824398
25 changed files with 171 additions and 106 deletions

View File

@@ -19,6 +19,7 @@ import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.PileBasicInfo;
import com.jsowell.pile.domain.ThirdPartyStationRelation;
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
import com.jsowell.pile.dto.PushRealTimeInfoDTO;
import com.jsowell.pile.dto.PushStationInfoDTO;
import com.jsowell.pile.dto.ThirdPartyCommonStartChargeDTO;
import com.jsowell.pile.dto.ThirdPartyCommonStopChargeDTO;
@@ -223,6 +224,9 @@ public class CommonService {
String pileConnectorCode = pileSn + connectorCode;
// 将枪口状态转换成对接平台的状态
String changedStatus = changeConnectorStatus(connectorStatus, realTimeMonitorData.getPutGunType());
PushRealTimeInfoDTO dto = new PushRealTimeInfoDTO();
dto.setPileConnectorCode(pileConnectorCode);
dto.setStatus(changedStatus);
for (ThirdPartyStationRelationVO vo : list) {
String thirdPartyType = vo.getThirdPartyType();
if (StringUtils.equals(Constants.ONE, vo.getStartMode())) {
@@ -237,7 +241,8 @@ public class CommonService {
}
// log.info("推送联联平台实时数据 params: orderBasicInfo:{}", JSON.toJSONString(orderInfo));
// 设备状态变化推送 notification_stationStatus
lianLianService.pushConnectorStatus(pileConnectorCode, changedStatus);
dto.setThirdPartyType(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode());
lianLianService.pushConnectorStatus(dto);
if (StringUtils.equals(connectorStatus, "03")) {
// 充电中
lianLianService.pushPileChargeStatusChange(orderInfo.getOrderCode());
@@ -247,14 +252,17 @@ public class CommonService {
}
if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) {
// 中电联
dto.setThirdPartyType(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getTypeCode());
// log.info("推送中电联平台实时数据 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus);
zdlService.notificationStationStatus(pileConnectorCode, changedStatus);
zdlService.notificationStationStatus(dto);
}
if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), thirdPartyType)) {
// 先判断缓存中是否有数据
String redisKey = CacheConstants.JIANGSU_PUSH_PILE_STATUS + pileConnectorCode;
Object cacheObject = redisCache.getCacheObject(redisKey);
dto.setThirdPartyType(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode());
realTimeMonitorData.setThirdPartyType(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode());
// 江苏省平台(充电状态至少一分钟推送一次)
if (StringUtils.equals(connectorStatus, "03")) {
// 充电状态
@@ -276,8 +284,9 @@ public class CommonService {
}
if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), thirdPartyType)) {
// 新电途平台
log.info("新电途平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus);
String result1 = xdtService.notificationStationStatus(pileConnectorCode, changedStatus);
dto.setThirdPartyType(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode());
log.info("新电途平台设备状态变化推送 params:{}", JSON.toJSONString(dto));
String result1 = xdtService.notificationStationStatus(dto);
log.info("新电途平台设备状态变化推送 result:{}", result1);
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
if (orderInfo == null) {
@@ -298,13 +307,15 @@ public class CommonService {
// }
if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1_PLATFORM.getTypeCode(), thirdPartyType)) {
// 海南平台
haiNanChargeService.notificationStationStatus(pileConnectorCode, changedStatus);
dto.setThirdPartyType(ThirdPlatformTypeEnum.HAI_NAN_1_PLATFORM.getTypeCode());
haiNanChargeService.notificationStationStatus(dto);
}
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) {
// 甬城泊车
dto.setThirdPartyType(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode());
// log.info("推送甬城泊车平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus);
// 设备状态变化推送 notification_stationStatus
String result1 = ycbcService.notificationStationStatus(pileConnectorCode, changedStatus);
String result1 = ycbcService.notificationStationStatus(dto);
// log.info("推送甬城泊车平台设备状态变化推送 result:{}", result1);
// 推送充电状态
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
@@ -319,9 +330,9 @@ public class CommonService {
}
if (StringUtils.equals(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode(), thirdPartyType)) {
// 青海省平台
String result = qingHaiPlatformService.notificationStationStatus(pileConnectorCode, changedStatus);
log.info("推送青海平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}, result:{}"
, pileConnectorCode, changedStatus, result);
dto.setThirdPartyType(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode());
String result = qingHaiPlatformService.notificationStationStatus(dto);
log.info("推送青海平台设备状态变化推送 params:{}", JSON.toJSONString(dto));
// 先判断缓存中是否有数据
String redisKey = CacheConstants.JIANGSU_PUSH_PILE_STATUS + pileConnectorCode;
Object cacheObject = redisCache.getCacheObject(redisKey);
@@ -425,9 +436,9 @@ public class CommonService {
* @return
*/
public String commonPushStartChargeResult(OrderBasicInfo orderBasicInfo) {
// 通过站点id查询相关配置信息
// 通过第三方平台类型查询相关配置信息
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(orderBasicInfo.getStationId()));
relation.setThirdPartyType(orderBasicInfo.getThirdPartyType());
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
if (relationInfo == null) {