mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
新增 青海平台相关代码
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 辅助电源
|
||||||
|
*
|
||||||
|
* 1:12V
|
||||||
|
* 2: 24V
|
||||||
|
* 3: 兼容 12V 和 24V
|
||||||
|
*/
|
||||||
|
@JSONField(name = "AuxPower")
|
||||||
|
private Integer auxPower;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 HH:mm:ss”
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@JSONField(name = "RunTime")
|
||||||
|
private String runTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频监控配套情况
|
||||||
|
*
|
||||||
|
* 0:无 1:有
|
||||||
|
*/
|
||||||
|
@JSONField(name = "VideoMonitor")
|
||||||
|
private Integer videoMonitor;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user