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") @JSONField(name = "BMSCode")
private String bmsCode; private String bmsCode;
/**
* 电池类型
* 1铅酸电池
* 2镍氢电池
* 3磷酸铁锂电池
* 4锰酸锂电池
* 5钴酸锂电池
* 6三元材料电池
* 7聚合物锂离子电池
* 8钛酸锂电池
* 9超级电容
* 255其它电池
*/
@JSONField(name = "BatteryType")
private Integer batteryType;
/** /**
* 车辆 BMS 版本 * 车辆 BMS 版本
*/ */
@@ -68,17 +84,30 @@ public class BMSInfo {
@JSONField(name = "RatedCapacity") @JSONField(name = "RatedCapacity")
private Integer ratedCapacity; private Integer ratedCapacity;
/**
* 电池标称总能量
*/
@JSONField(name = "RatedEnergy")
private BigDecimal ratedEnergy;
/**
* 电池额定总电压
*/
@JSONField(name = "RatedVoltage")
private BigDecimal ratedVoltage;
/** /**
* 总电压 * 总电压
*/ */
@JSONField(name = "TatalVoltage") @JSONField(name = "BTotalVoltage")
private BigDecimal tatalVoltage; private BigDecimal bTotalVoltage;
/** /**
* 总电流 * 总电流
*/ */
@JSONField(name = "TotalCurrent") @JSONField(name = "BTotalCurrent")
private BigDecimal totalCurrent; private BigDecimal bTotalCurrent;
/** /**
* 荷电状态 * 荷电状态
@@ -86,6 +115,25 @@ public class BMSInfo {
@JSONField(name = "Soc") @JSONField(name = "Soc")
private Integer 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") @JSONField(name = "TemptureHNumIndex")
private Integer temptureHNumIndex; private Integer temptureHNumIndex;
/**
* 剩余充电时间
*/
@JSONField(name = "RemainChargTime")
private Integer remainChargTime;
/** /**
* 单体最低温度 * 单体最低温度
*/ */
@@ -122,6 +176,30 @@ public class BMSInfo {
@JSONField(name = "TemptureLNumIndex") @JSONField(name = "TemptureLNumIndex")
private Integer 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") @JSONField(name = "ChargingSessionMin")
private Integer chargingSessionMin; private Integer chargingSessionMin;
/**
* 充电状态
*/
@JSONField(name = "ChargeStatus")
private Integer chargeStatus;
} }

View File

