From 90315d8e2c350d2881e1e8b0bab6f3102ee69117 Mon Sep 17 00:00:00 2001 From: mashili Date: Mon, 4 Aug 2025 16:23:04 +0800 Subject: [PATCH] =?UTF-8?q?DDS=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 8 ++ .idea/misc.xml | 2 +- .idea/vcs.xml | 2 +- .../common/constant/RedisKeyConstants.java | 5 ++ .../impl/DDSDataProcessServiceImpl.java | 81 +++++++++++++++---- 5 files changed, 79 insertions(+), 19 deletions(-) diff --git a/.idea/.gitignore b/.idea/.gitignore index 35410ca..be64bd1 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -6,3 +6,11 @@ # Datasource local storage ignored files /dataSources/ /dataSources.local.xml +# 忽略Maven/Gradle编译生成的文件和目录 +target/ +build/ + +# 忽略IDE特定文件 +.idea/ +*.iml +.vscode/ \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 9533805..4c7d54e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,5 +8,5 @@ - + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/ems-common/src/main/java/com/xzzn/common/constant/RedisKeyConstants.java b/ems-common/src/main/java/com/xzzn/common/constant/RedisKeyConstants.java index 0e3b343..e16229c 100644 --- a/ems-common/src/main/java/com/xzzn/common/constant/RedisKeyConstants.java +++ b/ems-common/src/main/java/com/xzzn/common/constant/RedisKeyConstants.java @@ -46,4 +46,9 @@ public class RedisKeyConstants * 电池组 redis key */ public static final String GROUP = "GROUP_"; + + /** + * BMSD原始数据 redis key + */ + public static final String ORIGINAL_BMSD = "BMSD_"; } diff --git a/ems-system/src/main/java/com/xzzn/ems/service/impl/DDSDataProcessServiceImpl.java b/ems-system/src/main/java/com/xzzn/ems/service/impl/DDSDataProcessServiceImpl.java index 8e6d4e9..e995622 100644 --- a/ems-system/src/main/java/com/xzzn/ems/service/impl/DDSDataProcessServiceImpl.java +++ b/ems-system/src/main/java/com/xzzn/ems/service/impl/DDSDataProcessServiceImpl.java @@ -137,6 +137,8 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService { Map obj = JSON.parseObject(dataJson, new TypeReference>() { }); + // 将原始数据存一下方便后面簇数据使用 + redisCache.setCacheObject(RedisKeyConstants.ORIGINAL_BMSD + SITE_ID + "_" + deviceId, obj); //BMS 电池堆 EmsBatteryStack dataStack = new EmsBatteryStack(); @@ -173,6 +175,13 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService { dataStack.setEnvironmentHumidity(StringUtils.getBigDecimal(obj.get("HJSD"))); 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.setCreateTime(DateUtils.getNowDate()); dataStack.setUpdateBy("system"); @@ -332,6 +341,9 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService { }); EmsDevicesSetting joken = new EmsDevicesSetting(); + // 获取redis获取最新的BMSD01数据 + Map stackObj = redisCache.getCacheObject(RedisKeyConstants.ORIGINAL_BMSD +SITE_ID+"_BMSD01"); + //BMSC 电池簇 EmsBatteryCluster data = new EmsBatteryCluster(); // 其他非 BigDecimal 字段 @@ -343,24 +355,9 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService { data.setUpdateBy("system"); data.setUpdateTime(DateUtils.getNowDate()); 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 电流电压功率 deviceId = "BMSC02"; - stackDeviceId = getDeviceParent(deviceId, SITE_ID); + String stackDeviceId = getDeviceParent(deviceId, SITE_ID); if (StringUtils.isNotBlank(stackDeviceId)) { data.setStackDeviceId(stackDeviceId); } else { @@ -370,6 +367,45 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService { data.setClusterVoltage(StringUtils.getBigDecimal(obj.get("BMSC02ZLDY"))); data.setClusterCurrent(StringUtils.getBigDecimal(obj.get("BMSC02ZLDL"))); 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); 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.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.setCreateTime(DateUtils.getNowDate()); @@ -519,7 +560,8 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService { private void pcsBranchDataProcess(String deviceId, String dataJson) { - Map> records = processDataPrefix(JSON.parseObject(dataJson, new TypeReference>() {})); + Map records = JSON.parseObject(dataJson, new TypeReference>() { + }); List list = new ArrayList<>(); EmsPcsBranchData data = new EmsPcsBranchData(); @@ -534,6 +576,11 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService { data.setOutputVCurrent(StringUtils.getBigDecimal(records.get("PCSJLDLIB"))); 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.setCreateBy("system"); data.setCreateTime(DateUtils.getNowDate());