update 深圳平台推送BMS信息接口

This commit is contained in:
Lemon
2025-05-22 14:07:59 +08:00
parent 25f9da45d1
commit 8ec72f0f12
3 changed files with 233 additions and 18 deletions

View File

@@ -32,6 +32,22 @@ public class BMSInfo {
@JSONField(name = "BMSCode")
private String bmsCode;
/**
* 电池类型
* 1铅酸电池
* 2镍氢电池
* 3磷酸铁锂电池
* 4锰酸锂电池
* 5钴酸锂电池
* 6三元材料电池
* 7聚合物锂离子电池
* 8钛酸锂电池
* 9超级电容
* 255其它电池
*/
@JSONField(name = "BatteryType")
private Integer batteryType;
/**
* 车辆 BMS 版本
*/
@@ -68,17 +84,30 @@ public class BMSInfo {
@JSONField(name = "RatedCapacity")
private Integer ratedCapacity;
/**
* 电池标称总能量
*/
@JSONField(name = "RatedEnergy")
private BigDecimal ratedEnergy;
/**
* 电池额定总电压
*/
@JSONField(name = "RatedVoltage")
private BigDecimal ratedVoltage;
/**
* 总电压
*/
@JSONField(name = "TatalVoltage")
private BigDecimal tatalVoltage;
@JSONField(name = "BTotalVoltage")
private BigDecimal bTotalVoltage;
/**
* 总电流
*/
@JSONField(name = "TotalCurrent")
private BigDecimal totalCurrent;
@JSONField(name = "BTotalCurrent")
private BigDecimal bTotalCurrent;
/**
* 荷电状态
@@ -86,6 +115,25 @@ public class BMSInfo {
@JSONField(name = "Soc")
private Integer soc;
/**
* 充电电压需求
*/
@JSONField(name = "ReqVoltage")
private BigDecimal reqVoltage;
/**
* 充电电流需求
*/
@JSONField(name = "ReqCurrent")
private BigDecimal reqCurrent;
/**
* 充电模式
* 1:恒压充电2恒流充电 3其它
*/
@JSONField(name = "ChargeMode")
private Integer chargeMode;
/**
* 单体最高电压
*/
@@ -110,6 +158,12 @@ public class BMSInfo {
@JSONField(name = "TemptureHNumIndex")
private Integer temptureHNumIndex;
/**
* 剩余充电时间
*/
@JSONField(name = "RemainChargTime")
private Integer remainChargTime;
/**
* 单体最低温度
*/
@@ -122,6 +176,30 @@ public class BMSInfo {
@JSONField(name = "TemptureLNumIndex")
private Integer temptureLNumIndex;
/**
* 充电设施输出电压
*/
@JSONField(name = "CTotalVoltage")
private BigDecimal cTotalVoltage;
/**
* 充电设施输出电流
*/
@JSONField(name = "CTotalCurrent")
private BigDecimal cTotalCurrent;
/**
* 充放电侧总电压
*/
@JSONField(name = "TatalVoltage")
private BigDecimal tatalVoltage;
/**
* 充放电侧总电流
*/
@JSONField(name = "TotalCurrent")
private BigDecimal totalCurrent;
/**
* 充放电侧能量变化
*/
@@ -145,4 +223,10 @@ public class BMSInfo {
*/
@JSONField(name = "ChargingSessionMin")
private Integer chargingSessionMin;
/**
* 充电状态
*/
@JSONField(name = "ChargeStatus")
private Integer chargeStatus;
}

View File

@@ -44,6 +44,24 @@ public class StationChargeStatsInfo {
@JSONField(name = "StationChargeElectricity")
private BigDecimal stationChargeElectricity;
/**
* 充电站累计充电时长
*/
@JSONField(name = "StationTotalChargeTime")
private Integer stationTotalChargeTime;
/**
* 充电站累计充电次数
*/
@JSONField(name = "StationTotalChargeNum")
private Integer stationTotalChargeNum;
/**
* 充电站累计告警数量
*/
@JSONField(name = "StationTotalWarningNum")
private Integer stationTotalWarningNum;
/**
* 充电设备统计信息列表
*/
@@ -66,6 +84,24 @@ public class StationChargeStatsInfo {
@JSONField(name = "EquipmentChargeElectricity")
private BigDecimal equipmentChargeElectricity;
/**
* 充电设备累计充电时长
*/
@JSONField(name = "EquipmentTotalChargeTime")
private Integer equipmentTotalChargeTime;
/**
* 充电设备累计充电次数
*/
@JSONField(name = "EquipmentTotalChargeNum")
private Integer equipmentTotalChargeNum;
/**
* 充电设备累计告警数量
*/
@JSONField(name = "EquipmentTotalWarningNum")
private Integer equipmentTotalWarningNum;
/**
* 充电设备接口统计信息列表
*/
@@ -88,6 +124,24 @@ public class StationChargeStatsInfo {
*/
@JSONField(name = "ConnectorChargeElectricity")
private BigDecimal connectorChargeElectricity;
/**
* 充电设备接口累计充电时长
*/
@JSONField(name = "ConnectorTotalChargeTime")
private Integer connectorTotalChargeTime;
/**
* 充电设备接口累计充电次数
*/
@JSONField(name = "ConnectorTotalChargeNum")
private Integer connectorTotalChargeNum;
/**
* 充电设备接口累计告警数量
*/
@JSONField(name = "ConnectorTotalWarningNum")
private Integer connectorTotalWarningNum;
}
}
}

View File

@@ -5,7 +5,11 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ykc.BMSChargeInfoData;
import com.jsowell.common.core.domain.ykc.BMSDemandAndChargerOutputData;
import com.jsowell.common.core.domain.ykc.ChargingHandshakeData;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum;
@@ -22,6 +26,7 @@ import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.service.*;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.pile.thirdparty.EquipmentInfo;
import com.jsowell.pile.thirdparty.ParameterConfigData;
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
@@ -540,8 +545,13 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
.EquipmentChargeStatsInfo> equipmentStatsInfoList = Lists.newArrayList();
// 站点用电量
BigDecimal stationElectricity = BigDecimal.ZERO;
int stationChargingTime = Constants.zero;
// 用于记录枪口用电量 在循环每个枪口的时候初始化
BigDecimal pileElec;
// 桩充电次数
int pileChargingNum;
// 桩充电时长
int pileChargingTime;
for (String pileSn : pileMap.keySet()) {
// 该充电桩下 所有枪口的用电数据
List<AccumulativeInfoVO> accumulativeInfoVOS = pileMap.get(pileSn);
@@ -551,6 +561,10 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
// 存放充电桩用电量
pileElec = BigDecimal.ZERO;
// 充电桩充电次数
pileChargingNum = Constants.zero;
// 充电桩充电时长
pileChargingTime = Constants.zero;
// key=枪口编号 value 该枪口的用电数据
Map<String, List<AccumulativeInfoVO>> collect = accumulativeInfoVOS.stream()
@@ -567,6 +581,17 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
.map(AccumulativeInfoVO::getConnectorElectricity)
.map(BigDecimal::new)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 充电时长求和
BigDecimal chargingTime = value.stream()
.map(AccumulativeInfoVO::getChargingTime)
.map(BigDecimal::new)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 充电次数
long chargingNumLong = accumulativeInfoVOS.stream()
.map(x -> x.getPileConnectorCode().equals(pileConnectorCode))
.count();
int chargingNum = Integer.parseInt(String.valueOf(chargingNumLong));
connectorStatsInfos.add(
StationChargeStatsInfo
@@ -574,22 +599,34 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
.ConnectorChargeStatsInfo.builder()
.connectorId(pileConnectorCode)
.connectorChargeElectricity(connectorElec)
.connectorTotalChargeTime(chargingTime.intValue())
.connectorTotalChargeNum(chargingNum)
.connectorTotalWarningNum(0)
.build()
);
// 充电桩电量为枪口用电量累计
pileElec = pileElec.add(connectorElec);
// 充电桩充电次数为枪口充电次数累计
pileChargingNum += chargingNum;
// 充电时长
pileChargingTime += chargingTime.intValue();
}
StationChargeStatsInfo
.EquipmentChargeStatsInfo build = StationChargeStatsInfo.EquipmentChargeStatsInfo.builder()
.equipmentId(pileSn)
.equipmentChargeElectricity(pileElec)
.equipmentTotalChargeTime(pileChargingTime)
.equipmentTotalChargeNum(pileChargingNum)
.equipmentTotalWarningNum(0)
.connectorChargeStatsInfos(connectorStatsInfos)
.build();
equipmentStatsInfoList.add(build);
// 所有充电桩用电量之和
stationElectricity = stationElectricity.add(pileElec);
// 充电时长
stationChargingTime += pileChargingTime;
}
StationChargeStatsInfo stationChargeStatsInfo = StationChargeStatsInfo.builder()
@@ -597,6 +634,9 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
.startTime(dto.getStartTime())
.endTime(dto.getEndTime())
.stationChargeElectricity(stationElectricity)
.stationTotalChargeTime(stationChargingTime)
.stationTotalChargeNum(list.size())
.stationTotalWarningNum(0)
.equipmentChargeStatsInfos(equipmentStatsInfoList) // 设备列表
.build();
@@ -640,28 +680,65 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
return null;
}
RealTimeMonitorData data = chargingRealTimeData.get(0);
// 获取0x15
String chargingHandshakeKey = CacheConstants.CHARGING_HANDSHAKE_DATA_BY_TRANSACTION_CODE + orderVO.getTransactionCode();
ChargingHandshakeData chargingHandshakeData = redisCache.getCacheObject(chargingHandshakeKey);
if (chargingHandshakeData == null) {
return "0x15信息为空";
}
// 0x17
String redisKey = CacheConstants.PARAMETER_CONFIGURATION_BY_TRANSACTION_CODE + orderVO.getTransactionCode();
ParameterConfigData parameterConfigData = redisCache.getCacheObject(redisKey);
if (parameterConfigData == null) {
return "0x17信息为空";
}
// 获取最后一条0x23
List<BMSDemandAndChargerOutputData> chargerOutputInfoList = pileBasicInfoService.getBMSDemandAndChargerOutputInfoList(orderVO.getTransactionCode());
if (org.springframework.util.CollectionUtils.isEmpty(chargerOutputInfoList)) {
return "0x23信息为空";
}
// 获取最后一条0x25
List<BMSChargeInfoData> bmsChargeInfoList = pileBasicInfoService.getBMSChargeInfoList(orderVO.getTransactionCode());
if (org.springframework.util.CollectionUtils.isEmpty(chargerOutputInfoList)) {
return "0x23信息为空";
}
BMSChargeInfoData bmsChargeInfoData = bmsChargeInfoList.get(0);
BMSDemandAndChargerOutputData bmsDemandAndChargerOutputData = chargerOutputInfoList.get(0);
bmsInfo = BMSInfo.builder()
.vinCode(orderVO.getVinCode())
.batteryType(Integer.parseInt(chargingHandshakeData.getBmsBatteryType()))
.bmsCode("")
.bmsVer("")
.bmsVer("V1.1")
.connectorID(orderVO.getPileConnectorCode())
.maxChargeCurrent(new BigDecimal(""))
.maxChargeCellVoltage(new BigDecimal(""))
.maxTemp(0)
.ratedCapacity(0)
.tatalVoltage(new BigDecimal(data.getOutputVoltage()))
.totalCurrent(new BigDecimal(data.getOutputCurrent()))
.maxChargeCurrent(new BigDecimal(parameterConfigData.getBmsMaxCurrent()).setScale(2, BigDecimal.ROUND_HALF_DOWN))
.maxChargeCellVoltage(new BigDecimal(parameterConfigData.getBmsMaxChargingVoltage()).setScale(2, BigDecimal.ROUND_HALF_DOWN))
.maxTemp(Integer.parseInt(parameterConfigData.getBmsMaxTemperature()))
.ratedCapacity(new BigDecimal(parameterConfigData.getBmsSumEnergy()).intValue())
.ratedEnergy(new BigDecimal(parameterConfigData.getBmsSumEnergy()).setScale(2, BigDecimal.ROUND_HALF_DOWN))
.ratedVoltage(new BigDecimal(chargingHandshakeData.getBmsBatteryVoltage()))
.bTotalVoltage(new BigDecimal(bmsDemandAndChargerOutputData.getPileVoltageOutput()))
.bTotalCurrent(new BigDecimal(bmsDemandAndChargerOutputData.getPileCurrentOutput()))
.soc(Integer.parseInt(data.getSOC()))
.voltageH(new BigDecimal(""))
.voltageHNumIndex(0)
.temptureH(0)
.temptureHNumIndex(0)
.temptureL(0)
.temptureLNumIndex(0)
.currentCapacity(new BigDecimal(""))
.reqVoltage(new BigDecimal(bmsDemandAndChargerOutputData.getBmsVoltageDemand()))
.reqCurrent(new BigDecimal(bmsDemandAndChargerOutputData.getBmsCurrentDemand()))
.chargeMode(Integer.parseInt(bmsDemandAndChargerOutputData.getBmsChargingModel()))
.voltageH(new BigDecimal(parameterConfigData.getBmsMaxVoltage()).setScale(2, BigDecimal.ROUND_HALF_DOWN))
.voltageHNumIndex(new BigDecimal(bmsDemandAndChargerOutputData.getBmsMaxVoltageAndGroup()).intValue())
.remainChargTime(Integer.parseInt(data.getTimeRemaining()) * 60)
.temptureH(Integer.parseInt(bmsChargeInfoData.getBmsMaxBatteryTemperature()))
.temptureHNumIndex(Integer.parseInt(bmsChargeInfoData.getMaxTemperatureDetectionNum()))
.temptureL(Integer.parseInt(bmsChargeInfoData.getMinBatteryTemperature()))
.temptureLNumIndex(Integer.parseInt(bmsChargeInfoData.getMinTemperatureDetectionNum()))
.cTotalVoltage(new BigDecimal(bmsDemandAndChargerOutputData.getPileVoltageOutput()))
.cTotalCurrent(new BigDecimal(bmsDemandAndChargerOutputData.getPileCurrentOutput()))
.tatalVoltage(new BigDecimal(bmsDemandAndChargerOutputData.getPileVoltageOutput()))
.totalCurrent(new BigDecimal(bmsDemandAndChargerOutputData.getPileCurrentOutput()))
.currentCapacity(BigDecimal.ZERO)
.freshTime(DateUtils.getDateTime())
.startChargingTime(orderVO.getChargeStartTime())
.chargingSessionMin(Integer.parseInt(data.getSumChargingTime()) * 60)
.chargeStatus(1)
.build();