DDS监控逻辑修改

This commit is contained in:
2025-07-29 18:28:17 +08:00
parent 8fd2f45e18
commit a12f7820cf
5 changed files with 33 additions and 36 deletions

View File

@ -66,7 +66,7 @@ public interface EmsDevicesSettingMapper
* @param parentId
* @return
*/
public List<Map<String, Object>> getDeviceInfoByParentId(String parentId);
public List<Map<String, Object>> getDeviceInfoByParentId(@Param("siteId")String siteId, @Param("parentId")String parentId);
/**
* 根据site_id和device_category获取指定设备信息

View File

@ -299,8 +299,8 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService {
List<EmsBatteryData> dataList = new ArrayList<>(dataMap.values());
emsBatteryDataMapper.insertEmsBatteryDataList(new ArrayList<>(dataList));
redisCache.deleteList(RedisKeyConstants.BATTERY + SITE_ID + "_" +deviceId);
redisCache.setCacheList(RedisKeyConstants.BATTERY + SITE_ID + "_" +deviceId, dataList);
redisCache.deleteList(RedisKeyConstants.BATTERY + SITE_ID + "_" + "BMSC01");
redisCache.setCacheList(RedisKeyConstants.BATTERY + SITE_ID + "_" + "BMSC01" , dataList);
}
// 批量处理每日最新数据
if (dailyList != null && dailyList.size() > 0) {
@ -522,32 +522,26 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService {
Map<String, Map<String, Object>> records = processDataPrefix(JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {}));
List<EmsPcsBranchData> list = new ArrayList<>();
//PCS支路
for (Map.Entry<String, Map<String, Object>> record : records.entrySet()) {
String recordId = record.getKey();
Map<String, Object> fields = record.getValue();
EmsPcsBranchData data = new EmsPcsBranchData();
data.setDeviceId(deviceId);
data.setSiteId(SITE_ID);
data.setGridStatus(GridStatus.GRID.getCode());
EmsPcsBranchData data = new EmsPcsBranchData();
data.setDeviceId(deviceId);
data.setGridStatus(GridStatus.GRID.getCode());
data.setGridUVoltage(StringUtils.getBigDecimal(fields.get("DWXDYUAB")));
data.setGridVVoltage(StringUtils.getBigDecimal(fields.get("DWXDYUBC")));
data.setGridWVoltage(StringUtils.getBigDecimal(fields.get("DWXDYUCA")));
data.setOutputUCurrent(StringUtils.getBigDecimal(fields.get("PCSJLDLIA")));
data.setOutputVCurrent(StringUtils.getBigDecimal(fields.get("PCSJLDLIB")));
data.setOutputWCurrent(StringUtils.getBigDecimal(fields.get("PCSJLDLIC")));
data.setBranchId(recordId);
list.add(data);
}
if (list.size() > 0 ) {
emsPcsBranchDataMapper.insertPcsBranchDataList(list);
redisCache.setCacheObject(RedisKeyConstants.BRANCH + SITE_ID + "_" +deviceId, list);
}
data.setGridUVoltage(StringUtils.getBigDecimal(records.get("DWXDYUAB")));
data.setGridVVoltage(StringUtils.getBigDecimal(records.get("DWXDYUBC")));
data.setGridWVoltage(StringUtils.getBigDecimal(records.get("DWXDYUCA")));
data.setOutputUCurrent(StringUtils.getBigDecimal(records.get("PCSJLDLIA")));
data.setOutputVCurrent(StringUtils.getBigDecimal(records.get("PCSJLDLIB")));
data.setOutputWCurrent(StringUtils.getBigDecimal(records.get("PCSJLDLIC")));
data.setBranchId("DY1");
data.setCreateBy("system");
data.setCreateTime(DateUtils.getNowDate());
data.setUpdateBy("system");
data.setUpdateTime(DateUtils.getNowDate());
list.add(data);
emsPcsBranchDataMapper.insertPcsBranchDataList(list);
redisCache.setCacheObject(RedisKeyConstants.BRANCH + SITE_ID + "_" +deviceId, list);
}
private void meteGFDataProcess(String deviceId, String dataJson) {

View File

@ -53,7 +53,7 @@ public class EmsSiteServiceImpl implements IEmsSiteService
*/
@Override
public List<Map<String, Object>> getAllClusterInfo(String parentId) {
return emsDevicesMapper.getDeviceInfoByParentId(parentId);
return emsDevicesMapper.getDeviceInfoByParentId(null,parentId);
}
/**

View File

@ -260,7 +260,7 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
private void getBMSClusterListInfo(String siteId, String stackId, BMSOverViewVo bmsOverViewVo) {
List<BMSBatteryDataList> batteryDataList = new ArrayList();
List<Map<String, Object>> clusterIds = emsDevicesSettingMapper.getDeviceInfoByParentId(stackId);
List<Map<String, Object>> clusterIds = emsDevicesSettingMapper.getDeviceInfoByParentId(siteId, stackId);
for (Map<String, Object> clusterDevice : clusterIds) {
BMSBatteryDataList bmsBatteryDataList= new BMSBatteryDataList();
// 从redis取单个簇的详细数据
@ -313,21 +313,21 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
voltageData.setDataName(CLUSTER_DATA_VOLTAGE);
voltageData.setAvgData(clusterData.getAvgCellVoltage());
voltageData.setMaxData(clusterData.getMaxCellVoltage());
voltageData.setMaxDataID(clusterData.getMaxCellVoltageId().toString());
voltageData.setMaxDataID(clusterData.getMaxCellVoltageId() == null ? null : clusterData.getMaxCellVoltageId().toString());
voltageData.setMinData(clusterData.getMinCellVoltage());
voltageData.setMinDataID(clusterData.getMinCellVoltageId().toString());
voltageData.setMinDataID(clusterData.getMinCellVoltageId() == null ? null : clusterData.getMinCellVoltageId().toString());
tempData.setDataName(CLUSTER_DATA_TEP);
tempData.setAvgData(clusterData.getAvgCellTemp());
tempData.setMaxData(clusterData.getMaxCellTemp());
tempData.setMaxDataID(clusterData.getMaxCellTempId().toString());
tempData.setMaxDataID(clusterData.getMaxCellTempId() == null ? null : clusterData.getMaxCellTempId().toString());
tempData.setMinData(clusterData.getMinCellTemp());
tempData.setMinDataID(clusterData.getMinCellTempId().toString());
tempData.setMinDataID(clusterData.getMinCellTempId() == null ? null : clusterData.getMinCellTempId().toString());
socData.setDataName(CLUSTER_DATA_SOC);
socData.setAvgData(clusterData.getCurrentSoc());
socData.setMaxData(clusterData.getMaxCellSoc());
socData.setMaxDataID(clusterData.getMaxCellSocId().toString());
socData.setMaxDataID(clusterData.getMaxCellSocId() == null ? null : clusterData.getMaxCellSocId().toString());
socData.setMinData(clusterData.getMinCellSoc());
socData.setMinDataID(clusterData.getMinCellSocId().toString());
socData.setMinDataID(clusterData.getMinCellSocId() == null ? null : clusterData.getMinCellSocId().toString());
clusterDataList.add(voltageData);
clusterDataList.add(tempData);

View File

@ -161,7 +161,10 @@
</select>
<select id="getDeviceInfoByParentId" parameterType="String" resultType="java.util.Map">
select distinct t.device_id as id,t.device_name as deviceName from ems_devices_setting t where t.parent_id = #{parentId}
select distinct t.device_id as id,t.device_name as deviceName
from ems_devices_setting t
where t.site_id = #{siteId}
and t.parent_id = #{parentId}
</select>
<select id="getAllBatteryDeviceBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.EmsDevicesSetting">