redis key常量

This commit is contained in:
2025-07-02 17:32:17 +08:00
parent 8081e38d5e
commit 88fee64f46
4 changed files with 75 additions and 7 deletions

View File

@ -1,5 +1,6 @@
package com.xzzn.ems.service.impl;
import com.xzzn.common.constant.RedisKeyConstants;
import com.xzzn.common.core.redis.RedisCache;
import com.xzzn.common.enums.DeviceCategory;
import com.xzzn.common.utils.StringUtils;
@ -149,7 +150,7 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
pcsDetailInfoVo.setCommunicationStatus(pcsDevice.get("communicationStatus").toString());
// 从redis取pcs单个详细数据
String pcsId = pcsDevice.get("id").toString();
EmsPcsData pcsData = redisCache.getCacheObject("PCS_"+siteId+"_"+pcsId);
EmsPcsData pcsData = redisCache.getCacheObject(RedisKeyConstants.PCS +siteId+"_"+pcsId);
if (pcsData != null) {
BeanUtils.copyProperties(pcsData, pcsDetailInfoVo);
}
@ -166,7 +167,7 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
private void processBranchDataInfo(String siteId, String pcsId, List<PcsBranchInfo> pcsBranchInfoList) {
if (!StringUtils.isEmpty(pcsId)) {
List<EmsPcsBranchData> pcsBranchData = redisCache.getCacheObject("BRANCH_"+siteId+"_"+pcsId);
List<EmsPcsBranchData> pcsBranchData = redisCache.getCacheObject(RedisKeyConstants.BRANCH +siteId+"_"+pcsId);
if (pcsBranchData != null) {
for(EmsPcsBranchData emsPcsBranchData : pcsBranchData) {
PcsBranchInfo pcsBranchInfo = new PcsBranchInfo();
@ -190,7 +191,7 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
bmsOverViewVo.setDeviceName(stackDevice.get("deviceName").toString());
// 从redis取堆单个详细数据
String stackId = stackDevice.get("id").toString();
EmsBatteryStack stackData = redisCache.getCacheObject("STACK_"+siteId+"_"+stackId);
EmsBatteryStack stackData = redisCache.getCacheObject(RedisKeyConstants.STACK +siteId+"_"+stackId);
if (stackData != null) {
BeanUtils.copyProperties(stackData, bmsOverViewVo);
}
@ -218,7 +219,7 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
bmsBatteryClusterVo.setDeviceName(clusterDevice.get("deviceName").toString());
// 从redis取单个簇详细数据
String clusterId = clusterDevice.get("id").toString();
EmsBatteryCluster clusterData = redisCache.getCacheObject("CLUSTER_"+siteId+"_"+clusterId);
EmsBatteryCluster clusterData = redisCache.getCacheObject(RedisKeyConstants.CLUSTER +siteId+"_"+clusterId);
if (clusterData != null) {
BeanUtils.copyProperties(clusterData, bmsBatteryClusterVo);
// 处理单体电池数据-平均/最大/最小
@ -275,7 +276,7 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
/**
* 根据电池堆获取单体柱状数据
* 根据电池堆获取单体电池数据
* @param clusterDeviceId
* @return
*/
@ -293,7 +294,7 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
for (Map<String, Object> clusterDevice : clusterIds) {
// 从redis取单个簇详细数据
String clusterId = clusterDevice.get("id").toString();
List<EmsBatteryData> batteryDataList = redisCache.getCacheList("BATTERY_"+siteId+"_"+clusterId);
List<EmsBatteryData> batteryDataList = redisCache.getCacheList(RedisKeyConstants.BATTERY + siteId + "_" + clusterId);
if (batteryDataList != null) {
for (EmsBatteryData batteryData : batteryDataList) {
BatteryDataStatsListVo batteryDataStatsVo = new BatteryDataStatsListVo();