修正部分参数
This commit is contained in:
@ -149,65 +149,7 @@ public class MqttMessageController implements MqttPublisher, MqttSubscriber {
|
||||
String jsonData = obj.get("Data").toString();
|
||||
|
||||
log.info("deviceId:" + deviceId);
|
||||
if (deviceId.contains("BMS")) {
|
||||
log.info("====================");
|
||||
log.info("BMS data:"+ jsonData);
|
||||
//BMS 电池簇
|
||||
EmsBatteryCluster data = new EmsBatteryCluster();
|
||||
// 设置所有 BigDecimal 类型字段为 ZERO
|
||||
data.setChargeableCapacity(BigDecimal.ZERO);
|
||||
data.setTotalChargedCapacity(BigDecimal.ZERO);
|
||||
data.setDischargeableCapacity(BigDecimal.ZERO);
|
||||
data.setTotalDischargedCapacity(BigDecimal.ZERO);
|
||||
data.setSoh(BigDecimal.ZERO);
|
||||
data.setAverageTemperature(BigDecimal.ZERO);
|
||||
data.setInsulationResistance(BigDecimal.ZERO);
|
||||
data.setCurrentSoc(BigDecimal.ZERO);
|
||||
data.setMaxAllowedChargePower(BigDecimal.ZERO);
|
||||
data.setMaxAllowedDischargePower(BigDecimal.ZERO);
|
||||
data.setMaxAllowedChargeVoltage(BigDecimal.ZERO);
|
||||
data.setMaxAllowedDischargeVoltage(BigDecimal.ZERO);
|
||||
data.setMaxAllowedChargeCurrent(BigDecimal.ZERO);
|
||||
data.setMaxAllowedDischargeCurrent(BigDecimal.ZERO);
|
||||
data.setBatteryPackVoltage(BigDecimal.ZERO);
|
||||
data.setBatteryPackCurrent(BigDecimal.ZERO);
|
||||
data.setBatteryPackTemp(BigDecimal.ZERO);
|
||||
data.setBatteryPackSoc(BigDecimal.ZERO);
|
||||
data.setBatteryPackSoh(BigDecimal.ZERO);
|
||||
data.setBatteryPackInsulationResistance(BigDecimal.ZERO);
|
||||
data.setAvgCellVoltage(BigDecimal.ZERO);
|
||||
data.setAvgCellTemp(BigDecimal.ZERO);
|
||||
data.setMaxCellVoltage(BigDecimal.ZERO);
|
||||
data.setMinCellVoltage(BigDecimal.ZERO);
|
||||
data.setMaxCellTemp(BigDecimal.ZERO);
|
||||
data.setMinCellTemp(BigDecimal.ZERO);
|
||||
data.setMaxCellSoc(BigDecimal.ZERO);
|
||||
data.setMinCellSoc(BigDecimal.ZERO);
|
||||
data.setMaxCellSoh(BigDecimal.ZERO);
|
||||
data.setMinCellSoh(BigDecimal.ZERO);
|
||||
data.setTotalChargeEnergy(BigDecimal.ZERO);
|
||||
data.setTotalDischargeEnergy(BigDecimal.ZERO);
|
||||
|
||||
// 其他非 BigDecimal 字段
|
||||
data.setWorkStatus(WorkStatus.NORMAL.getCode()); // 或其他默认值
|
||||
data.setPcsCommunicationStatus(CommunicationStatus.OK.getCode());
|
||||
data.setEmsCommunicationStatus(CommunicationStatus.OK.getCode());
|
||||
data.setCreateBy("system");
|
||||
data.setCreateTime(DateUtils.getNowDate());
|
||||
data.setUpdateBy("system");
|
||||
data.setUpdateTime(DateUtils.getNowDate());
|
||||
data.setSiteId("021_FXX_01");
|
||||
data.setDeviceId(deviceId);
|
||||
data.setMaxCellVoltageId(Long.parseLong("1"));
|
||||
data.setMinCellVoltageId(Long.parseLong("1"));
|
||||
data.setMaxCellTempId(Long.parseLong("1"));
|
||||
data.setMinCellTempId(Long.parseLong("1"));
|
||||
data.setMaxCellSocId(Long.parseLong("1"));
|
||||
data.setMinCellSocId(Long.parseLong("1"));
|
||||
data.setMaxCellSohId(Long.parseLong("1"));
|
||||
data.setMinCellSohId(Long.parseLong("1"));
|
||||
data.setStackDeviceId("1");
|
||||
emsBatteryClusterService.insertEmsBatteryCluster(data);
|
||||
if (deviceId.contains("BMSD")) {
|
||||
|
||||
|
||||
//电池堆
|
||||
@ -269,6 +211,98 @@ public class MqttMessageController implements MqttPublisher, MqttSubscriber {
|
||||
emsBatteryStackService.insertEmsBatteryStack(dataStack);
|
||||
|
||||
|
||||
//单体电池
|
||||
Map<String, Map<String, Object>> records = processData(JSON.parseObject(jsonData, new TypeReference<Map<String, Object>>() {}));
|
||||
List<EmsBatteryData> list = new ArrayList<>();
|
||||
//单体电池
|
||||
for (Map.Entry<String, Map<String, Object>> record : records.entrySet()) {
|
||||
String recordId = record.getKey();
|
||||
Map<String, Object> fields = record.getValue();
|
||||
|
||||
EmsBatteryData batteryData = new EmsBatteryData();
|
||||
batteryData.setDeviceId(recordId);
|
||||
batteryData.setBatteryCellId(recordId);
|
||||
batteryData.setSoc(StringUtils.getBigDecimal(fields.get("DTSOC")));
|
||||
batteryData.setSoh(StringUtils.getBigDecimal(fields.get("DTSOH")));
|
||||
batteryData.setTemperature(StringUtils.getBigDecimal(fields.get("DTWD")));
|
||||
batteryData.setVoltage(StringUtils.getBigDecimal(fields.get("DTDY")));
|
||||
|
||||
batteryData.setBatteryCluster(deviceId);
|
||||
batteryData.setBatteryPack(deviceId);
|
||||
|
||||
// 时间戳
|
||||
batteryData.setDataTimestamp(new Date());
|
||||
|
||||
// ID字段
|
||||
batteryData.setSiteId(("021_FXX_01"));
|
||||
batteryData.setClusterDeviceId(("021"));
|
||||
|
||||
list.add(batteryData);
|
||||
}
|
||||
if (list.size() > 0 ) {
|
||||
emsBatteryDataService.insertEmsBatteryDataList(list);
|
||||
}
|
||||
} else if (deviceId.contains("DMSC")) {
|
||||
log.info("====================");
|
||||
log.info("BMSC data:"+ jsonData);
|
||||
//BMS 电池簇
|
||||
EmsBatteryCluster data = new EmsBatteryCluster();
|
||||
// 设置所有 BigDecimal 类型字段为 ZERO
|
||||
data.setChargeableCapacity(BigDecimal.ZERO);
|
||||
data.setTotalChargedCapacity(BigDecimal.ZERO);
|
||||
data.setDischargeableCapacity(BigDecimal.ZERO);
|
||||
data.setTotalDischargedCapacity(BigDecimal.ZERO);
|
||||
data.setSoh(BigDecimal.ZERO);
|
||||
data.setAverageTemperature(BigDecimal.ZERO);
|
||||
data.setInsulationResistance(BigDecimal.ZERO);
|
||||
data.setCurrentSoc(BigDecimal.ZERO);
|
||||
data.setMaxAllowedChargePower(BigDecimal.ZERO);
|
||||
data.setMaxAllowedDischargePower(BigDecimal.ZERO);
|
||||
data.setMaxAllowedChargeVoltage(BigDecimal.ZERO);
|
||||
data.setMaxAllowedDischargeVoltage(BigDecimal.ZERO);
|
||||
data.setMaxAllowedChargeCurrent(BigDecimal.ZERO);
|
||||
data.setMaxAllowedDischargeCurrent(BigDecimal.ZERO);
|
||||
data.setBatteryPackVoltage(BigDecimal.ZERO);
|
||||
data.setBatteryPackCurrent(BigDecimal.ZERO);
|
||||
data.setBatteryPackTemp(BigDecimal.ZERO);
|
||||
data.setBatteryPackSoc(BigDecimal.ZERO);
|
||||
data.setBatteryPackSoh(BigDecimal.ZERO);
|
||||
data.setBatteryPackInsulationResistance(BigDecimal.ZERO);
|
||||
data.setAvgCellVoltage(BigDecimal.ZERO);
|
||||
data.setAvgCellTemp(BigDecimal.ZERO);
|
||||
data.setMaxCellVoltage(BigDecimal.ZERO);
|
||||
data.setMinCellVoltage(BigDecimal.ZERO);
|
||||
data.setMaxCellTemp(BigDecimal.ZERO);
|
||||
data.setMinCellTemp(BigDecimal.ZERO);
|
||||
data.setMaxCellSoc(BigDecimal.ZERO);
|
||||
data.setMinCellSoc(BigDecimal.ZERO);
|
||||
data.setMaxCellSoh(BigDecimal.ZERO);
|
||||
data.setMinCellSoh(BigDecimal.ZERO);
|
||||
data.setTotalChargeEnergy(BigDecimal.ZERO);
|
||||
data.setTotalDischargeEnergy(BigDecimal.ZERO);
|
||||
|
||||
// 其他非 BigDecimal 字段
|
||||
data.setWorkStatus(WorkStatus.NORMAL.getCode()); // 或其他默认值
|
||||
data.setPcsCommunicationStatus(CommunicationStatus.OK.getCode());
|
||||
data.setEmsCommunicationStatus(CommunicationStatus.OK.getCode());
|
||||
data.setCreateBy("system");
|
||||
data.setCreateTime(DateUtils.getNowDate());
|
||||
data.setUpdateBy("system");
|
||||
data.setUpdateTime(DateUtils.getNowDate());
|
||||
data.setSiteId("021_FXX_01");
|
||||
data.setDeviceId(deviceId);
|
||||
data.setMaxCellVoltageId(Long.parseLong("1"));
|
||||
data.setMinCellVoltageId(Long.parseLong("1"));
|
||||
data.setMaxCellTempId(Long.parseLong("1"));
|
||||
data.setMinCellTempId(Long.parseLong("1"));
|
||||
data.setMaxCellSocId(Long.parseLong("1"));
|
||||
data.setMinCellSocId(Long.parseLong("1"));
|
||||
data.setMaxCellSohId(Long.parseLong("1"));
|
||||
data.setMinCellSohId(Long.parseLong("1"));
|
||||
data.setStackDeviceId("1");
|
||||
emsBatteryClusterService.insertEmsBatteryCluster(data);
|
||||
|
||||
|
||||
//单体电池
|
||||
Map<String, Map<String, Object>> records = processData(JSON.parseObject(jsonData, new TypeReference<Map<String, Object>>() {}));
|
||||
List<EmsBatteryData> list = new ArrayList<>();
|
||||
@ -304,6 +338,8 @@ public class MqttMessageController implements MqttPublisher, MqttSubscriber {
|
||||
log.info("====================");
|
||||
|
||||
log.info("PCS data:"+ jsonData);
|
||||
|
||||
|
||||
//pcs
|
||||
EmsPcsData pcsData = new EmsPcsData();
|
||||
// 时间与状态类字段
|
||||
|
Reference in New Issue
Block a user