DDS页面数据设置

This commit is contained in:
2025-08-04 16:23:04 +08:00
parent 97c667bd77
commit 90315d8e2c
5 changed files with 79 additions and 19 deletions

8
.idea/.gitignore generated vendored
View File

@ -6,3 +6,11 @@
# Datasource local storage ignored files # Datasource local storage ignored files
/dataSources/ /dataSources/
/dataSources.local.xml /dataSources.local.xml
# 忽略Maven/Gradle编译生成的文件和目录
target/
build/
# 忽略IDE特定文件
.idea/
*.iml
.vscode/

2
.idea/misc.xml generated
View File

@ -8,5 +8,5 @@
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="openjdk-24" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="ms-21" project-jdk-type="JavaSDK" />
</project> </project>

2
.idea/vcs.xml generated
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="" vcs="Git" />
</component> </component>
</project> </project>

View File

@ -46,4 +46,9 @@ public class RedisKeyConstants
* 电池组 redis key * 电池组 redis key
*/ */
public static final String GROUP = "GROUP_"; public static final String GROUP = "GROUP_";
/**
* BMSD原始数据 redis key
*/
public static final String ORIGINAL_BMSD = "BMSD_";
} }

View File

@ -137,6 +137,8 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService {
Map<String, Object> obj = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() { Map<String, Object> obj = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
}); });
// 将原始数据存一下方便后面簇数据使用
redisCache.setCacheObject(RedisKeyConstants.ORIGINAL_BMSD + SITE_ID + "_" + deviceId, obj);
//BMS 电池堆 //BMS 电池堆
EmsBatteryStack dataStack = new EmsBatteryStack(); EmsBatteryStack dataStack = new EmsBatteryStack();
@ -173,6 +175,13 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService {
dataStack.setEnvironmentHumidity(StringUtils.getBigDecimal(obj.get("HJSD"))); dataStack.setEnvironmentHumidity(StringUtils.getBigDecimal(obj.get("HJSD")));
dataStack.setCircuitBreakerStatus(StringUtils.getString(obj.get("LDQZT"))); dataStack.setCircuitBreakerStatus(StringUtils.getString(obj.get("LDQZT")));
// 页面字段临时填充
dataStack.setStackVoltage(StringUtils.getBigDecimal(obj.get("BMSD01DY")));
dataStack.setStackCurrent(StringUtils.getBigDecimal(obj.get("BMSD01DL")));
dataStack.setStackSoc(StringUtils.getBigDecimal(obj.get("BMSD01SOC")));
dataStack.setStackSoh(StringUtils.getBigDecimal(obj.get("BMSD01SOH")));
dataStack.setOperatingTemp(StringUtils.getBigDecimal(obj.get("HJWD")));
dataStack.setCreateBy("system"); dataStack.setCreateBy("system");
dataStack.setCreateTime(DateUtils.getNowDate()); dataStack.setCreateTime(DateUtils.getNowDate());
dataStack.setUpdateBy("system"); dataStack.setUpdateBy("system");
@ -332,6 +341,9 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService {
}); });
EmsDevicesSetting joken = new EmsDevicesSetting(); EmsDevicesSetting joken = new EmsDevicesSetting();
// 获取redis获取最新的BMSD01数据
Map<String, Object> stackObj = redisCache.getCacheObject(RedisKeyConstants.ORIGINAL_BMSD +SITE_ID+"_BMSD01");
//BMSC 电池簇 //BMSC 电池簇
EmsBatteryCluster data = new EmsBatteryCluster(); EmsBatteryCluster data = new EmsBatteryCluster();
// 其他非 BigDecimal 字段 // 其他非 BigDecimal 字段
@ -343,24 +355,9 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService {
data.setUpdateBy("system"); data.setUpdateBy("system");
data.setUpdateTime(DateUtils.getNowDate()); data.setUpdateTime(DateUtils.getNowDate());
data.setSiteId(SITE_ID); data.setSiteId(SITE_ID);
// BMSC01 电流电压功率
deviceId = "BMSC01";
String stackDeviceId = getDeviceParent(deviceId, SITE_ID);
if (StringUtils.isNotBlank(stackDeviceId)) {
data.setStackDeviceId(stackDeviceId);
} else {
data.setStackDeviceId("1");
}
data.setDeviceId(deviceId);
data.setClusterVoltage(StringUtils.getBigDecimal(obj.get("BMSC01ZLDY")));
data.setClusterCurrent(StringUtils.getBigDecimal(obj.get("BMSC01ZLDL")));
data.setMaxAllowedChargePower(StringUtils.getBigDecimal(obj.get("BMSC01ZLSCGL")));
emsBatteryClusterMapper.insertEmsBatteryCluster(data);
redisCache.setCacheObject(RedisKeyConstants.CLUSTER + SITE_ID + "_" +deviceId, data);
// BMSC02 电流电压功率 // BMSC02 电流电压功率
deviceId = "BMSC02"; deviceId = "BMSC02";
stackDeviceId = getDeviceParent(deviceId, SITE_ID); String stackDeviceId = getDeviceParent(deviceId, SITE_ID);
if (StringUtils.isNotBlank(stackDeviceId)) { if (StringUtils.isNotBlank(stackDeviceId)) {
data.setStackDeviceId(stackDeviceId); data.setStackDeviceId(stackDeviceId);
} else { } else {
@ -370,6 +367,45 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService {
data.setClusterVoltage(StringUtils.getBigDecimal(obj.get("BMSC02ZLDY"))); data.setClusterVoltage(StringUtils.getBigDecimal(obj.get("BMSC02ZLDY")));
data.setClusterCurrent(StringUtils.getBigDecimal(obj.get("BMSC02ZLDL"))); data.setClusterCurrent(StringUtils.getBigDecimal(obj.get("BMSC02ZLDL")));
data.setMaxAllowedChargePower(StringUtils.getBigDecimal(obj.get("BMSC02ZLSCGL"))); data.setMaxAllowedChargePower(StringUtils.getBigDecimal(obj.get("BMSC02ZLSCGL")));
// 取堆里面数据
data.setSoh(StringUtils.getBigDecimal(stackObj.get("BMSD02SOH")));
data.setCurrentSoc(StringUtils.getBigDecimal(stackObj.get("BMSD02SOC")));
data.setBatteryPackVoltage(StringUtils.getBigDecimal(stackObj.get("BMSD02DY")));
data.setBatteryPackCurrent(StringUtils.getBigDecimal(stackObj.get("BMSD02DL")));
data.setBatteryPackSoc(StringUtils.getBigDecimal(stackObj.get("BMSD02SOC")));
data.setBatteryPackSoh(StringUtils.getBigDecimal(stackObj.get("BMSD02SOH")));
emsBatteryClusterMapper.insertEmsBatteryCluster(data);
redisCache.setCacheObject(RedisKeyConstants.CLUSTER + SITE_ID + "_" +deviceId, data);
// BMSC01 电流电压功率
deviceId = "BMSC01";
stackDeviceId = getDeviceParent(deviceId, SITE_ID);
if (StringUtils.isNotBlank(stackDeviceId)) {
data.setStackDeviceId(stackDeviceId);
} else {
data.setStackDeviceId("1");
}
data.setDeviceId(deviceId);
data.setClusterVoltage(StringUtils.getBigDecimal(obj.get("BMSC01ZLDY")));
data.setClusterCurrent(StringUtils.getBigDecimal(obj.get("BMSC01ZLDL")));
data.setMaxAllowedChargePower(StringUtils.getBigDecimal(obj.get("BMSC01ZLSCGL")));
// 取堆里面数据
data.setSoh(StringUtils.getBigDecimal(stackObj.get("BMSD01SOH")));
data.setCurrentSoc(StringUtils.getBigDecimal(stackObj.get("BMSD01SOC")));
data.setBatteryPackVoltage(StringUtils.getBigDecimal(stackObj.get("BMSD01DY")));
data.setBatteryPackCurrent(StringUtils.getBigDecimal(stackObj.get("BMSD01DL")));
data.setBatteryPackSoc(StringUtils.getBigDecimal(stackObj.get("BMSD01SOC")));
data.setBatteryPackSoh(StringUtils.getBigDecimal(stackObj.get("BMSD01SOH")));
data.setAvgCellTemp(StringUtils.getBigDecimal(stackObj.get("DTPJWD")));
data.setMaxCellVoltage(StringUtils.getBigDecimal(stackObj.get("DTZDDY")));
data.setMaxCellVoltageId(StringUtils.getLong(stackObj.get("DTZDDYXH")));
data.setMinCellVoltage(StringUtils.getBigDecimal(stackObj.get("DTZXDY")));
data.setMinCellVoltageId(StringUtils.getLong(stackObj.get("DTZXDYXH")));
data.setMaxCellTemp(StringUtils.getBigDecimal(stackObj.get("DTZGWD")));
data.setMaxCellTempId(StringUtils.getLong(stackObj.get("DTZGWDXH")));
data.setMinCellTemp(StringUtils.getBigDecimal(stackObj.get("DTZDWD")));
data.setMinCellTempId(StringUtils.getLong(stackObj.get("DTZDWDXH")));
emsBatteryClusterMapper.insertEmsBatteryCluster(data); emsBatteryClusterMapper.insertEmsBatteryCluster(data);
redisCache.setCacheObject(RedisKeyConstants.CLUSTER + SITE_ID + "_" +deviceId, data); redisCache.setCacheObject(RedisKeyConstants.CLUSTER + SITE_ID + "_" +deviceId, data);
} }
@ -502,6 +538,11 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService {
pcsData.setSysVCurrent(StringUtils.getBigDecimal(obj.get("XTSCVXDL"))); pcsData.setSysVCurrent(StringUtils.getBigDecimal(obj.get("XTSCVXDL")));
pcsData.setSysWCurrent(StringUtils.getBigDecimal(obj.get("XTSCWXDL"))); pcsData.setSysWCurrent(StringUtils.getBigDecimal(obj.get("XTSCWXDL")));
// 页面字段填充
pcsData.setAcFrequency(StringUtils.getBigDecimal(obj.get("DWPL")));
pcsData.setTotalApparentPower(StringUtils.getBigDecimal(obj.get("ZLZGL")));
pcsData.setTotalPowerFactor(new BigDecimal(0));
// 系统管理字段 // 系统管理字段
pcsData.setCreateBy("system"); pcsData.setCreateBy("system");
pcsData.setCreateTime(DateUtils.getNowDate()); pcsData.setCreateTime(DateUtils.getNowDate());
@ -519,7 +560,8 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService {
private void pcsBranchDataProcess(String deviceId, String dataJson) { private void pcsBranchDataProcess(String deviceId, String dataJson) {
Map<String, Map<String, Object>> records = processDataPrefix(JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {})); Map<String, Object> records = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
});
List<EmsPcsBranchData> list = new ArrayList<>(); List<EmsPcsBranchData> list = new ArrayList<>();
EmsPcsBranchData data = new EmsPcsBranchData(); EmsPcsBranchData data = new EmsPcsBranchData();
@ -534,6 +576,11 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService {
data.setOutputVCurrent(StringUtils.getBigDecimal(records.get("PCSJLDLIB"))); data.setOutputVCurrent(StringUtils.getBigDecimal(records.get("PCSJLDLIB")));
data.setOutputWCurrent(StringUtils.getBigDecimal(records.get("PCSJLDLIC"))); data.setOutputWCurrent(StringUtils.getBigDecimal(records.get("PCSJLDLIC")));
// 页面字段填充
data.setDcPower(StringUtils.getBigDecimal(records.get("ZLZGL")));
data.setDcVoltage(StringUtils.getBigDecimal(records.get("ZLDY")));
data.setDcCurrent(StringUtils.getBigDecimal(records.get("ZLDL")));
data.setBranchId("DY1"); data.setBranchId("DY1");
data.setCreateBy("system"); data.setCreateBy("system");
data.setCreateTime(DateUtils.getNowDate()); data.setCreateTime(DateUtils.getNowDate());