从redis取数
This commit is contained in:
@ -11,7 +11,7 @@ import com.xzzn.common.annotation.Excel;
|
||||
* Modbus设备配置对象 ems_devices_setting
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-07-01
|
||||
* @date 2025-07-02
|
||||
*/
|
||||
public class EmsDevicesSetting extends BaseEntity
|
||||
{
|
||||
@ -98,6 +98,10 @@ public class EmsDevicesSetting extends BaseEntity
|
||||
@Excel(name = "上级设备id")
|
||||
private String parentId;
|
||||
|
||||
/** 设备类别,例如“STACK/CLUSTER/PCS等” */
|
||||
@Excel(name = "设备类别,例如“STACK/CLUSTER/PCS等”")
|
||||
private String deviceCategory;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
@ -298,6 +302,16 @@ public class EmsDevicesSetting extends BaseEntity
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setDeviceCategory(String deviceCategory)
|
||||
{
|
||||
this.deviceCategory = deviceCategory;
|
||||
}
|
||||
|
||||
public String getDeviceCategory()
|
||||
{
|
||||
return deviceCategory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@ -321,6 +335,7 @@ public class EmsDevicesSetting extends BaseEntity
|
||||
.append("communicationStatus", getCommunicationStatus())
|
||||
.append("deviceId", getDeviceId())
|
||||
.append("parentId", getParentId())
|
||||
.append("deviceCategory", getDeviceCategory())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,51 +57,6 @@ public class BMSBatteryClusterVo {
|
||||
/** 设备唯一标识符 */
|
||||
private String deviceId;
|
||||
|
||||
/** 单体温度平均值 */
|
||||
private BigDecimal avgTemp;
|
||||
|
||||
/** 单体温度最小值 */
|
||||
private BigDecimal minTemp;
|
||||
|
||||
/** 单体温度最小值ID */
|
||||
private String minTempID;
|
||||
|
||||
/** 单体温度最大值 */
|
||||
private BigDecimal maxTemp;
|
||||
|
||||
/** 单体温度最大值ID */
|
||||
private String maxTempID;
|
||||
|
||||
/** 单体电压平均值 */
|
||||
private BigDecimal avgVoltage;
|
||||
|
||||
/** 单体电压最小值 */
|
||||
private BigDecimal minVoltage;
|
||||
|
||||
/** 单体电压最小值ID */
|
||||
private String minVoltageID;
|
||||
|
||||
/** 单体电压最大值 */
|
||||
private BigDecimal maxVoltage;
|
||||
|
||||
/** 单体电压最大值ID */
|
||||
private String maxVoltageID;
|
||||
|
||||
/** 单体Soc平均值 */
|
||||
private BigDecimal avgSoc;
|
||||
|
||||
/** 单体Soc最小值 */
|
||||
private BigDecimal minSoc;
|
||||
|
||||
/** 单体Soc最小值ID */
|
||||
private String minSocID;
|
||||
|
||||
/** 单体Soc最大值 */
|
||||
private BigDecimal maxSoc;
|
||||
|
||||
/** 单体Soc最大值ID */
|
||||
private String maxSocID;
|
||||
|
||||
private List<BMSBatteryClusterDataList> batteryDataList;
|
||||
|
||||
public String getDeviceName() {
|
||||
@ -239,124 +194,4 @@ public class BMSBatteryClusterVo {
|
||||
public void setBatteryDataList(List<BMSBatteryClusterDataList> batteryDataList) {
|
||||
this.batteryDataList = batteryDataList;
|
||||
}
|
||||
|
||||
public String getMaxSocID() {
|
||||
return maxSocID;
|
||||
}
|
||||
|
||||
public void setMaxSocID(String maxSocID) {
|
||||
this.maxSocID = maxSocID;
|
||||
}
|
||||
|
||||
public BigDecimal getMaxSoc() {
|
||||
return maxSoc;
|
||||
}
|
||||
|
||||
public void setMaxSoc(BigDecimal maxSoc) {
|
||||
this.maxSoc = maxSoc;
|
||||
}
|
||||
|
||||
public String getMinSocID() {
|
||||
return minSocID;
|
||||
}
|
||||
|
||||
public void setMinSocID(String minSocID) {
|
||||
this.minSocID = minSocID;
|
||||
}
|
||||
|
||||
public BigDecimal getMinSoc() {
|
||||
return minSoc;
|
||||
}
|
||||
|
||||
public void setMinSoc(BigDecimal minSoc) {
|
||||
this.minSoc = minSoc;
|
||||
}
|
||||
|
||||
public BigDecimal getAvgSoc() {
|
||||
return avgSoc;
|
||||
}
|
||||
|
||||
public void setAvgSoc(BigDecimal avgSoc) {
|
||||
this.avgSoc = avgSoc;
|
||||
}
|
||||
|
||||
public String getMaxVoltageID() {
|
||||
return maxVoltageID;
|
||||
}
|
||||
|
||||
public void setMaxVoltageID(String maxVoltageID) {
|
||||
this.maxVoltageID = maxVoltageID;
|
||||
}
|
||||
|
||||
public BigDecimal getMaxVoltage() {
|
||||
return maxVoltage;
|
||||
}
|
||||
|
||||
public void setMaxVoltage(BigDecimal maxVoltage) {
|
||||
this.maxVoltage = maxVoltage;
|
||||
}
|
||||
|
||||
public String getMinVoltageID() {
|
||||
return minVoltageID;
|
||||
}
|
||||
|
||||
public void setMinVoltageID(String minVoltageID) {
|
||||
this.minVoltageID = minVoltageID;
|
||||
}
|
||||
|
||||
public BigDecimal getMinVoltage() {
|
||||
return minVoltage;
|
||||
}
|
||||
|
||||
public void setMinVoltage(BigDecimal minVoltage) {
|
||||
this.minVoltage = minVoltage;
|
||||
}
|
||||
|
||||
public BigDecimal getAvgVoltage() {
|
||||
return avgVoltage;
|
||||
}
|
||||
|
||||
public void setAvgVoltage(BigDecimal avgVoltage) {
|
||||
this.avgVoltage = avgVoltage;
|
||||
}
|
||||
|
||||
public String getMaxTempID() {
|
||||
return maxTempID;
|
||||
}
|
||||
|
||||
public void setMaxTempID(String maxTempID) {
|
||||
this.maxTempID = maxTempID;
|
||||
}
|
||||
|
||||
public BigDecimal getMaxTemp() {
|
||||
return maxTemp;
|
||||
}
|
||||
|
||||
public void setMaxTemp(BigDecimal maxTemp) {
|
||||
this.maxTemp = maxTemp;
|
||||
}
|
||||
|
||||
public String getMinTempID() {
|
||||
return minTempID;
|
||||
}
|
||||
|
||||
public void setMinTempID(String minTempID) {
|
||||
this.minTempID = minTempID;
|
||||
}
|
||||
|
||||
public BigDecimal getMinTemp() {
|
||||
return minTemp;
|
||||
}
|
||||
|
||||
public void setMinTemp(BigDecimal minTemp) {
|
||||
this.minTemp = minTemp;
|
||||
}
|
||||
|
||||
public BigDecimal getAvgTemp() {
|
||||
return avgTemp;
|
||||
}
|
||||
|
||||
public void setAvgTemp(BigDecimal avgTemp) {
|
||||
this.avgTemp = avgTemp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,34 +22,34 @@ public class BMSOverViewVo {
|
||||
private String emsCommunicationStatus;
|
||||
|
||||
/** 电池堆总电压 (V) */
|
||||
private BigDecimal totalVoltage;
|
||||
private BigDecimal stackVoltage;
|
||||
|
||||
/** 可充电量 (kWh) */
|
||||
private BigDecimal chargeableCapacity;
|
||||
private BigDecimal availableChargeCapacity;
|
||||
|
||||
/** 累计充电量 (kWh) */
|
||||
private BigDecimal totalChargedCapacity;
|
||||
private BigDecimal totalChargeCapacity;
|
||||
|
||||
/** 电池堆总电流 (A) */
|
||||
private BigDecimal totalCurrent;
|
||||
private BigDecimal stackCurrent;
|
||||
|
||||
/** 可放电量 (kWh) */
|
||||
private BigDecimal dischargeableCapacity;
|
||||
private BigDecimal availableDischargeCapacity;
|
||||
|
||||
/** 累计放电量 (kWh) */
|
||||
private BigDecimal totalDischargedCapacity;
|
||||
private BigDecimal totalDischargeCapacity;
|
||||
|
||||
/** SOH (%) */
|
||||
private BigDecimal soh;
|
||||
private BigDecimal stackSoh;
|
||||
|
||||
/** 平均温度 (℃) */
|
||||
private BigDecimal averageTemperature;
|
||||
private BigDecimal operatingTemp;
|
||||
|
||||
/** 绝缘电阻 (Ω) */
|
||||
private BigDecimal insulationResistance;
|
||||
private BigDecimal stackInsulationResistance;
|
||||
|
||||
/** 当前SOC (%) */
|
||||
private BigDecimal currentSoc;
|
||||
private BigDecimal stackSoc;
|
||||
|
||||
/** 站点id */
|
||||
private String siteId;
|
||||
@ -91,92 +91,84 @@ public class BMSOverViewVo {
|
||||
this.emsCommunicationStatus = emsCommunicationStatus;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalVoltage() {
|
||||
return totalVoltage;
|
||||
public BigDecimal getStackVoltage() {
|
||||
return stackVoltage;
|
||||
}
|
||||
|
||||
public void setTotalVoltage(BigDecimal totalVoltage) {
|
||||
this.totalVoltage = totalVoltage;
|
||||
public void setStackVoltage(BigDecimal stackVoltage) {
|
||||
this.stackVoltage = stackVoltage;
|
||||
}
|
||||
|
||||
public BigDecimal getChargeableCapacity() {
|
||||
return chargeableCapacity;
|
||||
public BigDecimal getAvailableChargeCapacity() {
|
||||
return availableChargeCapacity;
|
||||
}
|
||||
|
||||
public void setChargeableCapacity(BigDecimal chargeableCapacity) {
|
||||
this.chargeableCapacity = chargeableCapacity;
|
||||
public void setAvailableChargeCapacity(BigDecimal availableChargeCapacity) {
|
||||
this.availableChargeCapacity = availableChargeCapacity;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalChargedCapacity() {
|
||||
return totalChargedCapacity;
|
||||
public BigDecimal getTotalChargeCapacity() {
|
||||
return totalChargeCapacity;
|
||||
}
|
||||
|
||||
public void setTotalChargedCapacity(BigDecimal totalChargedCapacity) {
|
||||
this.totalChargedCapacity = totalChargedCapacity;
|
||||
public void setTotalChargeCapacity(BigDecimal totalChargeCapacity) {
|
||||
this.totalChargeCapacity = totalChargeCapacity;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalCurrent() {
|
||||
return totalCurrent;
|
||||
public BigDecimal getStackCurrent() {
|
||||
return stackCurrent;
|
||||
}
|
||||
|
||||
public void setTotalCurrent(BigDecimal totalCurrent) {
|
||||
this.totalCurrent = totalCurrent;
|
||||
public void setStackCurrent(BigDecimal stackCurrent) {
|
||||
this.stackCurrent = stackCurrent;
|
||||
}
|
||||
|
||||
public BigDecimal getDischargeableCapacity() {
|
||||
return dischargeableCapacity;
|
||||
public BigDecimal getAvailableDischargeCapacity() {
|
||||
return availableDischargeCapacity;
|
||||
}
|
||||
|
||||
public void setDischargeableCapacity(BigDecimal dischargeableCapacity) {
|
||||
this.dischargeableCapacity = dischargeableCapacity;
|
||||
public void setAvailableDischargeCapacity(BigDecimal availableDischargeCapacity) {
|
||||
this.availableDischargeCapacity = availableDischargeCapacity;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalDischargedCapacity() {
|
||||
return totalDischargedCapacity;
|
||||
public BigDecimal getTotalDischargeCapacity() {
|
||||
return totalDischargeCapacity;
|
||||
}
|
||||
|
||||
public void setTotalDischargedCapacity(BigDecimal totalDischargedCapacity) {
|
||||
this.totalDischargedCapacity = totalDischargedCapacity;
|
||||
public void setTotalDischargeCapacity(BigDecimal totalDischargeCapacity) {
|
||||
this.totalDischargeCapacity = totalDischargeCapacity;
|
||||
}
|
||||
|
||||
public BigDecimal getSoh() {
|
||||
return soh;
|
||||
public BigDecimal getStackSoh() {
|
||||
return stackSoh;
|
||||
}
|
||||
|
||||
public void setSoh(BigDecimal soh) {
|
||||
this.soh = soh;
|
||||
public void setStackSoh(BigDecimal stackSoh) {
|
||||
this.stackSoh = stackSoh;
|
||||
}
|
||||
|
||||
public BigDecimal getAverageTemperature() {
|
||||
return averageTemperature;
|
||||
public BigDecimal getOperatingTemp() {
|
||||
return operatingTemp;
|
||||
}
|
||||
|
||||
public void setAverageTemperature(BigDecimal averageTemperature) {
|
||||
this.averageTemperature = averageTemperature;
|
||||
public void setOperatingTemp(BigDecimal operatingTemp) {
|
||||
this.operatingTemp = operatingTemp;
|
||||
}
|
||||
|
||||
public BigDecimal getInsulationResistance() {
|
||||
return insulationResistance;
|
||||
public BigDecimal getStackInsulationResistance() {
|
||||
return stackInsulationResistance;
|
||||
}
|
||||
|
||||
public void setInsulationResistance(BigDecimal insulationResistance) {
|
||||
this.insulationResistance = insulationResistance;
|
||||
public void setStackInsulationResistance(BigDecimal stackInsulationResistance) {
|
||||
this.stackInsulationResistance = stackInsulationResistance;
|
||||
}
|
||||
|
||||
public BigDecimal getCurrentSoc() {
|
||||
return currentSoc;
|
||||
public BigDecimal getStackSoc() {
|
||||
return stackSoc;
|
||||
}
|
||||
|
||||
public void setCurrentSoc(BigDecimal currentSoc) {
|
||||
this.currentSoc = currentSoc;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
public void setStackSoc(BigDecimal stackSoc) {
|
||||
this.stackSoc = stackSoc;
|
||||
}
|
||||
|
||||
public String getSiteId() {
|
||||
@ -187,6 +179,14 @@ public class BMSOverViewVo {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public List<BMSBatteryDataList> getBatteryDataList() {
|
||||
return batteryDataList;
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xzzn.ems.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@ -23,8 +24,9 @@ public class BatteryDataStatsListVo {
|
||||
|
||||
/** SOH (%) */
|
||||
private BigDecimal soh;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date dataTimestamp;
|
||||
|
||||
/** 簇号 */
|
||||
private String clusterDeviceId;
|
||||
@ -69,12 +71,12 @@ public class BatteryDataStatsListVo {
|
||||
this.soh = soh;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
public Date getDataTimestamp() {
|
||||
return dataTimestamp;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
public void setDataTimestamp(Date dataTimestamp) {
|
||||
this.dataTimestamp = dataTimestamp;
|
||||
}
|
||||
|
||||
public String getClusterDeviceId() {
|
||||
|
||||
@ -2,7 +2,6 @@ package com.xzzn.ems.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.ems.domain.EmsBatteryCluster;
|
||||
import com.xzzn.ems.domain.vo.BMSBatteryClusterVo;
|
||||
import com.xzzn.ems.domain.vo.BMSBatteryDataList;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -62,13 +61,6 @@ public interface EmsBatteryClusterMapper
|
||||
*/
|
||||
public int deleteEmsBatteryClusterByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据site_id获取电池簇数据
|
||||
* @param siteId
|
||||
* @return
|
||||
*/
|
||||
public List<BMSBatteryClusterVo> getBMSBatteryCluster(String siteId);
|
||||
|
||||
/**
|
||||
* 根据site_di和堆id获取簇数据和单体数据
|
||||
* @param siteId
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.xzzn.ems.domain.EmsDevicesSetting;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* Modbus设备配置Mapper接口
|
||||
@ -60,24 +61,25 @@ public interface EmsDevicesSettingMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsDevicesSettingByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据site_id获取所有电池堆
|
||||
* @param siteId
|
||||
* 根据父类设备id获取子设备id
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getAllStackInfoBySiteId(String siteId);
|
||||
|
||||
/**
|
||||
* 根据电池堆id获取所有电池簇
|
||||
* @param stackDeviceId
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getAllClusterInfoByStackId(String stackDeviceId);
|
||||
public List<Map<String, Object>> getDeviceInfoByParentId(String parentId);
|
||||
/**
|
||||
* 获取该设备下的所有电表
|
||||
* @param siteId
|
||||
* @return
|
||||
*/
|
||||
public List<EmsDevicesSetting> getAllBatteryDeviceBySiteId(String siteId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据site_id和device_category获取指定设备信息
|
||||
* @param siteId
|
||||
* @param deviceCategory
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getDeviceInfosBySiteIdAndCategory(@Param("siteId")String siteId, @Param("deviceCategory")String deviceCategory);
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xzzn.ems.service.impl;
|
||||
|
||||
import com.xzzn.common.enums.DeviceCategory;
|
||||
import com.xzzn.ems.domain.EmsSiteSetting;
|
||||
import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
|
||||
import com.xzzn.ems.mapper.EmsDevicesSettingMapper;
|
||||
@ -41,17 +42,17 @@ public class EmsSiteServiceImpl implements IEmsSiteService
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getAllStackInfo(String siteId) {
|
||||
return emsDevicesMapper.getAllStackInfoBySiteId(siteId);
|
||||
return emsDevicesMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.STACK.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据电池堆Id获取电池簇
|
||||
* @param stackDeviceId
|
||||
* 根据父类设备id获取子设备id
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getAllClusterInfo(String stackDeviceId) {
|
||||
return emsDevicesMapper.getAllClusterInfoByStackId(stackDeviceId);
|
||||
public List<Map<String, Object>> getAllClusterInfo(String parentId) {
|
||||
return emsDevicesMapper.getDeviceInfoByParentId(parentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -273,6 +273,7 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
|
||||
if (list.size() > 0 ) {
|
||||
emsBatteryDataMapper.insertEmsBatteryDataList(list);
|
||||
|
||||
redisCache.deleteList("BATTERY_021_FXX_01_"+deviceId);
|
||||
redisCache.setCacheList("BATTERY_021_FXX_01_"+deviceId, list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
package com.xzzn.ems.service.impl;
|
||||
|
||||
import com.xzzn.common.core.redis.RedisCache;
|
||||
import com.xzzn.common.enums.DeviceCategory;
|
||||
import com.xzzn.common.utils.StringUtils;
|
||||
import com.xzzn.ems.domain.EmsBatteryData;
|
||||
import com.xzzn.ems.domain.EmsCoolingData;
|
||||
import com.xzzn.ems.domain.EmsDevicesSetting;
|
||||
import com.xzzn.ems.domain.*;
|
||||
import com.xzzn.ems.domain.vo.*;
|
||||
import com.xzzn.ems.mapper.*;
|
||||
import com.xzzn.ems.service.ISingleSiteService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 单点监控 服务层实现
|
||||
@ -46,6 +46,9 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
||||
@Autowired
|
||||
private EmsDevicesSettingMapper emsDevicesSettingMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Override
|
||||
public SiteMonitorHomeVo getSiteMonitorDataVo(String siteId) {
|
||||
SiteMonitorHomeVo siteMonitorHomeVo = new SiteMonitorHomeVo();
|
||||
@ -137,39 +140,66 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
||||
List<PcsDetailInfoVo> pcsDetailInfoVoList = new ArrayList<>();
|
||||
|
||||
if (!StringUtils.isEmpty(siteId)) {
|
||||
// 获取pcs最新数据
|
||||
pcsDetailInfoVoList = emsPcsDataMapper.getPcsDetailInfoBySiteId(siteId);
|
||||
if (!CollectionUtils.isEmpty(pcsDetailInfoVoList)) {
|
||||
for (PcsDetailInfoVo pcsDetailInfoVo : pcsDetailInfoVoList) {
|
||||
String deviceId = pcsDetailInfoVo.getDeviceId();
|
||||
// 获取支路最新数据
|
||||
if (!StringUtils.isEmpty(deviceId)) {
|
||||
List<PcsBranchInfo> pcsBranchInfoList = emsPcsBranchDataMapper.getPcsBranchInfoList(siteId, deviceId);
|
||||
pcsDetailInfoVo.setPcsBranchInfoList(pcsBranchInfoList);
|
||||
}
|
||||
// 获取该设备下所有pcs的id
|
||||
List<Map<String, Object>> pcsIds = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.PCS.getCode());
|
||||
|
||||
for (Map<String, Object> pcsDevice : pcsIds) {
|
||||
PcsDetailInfoVo pcsDetailInfoVo = new PcsDetailInfoVo();
|
||||
pcsDetailInfoVo.setDeviceName(pcsDevice.get("deviceName").toString());
|
||||
pcsDetailInfoVo.setCommunicationStatus(pcsDevice.get("communicationStatus").toString());
|
||||
// 从redis取pcs单个详细数据
|
||||
String pcsId = pcsDevice.get("id").toString();
|
||||
EmsPcsData pcsData = redisCache.getCacheObject("PCS_"+siteId+"_"+pcsId);
|
||||
if (pcsData != null) {
|
||||
BeanUtils.copyProperties(pcsData, pcsDetailInfoVo);
|
||||
}
|
||||
// 支路信息数据
|
||||
List<PcsBranchInfo> pcsBranchInfoList = new ArrayList<>();
|
||||
processBranchDataInfo(siteId,pcsId,pcsBranchInfoList);
|
||||
pcsDetailInfoVo.setPcsBranchInfoList(pcsBranchInfoList);
|
||||
|
||||
pcsDetailInfoVoList.add(pcsDetailInfoVo);
|
||||
}
|
||||
}
|
||||
return pcsDetailInfoVoList;
|
||||
}
|
||||
|
||||
private void processBranchDataInfo(String siteId, String pcsId, List<PcsBranchInfo> pcsBranchInfoList) {
|
||||
if (!StringUtils.isEmpty(pcsId)) {
|
||||
List<EmsPcsBranchData> pcsBranchData = redisCache.getCacheObject("BRANCH_"+siteId+"_"+pcsId);
|
||||
if (pcsBranchData != null) {
|
||||
for(EmsPcsBranchData emsPcsBranchData : pcsBranchData) {
|
||||
PcsBranchInfo pcsBranchInfo = new PcsBranchInfo();
|
||||
BeanUtils.copyProperties(emsPcsBranchData, pcsBranchInfo);
|
||||
pcsBranchInfoList.add(pcsBranchInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取BMS总览数据
|
||||
@Override
|
||||
public List<BMSOverViewVo> getBMSOverView(String siteId) {
|
||||
List<BMSOverViewVo> bmsOverViewVoList = new ArrayList<>();
|
||||
|
||||
// 获取所有电池堆
|
||||
if (!StringUtils.isEmpty(siteId)) {
|
||||
// 获取电池堆list
|
||||
bmsOverViewVoList = emsBatteryStackMapper.selectEmsBatteryStackBySiteId(siteId);
|
||||
if (!CollectionUtils.isEmpty(bmsOverViewVoList)) {
|
||||
for (BMSOverViewVo bmsOverViewVo : bmsOverViewVoList) {
|
||||
// 获取单体电池数据
|
||||
String stackDeviceId = bmsOverViewVo.getDeviceId();
|
||||
if (!StringUtils.isEmpty(stackDeviceId)) {
|
||||
List<BMSBatteryDataList> batteryDataList = emsBatteryClusterMapper.getBmsBatteryData(siteId,stackDeviceId);
|
||||
bmsOverViewVo.setBatteryDataList(batteryDataList);
|
||||
}
|
||||
List<Map<String, Object>> stackIds = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.STACK.getCode());
|
||||
for (Map<String, Object> stackDevice : stackIds) {
|
||||
BMSOverViewVo bmsOverViewVo = new BMSOverViewVo();
|
||||
bmsOverViewVo.setDeviceName(stackDevice.get("deviceName").toString());
|
||||
// 从redis取堆单个详细数据
|
||||
String stackId = stackDevice.get("id").toString();
|
||||
EmsBatteryStack stackData = redisCache.getCacheObject("STACK_"+siteId+"_"+stackId);
|
||||
if (stackData != null) {
|
||||
BeanUtils.copyProperties(stackData, bmsOverViewVo);
|
||||
}
|
||||
// 列表数据
|
||||
if (!StringUtils.isEmpty(stackId)) {
|
||||
List<BMSBatteryDataList> batteryDataList = emsBatteryClusterMapper.getBmsBatteryData(siteId,stackId);
|
||||
bmsOverViewVo.setBatteryDataList(batteryDataList);
|
||||
}
|
||||
bmsOverViewVoList.add(bmsOverViewVo);
|
||||
}
|
||||
}
|
||||
return bmsOverViewVoList;
|
||||
@ -181,50 +211,58 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
||||
List<BMSBatteryClusterVo> bmsBatteryClusterVoList = new ArrayList<>();
|
||||
|
||||
if (!StringUtils.isEmpty(siteId)) {
|
||||
bmsBatteryClusterVoList = emsBatteryClusterMapper.getBMSBatteryCluster(siteId);
|
||||
if (!CollectionUtils.isEmpty(bmsBatteryClusterVoList)) {
|
||||
for (BMSBatteryClusterVo bmsBatteryClusterVo : bmsBatteryClusterVoList) {
|
||||
|
||||
String clusterDeviceId = bmsBatteryClusterVo.getDeviceId();
|
||||
// 获取所有设备下的电池簇id
|
||||
List<Map<String, Object>> clusterIds = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.CLUSTER.getCode());
|
||||
for (Map<String, Object> clusterDevice : clusterIds) {
|
||||
BMSBatteryClusterVo bmsBatteryClusterVo = new BMSBatteryClusterVo();
|
||||
bmsBatteryClusterVo.setDeviceName(clusterDevice.get("deviceName").toString());
|
||||
// 从redis取单个簇详细数据
|
||||
String clusterId = clusterDevice.get("id").toString();
|
||||
EmsBatteryCluster clusterData = redisCache.getCacheObject("CLUSTER_"+siteId+"_"+clusterId);
|
||||
if (clusterData != null) {
|
||||
BeanUtils.copyProperties(clusterData, bmsBatteryClusterVo);
|
||||
// 处理单体电池数据-平均/最大/最小
|
||||
List<BMSBatteryClusterDataList> clusterDataList = new ArrayList<>();
|
||||
if (!StringUtils.isEmpty(clusterDeviceId)) {
|
||||
// 获取单体电池数据-平均/最大/最小
|
||||
//BatteryClusterDataDetailVo batteryClusterDataDetailVo = emsBatteryDataMapper.getBatteryDataByClusterId(siteId,clusterDeviceId);
|
||||
// 处理数据
|
||||
BMSBatteryClusterDataList voltageData = new BMSBatteryClusterDataList();
|
||||
BMSBatteryClusterDataList tempData = new BMSBatteryClusterDataList();
|
||||
BMSBatteryClusterDataList socData = new BMSBatteryClusterDataList();
|
||||
// 设值
|
||||
voltageData.setDataName(CLUSTER_DATA_VOLTAGE);
|
||||
voltageData.setAvgData(bmsBatteryClusterVo.getAvgVoltage());
|
||||
voltageData.setMaxData(bmsBatteryClusterVo.getMaxVoltage());
|
||||
voltageData.setMaxDataID(bmsBatteryClusterVo.getMaxVoltageID());
|
||||
voltageData.setMinData(bmsBatteryClusterVo.getMinVoltage());
|
||||
voltageData.setMinDataID(bmsBatteryClusterVo.getMinVoltageID());
|
||||
tempData.setDataName(CLUSTER_DATA_TEP);
|
||||
tempData.setAvgData(bmsBatteryClusterVo.getAvgTemp());
|
||||
tempData.setMaxData(bmsBatteryClusterVo.getMaxTemp());
|
||||
tempData.setMaxDataID(bmsBatteryClusterVo.getMaxTempID());
|
||||
tempData.setMinData(bmsBatteryClusterVo.getMinTemp());
|
||||
tempData.setMinDataID(bmsBatteryClusterVo.getMinTempID());
|
||||
socData.setDataName(CLUSTER_DATA_SOC);
|
||||
socData.setAvgData(bmsBatteryClusterVo.getAvgSoc());
|
||||
socData.setMaxData(bmsBatteryClusterVo.getMaxSoc());
|
||||
socData.setMaxDataID(bmsBatteryClusterVo.getMaxSocID());
|
||||
socData.setMinData(bmsBatteryClusterVo.getMinSoc());
|
||||
socData.setMinDataID(bmsBatteryClusterVo.getMinSocID());
|
||||
|
||||
clusterDataList.add(voltageData);
|
||||
clusterDataList.add(tempData);
|
||||
clusterDataList.add(socData);
|
||||
bmsBatteryClusterVo.setBatteryDataList(clusterDataList);
|
||||
}
|
||||
dealWithBatteryClusterData(clusterData,clusterDataList);
|
||||
bmsBatteryClusterVo.setBatteryDataList(clusterDataList);
|
||||
}
|
||||
|
||||
bmsBatteryClusterVoList.add(bmsBatteryClusterVo);
|
||||
}
|
||||
}
|
||||
return bmsBatteryClusterVoList;
|
||||
}
|
||||
|
||||
private void dealWithBatteryClusterData(EmsBatteryCluster clusterData, List<BMSBatteryClusterDataList> clusterDataList) {
|
||||
BMSBatteryClusterDataList voltageData = new BMSBatteryClusterDataList();
|
||||
BMSBatteryClusterDataList tempData = new BMSBatteryClusterDataList();
|
||||
BMSBatteryClusterDataList socData = new BMSBatteryClusterDataList();
|
||||
|
||||
// 设值
|
||||
voltageData.setDataName(CLUSTER_DATA_VOLTAGE);
|
||||
voltageData.setAvgData(clusterData.getAvgCellVoltage());
|
||||
voltageData.setMaxData(clusterData.getMaxCellVoltage());
|
||||
voltageData.setMaxDataID(clusterData.getMaxCellVoltageId().toString());
|
||||
voltageData.setMinData(clusterData.getMinCellVoltage());
|
||||
voltageData.setMinDataID(clusterData.getMinCellVoltageId().toString());
|
||||
tempData.setDataName(CLUSTER_DATA_TEP);
|
||||
tempData.setAvgData(clusterData.getAvgCellTemp());
|
||||
tempData.setMaxData(clusterData.getMaxCellTemp());
|
||||
tempData.setMaxDataID(clusterData.getMaxCellTempId().toString());
|
||||
tempData.setMinData(clusterData.getMinCellTemp());
|
||||
tempData.setMinDataID(clusterData.getMinCellTempId().toString());
|
||||
socData.setDataName(CLUSTER_DATA_SOC);
|
||||
socData.setAvgData(clusterData.getCurrentSoc());
|
||||
socData.setMaxData(clusterData.getMaxCellSoc());
|
||||
socData.setMaxDataID(clusterData.getMaxCellSocId().toString());
|
||||
socData.setMinData(clusterData.getMinCellSoc());
|
||||
socData.setMinDataID(clusterData.getMinCellSocId().toString());
|
||||
|
||||
clusterDataList.add(voltageData);
|
||||
clusterDataList.add(tempData);
|
||||
clusterDataList.add(socData);
|
||||
}
|
||||
|
||||
// 获取液冷设备参数
|
||||
@Override
|
||||
public List<EmsCoolingData> getCoolingDataList(String siteId) {
|
||||
@ -244,7 +282,26 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
||||
@Override
|
||||
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId,String siteId) {
|
||||
List<BatteryDataStatsListVo> batteryDataStatsListVo = new ArrayList<>();
|
||||
batteryDataStatsListVo = emsBatteryDataMapper.getAllBatteryDataByClusterId(clusterDeviceId,siteId);
|
||||
List<Map<String, Object>> clusterIds = new ArrayList<>();
|
||||
if (StringUtils.isEmpty(clusterDeviceId)) {
|
||||
clusterIds = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.CLUSTER.getCode());
|
||||
} else {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", clusterDeviceId);
|
||||
clusterIds.add(map);
|
||||
}
|
||||
for (Map<String, Object> clusterDevice : clusterIds) {
|
||||
// 从redis取单个簇详细数据
|
||||
String clusterId = clusterDevice.get("id").toString();
|
||||
List<EmsBatteryData> batteryDataList = redisCache.getCacheList("BATTERY_"+siteId+"_"+clusterId);
|
||||
if (batteryDataList != null) {
|
||||
for (EmsBatteryData batteryData : batteryDataList) {
|
||||
BatteryDataStatsListVo batteryDataStatsVo = new BatteryDataStatsListVo();
|
||||
BeanUtils.copyProperties(batteryData, batteryDataStatsVo);
|
||||
batteryDataStatsListVo.add(batteryDataStatsVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return batteryDataStatsListVo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user