diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/BMSInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/BMSInfo.java index 2f159c503..3b5661e1c 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/BMSInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/BMSInfo.java @@ -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; } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/StationChargeStatsInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/StationChargeStatsInfo.java index 891c6d216..12f398d06 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/StationChargeStatsInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/StationChargeStatsInfo.java @@ -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; } } } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ShenZhenPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ShenZhenPlatformServiceImpl.java index 013783bce..28e604a9d 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ShenZhenPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ShenZhenPlatformServiceImpl.java @@ -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 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> 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 chargerOutputInfoList = pileBasicInfoService.getBMSDemandAndChargerOutputInfoList(orderVO.getTransactionCode()); + if (org.springframework.util.CollectionUtils.isEmpty(chargerOutputInfoList)) { + return "0x23信息为空"; + } + // 获取最后一条0x25 + List 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();