diff --git a/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java b/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java index 195b6e64c..68dc5be68 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java @@ -314,8 +314,31 @@ public class OrderService { if (!StringUtils.equals(orderInfo.getMemberId(), dto.getMemberId())) { throw new BusinessException(ReturnCodeEnum.CODE_ORDER_MEMBER_NOT_MATCH_ERROR); } + // 判断该桩所在的站点是否推送了第三方站点(需要我方平台发送启动指令的,如:华为平台) + List relationInfoList = thirdPartyStationRelationService.getRelationInfoList(orderInfo.getStationId()); + + if (CollectionUtils.isNotEmpty(relationInfoList)) { + for (ThirdPartyStationRelationVO vo : relationInfoList) { + String startMode = vo.getStartMode(); + if (StringUtils.equals(Constants.ONE, startMode)) { + // 启动类型为 1 的即为对接了类似华为平台,需要调用第三方平台的统一停止充电接口 + ThirdPartyCommonStopChargeDTO commonStopChargeDTO = new ThirdPartyCommonStopChargeDTO(); + commonStopChargeDTO.setThirdPartyType(vo.getThirdPartyType()); + commonStopChargeDTO.setOrderBasicInfo(orderInfo); + // 调用统一停止充电接口 + String result = commonService.commonStopCharge(commonStopChargeDTO); + log.info("订单:{}调用第三方平台统一停止充电接口,调用结果 SuccStat:{}", orderInfo.getOrderCode(), result); + }else { + // 发送停止指令 + pileRemoteService.remoteStopCharging(orderInfo.getPileSn(), orderInfo.getConnectorCode(), orderInfo.getTransactionCode()); + } + } + }else { + // 发送停止指令 + pileRemoteService.remoteStopCharging(orderInfo.getPileSn(), orderInfo.getConnectorCode(), orderInfo.getTransactionCode()); + } // 发送停止指令 - pileRemoteService.remoteStopCharging(orderInfo.getPileSn(), orderInfo.getConnectorCode(), orderInfo.getTransactionCode()); + // pileRemoteService.remoteStopCharging(orderInfo.getPileSn(), orderInfo.getConnectorCode(), orderInfo.getTransactionCode()); log.info("订单号:{}发送停机指令成功", dto.getOrderCode()); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/ThirdPartyCommonStopChargeDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/ThirdPartyCommonStopChargeDTO.java new file mode 100644 index 000000000..d4dde60c7 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/ThirdPartyCommonStopChargeDTO.java @@ -0,0 +1,17 @@ +package com.jsowell.pile.dto; + +import com.jsowell.pile.domain.OrderBasicInfo; +import lombok.Data; + +/** + * TODO + * + * @author Lemon + * @Date 2024/3/26 8:30:01 + */ +@Data +public class ThirdPartyCommonStopChargeDTO { + private String thirdPartyType; + + private OrderBasicInfo orderBasicInfo; +} 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 41d6116a7..e859d04ef 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 @@ -22,6 +22,7 @@ import com.jsowell.pile.domain.ThirdPartyStationRelation; import com.jsowell.pile.domain.ThirdpartyParkingConfig; import com.jsowell.pile.dto.PushStationInfoDTO; import com.jsowell.pile.dto.ThirdPartyCommonStartChargeDTO; +import com.jsowell.pile.dto.ThirdPartyCommonStopChargeDTO; import com.jsowell.pile.dto.huawei.HWQueryStartChargeDTO; import com.jsowell.pile.dto.lutongyunting.BindCouponDTO; import com.jsowell.pile.dto.ruanjie.UseCouponDTO; @@ -122,7 +123,7 @@ public class CommonService { ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); relation.setStationId(dto.getStationId()); relation.setThirdPartyType(thirdPartyType); - if (StringUtils.equals(thirdPartyType, ThirdPlatformTypeEnum.HUA_WEI.getTypeCode())) { + if (StringUtils.equals(thirdPartyType, ThirdPlatformTypeEnum.HUA_WEI.getCode())) { relation.setStartMode(Constants.ONE); } ThirdPartyStationRelationVO vo = thirdPartyStationRelationService.selectRelationInfo(relation); @@ -147,27 +148,27 @@ public class CommonService { StringBuilder finalResult = new StringBuilder(); for (String type : types) { dto.setThirdPartyType(type); - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) { // 推送联联 // result = lianLianService.pushStationInfo(dto); result = lianLianService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) { // 中电联 // result = zdlService.pushStationInfo(dto); result = zdlService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), dto.getThirdPartyType())) { // 江苏省平台 // result = nrService.pushStationInfo(dto); result = nrService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), dto.getThirdPartyType())) { // 甬城泊车平台 // result = ycbcService.pushStationInfo(dto); result = ycbcService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), dto.getThirdPartyType())) { // 新电途平台 result = xdtService.pushStationInfoV2(dto); } @@ -175,7 +176,7 @@ public class CommonService { // // 华为 // result = huaWeiService.notificationOperationSystemInfo(dto); // } - if(StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(), dto.getThirdPartyType())) { + if(StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), dto.getThirdPartyType())) { // 海南 result = haiNanChargeService.pushStationInfoV2(dto); } @@ -224,7 +225,7 @@ public class CommonService { // 如果是类似华为格式,不需要传 continue; } - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { // 联联 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); if (orderInfo == null) { @@ -240,12 +241,12 @@ public class CommonService { // 推送充电状态 lianLianService.pushChargeStatus(orderInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { // 中电联 // log.info("推送中电联平台实时数据 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus); zdlService.notificationStationStatus(pileConnectorCode, changedStatus); } - if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), thirdPartyType)) { // 先判断缓存中是否有数据 String redisKey = CacheConstants.JIANGSU_PUSH_PILE_STATUS + pileConnectorCode; Object cacheObject = redisCache.getCacheObject(redisKey); @@ -269,7 +270,7 @@ public class CommonService { // log.info("推送江苏省平台实时数据 result:{}", result); } - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), thirdPartyType)) { // 新电途平台 log.info("新电途平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus); String result1 = xdtService.notificationStationStatus(pileConnectorCode, changedStatus); @@ -282,20 +283,20 @@ public class CommonService { String result = xdtService.notificationEquipChargeStatus(orderInfo.getOrderCode()); log.info("推送新电途平台 充电状态 result:{}", result); } - if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) { - // 华为平台 - huaWeiService.notificationStationStatus(pileConnectorCode, changedStatus); - OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); - if (orderInfo == null) { - return; - } - huaWeiService.notificationEquipChargeStatus(orderInfo.getOrderCode()); - } - if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(), thirdPartyType)) { + // if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), thirdPartyType)) { + // // 华为平台 + // huaWeiService.notificationStationStatus(pileConnectorCode, changedStatus); + // OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); + // if (orderInfo == null) { + // return; + // } + // huaWeiService.notificationEquipChargeStatus(orderInfo.getOrderCode()); + // } + if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), thirdPartyType)) { // 海南平台 haiNanChargeService.notificationStationStatus(pileConnectorCode, changedStatus); } - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { // 甬城泊车 // log.info("推送甬城泊车平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus); // 设备状态变化推送 notification_stationStatus @@ -335,7 +336,7 @@ public class CommonService { // 如果是类似华为格式,不需要传 continue; } - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { // 联联平台 // 推送停止充电结果 lianLianService.pushStopChargeResult(orderBasicInfo.getOrderCode()); @@ -344,16 +345,16 @@ public class CommonService { // 推送充电订单信息 lianLianService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { // 中电联 zdlService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), thirdPartyType)) { // 江苏平台 // 推送订单信息 nrService.pushOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), thirdPartyType)) { // 新电途平台 // 推送停止充电结果 xdtService.notificationStopChargeResult(orderBasicInfo.getOrderCode()); @@ -367,12 +368,12 @@ public class CommonService { // // 推送订单信息 // result = huaWeiService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); // } - if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), thirdPartyType)) { // 海南平台 haiNanChargeService.notificationChargeOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { if (StringUtils.equals(orderBasicInfo.getStartMode(), StartModeEnum.THIRD_PARTY_PLATFORM.getValue())) { // 甬城泊车 // 推送停止充电结果 @@ -435,7 +436,7 @@ public class CommonService { String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { YCBCGetTokenDTO dto = new YCBCGetTokenDTO(); dto.setOperatorId(operatorId); dto.setDataSecret(dataSecret); @@ -513,9 +514,9 @@ public class CommonService { String payMode = dto.getPayMode(); // 判断平台类型 - if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), thirdPartyType)) { // 华为平台 - String label = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(thirdPartyType); + String label = ThirdPlatformTypeEnum.getLabelByCode(thirdPartyType); // query_station_status 查询站点枪口详情 Map map = huaweiServiceV2.queryStationStatus(stationIds); String status = map.get(pileConnectorCode); @@ -554,6 +555,24 @@ public class CommonService { } + /** + * 统一停止充电 + * @param dto + * @return + */ + public String commonStopCharge(ThirdPartyCommonStopChargeDTO dto) { + OrderBasicInfo orderBasicInfo = dto.getOrderBasicInfo(); + String thirdPartyType = dto.getThirdPartyType(); + + // 判断平台类型 + if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), thirdPartyType)) { + QueryStartChargeVO vo = huaweiServiceV2.queryStopCharge(orderBasicInfo.getOrderCode()); + return String.valueOf(vo.getSuccStat()); + } + return null; + } + + /** * 转换枪口状态 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java index 5f710eb51..6d7b868e1 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java @@ -379,10 +379,10 @@ public class LianLianServiceImpl implements LianLianService { public static void main(String[] args) throws UnsupportedEncodingException { - String dataSecret = "E6gnWuz0QzBW75CR"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO huawei: zd4NrLWJ38XCTaqP E6gnWuz0QzBW75CR - String dataSecretIV = "SXejaSUx5yud8UHm"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR huawei: RJJecvNTJ48SGMG7 SXejaSUx5yud8UHm + String dataSecret = "pJahbxk8wG79CMDB"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO huawei: zd4NrLWJ38XCTaqP E6gnWuz0QzBW75CR 正式:NHsBDtTanA60vTIu pJahbxk8wG79CMDB + String dataSecretIV = "y259VRq7h8RyFXmT"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR huawei: RJJecvNTJ48SGMG7 SXejaSUx5yud8UHm 正式:2uyE2Cgu4nVf6egc y259VRq7h8RyFXmT String signSecret = "sRjCDeokckFGpYpA"; // sRjCDeokckFGpYpA - String dataString = "GZlmSIZOVzT+Yvpc2PmvNmwKXhaqSnsNdCUS61pq9BxES7v9FWNrUvqk3OsAUMPvjCwmYeskIglHXw0OFfYGZ1bXxAzHymzsqfehZ10WoNs="; + String dataString = "ESOi5BHD3GIr3bEN8VTQsvSyj6P8nICQF0+sk8pqaGJ/z9Y4bJK+UPLBYNZze7De5GKDsVcM/V8rfx3DG+yDqLkpq4vSNm6LFzpk/U6WQF1Z7n+8NrqTDCEtFTYmiF7qhZPng550UpLg3rU6G9CXQw=="; // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());