新增 青海平台相关代码

This commit is contained in:
Lemon
2024-04-09 10:16:48 +08:00
parent a8e2996f43
commit 6f5e3b950c
5 changed files with 266 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ public enum ThirdPlatformTypeEnum {
HAI_NAN_2("8", "海南一张网(充电平台)", "MAA9A0PP1"), HAI_NAN_2("8", "海南一张网(充电平台)", "MAA9A0PP1"),
HUA_WEI("9", "华为平台", "MA5GTQ528"), HUA_WEI("9", "华为平台", "MA5GTQ528"),
NEI_MENG_GU_PLATFORM("10", "内蒙古平台", ""), NEI_MENG_GU_PLATFORM("10", "内蒙古平台", ""),
QING_HAI_PLATFORM("11", "青海平台", ""),
; ;
private String typeCode; private String typeCode;

View File

@@ -6,7 +6,7 @@ import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* TODO * 中电联标准枪口信息
* *
* @author Lemon * @author Lemon
* @Date 2023/9/7 14:03 * @Date 2023/9/7 14:03
@@ -37,4 +37,27 @@ public class ZDLConnectorInfo {
@JSONField(name = "NationalStandard") @JSONField(name = "NationalStandard")
private Integer nationalStandard; private Integer nationalStandard;
/**
* ======================= 以下为青海平台必填字段 =======================
*/
/**
* 设备接口分类
*
* 1车辆充电设备接口
* 2换电站内的电池箱充电设备接口
*/
@JSONField(name = "EquipmentClassification")
private Integer equipmentClassification;
/**
* 辅助电源
*
* 112V
* 2: 24V
* 3: 兼容 12V 和 24V
*/
@JSONField(name = "AuxPower")
private Integer auxPower;
} }

View File

@@ -25,4 +25,17 @@ public class ZDLEquipmentInfo {
@JSONField(name = "ConnectorInfos") @JSONField(name = "ConnectorInfos")
private List<ZDLConnectorInfo> connectorInfos; private List<ZDLConnectorInfo> connectorInfos;
/**
* ======================= 以下为青海平台必填字段 =======================
*/
/**
* 设备分类
*
* 1车辆充电设备
* 2换电站内的电池箱充电设备
*/
@JSONField(name = "EquipmentClassification")
private Integer equipmentClassification;
} }

View File

@@ -70,4 +70,119 @@ public class ZDLStationInfo {
@JSONField(name = "EquipmentInfos") @JSONField(name = "EquipmentInfos")
private List<ZDLEquipmentInfo> equipmentInfos; private List<ZDLEquipmentInfo> equipmentInfos;
/**
* ======================= 以下为青海平台必填字段 =======================
*/
/**
* 充换电站所在县以下行政区划代码
* 填写内容为 12 位行政区划代码1-6 位为县以上行政区划代码7-12 位为县以下区划代码。
*
* 具体参考国家统计局发布的 2022 年度全国统计用区划代码和城乡划分代码:
*
* http://www.stats.gov.cn/sj/tjbz/tjyqhdmhcxhfdm/2022
*/
@JSONField(name = "AreaCodeCountryside")
private String areaCodeCountryside;
/**
* 站点分类
*
* 1充电站
* 2换电站
* 3充换电一体站
*/
@JSONField(name = "StationClassification")
private Integer stationClassification;
/**
* 通用类型
*
* 1通用可为 3 种或 3 种以上的车型进行换电)
* 2非通用
* 注:站点分类为 2 或 3 时,此字段必填,为 1 时非必填。
*/
@JSONField(name = "GeneralApplicationType")
private Integer generalApplicationType;
/**
* 服务车型描述
*
* 描述换电站可服务的车系车型(厂牌型号)
* 注:站点分类为 2 或 3 时,此字段必填,为 1 时非必填。
*/
@JSONField(name = "SwapMatchCars")
private List<String> swapMatchCars;
/**
* 7 * 24 小时营业
*
* 0否 1
*/
@JSONField(name = "OpenAllDay")
private Integer openAllDay;
/**
* 停车费类型
*
* 0免费
* 1不免费
* 2限时免费停车
* 3充电限时免费
* 255参考场地实际收费标准
*/
@JSONField(name = "ParkFeeType")
private Integer parkFeeType;
/**
* 电费类型
*
* 1商业用电
* 2普通工业用电
* 3大工业用电
* 4其他用电
*/
@JSONField(name = "ElectricityType")
private Integer electricityType;
/**
* 报装类型
*
* 是否独立报装
* 0否 1
*/
@JSONField(name = "IsAloneApply")
private Integer isAloneApply;
/**
* 站点额定总功率
* 单位 kW,保留 1 位小数
*/
@JSONField(name = "RatedPower")
private BigDecimal ratedPower;
/**
* 峰谷分时
* 0否 1
*/
@JSONField(name = "PeriodFee")
private Integer periodFee;
/**
* 投运时间
*
* 格式“yyyy-MM-dd HHmm:ss”
*
*/
@JSONField(name = "RunTime")
private String runTime;
/**
* 视频监控配套情况
*
* 0无 1
*/
@JSONField(name = "VideoMonitor")
private Integer videoMonitor;
} }

