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

@@ -26,6 +26,7 @@ public enum ThirdPlatformTypeEnum {
ZHE_JIANG_PLATFORM("15", "浙江省平台", "002485048"), ZHE_JIANG_PLATFORM("15", "浙江省平台", "002485048"),
SU_ZHOU_PLATFORM("16", "苏州市平台", "MAC1MFJ1X"), SU_ZHOU_PLATFORM("16", "苏州市平台", "MAC1MFJ1X"),
GAN_SU_PLATFORM("17", "甘肃省平台", ""), GAN_SU_PLATFORM("17", "甘肃省平台", ""),
GUI_ZHOU_PLATFORM("18", "贵州省平台", ""),
; ;
private String typeCode; private String typeCode;

View File

@@ -62,9 +62,12 @@ import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* 贵州平台Service
*/
@Service @Service
public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { 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 @Autowired
private PileStationInfoService pileStationInfoService; private PileStationInfoService pileStationInfoService;
@@ -177,7 +180,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
operatorInfos.add(supOperatorInfo); operatorInfos.add(supOperatorInfo);
} }
} }
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType); ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuiZhouPlatformSecretInfo();
// 组装结果集 // 组装结果集
Map<String, Object> map = Maps.newHashMap(); Map<String, Object> map = Maps.newHashMap();
@@ -189,6 +192,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO); Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO);
return resultMap; return resultMap;
} }
/** /**
* 查询充电站信息 query_stations_info * 查询充电站信息 query_stations_info
* supervise_query_operator_info * supervise_query_operator_info
@@ -209,10 +213,12 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
return null; return null;
} }
// ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId()); // ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType); // ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
if (thirdPartySecretInfoVO == null) { // if (thirdPartySecretInfoVO == null) {
return null; // return null;
} // }
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuiZhouPlatformSecretInfo();
PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos); PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
List<SupStationInfo> resultList = new ArrayList<>(); List<SupStationInfo> resultList = new ArrayList<>();
for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) { for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) {
@@ -265,17 +271,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
return resultMap; 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 * supervise_notification_station_info
@@ -387,9 +382,11 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result; return result;
} }
/** /**
* 查询站点状态信息 * 查询站点状态信息
* supervise_query_station_status * supervise_query_station_status
*
* @param dto * @param dto
*/ */
@Override @Override
@@ -523,6 +520,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result; return result;
} }
/** /**
* 推送充电状态 notification_equip_charge_status * 推送充电状态 notification_equip_charge_status
* 推送充电状态信息 supervise_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(); BigDecimal voltage = info.getVoltage() == null ? BigDecimal.ZERO : info.getVoltage();
String soc = info.getSOC() == null ? Constants.ZERO : info.getSOC(); String soc = info.getSOC() == null ? Constants.ZERO : info.getSOC();
// 查询相关配置信息 // 查询相关配置信息
ThirdPartySecretInfoVO zheJiangPlatformSecretInfo = getGuiZhouPlatformSecretInfo(); ThirdPartySecretInfoVO guiZhouPlatformSecretInfo = getGuiZhouPlatformSecretInfo();
String operatorId = zheJiangPlatformSecretInfo.getOurOperatorId(); String operatorId = guiZhouPlatformSecretInfo.getOurOperatorId();
String operatorSecret = zheJiangPlatformSecretInfo.getTheirOperatorSecret(); String operatorSecret = guiZhouPlatformSecretInfo.getTheirOperatorSecret();
String signSecret = zheJiangPlatformSecretInfo.getTheirSigSecret(); String signSecret = guiZhouPlatformSecretInfo.getTheirSigSecret();
String dataSecret = zheJiangPlatformSecretInfo.getTheirDataSecret(); String dataSecret = guiZhouPlatformSecretInfo.getTheirDataSecret();
String dataSecretIv = zheJiangPlatformSecretInfo.getTheirDataSecretIv(); String dataSecretIv = guiZhouPlatformSecretInfo.getTheirDataSecretIv();
String urlAddress = zheJiangPlatformSecretInfo.getTheirUrlPrefix(); String urlAddress = guiZhouPlatformSecretInfo.getTheirUrlPrefix();
String dateTime = DateUtils.getDateTime(); String dateTime = DateUtils.getDateTime();
SupEquipChargeStatusInfo supEquipChargeStatusInfo = SupEquipChargeStatusInfo.builder() SupEquipChargeStatusInfo supEquipChargeStatusInfo = SupEquipChargeStatusInfo.builder()
@@ -588,6 +586,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result; return result;
} }
/** /**
* 推送充电订单信息 * 推送充电订单信息
* supervise_notification_charge_order_info * supervise_notification_charge_order_info
@@ -663,18 +662,19 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
// 通过站点id查询相关配置信息 // 通过站点id查询相关配置信息
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(orderBasicInfo.getStationId()); // ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(orderBasicInfo.getStationId());
if (relationInfo == null) { // if (relationInfo == null) {
return null; // return null;
} // }
ThirdPartySecretInfoVO guiZhouPlatformSecretInfo = getGuiZhouPlatformSecretInfo();
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
String operatorId = relationInfo.getOperatorId(); String operatorId = guiZhouPlatformSecretInfo.getTheirOperatorId();
String operatorSecret = relationInfo.getOperatorSecret(); String operatorSecret = guiZhouPlatformSecretInfo.getTheirOperatorSecret();
String signSecret = relationInfo.getSignSecret(); String signSecret = guiZhouPlatformSecretInfo.getTheirSigSecret();
String dataSecret = relationInfo.getDataSecret(); String dataSecret = guiZhouPlatformSecretInfo.getTheirDataSecret();
String dataSecretIv = relationInfo.getDataSecretIv(); String dataSecretIv = guiZhouPlatformSecretInfo.getTheirDataSecretIv();
String urlAddress = relationInfo.getUrlAddress(); String urlAddress = guiZhouPlatformSecretInfo.getTheirUrlPrefix();
String url = urlAddress + "supervise_notification_charge_order_info_history"; 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); String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result; return result;
} }
/** /**
* 推送充换电站实时功率 supervise_notification_realtime_power_info * 推送充换电站实时功率 supervise_notification_realtime_power_info
* *
@@ -794,16 +795,18 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
list.add(supStationPowerInfo); list.add(supStationPowerInfo);
// 获取推送配置密钥信息 // 获取推送配置密钥信息
ThirdPartyStationRelationVO settingInfo = getGuizhouSettingInfo(); // ThirdPartyStationRelationVO settingInfo = getGuizhouSettingInfo();
if (settingInfo == null) { // if (settingInfo == null) {
return null; // return null;
} // }
String operatorId = settingInfo.getOperatorId(); ThirdPartySecretInfoVO guiZhouPlatformSecretInfo = getGuiZhouPlatformSecretInfo();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret(); String operatorId = guiZhouPlatformSecretInfo.getTheirOperatorId();
String dataSecret = settingInfo.getDataSecret(); String operatorSecret = guiZhouPlatformSecretInfo.getTheirOperatorSecret();
String dataSecretIv = settingInfo.getDataSecretIv(); String signSecret = guiZhouPlatformSecretInfo.getTheirSigSecret();
String urlAddress = settingInfo.getUrlAddress(); String dataSecret = guiZhouPlatformSecretInfo.getTheirDataSecret();
String dataSecretIv = guiZhouPlatformSecretInfo.getTheirDataSecretIv();
String urlAddress = guiZhouPlatformSecretInfo.getTheirUrlPrefix();
String url = urlAddress + "supervise_notification_realtime_power_info"; String url = urlAddress + "supervise_notification_realtime_power_info";
// 获取令牌 // 获取令牌
@@ -819,18 +822,36 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
return result; 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(); ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(ThirdPlatformTypeEnum.GUI_ZHOU_PLATFORM.getTypeCode());
relation.setThirdPartyType(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode()); if (thirdPartySecretInfoVO == null) {
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation); throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
return relationInfo;
} }
thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_JIANG_SU);
return thirdPartySecretInfoVO;
}
/** /**
* 转换充电站充电订单信息 * 转换充电站充电订单信息
*
* @param orderBasicInfo * @param orderBasicInfo
* @param orderDetail * @param orderDetail
* @return * @return
@@ -862,8 +883,10 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
.build(); .build();
return chargeOrderInfo; return chargeOrderInfo;
} }
/** /**
* 转换时段充电明细 * 转换时段充电明细
*
* @param orderDetail * @param orderDetail
* @param billingList * @param billingList
* @return * @return