update 甘肃省平台Service

This commit is contained in:
Lemon
2024-11-19 10:22:43 +08:00
parent 7767d8cdf1
commit 893bd6c182
2 changed files with 77 additions and 53 deletions

View File

@@ -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<String, Object> map = Maps.newHashMap();
@@ -189,6 +192,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
Map<String, String> 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<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
List<SupStationInfo> 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