@@ -44,6 +44,24 @@ public class StationChargeStatsInfo {
@JSONField(name = "StationChargeElectricity") @JSONField(name = "StationChargeElectricity")
private BigDecimal 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") @JSONField(name = "EquipmentChargeElectricity")
private BigDecimal 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") @JSONField(name = "ConnectorChargeElectricity")
private BigDecimal 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.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants; 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.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum; 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.service.*;
import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.pile.thirdparty.EquipmentInfo; import com.jsowell.pile.thirdparty.EquipmentInfo;
import com.jsowell.pile.thirdparty.ParameterConfigData;
import com.jsowell.pile.vo.ThirdPartySecretInfoVO; import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
import com.jsowell.pile.vo.base.ConnectorInfoVO; import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
@@ -540,8 +545,13 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
.EquipmentChargeStatsInfo> equipmentStatsInfoList = Lists.newArrayList(); .EquipmentChargeStatsInfo> equipmentStatsInfoList = Lists.newArrayList();
// 站点用电量 // 站点用电量
BigDecimal stationElectricity = BigDecimal.ZERO; BigDecimal stationElectricity = BigDecimal.ZERO;
int stationChargingTime = Constants.zero;
// 用于记录枪口用电量 在循环每个枪口的时候初始化 // 用于记录枪口用电量 在循环每个枪口的时候初始化
BigDecimal pileElec; BigDecimal pileElec;
// 桩充电次数
int pileChargingNum;
// 桩充电时长
int pileChargingTime;
for (String pileSn : pileMap.keySet()) { for (String pileSn : pileMap.keySet()) {
// 该充电桩下 所有枪口的用电数据 // 该充电桩下 所有枪口的用电数据
List<AccumulativeInfoVO> accumulativeInfoVOS = pileMap.get(pileSn); List<AccumulativeInfoVO> accumulativeInfoVOS = pileMap.get(pileSn);
@@ -551,6 +561,10 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
// 存放充电桩用电量 // 存放充电桩用电量
pileElec = BigDecimal.ZERO; pileElec = BigDecimal.ZERO;
// 充电桩充电次数
pileChargingNum = Constants.zero;
// 充电桩充电时长
pileChargingTime = Constants.zero;
// key=枪口编号 value 该枪口的用电数据 // key=枪口编号 value 该枪口的用电数据
Map<String, List<AccumulativeInfoVO>> collect = accumulativeInfoVOS.stream() Map<String, List<AccumulativeInfoVO>> collect = accumulativeInfoVOS.stream()
@@ -567,6 +581,17 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
.map(AccumulativeInfoVO::getConnectorElectricity) .map(AccumulativeInfoVO::getConnectorElectricity)
.map(BigDecimal::new) .map(BigDecimal::new)
.reduce(BigDecimal.ZERO, BigDecimal::add); .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( connectorStatsInfos.add(
StationChargeStatsInfo StationChargeStatsInfo
@@ -574,22 +599,34 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
.ConnectorChargeStatsInfo.builder() .ConnectorChargeStatsInfo.builder()
.connectorId(pileConnectorCode) .connectorId(pileConnectorCode)
.connectorChargeElectricity(connectorElec) .connectorChargeElectricity(connectorElec)
.connectorTotalChargeTime(chargingTime.intValue())
.connectorTotalChargeNum(chargingNum)
.connectorTotalWarningNum(0)
.build() .build()
); );
// 充电桩电量为枪口用电量累计 // 充电桩电量为枪口用电量累计
pileElec = pileElec.add(connectorElec); pileElec = pileElec.add(connectorElec);
// 充电桩充电次数为枪口充电次数累计
pileChargingNum += chargingNum;
// 充电时长
pileChargingTime += chargingTime.intValue();
} }
StationChargeStatsInfo StationChargeStatsInfo
.EquipmentChargeStatsInfo build = StationChargeStatsInfo.EquipmentChargeStatsInfo.builder() .EquipmentChargeStatsInfo build = StationChargeStatsInfo.EquipmentChargeStatsInfo.builder()
.equipmentId(pileSn) .equipmentId(pileSn)
.equipmentChargeElectricity(pileElec) .equipmentChargeElectricity(pileElec)
.equipmentTotalChargeTime(pileChargingTime)
.equipmentTotalChargeNum(pileChargingNum)
.equipmentTotalWarningNum(0)
.connectorChargeStatsInfos(connectorStatsInfos) .connectorChargeStatsInfos(connectorStatsInfos)
.build(); .build();
equipmentStatsInfoList.add(build); equipmentStatsInfoList.add(build);
// 所有充电桩用电量之和 // 所有充电桩用电量之和
stationElectricity = stationElectricity.add(pileElec); stationElectricity = stationElectricity.add(pileElec);
// 充电时长
stationChargingTime += pileChargingTime;
} }
StationChargeStatsInfo stationChargeStatsInfo = StationChargeStatsInfo.builder() StationChargeStatsInfo stationChargeStatsInfo = StationChargeStatsInfo.builder()
@@ -597,6 +634,9 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
.startTime(dto.getStartTime()) .startTime(dto.getStartTime())
.endTime(dto.getEndTime()) .endTime(dto.getEndTime())
.stationChargeElectricity(stationElectricity) .stationChargeElectricity(stationElectricity)
.stationTotalChargeTime(stationChargingTime)
.stationTotalChargeNum(list.size())
.stationTotalWarningNum(0)
.equipmentChargeStatsInfos(equipmentStatsInfoList) // 设备列表 .equipmentChargeStatsInfos(equipmentStatsInfoList) // 设备列表
.build(); .build();
@@ -640,28 +680,65 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
return null; return null;
} }
RealTimeMonitorData data = chargingRealTimeData.get(0); 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() bmsInfo = BMSInfo.builder()
.vinCode(orderVO.getVinCode()) .vinCode(orderVO.getVinCode())
.batteryType(Integer.parseInt(chargingHandshakeData.getBmsBatteryType()))
.bmsCode("") .bmsCode("")
.bmsVer("") .bmsVer("V1.1")
.connectorID(orderVO.getPileConnectorCode()) .connectorID(orderVO.getPileConnectorCode())
.maxChargeCurrent(new BigDecimal("")) .maxChargeCurrent(new BigDecimal(parameterConfigData.getBmsMaxCurrent()).setScale(2, BigDecimal.ROUND_HALF_DOWN))
.maxChargeCellVoltage(new BigDecimal("")) .maxChargeCellVoltage(new BigDecimal(parameterConfigData.getBmsMaxChargingVoltage()).setScale(2, BigDecimal.ROUND_HALF_DOWN))
.maxTemp(0) .maxTemp(Integer.parseInt(parameterConfigData.getBmsMaxTemperature()))
.ratedCapacity(0) .ratedCapacity(new BigDecimal(parameterConfigData.getBmsSumEnergy()).intValue())
.tatalVoltage(new BigDecimal(data.getOutputVoltage())) .ratedEnergy(new BigDecimal(parameterConfigData.getBmsSumEnergy()).setScale(2, BigDecimal.ROUND_HALF_DOWN))
.totalCurrent(new BigDecimal(data.getOutputCurrent())) .ratedVoltage(new BigDecimal(chargingHandshakeData.getBmsBatteryVoltage()))
.bTotalVoltage(new BigDecimal(bmsDemandAndChargerOutputData.getPileVoltageOutput()))
.bTotalCurrent(new BigDecimal(bmsDemandAndChargerOutputData.getPileCurrentOutput()))
.soc(Integer.parseInt(data.getSOC())) .soc(Integer.parseInt(data.getSOC()))
.voltageH(new BigDecimal("")) .reqVoltage(new BigDecimal(bmsDemandAndChargerOutputData.getBmsVoltageDemand()))
.voltageHNumIndex(0) .reqCurrent(new BigDecimal(bmsDemandAndChargerOutputData.getBmsCurrentDemand()))
.temptureH(0) .chargeMode(Integer.parseInt(bmsDemandAndChargerOutputData.getBmsChargingModel()))
.temptureHNumIndex(0) .voltageH(new BigDecimal(parameterConfigData.getBmsMaxVoltage()).setScale(2, BigDecimal.ROUND_HALF_DOWN))
.temptureL(0) .voltageHNumIndex(new BigDecimal(bmsDemandAndChargerOutputData.getBmsMaxVoltageAndGroup()).intValue())
.temptureLNumIndex(0) .remainChargTime(Integer.parseInt(data.getTimeRemaining()) * 60)
.currentCapacity(new BigDecimal("")) .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()) .freshTime(DateUtils.getDateTime())
.startChargingTime(orderVO.getChargeStartTime()) .startChargingTime(orderVO.getChargeStartTime())
.chargingSessionMin(Integer.parseInt(data.getSumChargingTime()) * 60) .chargingSessionMin(Integer.parseInt(data.getSumChargingTime()) * 60)
.chargeStatus(1)
.build(); .build();