View File

@@ -0,0 +1,113 @@
package com.jsowell.thirdparty.platform.qinghai.service;
import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.Maps;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
import com.jsowell.pile.domain.ThirdPartyStationRelation;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.service.PileStationInfoService;
import com.jsowell.pile.service.ThirdPartyPlatformConfigService;
import com.jsowell.pile.service.ThirdPartyStationRelationService;
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
import com.jsowell.thirdparty.platform.ThirdPartyPlatformService;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
import com.jsowell.thirdparty.platform.util.GBSignUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 青海平台 Service
*
* @author Lemon
* @Date 2024/4/8 15:12:35
*/
@Service
public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
@Resource
private ThirdPartyStationRelationService thirdPartyStationRelationService;
@Autowired
private PileStationInfoService pileStationInfoService;
@Autowired
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
Logger logger = LoggerFactory.getLogger(QingHaiPlatformServiceImpl.class);
// 平台类型
private final String platformType = ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode();
/**
* 查询站点信息 query_stations_info
* @param dto 查询站点信息dto
* @return
*/
@Override
public Map<String, String> queryStationsInfo(QueryStationInfoDTO dto) {
// 查询出要查询的充电站id并set进 dto 的stationIds
if (StringUtils.isNotBlank(dto.getThirdPlatformType())) {
List<ThirdPartyStationRelation> xdtList = thirdPartyStationRelationService.selectThirdPartyStationRelationList(dto.getThirdPlatformType());
if (CollectionUtils.isNotEmpty(xdtList)) {
List<String> stationList = xdtList.stream()
.map(x -> String.valueOf(x.getStationId()))
.collect(Collectors.toList());
dto.setStationIds(stationList);
}
}
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
PageUtils.startPage(pageNo, pageSize);
// 查询站点信息数据
List<ThirdPartyStationInfoVO> stationInfos = pileStationInfoService.getStationInfosByThirdParty(dto);
if (CollectionUtils.isEmpty(stationInfos)) {
// 未查到数据
return null;
}
return null;
}
/**
* 将需要发送至对接平台的的返回参数加密返回
* @param jsonObject
* @return
*/
private Map<String, String> getResultMap(JSONObject jsonObject) {
String operatorId = ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getOperatorId();
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId);
if (platformConfig == null) {
return null;
}
Map<String, String> resultMap = Maps.newLinkedHashMap();
// 加密数据
byte[] encryptText = Cryptos.aesEncrypt(jsonObject.toJSONString().getBytes(),
platformConfig.getDataSecret().getBytes(), platformConfig.getDataSecretIv().getBytes());
String encryptData = Encodes.encodeBase64(encryptText);
resultMap.put("Data", encryptData);
// 生成sig
String resultSign = GBSignUtils.sign(resultMap, platformConfig.getSignSecret());
resultMap.put("Sig", resultSign);
return resultMap;
}
}