diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java index a837c7532..f8a054c6f 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java @@ -26,6 +26,7 @@ public enum ThirdPlatformTypeEnum { ZHE_JIANG_PLATFORM("15", "浙江省平台", "002485048"), SU_ZHOU_PLATFORM("16", "苏州市平台", "MAC1MFJ1X"), GAN_SU_PLATFORM("17", "甘肃省平台", ""), + GUI_ZHOU_PLATFORM("18", "贵州省平台", ""), ; private String typeCode; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java index 749f51b8f..ceb5b3976 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java @@ -62,9 +62,12 @@ import java.math.RoundingMode; import java.util.*; import java.util.stream.Collectors; +/** + * 贵州平台Service + */ @Service public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { - private final String thirdPlatformType = ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getTypeCode(); + private final String thirdPlatformType = ThirdPlatformTypeEnum.GUI_ZHOU_PLATFORM.getTypeCode(); @Autowired private PileStationInfoService pileStationInfoService; @@ -177,7 +180,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { operatorInfos.add(supOperatorInfo); } } - ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuiZhouPlatformSecretInfo(); // 组装结果集 Map map = Maps.newHashMap(); @@ -189,6 +192,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { Map resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO); return resultMap; } + /** * 查询充电站信息 query_stations_info * supervise_query_operator_info @@ -209,10 +213,12 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { return null; } // ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId()); - ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType); - if (thirdPartySecretInfoVO == null) { - return null; - } + // ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType); + // if (thirdPartySecretInfoVO == null) { + // return null; + // } + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuiZhouPlatformSecretInfo(); + PageInfo pageInfo = new PageInfo<>(stationInfos); List resultList = new ArrayList<>(); for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) { @@ -265,17 +271,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { return resultMap; } - - // 获取平台配置密钥信息 - private ThirdPartySecretInfoVO getGuiZhouPlatformSecretInfo() { - // 通过第三方平台类型查询相关配置信息 - ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(ThirdPlatformTypeEnum.ZHE_JIANG_PLATFORM.getTypeCode()); - if (thirdPartySecretInfoVO == null) { - throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); - } - thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_JIANG_SU); - return thirdPartySecretInfoVO; - } /** * 推送充电站信息 * supervise_notification_station_info @@ -387,9 +382,11 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); return result; } + /** * 查询站点状态信息 - *supervise_query_station_status + * supervise_query_station_status + * * @param dto */ @Override @@ -523,6 +520,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); return result; } + /** * 推送充电状态 notification_equip_charge_status * 推送充电状态信息 supervise_notification_equip_charge_status @@ -540,14 +538,14 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { BigDecimal voltage = info.getVoltage() == null ? BigDecimal.ZERO : info.getVoltage(); String soc = info.getSOC() == null ? Constants.ZERO : info.getSOC(); // 查询相关配置信息 - ThirdPartySecretInfoVO zheJiangPlatformSecretInfo = getGuiZhouPlatformSecretInfo(); + ThirdPartySecretInfoVO guiZhouPlatformSecretInfo = getGuiZhouPlatformSecretInfo(); - String operatorId = zheJiangPlatformSecretInfo.getOurOperatorId(); - String operatorSecret = zheJiangPlatformSecretInfo.getTheirOperatorSecret(); - String signSecret = zheJiangPlatformSecretInfo.getTheirSigSecret(); - String dataSecret = zheJiangPlatformSecretInfo.getTheirDataSecret(); - String dataSecretIv = zheJiangPlatformSecretInfo.getTheirDataSecretIv(); - String urlAddress = zheJiangPlatformSecretInfo.getTheirUrlPrefix(); + String operatorId = guiZhouPlatformSecretInfo.getOurOperatorId(); + String operatorSecret = guiZhouPlatformSecretInfo.getTheirOperatorSecret(); + String signSecret = guiZhouPlatformSecretInfo.getTheirSigSecret(); + String dataSecret = guiZhouPlatformSecretInfo.getTheirDataSecret(); + String dataSecretIv = guiZhouPlatformSecretInfo.getTheirDataSecretIv(); + String urlAddress = guiZhouPlatformSecretInfo.getTheirUrlPrefix(); String dateTime = DateUtils.getDateTime(); SupEquipChargeStatusInfo supEquipChargeStatusInfo = SupEquipChargeStatusInfo.builder() @@ -588,6 +586,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); return result; } + /** * 推送充电订单信息 * supervise_notification_charge_order_info @@ -627,7 +626,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { String organizationCode = pileMerchantInfoVO.getOrganizationCode(); if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode()); - }else { + } else { equipmentOwnerID = Constants.OPERATORID_JIANG_SU; } } @@ -663,18 +662,19 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); // 通过站点id查询相关配置信息 - ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(orderBasicInfo.getStationId()); - if (relationInfo == null) { - return null; - } + // ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(orderBasicInfo.getStationId()); + // if (relationInfo == null) { + // return null; + // } + ThirdPartySecretInfoVO guiZhouPlatformSecretInfo = getGuiZhouPlatformSecretInfo(); OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); - String operatorId = relationInfo.getOperatorId(); - String operatorSecret = relationInfo.getOperatorSecret(); - String signSecret = relationInfo.getSignSecret(); - String dataSecret = relationInfo.getDataSecret(); - String dataSecretIv = relationInfo.getDataSecretIv(); - String urlAddress = relationInfo.getUrlAddress(); + String operatorId = guiZhouPlatformSecretInfo.getTheirOperatorId(); + String operatorSecret = guiZhouPlatformSecretInfo.getTheirOperatorSecret(); + String signSecret = guiZhouPlatformSecretInfo.getTheirSigSecret(); + String dataSecret = guiZhouPlatformSecretInfo.getTheirDataSecret(); + String dataSecretIv = guiZhouPlatformSecretInfo.getTheirDataSecretIv(); + String urlAddress = guiZhouPlatformSecretInfo.getTheirUrlPrefix(); String url = urlAddress + "supervise_notification_charge_order_info_history"; @@ -707,6 +707,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); return result; } + /** * 推送充换电站实时功率 supervise_notification_realtime_power_info * @@ -794,16 +795,18 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { list.add(supStationPowerInfo); // 获取推送配置密钥信息 - ThirdPartyStationRelationVO settingInfo = getGuizhouSettingInfo(); - if (settingInfo == null) { - return null; - } - String operatorId = settingInfo.getOperatorId(); - String operatorSecret = settingInfo.getOperatorSecret(); - String signSecret = settingInfo.getSignSecret(); - String dataSecret = settingInfo.getDataSecret(); - String dataSecretIv = settingInfo.getDataSecretIv(); - String urlAddress = settingInfo.getUrlAddress(); + // ThirdPartyStationRelationVO settingInfo = getGuizhouSettingInfo(); + // if (settingInfo == null) { + // return null; + // } + ThirdPartySecretInfoVO guiZhouPlatformSecretInfo = getGuiZhouPlatformSecretInfo(); + + String operatorId = guiZhouPlatformSecretInfo.getTheirOperatorId(); + String operatorSecret = guiZhouPlatformSecretInfo.getTheirOperatorSecret(); + String signSecret = guiZhouPlatformSecretInfo.getTheirSigSecret(); + String dataSecret = guiZhouPlatformSecretInfo.getTheirDataSecret(); + String dataSecretIv = guiZhouPlatformSecretInfo.getTheirDataSecretIv(); + String urlAddress = guiZhouPlatformSecretInfo.getTheirUrlPrefix(); String url = urlAddress + "supervise_notification_realtime_power_info"; // 获取令牌 @@ -819,18 +822,36 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { return result; } + /** + * 获取贵州平台配置密钥信息 + * + * @return + */ + // private ThirdPartyStationRelationVO getGuizhouSettingInfo() { + // // 通过第三方平台类型查询相关配置信息 + // ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); + // relation.setThirdPartyType(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode()); + // ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation); + // return relationInfo; + // } - - // 获取贵州平台配置密钥信息 - private ThirdPartyStationRelationVO getGuizhouSettingInfo() { + /** + * 获取甘肃省平台配置密钥信息 + * @return + */ + private ThirdPartySecretInfoVO getGuiZhouPlatformSecretInfo() { // 通过第三方平台类型查询相关配置信息 - ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); - relation.setThirdPartyType(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode()); - ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation); - return relationInfo; + ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(ThirdPlatformTypeEnum.GUI_ZHOU_PLATFORM.getTypeCode()); + if (thirdPartySecretInfoVO == null) { + throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); + } + thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_JIANG_SU); + return thirdPartySecretInfoVO; } + /** * 转换充电站充电订单信息 + * * @param orderBasicInfo * @param orderDetail * @return @@ -862,8 +883,10 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { .build(); return chargeOrderInfo; } + /** * 转换时段充电明细 + * * @param orderDetail * @param billingList * @return