mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
新增 0x17、0x23报文解析
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
package com.jsowell.thirdparty.platform.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.BMSDemandAndChargerOutputData;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import com.jsowell.pile.service.PileBasicInfoService;
|
||||
import com.jsowell.pile.thirdparty.ParameterConfigData;
|
||||
import com.jsowell.pile.vo.uniapp.customer.OrderVO;
|
||||
import com.jsowell.thirdparty.platform.domain.ChargeAlgorithmData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单算法平台Service
|
||||
@@ -24,6 +32,9 @@ public class ChargeAlgorithmService {
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileBasicInfoService pileBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@@ -48,6 +59,23 @@ public class ChargeAlgorithmService {
|
||||
String transactionDataKey = CacheConstants.TRANSACTION_RECORD_BY_TRANSACTION_CODE + transactionCode;
|
||||
TransactionRecordsData transactionRecordsData = redisCache.getCacheObject(transactionDataKey);
|
||||
|
||||
// 获取最近一条的0x23数据
|
||||
List<BMSDemandAndChargerOutputData> bmsChargeInfoList = pileBasicInfoService.getBMSDemandAndChargerOutputInfoList(transactionCode);
|
||||
if (CollectionUtils.isEmpty(bmsChargeInfoList)) {
|
||||
return;
|
||||
}
|
||||
BMSDemandAndChargerOutputData bmsDemandAndChargerOutputData = bmsChargeInfoList.get(0);
|
||||
|
||||
// 获取最后一条0x13
|
||||
List<RealTimeMonitorData> chargingRealTimeDataList = orderBasicInfoService.getChargingRealTimeData(transactionCode);
|
||||
if (CollectionUtils.isEmpty(chargingRealTimeDataList)) {
|
||||
return;
|
||||
}
|
||||
RealTimeMonitorData realTimeMonitorData = chargingRealTimeDataList.get(0);
|
||||
|
||||
// 获取0x25
|
||||
|
||||
|
||||
ChargeAlgorithmData data = ChargeAlgorithmData.builder()
|
||||
.orderCode(orderCode)
|
||||
.initSoc(Constants.zero)
|
||||
@@ -60,37 +88,38 @@ public class ChargeAlgorithmService {
|
||||
.remainChargeTime(Constants.zero)
|
||||
.maxAllowElectricity(parameterConfigData.getBmsMaxCurrent())
|
||||
.singleMaxAllowVoltage(parameterConfigData.getBmsMaxVoltage())
|
||||
// .dcv()
|
||||
// .dca()
|
||||
// .bmsDemandVoltage(parameterConfigData.get)
|
||||
// .bmsDemandElectricity()
|
||||
// .bmsChargeMode()
|
||||
.dcv(bmsDemandAndChargerOutputData.getPileVoltageOutput()) // 直流充电电压
|
||||
.dca(bmsDemandAndChargerOutputData.getPileCurrentOutput()) // 直流充电电流
|
||||
.bmsDemandVoltage(bmsDemandAndChargerOutputData.getBmsVoltageDemand()) // BMS需求电压
|
||||
.bmsDemandElectricity(bmsDemandAndChargerOutputData.getBmsCurrentDemand()) // BMS需求电流
|
||||
.bmsChargeMode(Integer.parseInt(bmsDemandAndChargerOutputData.getBmsChargingModel())) // BMS充电模式
|
||||
.readBeforeCharge(transactionRecordsData.getAmmeterTotalStart())
|
||||
.readCurrentCharge(transactionRecordsData.getAmmeterTotalEnd())
|
||||
.beginTime(orderVO.getStartTime())
|
||||
.maxAllowTemp(parameterConfigData.getBmsMaxTemperature())
|
||||
// .chargePower()
|
||||
// .ratedCapacity()
|
||||
.chargePower(bmsDemandAndChargerOutputData.getOutputPower()) // 充电功率
|
||||
.ratedCapacity(parameterConfigData.getBmsSumEnergy()) // 电池额定容量
|
||||
.nominalEnergy(parameterConfigData.getBmsSumEnergy())
|
||||
// .ratedVoltage()
|
||||
// .ratedVoltage() // 电池额定总电压
|
||||
.singleMaxVoltage(parameterConfigData.getPileMaxOutputVoltage())
|
||||
.singleMinVoltage(parameterConfigData.getPileMinOutputVoltage())
|
||||
// .singleMaxTemp()
|
||||
// .ventTemp()
|
||||
// .environmentTemp()
|
||||
// .gunTemp()
|
||||
// .doorStatus()
|
||||
// .bmsVersion()
|
||||
// .measuringChargeVoltage()
|
||||
// .measuringChargeElectricity()
|
||||
// .maxSingleVoltageGroupNum()
|
||||
// .maxSingleVoltageNum()
|
||||
// .maxTempPointNum()
|
||||
// .minTempPointNum()
|
||||
// .batteryType()
|
||||
// .batteryInsulation()
|
||||
// .singleMaxTemp(realTimeMonitorData.getBatteryMaxTemperature()) // 单体最高温度
|
||||
// .singleMinTemp() // 单体最低温度
|
||||
// .ventTemp() // 出风口温度
|
||||
// .environmentTemp() // 环境温度
|
||||
.gunTemp(realTimeMonitorData.getGunLineCode()) // 充电枪温度
|
||||
.doorStatus(Constants.zero) // 舱门状态
|
||||
.bmsVersion("V1.1") // BMS版本
|
||||
.measuringChargeVoltage(bmsDemandAndChargerOutputData.getBmsChargingVoltage()) // 车辆测量充电电压
|
||||
.measuringChargeElectricity(bmsDemandAndChargerOutputData.getBmsChargingCurrent()) // 车辆测量充电电流
|
||||
// .maxSingleVoltageGroupNum() // 最高单体电压组号
|
||||
// .maxSingleVoltageNum() // 最高单体电压编号
|
||||
// .maxTempPointNum() // 最高温度点编号
|
||||
// .minTempPointNum() // 最低温度点编号
|
||||
// .batteryType() // 电池类型
|
||||
// .batteryInsulation() // 电池绝缘状态
|
||||
.maxAllowTotalVoltage(parameterConfigData.getBmsMaxChargingVoltage())
|
||||
// .beforeChargeTotalVoltage()
|
||||
// .beforeChargeTotalVoltage() // 充电前总电压
|
||||
|
||||
.build();
|
||||
|
||||
@@ -100,5 +129,12 @@ public class ChargeAlgorithmService {
|
||||
if (StringUtils.isNotBlank(orderVO.getEndSoc())) {
|
||||
data.setCurrentSoc(Integer.parseInt(orderVO.getEndSoc()));
|
||||
}
|
||||
|
||||
String url = "http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json";
|
||||
String clientId = "";
|
||||
// 发送请求
|
||||
String response = HttpRequest.post(url).header("clientId", clientId).body(JSON.toJSONString(data)).execute().body();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user