diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/ConfirmStartChargingRequestHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/ConfirmStartChargingRequestHandler.java index 1b34b2b9c..9e9670b79 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/ConfirmStartChargingRequestHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/ConfirmStartChargingRequestHandler.java @@ -351,6 +351,9 @@ public class ConfirmStartChargingRequestHandler extends AbstractYkcHandler { dto.setMemberId(memberWalletVO.getMemberId()); dto.setMerchantId(pileBasicInfo.getMerchantId() + ""); + // 校验充电桩相关的信息 + orderBasicInfoService.checkPileInfoForEV(dto); + // 异步创建订单 CompletableFuture.runAsync(() -> { try { diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java index b8231af02..7065b4c1e 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java @@ -4913,6 +4913,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { // 查询站点状态 PileStationVO stationInfo = pileStationInfoService.getStationInfo(pileConnector.getStationId()); if (stationInfo == null || StringUtils.equals(stationInfo.getOpenFlag(), Constants.ZERO)) { + logger.error("checkPileInfo站点未营业,站点id:{}", pileConnector.getStationId()); throw new BusinessException(ReturnCodeEnum.CODE_STATION_IS_NOT_OPEN); } @@ -5767,6 +5768,9 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { generateOrderDTO.setMemberId(memberWalletVO.getMemberId()); generateOrderDTO.setMerchantId(pileBasicInfo.getMerchantId() + ""); + // 校验充电桩相关的信息 + checkPileInfoForEV(generateOrderDTO); + CompletableFuture.runAsync(() -> { try { Map resultMap = generateOrderByCardV2(generateOrderDTO); diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NanRuiPlatfromServiceImp.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NanRuiPlatfromServiceImp.java index 6b8e64478..812f2da36 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NanRuiPlatfromServiceImp.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NanRuiPlatfromServiceImp.java @@ -21,6 +21,7 @@ import com.jsowell.pile.dto.QueryConnectorListDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO; import com.jsowell.pile.dto.nanrui.PushAlarmInfoDTO; +import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.EquipmentInfo; @@ -93,6 +94,9 @@ public class NanRuiPlatfromServiceImp implements ThirdPartyPlatformService { @Autowired private ThirdPartyStationRelationService thirdPartyStationRelationService; + @Autowired + private ThirdPartyStationRelationMapper thirdPartyStationRelationMapper; + @Override public void afterPropertiesSet() throws Exception { @@ -207,18 +211,18 @@ public class NanRuiPlatfromServiceImp implements ThirdPartyPlatformService { String subAreaCode = split[split.length - 1]; info.setAreaCode(subAreaCode); // 截取运营商组织机构代码(去除最后一位后的最后九位) - String organizationCode = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.NAN_RUI_PLATFORM.getTypeCode(), thirdPlatformType)) { - organizationCode = Constants.OPERATORID_LIANLIAN; - info.setEquipmentOwnerID(organizationCode); - } else { - MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId())); - organizationCode = merchantInfo.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - info.setEquipmentOwnerID(equipmentOwnerId); - } - } + + + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + info.setEquipmentOwnerID(thirdPartyStationRelations.get(0).getEquipmentOwnerId()); + info.setPayment(StationPaymentEnum.getPaymentByCode(pileStationInfo.getPayment())); if (StringUtils.isNotBlank(pileStationInfo.getParkingNumber())) { @@ -286,7 +290,7 @@ public class NanRuiPlatfromServiceImp implements ThirdPartyPlatformService { NRStationInfo nrStationInfo = NRStationInfo.builder() .stationId(String.valueOf(pileStationInfo.getId())) .operatorID(Constants.OPERATORID_JIANG_SU) - .equipmentOwnerID(Constants.OPERATORID_JIANG_SU) +// .equipmentOwnerID(Constants.OPERATORID_JIANG_SU) .stationName(pileStationInfo.getStationName()) .countryCode(pileStationInfo.getCountryCode()) .areaCode(pileStationInfo.getAreaCode()) @@ -300,6 +304,16 @@ public class NanRuiPlatfromServiceImp implements ThirdPartyPlatformService { .openAllDay(Integer.parseInt(pileStationInfo.getOpenAllDay())) .busineHours(pileStationInfo.getBusinessHours()) .build(); + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(pileStationInfo.getId()) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + nrStationInfo.setEquipmentOwnerID(thirdPartyStationRelations.get(0).getEquipmentOwnerId()); + // 站点费率 // 查计费模板 CurrentTimePriceDetails currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetails(String.valueOf(pileStationInfo.getId())); diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java index c6a6e73bb..c13fd1b34 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java @@ -821,13 +821,22 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // 拼装成内蒙古平台所需格式对象 ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); orderInfo.setOperatorID(operatorId); - String equipmentOwnerID; - if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) { - equipmentOwnerID = Constants.OPERATORID_XI_XIAO; - } else { - equipmentOwnerID = Constants.OPERATORID_LIANLIAN; - } - orderInfo.setEquipmentOwnerID(equipmentOwnerID); +// String equipmentOwnerID; +// if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) { +// equipmentOwnerID = Constants.OPERATORID_XI_XIAO; +// } else { +// equipmentOwnerID = Constants.OPERATORID_LIANLIAN; +// } +// orderInfo.setEquipmentOwnerID(equipmentOwnerID); + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(orderBasicInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + orderInfo.setEquipmentOwnerID(thirdPartyStationRelations.get(0).getEquipmentOwnerId()); List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 先将list按照 尖、峰、平、谷 时段排序 @@ -882,13 +891,15 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // 拼装成内蒙古平台所需格式对象 ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); orderInfo.setOperatorID(operatorId); - String equipmentOwnerID; - if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) { - equipmentOwnerID = Constants.OPERATORID_XI_XIAO; - } else { - equipmentOwnerID = Constants.OPERATORID_LIANLIAN; - } - orderInfo.setEquipmentOwnerID(equipmentOwnerID); + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(orderBasicInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + orderInfo.setEquipmentOwnerID(thirdPartyStationRelations.get(0).getEquipmentOwnerId()); List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 先将list按照 尖、峰、平、谷 时段排序 @@ -960,7 +971,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { SupEquipChargeStatusInfo equipChargeStatusInfo = SupEquipChargeStatusInfo.builder() .operatorID(operatorId) - .equipmentOwnerID(ThirdPartyPlatformUtils.extractEquipmentOwnerID(stationVO.getOrganizationCode())) +// .equipmentOwnerID(ThirdPartyPlatformUtils.extractEquipmentOwnerID(stationVO.getOrganizationCode())) .stationID(orderInfo.getStationId()) .equipmentID(orderInfo.getPileSn()) .orderNo(orderInfo.getOrderCode()) @@ -980,6 +991,15 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { .build(); + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationVO.getId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + equipChargeStatusInfo.setEquipmentOwnerID(thirdPartyStationRelations.get(0).getEquipmentOwnerId()); + String url = urlAddress + "supervise_notification_equip_charge_status"; // 调用联联平台接口 String jsonString = JSON.toJSONString(equipChargeStatusInfo); @@ -1015,13 +1035,22 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { stationChargeTime += orderVO.getChargingTime(); } + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + // 创建对象 String startTime = DateUtils.getYesterdayStr() + " 00:00:00"; String endTime = DateUtils.getYesterdayStr() + " 23:59:59"; SupStationStatsInfo supStationStatsInfo = SupStationStatsInfo.builder() .stationId(stationId) .operatorId(Constants.OPERATORID_LIANLIAN) - .equipmentOwnerId(ThirdPartyPlatformUtils.extractEquipmentOwnerID(orderVOS.get(0).getOrganizationCode())) + .equipmentOwnerId(equipmentOwnerId) // .stationClassification(1) .startTime(startTime) .endTime(endTime) @@ -1086,13 +1115,16 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // 拼装成内蒙古平台所需格式对象 ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); orderInfo.setOperatorID(operatorId); - String equipmentOwnerID; - if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) { - equipmentOwnerID = Constants.OPERATORID_XI_XIAO; - } else { - equipmentOwnerID = Constants.OPERATORID_LIANLIAN; - } - orderInfo.setEquipmentOwnerID(equipmentOwnerID); + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(orderBasicInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + orderInfo.setEquipmentOwnerID(thirdPartyStationRelations.get(0).getEquipmentOwnerId()); + List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 先将list按照 尖、峰、平、谷 时段排序 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NingXiaPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NingXiaPlatformServiceImpl.java index cf92da1dc..521ebff5a 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NingXiaPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NingXiaPlatformServiceImpl.java @@ -23,6 +23,7 @@ import com.jsowell.pile.domain.*; import com.jsowell.pile.dto.PushRealTimeInfoDTO; import com.jsowell.pile.dto.QueryOperatorInfoDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; +import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.EquipmentInfo; @@ -96,6 +97,11 @@ public class NingXiaPlatformServiceImpl implements ThirdPartyPlatformService { @Autowired private PileBillingTemplateService pileBillingTemplateService; + + @Autowired + private ThirdPartyStationRelationMapper thirdPartyStationRelationMapper; + + /** * @return */ @@ -223,7 +229,17 @@ public class NingXiaPlatformServiceImpl implements ThirdPartyPlatformService { stationInfo.setStationID(stationId); // MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(String.valueOf(pileStationInfo.getMerchantId())); stationInfo.setOperatorID(Constants.OPERATORID_LIANLIAN); // 组织机构代码 - stationInfo.setEquipmentOwnerID(String.valueOf(pileStationInfo.getMerchantId())); +// stationInfo.setEquipmentOwnerID(String.valueOf(pileStationInfo.getMerchantId())); + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + stationInfo.setEquipmentOwnerID(thirdPartyStationRelations.get(0).getEquipmentOwnerId()); + stationInfo.setStationName(pileStationInfo.getStationName()); stationInfo.setIsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply())); stationInfo.setIsPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking())); @@ -364,15 +380,19 @@ public class NingXiaPlatformServiceImpl implements ThirdPartyPlatformService { throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR); } - String merchantId = connectorInfo.getMerchantId(); - MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(merchantId); - if (Objects.isNull(merchantInfoVO)) { - throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR); - } + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(connectorInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); SupConnectorStatusInfo info = SupConnectorStatusInfo.builder() .operatorID(Constants.JSOWELL_OPERATORID) - .equipmentOwnerID(MerchantUtils.getOperatorID(merchantInfoVO.getOrganizationCode())) + .equipmentOwnerID(equipmentOwnerId) .stationID(connectorInfo.getStationId()) .equipmentID(connectorInfo.getPileSn()) .connectorID(pileConnectorCode) @@ -412,15 +432,20 @@ public class NingXiaPlatformServiceImpl implements ThirdPartyPlatformService { throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR); } - String merchantId = connectorInfo.getMerchantId(); - MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(merchantId); - if (Objects.isNull(merchantInfoVO)) { - throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR); - } + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(connectorInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + SupConnectorStatusInfo info = SupConnectorStatusInfo.builder() .operatorID(Constants.JSOWELL_OPERATORID) - .equipmentOwnerID(MerchantUtils.getOperatorID(merchantInfoVO.getOrganizationCode())) + .equipmentOwnerID(equipmentOwnerId) .stationID(connectorInfo.getStationId()) .equipmentID(connectorInfo.getPileSn()) .connectorID(pileConnectorCode) @@ -487,13 +512,17 @@ public class NingXiaPlatformServiceImpl implements ThirdPartyPlatformService { // 拼装成内蒙古平台所需格式对象 ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); orderInfo.setOperatorID(operatorId); - String equipmentOwnerID; - if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) { - equipmentOwnerID = Constants.OPERATORID_XI_XIAO; - } else { - equipmentOwnerID = Constants.OPERATORID_LIANLIAN; - } - orderInfo.setEquipmentOwnerID(equipmentOwnerID); + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(orderBasicInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + orderInfo.setEquipmentOwnerID(equipmentOwnerId); List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 先将list按照 尖、峰、平、谷 时段排序 @@ -548,13 +577,16 @@ public class NingXiaPlatformServiceImpl implements ThirdPartyPlatformService { // 拼装成宁夏平台所需格式对象 ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); orderInfo.setOperatorID(operatorId); - String equipmentOwnerID; - if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) { - equipmentOwnerID = Constants.OPERATORID_XI_XIAO; - } else { - equipmentOwnerID = Constants.OPERATORID_LIANLIAN; - } - orderInfo.setEquipmentOwnerID(equipmentOwnerID); + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(orderBasicInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + orderInfo.setEquipmentOwnerID(equipmentOwnerId); List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 先将list按照 尖、峰、平、谷 时段排序 @@ -617,9 +649,19 @@ public class NingXiaPlatformServiceImpl implements ThirdPartyPlatformService { } String dateTimeNow = DateUtils.getDateTime(); + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(connectorInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + SupEquipChargeStatusInfo supEquipChargeStatusInfo = SupEquipChargeStatusInfo.builder() .operatorID(Constants.JSOWELL_OPERATORID) - .equipmentOwnerID(MerchantUtils.getOperatorID(merchantInfoVO.getOrganizationCode())) + .equipmentOwnerID(equipmentOwnerId) .stationID(orderInfo.getStationId()) .equipmentID(orderInfo.getPileSn()) .orderNo(orderCode) @@ -758,13 +800,23 @@ public class NingXiaPlatformServiceImpl implements ThirdPartyPlatformService { } + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + // 创建对象 String startTime = DateUtils.getYesterdayStr() + " 00:00:00"; String endTime = DateUtils.getYesterdayStr() + " 23:59:59"; SupStationStatsInfo supStationStatsInfo = SupStationStatsInfo.builder() .stationId(stationId) .operatorId(Constants.OPERATORID_JIANG_SU) - // .equipmentOwnerId(orderVOS.get(0).getOrganizationCode()) + .equipmentOwnerId(equipmentOwnerId) .stationClassification(1) .startTime(startTime) .endTime(endTime) @@ -820,7 +872,16 @@ public class NingXiaPlatformServiceImpl implements ThirdPartyPlatformService { EquipmentPowerInfo> equipmentPowerInfoList = new ArrayList<>(); BigDecimal stationInstantPower = BigDecimal.ZERO; supStationPowerInfo.setOperatorId(Constants.OPERATORID_LIANLIAN); - supStationPowerInfo.setEquipmentOwnerID(stationInfo.getMerchantId()); + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + supStationPowerInfo.setEquipmentOwnerID(equipmentOwnerId); supStationPowerInfo.setStationId(stationId); supStationPowerInfo.setStationClassification(1); supStationPowerInfo.setDataTime(dateTimeNow); @@ -924,13 +985,16 @@ public class NingXiaPlatformServiceImpl implements ThirdPartyPlatformService { // 拼装成内蒙古平台所需格式对象 ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); orderInfo.setOperatorID(operatorId); - String equipmentOwnerID; - if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) { - equipmentOwnerID = Constants.OPERATORID_XI_XIAO; - } else { - equipmentOwnerID = Constants.OPERATORID_LIANLIAN; - } - orderInfo.setEquipmentOwnerID(equipmentOwnerID); + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(orderBasicInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + orderInfo.setEquipmentOwnerID(equipmentOwnerId); List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 先将list按照 尖、峰、平、谷 时段排序 @@ -1106,26 +1170,20 @@ public class NingXiaPlatformServiceImpl implements ThirdPartyPlatformService { info.setAreaCode(subAreaCode); // 截取运营商组织机构代码(去除最后一位后的最后九位) String organizationCode = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPlatformType)) { - // 联联平台先使用自己运营商的组织机构代码 - organizationCode = Constants.OPERATORID_LIANLIAN; - info.setEquipmentOwnerID(organizationCode); - } else { - MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId())); - organizationCode = merchantInfo.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - info.setEquipmentOwnerID(equipmentOwnerId); - } - } - if (StringUtils.equals("36", String.valueOf(pileStationInfo.getMerchantId()))) { - // 远大 - info.setEquipmentOwnerID(Constants.OPERATORID_YUAN_DA); - } - if (MerchantUtils.isXiXiaoMerchant(String.valueOf(pileStationInfo.getMerchantId()))) { - // 如果是希晓运营商,则把equipmentOwnerID换成希晓 - info.setEquipmentOwnerID(Constants.OPERATORID_XI_XIAO); - } + + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + info.setEquipmentOwnerID(equipmentOwnerId); + + String payment = StationPaymentEnum.getPaymentByCode(pileStationInfo.getPayment()); info.setPayment(payment); if (StringUtils.isNotBlank(pileStationInfo.getParkingNumber())) { diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/QingHaiPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/QingHaiPlatformServiceImpl.java index fbac5ab25..16d7dd614 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/QingHaiPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/QingHaiPlatformServiceImpl.java @@ -18,6 +18,7 @@ import com.jsowell.pile.dto.PushRealTimeInfoDTO; import com.jsowell.pile.dto.QueryConnectorListDTO; import com.jsowell.pile.dto.QueryStartChargeDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; +import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.ZDLEquipmentInfo; @@ -91,6 +92,10 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService { @Autowired private RedisCache redisCache; + @Autowired + private ThirdPartyStationRelationMapper thirdPartyStationRelationMapper; + + Logger logger = LoggerFactory.getLogger(QingHaiPlatformServiceImpl.class); // 平台类型 @@ -243,12 +248,18 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService { .build(); String organizationCode = stationInfoVO.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - stationInfo.setEquipmentOwnerId(equipmentOwnerId); - } else { - stationInfo.setEquipmentOwnerId(Constants.OPERATORID_JIANG_SU); - } + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(stationId) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + stationInfo.setEquipmentOwnerId(equipmentOwnerId); + String areaCode = stationInfoVO.getAreaCode(); // 330000,330200,330213 // 根据逗号分组 @@ -429,12 +440,14 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService { // 查询运营商基本信息 PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(stationId); String organizationCode = pileMerchantInfoVO.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - supStationPowerInfo.setEquipmentOwnerID(equipmentOwnerId); - } else { - supStationPowerInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU); - } + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + supStationPowerInfo.setEquipmentOwnerID(thirdPartyStationRelations.get(0).getEquipmentOwnerId()); // 根据站点id查询桩信息 List pileList = pileBasicInfoService.getPileListByStationId(stationId); @@ -614,13 +627,17 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService { .build(); // 设备产权所属单位ID - String organizationCode = orderVO.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - chargeOrderInfo.setEquipmentOwnerId(equipmentOwnerId); - } else { - chargeOrderInfo.setEquipmentOwnerId(Constants.OPERATORID_JIANG_SU); - } + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(orderVO.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + chargeOrderInfo.setEquipmentOwnerId(equipmentOwnerId); + // 支付方式 String payMode = orderVO.getPayMode(); if (StringUtils.equals("4", payMode)) { diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ShenZhenPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ShenZhenPlatformServiceImpl.java index 28e604a9d..c2ff68550 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ShenZhenPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ShenZhenPlatformServiceImpl.java @@ -23,6 +23,7 @@ import com.jsowell.pile.domain.OrderBasicInfo; import com.jsowell.pile.domain.ThirdPartyStationRelation; import com.jsowell.pile.dto.PushRealTimeInfoDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; +import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.EquipmentInfo; @@ -98,6 +99,10 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService { @Autowired private RedisCache redisCache; + @Autowired + private ThirdPartyStationRelationMapper thirdPartyStationRelationMapper; + + Logger logger = LoggerFactory.getLogger(this.getClass()); // 平台类型 @@ -121,10 +126,19 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService { throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); } + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + StationInfo stationInfo = StationInfo.builder() .stationID(stationVO.getId()) .operatorID(Constants.OPERATORID_JIANG_SU) - .equipmentOwnerID(ThirdPartyPlatformUtils.extractEquipmentOwnerID(stationVO.getOrganizationCode())) + .equipmentOwnerID(equipmentOwnerId) .stationName(stationVO.getStationName()) .countryCode(stationVO.getCountryCode()) .areaCode(stationVO.getAreaCode()) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/SuZhouPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/SuZhouPlatformServiceImpl.java index ad1a4b7ca..3daae1a5c 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/SuZhouPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/SuZhouPlatformServiceImpl.java @@ -17,12 +17,10 @@ import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.*; -import com.jsowell.pile.domain.OrderBasicInfo; -import com.jsowell.pile.domain.OrderDetail; -import com.jsowell.pile.domain.PileStationInfo; -import com.jsowell.pile.domain.ThirdPartyPlatformConfig; +import com.jsowell.pile.domain.*; import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.dto.nanrui.PushAlarmInfoDTO; +import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.EquipmentInfo; @@ -87,6 +85,10 @@ public class SuZhouPlatformServiceImpl implements ThirdPartyPlatformService { @Autowired private RedisCache redisCache; + @Autowired + private ThirdPartyStationRelationMapper thirdPartyStationRelationMapper; + + Logger logger = LoggerFactory.getLogger(this.getClass()); // 平台类型 @@ -243,7 +245,16 @@ public class SuZhouPlatformServiceImpl implements ThirdPartyPlatformService { stationInfo.setStationID(stationId); // MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(String.valueOf(pileStationInfo.getMerchantId())); stationInfo.setOperatorID(Constants.OPERATORID_JIANG_SU); // 组织机构代码 - stationInfo.setEquipmentOwnerID(String.valueOf(pileStationInfo.getMerchantId())); + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + stationInfo.setEquipmentOwnerID(equipmentOwnerId); stationInfo.setStationName(pileStationInfo.getStationName()); stationInfo.setIsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply())); stationInfo.setIsPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking())); @@ -584,27 +595,18 @@ public class SuZhouPlatformServiceImpl implements ThirdPartyPlatformService { String subAreaCode = split[split.length - 1]; info.setAreaCode(subAreaCode); // 截取运营商组织机构代码(去除最后一位后的最后九位) - String organizationCode = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPlatformType)) { - // 联联平台先使用自己运营商的组织机构代码 - organizationCode = Constants.OPERATORID_LIANLIAN; - info.setEquipmentOwnerID(organizationCode); - } else { - MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId())); - organizationCode = merchantInfo.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - info.setEquipmentOwnerID(equipmentOwnerId); - } - } - if (StringUtils.equals("36", String.valueOf(pileStationInfo.getMerchantId()))) { - // 远大 - info.setEquipmentOwnerID(Constants.OPERATORID_YUAN_DA); - } - if (MerchantUtils.isXiXiaoMerchant(String.valueOf(pileStationInfo.getMerchantId()))) { - // 如果是希晓运营商,则把equipmentOwnerID换成希晓 - info.setEquipmentOwnerID(Constants.OPERATORID_XI_XIAO); - } + + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + info.setEquipmentOwnerID(equipmentOwnerId); + String payment = StationPaymentEnum.getPaymentByCode(pileStationInfo.getPayment()); info.setPayment(payment); if (StringUtils.isNotBlank(pileStationInfo.getParkingNumber())) { diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/WeiWangKuaiDianPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/WeiWangKuaiDianPlatformServiceImpl.java index 7da7a0a8e..f11e704de 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/WeiWangKuaiDianPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/WeiWangKuaiDianPlatformServiceImpl.java @@ -17,6 +17,7 @@ import com.jsowell.common.util.*; import com.jsowell.pile.domain.*; import com.jsowell.pile.domain.ykcCommond.StartChargingCommand; import com.jsowell.pile.dto.*; +import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.ConnectorInfo; @@ -95,6 +96,9 @@ public class WeiWangKuaiDianPlatformServiceImpl implements ThirdPartyPlatformSer @Autowired private ThirdPartyStationRelationService thirdPartyStationRelationService; + @Autowired + private ThirdPartyStationRelationMapper thirdPartyStationRelationMapper; + @Override @@ -203,10 +207,15 @@ public class WeiWangKuaiDianPlatformServiceImpl implements ThirdPartyPlatformSer // 截取运营商组织机构代码(去除最后一位后的最后九位) MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId())); String organizationCode = merchantInfo.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - info.setEquipmentOwnerID(equipmentOwnerId); - } + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + info.setEquipmentOwnerID(equipmentOwnerId); // 站点图片 if (StringUtils.isNotBlank(pileStationInfo.getPictures())) { info.setPictures(Lists.newArrayList(pileStationInfo.getPictures().split(","))); @@ -260,12 +269,16 @@ public class WeiWangKuaiDianPlatformServiceImpl implements ThirdPartyPlatformSer stationInfo.setStationID(String.valueOf(pileStationInfo.getId())); stationInfo.setOperatorID(Constants.OPERATORID_JIANG_SU); // 组织机构代码 String organizationCode = pileStationInfo.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - stationInfo.setEquipmentOwnerID(equipmentOwnerId); - }else { - stationInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU); - } + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(pileStationInfo.getId()) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + stationInfo.setEquipmentOwnerID(equipmentOwnerId); + stationInfo.setStationName(pileStationInfo.getStationName()); stationInfo.setCountryCode(pileStationInfo.getCountryCode()); String areaCode = pileStationInfo.getAreaCode(); // 330000,330200,330213 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinDiantuPlatfromServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinDiantuPlatfromServiceImpl.java index a2d52413f..85dd47236 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinDiantuPlatfromServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinDiantuPlatfromServiceImpl.java @@ -19,6 +19,7 @@ import com.jsowell.common.util.*; import com.jsowell.pile.domain.*; import com.jsowell.pile.domain.ykcCommond.StartChargingCommand; import com.jsowell.pile.dto.*; +import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.ConnectorInfo; @@ -104,6 +105,10 @@ public class XinDiantuPlatfromServiceImpl implements ThirdPartyPlatformService { @Autowired private PileModelInfoService pileModelInfoService; + @Autowired + private ThirdPartyStationRelationMapper thirdPartyStationRelationMapper; + + @Override public void afterPropertiesSet() throws Exception { ThirdPartyPlatformFactory.register(thirdPlatformType, this); @@ -192,12 +197,22 @@ public class XinDiantuPlatfromServiceImpl implements ThirdPartyPlatformService { stationInfo.setStationID(String.valueOf(pileStationInfo.getId())); stationInfo.setOperatorID(Constants.OPERATORID_JIANG_SU); // 组织机构代码 String organizationCode = pileStationInfo.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - stationInfo.setEquipmentOwnerID(equipmentOwnerId); - }else { - stationInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU); - } +// if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { +// String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); +// stationInfo.setEquipmentOwnerID(equipmentOwnerId); +// }else { +// stationInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU); +// } + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationInfo.getStationID())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + stationInfo.setStationName(pileStationInfo.getStationName()); stationInfo.setCountryCode(pileStationInfo.getCountryCode()); String areaCode = pileStationInfo.getAreaCode(); // 330000,330200,330213 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunPlatformServiceImpl.java index c0c34f6f7..e12d19d93 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunPlatformServiceImpl.java @@ -17,8 +17,10 @@ import com.jsowell.common.util.PageUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.OrderBasicInfo; import com.jsowell.pile.domain.OrderDetail; +import com.jsowell.pile.domain.ThirdPartyStationRelation; import com.jsowell.pile.dto.QueryEquipChargeStatusDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; +import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.EquipmentInfo; @@ -76,6 +78,10 @@ public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { @Autowired private RedisCache redisCache; + @Autowired + private ThirdPartyStationRelationMapper thirdPartyStationRelationMapper; + + // 平台类型 private final String thirdPlatformType = ThirdPlatformTypeEnum.XIN_YUN_PLATFORM.getTypeCode(); @@ -169,12 +175,17 @@ public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { stationInfo.setStationID(String.valueOf(pileStationInfo.getId())); stationInfo.setOperatorID(Constants.OPERATORID_JIANG_SU); // 组织机构代码 String organizationCode = pileStationInfo.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - stationInfo.setEquipmentOwnerID(equipmentOwnerId); - }else { - stationInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU); - } + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(pileStationInfo.getId()) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + stationInfo.setEquipmentOwnerID(equipmentOwnerId); + stationInfo.setStationName(pileStationInfo.getStationName()); stationInfo.setCountryCode(pileStationInfo.getCountryCode()); String areaCode = pileStationInfo.getAreaCode(); // 330000,330200,330213 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YongChengbochePlatfromServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YongChengbochePlatfromServiceImpl.java index 1a84b03f9..573b9bd6e 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YongChengbochePlatfromServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YongChengbochePlatfromServiceImpl.java @@ -16,12 +16,10 @@ import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.*; -import com.jsowell.pile.domain.OrderBasicInfo; -import com.jsowell.pile.domain.OrderDetail; -import com.jsowell.pile.domain.PileBasicInfo; -import com.jsowell.pile.domain.ThirdPartyPlatformConfig; +import com.jsowell.pile.domain.*; import com.jsowell.pile.domain.ykcCommond.StartChargingCommand; import com.jsowell.pile.dto.*; +import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.EquipmentInfo; @@ -85,6 +83,10 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ @Autowired private PileRemoteService pileRemoteService; + @Autowired + private ThirdPartyStationRelationMapper thirdPartyStationRelationMapper; + + @Override public void afterPropertiesSet() throws Exception { ThirdPartyPlatformFactory.register(thirdPlatformType, this); @@ -170,7 +172,16 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ stationInfo.setStationID(stationId); // MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(String.valueOf(pileStationInfo.getMerchantId())); stationInfo.setOperatorID(Constants.OPERATORID_LIANLIAN); // 组织机构代码 - stationInfo.setEquipmentOwnerID(String.valueOf(pileStationInfo.getMerchantId())); + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(pileStationInfo.getId()) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + stationInfo.setEquipmentOwnerID(equipmentOwnerId); stationInfo.setStationName(pileStationInfo.getStationName()); stationInfo.setIsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply())); stationInfo.setIsPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking())); @@ -621,9 +632,19 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv(); String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix(); String dateTime = DateUtils.getDateTime(); + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(orderInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + SupEquipChargeStatusInfo supEquipChargeStatusInfo = SupEquipChargeStatusInfo.builder() .operatorID(Constants.OPERATORID_JIANG_SU) - .equipmentOwnerID(Constants.OPERATORID_JIANG_SU) + .equipmentOwnerID(equipmentOwnerId) .stationID(orderInfo.getStationId()) .equipmentID(orderInfo.getPileSn()) .connectorID(orderInfo.getPileConnectorCode()) @@ -642,14 +663,6 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ .chargeCurrent(current.setScale(1, BigDecimal.ROUND_HALF_UP)) .build(); - // 查询运营商信息 - PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(orderInfo.getStationId()); - String organizationCode = pileMerchantInfoVO.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - supEquipChargeStatusInfo.setEquipmentOwnerID(equipmentOwnerId); - } - String url = urlAddress + "supervise_notification_equip_charge_status"; // 调用平台接口 String jsonString = JSON.toJSONString(supEquipChargeStatusInfo); @@ -756,13 +769,16 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); orderInfo.setOperatorID(operatorId); - String equipmentOwnerID; - if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) { - equipmentOwnerID = Constants.OPERATORID_XI_XIAO; - } else { - equipmentOwnerID = Constants.OPERATORID_LIANLIAN; - } - orderInfo.setEquipmentOwnerID(equipmentOwnerID); + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(orderBasicInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + orderInfo.setEquipmentOwnerID(equipmentOwnerId); List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 先将list按照 尖、峰、平、谷 时段排序 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YunWeiPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YunWeiPlatformServiceImpl.java index 3418b2d00..3a7d02405 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YunWeiPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YunWeiPlatformServiceImpl.java @@ -16,6 +16,7 @@ import com.jsowell.common.util.*; import com.jsowell.pile.domain.*; import com.jsowell.pile.domain.ykcCommond.StartChargingCommand; import com.jsowell.pile.dto.*; +import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.*; import com.jsowell.pile.vo.ThirdPartySecretInfoVO; @@ -90,6 +91,10 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService { @Autowired private PileRemoteService pileRemoteService; + @Autowired + private ThirdPartyStationRelationMapper thirdPartyStationRelationMapper; + + @Override public void afterPropertiesSet() throws Exception { ThirdPartyPlatformFactory.register(thirdPlatformType, this); @@ -258,12 +263,16 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService { stationInfo.setStationID(String.valueOf(pileStationInfo.getId())); stationInfo.setOperatorID(Constants.OPERATORID_JIANG_SU); // 组织机构代码 String organizationCode = pileStationInfo.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - stationInfo.setEquipmentOwnerID(equipmentOwnerId); - }else { - stationInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU); - } + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(pileStationInfo.getId()) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + stationInfo.setEquipmentOwnerID(equipmentOwnerId); stationInfo.setStationName(pileStationInfo.getStationName()); stationInfo.setCountryCode(pileStationInfo.getCountryCode()); String areaCode = pileStationInfo.getAreaCode(); // 330000,330200,330213 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ZheJiangPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ZheJiangPlatformServiceImpl.java index 3eac10ed3..067a9cc2f 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ZheJiangPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ZheJiangPlatformServiceImpl.java @@ -25,6 +25,7 @@ import com.jsowell.pile.dto.PushRealTimeInfoDTO; import com.jsowell.pile.dto.QueryEquipChargeStatusDTO; import com.jsowell.pile.dto.QueryOperatorInfoDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; +import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.EquipmentInfo; @@ -104,6 +105,10 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService { @Autowired private PileBillingTemplateService pileBillingTemplateService; + @Autowired + private ThirdPartyStationRelationMapper thirdPartyStationRelationMapper; + + @Override public void afterPropertiesSet() throws Exception { @@ -225,7 +230,17 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService { stationInfo.setStationID(stationId); // MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(String.valueOf(pileStationInfo.getMerchantId())); stationInfo.setOperatorID(Constants.OPERATORID_JIANG_SU); // 组织机构代码 - stationInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU); + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(pileStationInfo.getId()) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + stationInfo.setEquipmentOwnerID(equipmentOwnerId); + stationInfo.setStationName(pileStationInfo.getStationName()); stationInfo.setIsAloneApply(Integer.parseInt(pileStationInfo.getAloneApply())); stationInfo.setIsPublicParkingLot(Integer.parseInt(pileStationInfo.getPublicParking())); @@ -374,18 +389,17 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService { info.setAreaCode(subAreaCode); // 截取运营商组织机构代码(去除最后一位后的最后九位) String organizationCode = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPlatformType)) { - // 联联平台先使用自己运营商的组织机构代码 - organizationCode = Constants.OPERATORID_LIANLIAN; - info.setEquipmentOwnerID(organizationCode); - } else { - MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId())); - organizationCode = merchantInfo.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - info.setEquipmentOwnerID(equipmentOwnerId); - } - } + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(pileStationInfo.getId()) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + info.setEquipmentOwnerID(equipmentOwnerId); info.setPayment(StationPaymentEnum.getPaymentByCode(pileStationInfo.getPayment())); if (StringUtils.isNotBlank(pileStationInfo.getParkingNumber())) { @@ -467,10 +481,19 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService { if (Objects.isNull(merchantInfoVO)) { throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR); } + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(connectorInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + SupConnectorStatusInfo info = SupConnectorStatusInfo.builder() .operatorID(Constants.OPERATORID_JIANG_SU) - .equipmentOwnerID(MerchantUtils.getOperatorID(merchantInfoVO.getOrganizationCode())) + .equipmentOwnerID(equipmentOwnerId) .stationID(connectorInfo.getStationId()) .equipmentID(connectorInfo.getPileSn()) .connectorID(pileConnectorCode) @@ -518,7 +541,16 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService { stationStatusInfo.setStationId(stationId); stationStatusInfo.setOperatorId(Constants.OPERATORID_JIANG_SU); stationStatusInfo.setStationStatus(50); - String equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode()); + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerID = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + stationStatusInfo.setEquipmentOwnerId(equipmentOwnerID); // 根据站点id查询 List list = pileConnectorInfoService.getConnectorListForLianLian(Long.parseLong(stationId)); @@ -584,9 +616,20 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService { String urlAddress = zheJiangPlatformSecretInfo.getTheirUrlPrefix(); String dateTime = DateUtils.getDateTime(); + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(orderInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + SupEquipChargeStatusInfo supEquipChargeStatusInfo = SupEquipChargeStatusInfo.builder() .operatorID(Constants.OPERATORID_JIANG_SU) - .equipmentOwnerID(Constants.OPERATORID_JIANG_SU) + .equipmentOwnerID(equipmentOwnerId) .stationID(orderInfo.getStationId()) .equipmentID(orderInfo.getPileSn()) .connectorID(orderInfo.getPileConnectorCode()) @@ -608,10 +651,6 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService { // 查询运营商信息 PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(orderInfo.getStationId()); String organizationCode = pileMerchantInfoVO.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - supEquipChargeStatusInfo.setEquipmentOwnerID(equipmentOwnerId); - } String url = urlAddress + "supervise_notification_equip_charge_status"; // 调用平台接口 @@ -654,19 +693,16 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService { // 拼装成平台所需格式对象 ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); orderInfo.setOperatorID(operatorId); - String equipmentOwnerID; - if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) { - equipmentOwnerID = Constants.OPERATORID_XI_XIAO; - } else { - PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(orderInfo.getStationID()); - String organizationCode = pileMerchantInfoVO.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode()); - }else { - equipmentOwnerID = Constants.OPERATORID_JIANG_SU; - } - } - orderInfo.setEquipmentOwnerID(equipmentOwnerID); + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(orderBasicInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + orderInfo.setEquipmentOwnerID(equipmentOwnerId); List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 先将list按照 尖、峰、平、谷 时段排序 @@ -712,9 +748,17 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService { // 拼装成平台所需格式对象 ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); orderInfo.setOperatorID(operatorId); - PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(orderInfo.getStationID()); - String equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode()); - orderInfo.setEquipmentOwnerID(equipmentOwnerID); + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(orderBasicInfo.getStationId())) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + orderInfo.setEquipmentOwnerID(equipmentOwnerId); List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 先将list按照 尖、峰、平、谷 时段排序 @@ -830,7 +874,7 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService { List supStationPowerInfoList = new ArrayList<>(); stationIds.forEach(stationId -> { PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId); - PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(stationId); +// PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(stationId); String dateTimeNow = DateUtils.getDateTime(); SupStationPowerInfo supStationPowerInfo = new SupStationPowerInfo(); // 根据站点id查询桩列表 @@ -839,8 +883,18 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService { List equipmentPowerInfoList = new ArrayList<>(); BigDecimal stationInstantPower = BigDecimal.ZERO; supStationPowerInfo.setOperatorId(Constants.OPERATORID_JIANG_SU); - String equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode()); - supStationPowerInfo.setEquipmentOwnerID(equipmentOwnerID); + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.valueOf(stationId)) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + supStationPowerInfo.setEquipmentOwnerID(equipmentOwnerId); + supStationPowerInfo.setStationId(stationId); // supStationPowerInfo.setStationClassification(1); supStationPowerInfo.setDataTime(dateTimeNow); 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 17b8ef6a7..89208fe30 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 @@ -16,6 +16,7 @@ import com.jsowell.common.util.*; import com.jsowell.pile.domain.*; import com.jsowell.pile.domain.ykcCommond.StartChargingCommand; import com.jsowell.pile.dto.*; +import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.*; import com.jsowell.pile.vo.ThirdPartySecretInfoVO; @@ -90,6 +91,10 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi @Autowired private PileRemoteService pileRemoteService; + @Autowired + private ThirdPartyStationRelationMapper thirdPartyStationRelationMapper; + + @Override public void afterPropertiesSet() throws Exception { ThirdPartyPlatformFactory.register(thirdPlatformType, this); @@ -198,12 +203,18 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi String subAreaCode = split[split.length - 1]; info.setAreaCode(subAreaCode); // 截取运营商组织机构代码(去除最后一位后的最后九位) - MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId())); - String organizationCode = merchantInfo.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - info.setEquipmentOwnerID(equipmentOwnerId); - } + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(pileStationInfo.getId()) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + info.setEquipmentOwnerID(equipmentOwnerId); + // 站点图片 if (StringUtils.isNotBlank(pileStationInfo.getPictures())) { info.setPictures(Lists.newArrayList(pileStationInfo.getPictures().split(","))); @@ -255,13 +266,19 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi SupStationInfo stationInfo = new SupStationInfo(); stationInfo.setStationID(String.valueOf(pileStationInfo.getId())); stationInfo.setOperatorID(Constants.OPERATORID_JIANG_SU); // 组织机构代码 - String organizationCode = pileStationInfo.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { - String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); - stationInfo.setEquipmentOwnerID(equipmentOwnerId); - }else { - stationInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU); - } + + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(pileStationInfo.getId()) + .thirdPartyType(thirdPlatformType) + .build(); + + List thirdPartyStationRelations = thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(build); + + String equipmentOwnerId = thirdPartyStationRelations.get(0).getEquipmentOwnerId(); + + stationInfo.setEquipmentOwnerID(equipmentOwnerId); + + stationInfo.setStationName(pileStationInfo.getStationName()); stationInfo.setCountryCode(pileStationInfo.getCountryCode()); String areaCode = pileStationInfo.getAreaCode(); // 330000,330200,330213