From 43fcb320f9163ff8a6c148c63c01c206b56d1f0b Mon Sep 17 00:00:00 2001 From: Lemon Date: Thu, 31 Oct 2024 14:21:08 +0800 Subject: [PATCH] =?UTF-8?q?update=20=20=20=E5=AE=81=E6=B3=A2=E5=B8=82?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thirdparty/common/CommonService.java | 30 ++++++------- .../ZhongDianLianPlatformServiceImpl.java | 43 +++++++------------ 2 files changed, 31 insertions(+), 42 deletions(-) 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 ccb02287b..77e73da57 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 @@ -173,11 +173,11 @@ public class CommonService { // result = lianLianService.pushStationInfo(dto); result = lianLianService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { - // 中电联 - // result = zdlService.pushStationInfo(dto); - result = zdlService.pushStationInfoV2(dto); - } + // if (StringUtils.equals(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { + // // 中电联 + // // result = zdlService.pushStationInfo(dto); + // result = zdlService.pushStationInfoV2(dto); + // } if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { // 江苏省平台 // result = nrService.pushStationInfo(dto); @@ -259,12 +259,12 @@ public class CommonService { lianLianService.pushChargeStatus(orderInfo.getOrderCode()); } } - if (StringUtils.equals(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode(), thirdPartyType)) { - // 中电联 - dto.setThirdPartyType(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode()); - // log.info("推送中电联平台实时数据 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus); - zdlService.notificationStationStatus(dto); - } + // if (StringUtils.equals(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode(), thirdPartyType)) { + // // 中电联 + // dto.setThirdPartyType(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode()); + // // log.info("推送中电联平台实时数据 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus); + // zdlService.notificationStationStatus(dto); + // } if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), thirdPartyType)) { // 先判断缓存中是否有数据 String redisKey = CacheConstants.JIANGSU_PUSH_PILE_STATUS + pileConnectorCode; @@ -455,10 +455,10 @@ public class CommonService { // 推送充电订单信息 lianLianService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode(), thirdPartyType)) { - // 中电联 - zdlService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); - } + // if (StringUtils.equals(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode(), thirdPartyType)) { + // // 中电联 + // zdlService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); + // } if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), thirdPartyType)) { // 江苏平台 // 推送订单信息 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ZhongDianLianPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ZhongDianLianPlatformServiceImpl.java index 148aa7687..888f7b47b 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ZhongDianLianPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ZhongDianLianPlatformServiceImpl.java @@ -163,12 +163,13 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi */ @Override public String notificationStationInfo(String stationId) { + List stationInfos = new ArrayList<>(); // 通过id查询站点相关信息 PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(Long.parseLong(stationId)); // 查询相关配置信息 ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO(); - String operatorId = ningBoSecretInfoVO.getTheirOperatorId(); + String operatorId = ningBoSecretInfoVO.getOurOperatorId(); String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret(); String signSecret = ningBoSecretInfoVO.getTheirSigSecret(); String dataSecret = ningBoSecretInfoVO.getTheirDataSecret(); @@ -214,25 +215,18 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi if (CollectionUtils.isNotEmpty(pileList)) { info.setEquipmentInfos(pileList); // 充电设备信息列表 } + stationInfos.add(info); // 调用中电联平台接口 String url = urlAddress + "notification_stationInfo"; JSONObject data = new JSONObject(); - data.put("StationInfo", info); + data.put("StationInfos", stationInfos); String jsonString = JSON.toJSONString(data); System.out.println("jsonString : " + jsonString); // 获取令牌 - ZDLGetTokenDTO tokenDTO = ZDLGetTokenDTO.builder() - .urlAddress(urlAddress) - .operatorId(operatorId) - .operatorSecret(operatorSecret) - .dataSecret(dataSecret) - .dataSecretIv(dataSecretIv) - .signSecret(signSecret) - .build(); String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); @@ -261,7 +255,6 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi List resultList = new ArrayList<>(); for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) { SupStationInfo stationInfo = new SupStationInfo(); - String stationId = String.valueOf(pileStationInfo.getId()); stationInfo.setStationID(String.valueOf(pileStationInfo.getId())); stationInfo.setOperatorID(Constants.OPERATORID_JIANG_SU); // 组织机构代码 String organizationCode = pileStationInfo.getOrganizationCode(); @@ -475,16 +468,13 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi /** * 枪口状态变化 notification_station_status - * @param dto * @return */ @Override - public String notificationStationStatus(PushRealTimeInfoDTO dto) { - String pileConnectorCode = dto.getPileConnectorCode(); - String status = dto.getStatus(); + public String notificationStationStatus(String stationId, String pileConnectorCode, String status, ThirdPartySecretInfoVO secretInfoVO) { ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO(); - String operatorId = ningBoSecretInfoVO.getTheirOperatorId(); + String operatorId = ningBoSecretInfoVO.getOurOperatorId(); String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret(); String signSecret = ningBoSecretInfoVO.getTheirSigSecret(); String dataSecret = ningBoSecretInfoVO.getTheirDataSecret(); @@ -516,17 +506,16 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi * @throws CryptoException */ @Override - public String notificationChargeOrderInfo(String orderCode) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException, CryptoException { + public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO thirdPartySecretInfoVO) { OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); - ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO(); - String operatorId = ningBoSecretInfoVO.getTheirOperatorId(); - String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret(); - String signSecret = ningBoSecretInfoVO.getTheirSigSecret(); - String dataSecret = ningBoSecretInfoVO.getTheirDataSecret(); - String dataSecretIv = ningBoSecretInfoVO.getTheirDataSecretIv(); - String urlAddress = ningBoSecretInfoVO.getTheirUrlPrefix(); + String operatorId = thirdPartySecretInfoVO.getOurOperatorId(); + String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret(); + String signSecret = thirdPartySecretInfoVO.getTheirSigSecret(); + String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret(); + String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv(); + String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix(); String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_CHARGE_ORDER_INFO.getValue(); Date chargeStartTime = orderBasicInfo.getChargeStartTime(); @@ -799,7 +788,7 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi return null; } ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO(); - String operatorId = ningBoSecretInfoVO.getTheirOperatorId(); + String operatorId = ningBoSecretInfoVO.getOurOperatorId(); String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret(); String signSecret = ningBoSecretInfoVO.getTheirSigSecret(); String dataSecret = ningBoSecretInfoVO.getTheirDataSecret(); @@ -836,7 +825,7 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi return null; } ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO(); - String operatorId = ningBoSecretInfoVO.getTheirOperatorId(); + String operatorId = ningBoSecretInfoVO.getOurOperatorId(); String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret(); String signSecret = ningBoSecretInfoVO.getTheirSigSecret(); String dataSecret = ningBoSecretInfoVO.getTheirDataSecret(); @@ -874,7 +863,7 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi // 查询相关配置信息 ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO(); - String operatorId = ningBoSecretInfoVO.getTheirOperatorId(); + String operatorId = ningBoSecretInfoVO.getOurOperatorId(); String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret(); String signSecret = ningBoSecretInfoVO.getTheirSigSecret(); String dataSecret = ningBoSecretInfoVO.getTheirDataSecret();