修正部分参数

This commit is contained in:
2025-07-01 21:50:54 +08:00
parent 4d5f2adef4
commit 9efb87ed24

View File

@ -41,6 +41,8 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
@Autowired
private RedisCache redisCache;
@Autowired
private EmsDevicesSettingMapper emsDevicesSettingMapper;;
@Override
public void handleFxData(String message) {
@ -138,7 +140,13 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
Map<String, Object> obj = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
});
EmsDevicesSetting joken = new EmsDevicesSetting();
joken.setDeviceId(deviceId);
List<EmsDevicesSetting> up = emsDevicesSettingMapper.selectEmsDevicesSettingList(joken);
String stackDeviceId = "";
if (up != null && up.size() >0) {
stackDeviceId = up.get(0).getParentId();
}
//BMS 电池簇
EmsBatteryCluster data = new EmsBatteryCluster();
// 设置所有 BigDecimal 类型字段为 ZERO
@ -195,14 +203,20 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
data.setMinCellSocId(StringUtils.getLong(obj.get("ZDDTSOCDYD")));
data.setMaxCellSohId(StringUtils.getLong(obj.get("ZGDTSOHDYD")));
data.setMinCellSohId(StringUtils.getLong(obj.get("ZDDTSOHDYD")));
data.setStackDeviceId("1");
data.setStackDeviceId(stackDeviceId);
emsBatteryClusterMapper.insertEmsBatteryCluster(data);
}
private void batteryDataProcess(String deviceId, String dataJson) {
EmsDevicesSetting joken = new EmsDevicesSetting();
joken.setDeviceId(deviceId);
List<EmsDevicesSetting> up = emsDevicesSettingMapper.selectEmsDevicesSettingList(joken);
String stackDeviceId = "";
if (up != null && up.size() >0) {
stackDeviceId = up.get(0).getParentId();
}
//单体电池
Map<String, Map<String, Object>> records = processData(JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {}));
List<EmsBatteryData> list = new ArrayList<>();
@ -220,14 +234,14 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
batteryData.setVoltage(StringUtils.getBigDecimal(fields.get("DTDY")));
batteryData.setBatteryCluster(deviceId);
batteryData.setBatteryPack(deviceId);
batteryData.setBatteryPack(stackDeviceId);
// 时间戳
batteryData.setDataTimestamp(new Date());
// ID字段
batteryData.setSiteId(("021_FXX_01"));
batteryData.setClusterDeviceId(("021"));
batteryData.setClusterDeviceId(deviceId);
list.add(batteryData);
}