20250808优化-单体电池优化
This commit is contained in:
@ -144,7 +144,8 @@ public class EmsSiteMonitorController extends BaseController{
|
||||
* 获取电池簇下面的单体电池数据
|
||||
*/
|
||||
@GetMapping("/getClusterDataInfoList")
|
||||
public TableDataInfo getClusterDataInfoList(@RequestParam String clusterDeviceId,@RequestParam String siteId,@RequestParam String stackDeviceId)
|
||||
public TableDataInfo getClusterDataInfoList(@RequestParam String clusterDeviceId,@RequestParam String siteId,
|
||||
@RequestParam String stackDeviceId,@RequestParam String batteryId)
|
||||
{
|
||||
startPage();
|
||||
SiteBatteryDataList siteBatteryDataList = new SiteBatteryDataList();
|
||||
@ -152,7 +153,7 @@ public class EmsSiteMonitorController extends BaseController{
|
||||
List<BMSBatteryDataList> clusterBatteryDataList = iSingleSiteService.getClusterBatteryList(siteId,stackDeviceId,clusterDeviceId);
|
||||
siteBatteryDataList.setClusterList(clusterBatteryDataList);
|
||||
// 单体电池数据
|
||||
List<BatteryDataStatsListVo> List = iSingleSiteService.getClusterDataInfoList(clusterDeviceId,siteId,stackDeviceId);
|
||||
List<BatteryDataStatsListVo> List = iSingleSiteService.getClusterDataInfoList(clusterDeviceId,siteId,stackDeviceId,batteryId);
|
||||
// 对batteryList进行分页处理
|
||||
List<BatteryDataStatsListVo> batteryList = paginateList(List);
|
||||
siteBatteryDataList.setBatteryList(batteryList);
|
||||
|
||||
@ -252,6 +252,10 @@ public class BaseController
|
||||
// 计算结束索引(处理超出列表长度的情况)
|
||||
endIndex = Math.min(startIndex + pageSize, sourceList.size());
|
||||
}
|
||||
// 防止越界
|
||||
if (startIndex >= sourceList.size()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 截取分页数据
|
||||
return sourceList.subList(startIndex, endIndex);
|
||||
}
|
||||
|
||||
@ -751,4 +751,17 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// 补全三位数字(返回字符串)
|
||||
public static String fillThreeDigits(String value) {
|
||||
if (value == null || value.trim().isEmpty()) {
|
||||
return "000";
|
||||
}
|
||||
try {
|
||||
int num = Integer.parseInt(value.trim());
|
||||
return String.format("%03d", num);
|
||||
} catch (NumberFormatException e) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.xzzn.ems.domain;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.xzzn.common.core.domain.BaseEntity;
|
||||
import com.xzzn.common.utils.StringUtils;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xzzn.common.annotation.Excel;
|
||||
@ -146,7 +147,7 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
|
||||
/** 最高单体电压对应点号 */
|
||||
@Excel(name = "最高单体电压对应点号")
|
||||
private Long maxCellVoltageId;
|
||||
private String maxCellVoltageId;
|
||||
|
||||
/** 最低单体电压 */
|
||||
@Excel(name = "最低单体电压")
|
||||
@ -154,7 +155,7 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
|
||||
/** 最低单体电压对应点号 */
|
||||
@Excel(name = "最低单体电压对应点号")
|
||||
private Long minCellVoltageId;
|
||||
private String minCellVoltageId;
|
||||
|
||||
/** 最高单体温度 */
|
||||
@Excel(name = "最高单体温度")
|
||||
@ -162,7 +163,7 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
|
||||
/** 最高单体温度对应点号 */
|
||||
@Excel(name = "最高单体温度对应点号")
|
||||
private Long maxCellTempId;
|
||||
private String maxCellTempId;
|
||||
|
||||
/** 最低单体温度 */
|
||||
@Excel(name = "最低单体温度")
|
||||
@ -170,7 +171,7 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
|
||||
/** 最低单体温度对应点号 */
|
||||
@Excel(name = "最低单体温度对应点号")
|
||||
private Long minCellTempId;
|
||||
private String minCellTempId;
|
||||
|
||||
/** 最高单体SOC */
|
||||
@Excel(name = "最高单体SOC")
|
||||
@ -178,7 +179,7 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
|
||||
/** 最高单体SOC对应点号 */
|
||||
@Excel(name = "最高单体SOC对应点号")
|
||||
private Long maxCellSocId;
|
||||
private String maxCellSocId;
|
||||
|
||||
/** 最低单体SOC */
|
||||
@Excel(name = "最低单体SOC")
|
||||
@ -186,7 +187,7 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
|
||||
/** 最低单体SOC对应点号 */
|
||||
@Excel(name = "最低单体SOC对应点号")
|
||||
private Long minCellSocId;
|
||||
private String minCellSocId;
|
||||
|
||||
/** 最高单体SOH */
|
||||
@Excel(name = "最高单体SOH")
|
||||
@ -194,7 +195,7 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
|
||||
/** 最高单体SOH对应点号 */
|
||||
@Excel(name = "最高单体SOH对应点号")
|
||||
private Long maxCellSohId;
|
||||
private String maxCellSohId;
|
||||
|
||||
/** 最低单体SOH */
|
||||
@Excel(name = "最低单体SOH")
|
||||
@ -202,7 +203,7 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
|
||||
/** 最低单体SOH对应点号 */
|
||||
@Excel(name = "最低单体SOH对应点号")
|
||||
private Long minCellSohId;
|
||||
private String minCellSohId;
|
||||
|
||||
/** 单次累计充电电量 */
|
||||
@Excel(name = "单次累计充电电量")
|
||||
@ -532,12 +533,12 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
return maxCellVoltage;
|
||||
}
|
||||
|
||||
public void setMaxCellVoltageId(Long maxCellVoltageId)
|
||||
public void setMaxCellVoltageId(String maxCellVoltageId)
|
||||
{
|
||||
this.maxCellVoltageId = maxCellVoltageId;
|
||||
this.maxCellVoltageId = StringUtils.fillThreeDigits(maxCellVoltageId);
|
||||
}
|
||||
|
||||
public Long getMaxCellVoltageId()
|
||||
public String getMaxCellVoltageId()
|
||||
{
|
||||
return maxCellVoltageId;
|
||||
}
|
||||
@ -552,12 +553,12 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
return minCellVoltage;
|
||||
}
|
||||
|
||||
public void setMinCellVoltageId(Long minCellVoltageId)
|
||||
public void setMinCellVoltageId(String minCellVoltageId)
|
||||
{
|
||||
this.minCellVoltageId = minCellVoltageId;
|
||||
this.minCellVoltageId = StringUtils.fillThreeDigits(minCellVoltageId);
|
||||
}
|
||||
|
||||
public Long getMinCellVoltageId()
|
||||
public String getMinCellVoltageId()
|
||||
{
|
||||
return minCellVoltageId;
|
||||
}
|
||||
@ -572,12 +573,12 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
return maxCellTemp;
|
||||
}
|
||||
|
||||
public void setMaxCellTempId(Long maxCellTempId)
|
||||
public void setMaxCellTempId(String maxCellTempId)
|
||||
{
|
||||
this.maxCellTempId = maxCellTempId;
|
||||
this.maxCellTempId = StringUtils.fillThreeDigits(maxCellTempId);
|
||||
}
|
||||
|
||||
public Long getMaxCellTempId()
|
||||
public String getMaxCellTempId()
|
||||
{
|
||||
return maxCellTempId;
|
||||
}
|
||||
@ -592,12 +593,12 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
return minCellTemp;
|
||||
}
|
||||
|
||||
public void setMinCellTempId(Long minCellTempId)
|
||||
public void setMinCellTempId(String minCellTempId)
|
||||
{
|
||||
this.minCellTempId = minCellTempId;
|
||||
this.minCellTempId = StringUtils.fillThreeDigits(minCellTempId);
|
||||
}
|
||||
|
||||
public Long getMinCellTempId()
|
||||
public String getMinCellTempId()
|
||||
{
|
||||
return minCellTempId;
|
||||
}
|
||||
@ -612,12 +613,12 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
return maxCellSoc;
|
||||
}
|
||||
|
||||
public void setMaxCellSocId(Long maxCellSocId)
|
||||
public void setMaxCellSocId(String maxCellSocId)
|
||||
{
|
||||
this.maxCellSocId = maxCellSocId;
|
||||
this.maxCellSocId = StringUtils.fillThreeDigits(maxCellSocId);
|
||||
}
|
||||
|
||||
public Long getMaxCellSocId()
|
||||
public String getMaxCellSocId()
|
||||
{
|
||||
return maxCellSocId;
|
||||
}
|
||||
@ -632,12 +633,12 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
return minCellSoc;
|
||||
}
|
||||
|
||||
public void setMinCellSocId(Long minCellSocId)
|
||||
public void setMinCellSocId(String minCellSocId)
|
||||
{
|
||||
this.minCellSocId = minCellSocId;
|
||||
this.minCellSocId = StringUtils.fillThreeDigits(minCellSocId);
|
||||
}
|
||||
|
||||
public Long getMinCellSocId()
|
||||
public String getMinCellSocId()
|
||||
{
|
||||
return minCellSocId;
|
||||
}
|
||||
@ -652,12 +653,12 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
return maxCellSoh;
|
||||
}
|
||||
|
||||
public void setMaxCellSohId(Long maxCellSohId)
|
||||
public void setMaxCellSohId(String maxCellSohId)
|
||||
{
|
||||
this.maxCellSohId = maxCellSohId;
|
||||
this.maxCellSohId = StringUtils.fillThreeDigits(maxCellSohId);
|
||||
}
|
||||
|
||||
public Long getMaxCellSohId()
|
||||
public String getMaxCellSohId()
|
||||
{
|
||||
return maxCellSohId;
|
||||
}
|
||||
@ -672,12 +673,12 @@ public class EmsBatteryCluster extends BaseEntity
|
||||
return minCellSoh;
|
||||
}
|
||||
|
||||
public void setMinCellSohId(Long minCellSohId)
|
||||
public void setMinCellSohId(String minCellSohId)
|
||||
{
|
||||
this.minCellSohId = minCellSohId;
|
||||
this.minCellSohId = StringUtils.fillThreeDigits(minCellSohId);
|
||||
}
|
||||
|
||||
public Long getMinCellSohId()
|
||||
public String getMinCellSohId()
|
||||
{
|
||||
return minCellSohId;
|
||||
}
|
||||
|
||||
@ -24,25 +24,25 @@ public class BMSBatteryDataList {
|
||||
private BigDecimal maxCellVoltage;
|
||||
|
||||
/** 最高单体电压对应点号 */
|
||||
private Long maxCellVoltageId;
|
||||
private String maxCellVoltageId;
|
||||
|
||||
/** 单体最低电压 (V) */
|
||||
private BigDecimal minCellVoltage;
|
||||
|
||||
/** 最低单体电压对应点号 */
|
||||
private Long minCellVoltageId;
|
||||
private String minCellVoltageId;
|
||||
|
||||
/** 单体最高温度 (℃) */
|
||||
private BigDecimal maxCellTemp;
|
||||
|
||||
/** 最高单体温度对应点号 */
|
||||
private Long maxCellTempId;
|
||||
private String maxCellTempId;
|
||||
|
||||
/** 单体最低温度 (℃) */
|
||||
private BigDecimal minCellTemp;
|
||||
|
||||
/** 最低单体温度对应点号 */
|
||||
private Long minCellTempId;
|
||||
private String minCellTempId;
|
||||
|
||||
/** 换电站id */
|
||||
private String siteId;
|
||||
@ -130,35 +130,35 @@ public class BMSBatteryDataList {
|
||||
this.clusterVoltage = clusterVoltage;
|
||||
}
|
||||
|
||||
public Long getMaxCellVoltageId() {
|
||||
public String getMaxCellVoltageId() {
|
||||
return maxCellVoltageId;
|
||||
}
|
||||
|
||||
public void setMaxCellVoltageId(Long maxCellVoltageId) {
|
||||
public void setMaxCellVoltageId(String maxCellVoltageId) {
|
||||
this.maxCellVoltageId = maxCellVoltageId;
|
||||
}
|
||||
|
||||
public Long getMinCellTempId() {
|
||||
public String getMinCellTempId() {
|
||||
return minCellTempId;
|
||||
}
|
||||
|
||||
public void setMinCellTempId(Long minCellTempId) {
|
||||
public void setMinCellTempId(String minCellTempId) {
|
||||
this.minCellTempId = minCellTempId;
|
||||
}
|
||||
|
||||
public Long getMaxCellTempId() {
|
||||
public String getMaxCellTempId() {
|
||||
return maxCellTempId;
|
||||
}
|
||||
|
||||
public void setMaxCellTempId(Long maxCellTempId) {
|
||||
public void setMaxCellTempId(String maxCellTempId) {
|
||||
this.maxCellTempId = maxCellTempId;
|
||||
}
|
||||
|
||||
public Long getMinCellVoltageId() {
|
||||
public String getMinCellVoltageId() {
|
||||
return minCellVoltageId;
|
||||
}
|
||||
|
||||
public void setMinCellVoltageId(Long minCellVoltageId) {
|
||||
public void setMinCellVoltageId(String minCellVoltageId) {
|
||||
this.minCellVoltageId = minCellVoltageId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,8 @@ public interface ISingleSiteService
|
||||
|
||||
public List<EmsCoolingData> getCoolingDataList(String siteId);
|
||||
|
||||
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId,String siteId,String stackDeviceId);
|
||||
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId,String siteId,
|
||||
String stackDeviceId, String batteryId);
|
||||
|
||||
public AmmeterDataResponse getAmmeterDataList(String siteId);
|
||||
|
||||
|
||||
@ -405,13 +405,13 @@ public class DDSDataProcessServiceImpl implements IDDSDataProcessService {
|
||||
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.setMaxCellVoltageId(StringUtils.getString(stackObj.get("DTZDDYXH")));
|
||||
data.setMinCellVoltage(StringUtils.getBigDecimal(stackObj.get("DTZXDY")));
|
||||
data.setMinCellVoltageId(StringUtils.getLong(stackObj.get("DTZXDYXH")));
|
||||
data.setMinCellVoltageId(StringUtils.getString(stackObj.get("DTZXDYXH")));
|
||||
data.setMaxCellTemp(StringUtils.getBigDecimal(stackObj.get("DTZGWD")));
|
||||
data.setMaxCellTempId(StringUtils.getLong(stackObj.get("DTZGWDXH")));
|
||||
data.setMaxCellTempId(StringUtils.getString(stackObj.get("DTZGWDXH")));
|
||||
data.setMinCellTemp(StringUtils.getBigDecimal(stackObj.get("DTZDWD")));
|
||||
data.setMinCellTempId(StringUtils.getLong(stackObj.get("DTZDWDXH")));
|
||||
data.setMinCellTempId(StringUtils.getString(stackObj.get("DTZDWDXH")));
|
||||
|
||||
emsBatteryClusterMapper.insertEmsBatteryCluster(data);
|
||||
redisCache.setCacheObject(RedisKeyConstants.CLUSTER + SITE_ID + "_" +deviceId, data);
|
||||
|
||||
@ -234,14 +234,14 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
|
||||
data.setUpdateTime(DateUtils.getNowDate());
|
||||
data.setSiteId(SITE_ID);
|
||||
data.setDeviceId(deviceId);
|
||||
data.setMaxCellVoltageId(StringUtils.getLong(obj.get("ZGDTDYDYD")));
|
||||
data.setMinCellVoltageId(StringUtils.getLong(obj.get("ZDDTDYDYD")));
|
||||
data.setMaxCellTempId(StringUtils.getLong(obj.get("ZGDTWDDYD")));
|
||||
data.setMinCellTempId(StringUtils.getLong(obj.get("ZDDTWDDYD")));
|
||||
data.setMaxCellSocId(StringUtils.getLong(obj.get("ZGDTSOCDYD")));
|
||||
data.setMinCellSocId(StringUtils.getLong(obj.get("ZDDTSOCDYD")));
|
||||
data.setMaxCellSohId(StringUtils.getLong(obj.get("ZGDTSOHDYD")));
|
||||
data.setMinCellSohId(StringUtils.getLong(obj.get("ZDDTSOHDYD")));
|
||||
data.setMaxCellVoltageId(StringUtils.getString(obj.get("ZGDTDYDYD")));
|
||||
data.setMinCellVoltageId(StringUtils.getString(obj.get("ZDDTDYDYD")));
|
||||
data.setMaxCellTempId(StringUtils.getString(obj.get("ZGDTWDDYD")));
|
||||
data.setMinCellTempId(StringUtils.getString(obj.get("ZDDTWDDYD")));
|
||||
data.setMaxCellSocId(StringUtils.getString(obj.get("ZGDTSOCDYD")));
|
||||
data.setMinCellSocId(StringUtils.getString(obj.get("ZDDTSOCDYD")));
|
||||
data.setMaxCellSohId(StringUtils.getString(obj.get("ZGDTSOHDYD")));
|
||||
data.setMinCellSohId(StringUtils.getString(obj.get("ZDDTSOHDYD")));
|
||||
if (StringUtils.isNotBlank(stackDeviceId)) {
|
||||
data.setStackDeviceId(stackDeviceId);
|
||||
} else {
|
||||
|
||||
@ -134,7 +134,8 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
||||
|
||||
if (!StringUtils.isEmpty(siteId)) {
|
||||
// 实时有功功率/实时无功功率/今日充电量/今日放电量
|
||||
siteMonitorRunningHeadInfoVo = emsPcsDataMapper.getSiteRunningHeadInfo(siteId);
|
||||
SiteMonitorRunningHeadInfoVo tempVo = emsPcsDataMapper.getSiteRunningHeadInfo(siteId);
|
||||
siteMonitorRunningHeadInfoVo = tempVo != null ? tempVo : siteMonitorRunningHeadInfoVo;
|
||||
// 电池堆SOC + 电池堆SOH
|
||||
EmsBatteryStack emsBatteryStack = emsBatteryStackMapper.getSiteSumStackInfo(siteId);
|
||||
if (emsBatteryStack != null) {
|
||||
@ -383,7 +384,8 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId,String siteId,String stackDeviceId) {
|
||||
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId,String siteId,
|
||||
String stackDeviceId, String batteryId) {
|
||||
List<BatteryDataStatsListVo> batteryDataStatsListVo = new ArrayList<>();
|
||||
List<Map<String, Object>> clusterIds = new ArrayList<>();
|
||||
if (StringUtils.isEmpty(clusterDeviceId)) {
|
||||
@ -399,9 +401,22 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
||||
List<EmsBatteryData> batteryDataList = redisCache.getCacheList(RedisKeyConstants.BATTERY + siteId + "_" + clusterId);
|
||||
if (batteryDataList != null) {
|
||||
for (EmsBatteryData batteryData : batteryDataList) {
|
||||
BatteryDataStatsListVo batteryDataStatsVo = new BatteryDataStatsListVo();
|
||||
BeanUtils.copyProperties(batteryData, batteryDataStatsVo);
|
||||
batteryDataStatsListVo.add(batteryDataStatsVo);
|
||||
// 判断是否需要筛选:batteryId不为空时才进行匹配
|
||||
if (batteryId == null || batteryId.trim().isEmpty()) {
|
||||
// 空值情况:直接添加所有数据
|
||||
BatteryDataStatsListVo batteryDataStatsVo = new BatteryDataStatsListVo();
|
||||
BeanUtils.copyProperties(batteryData, batteryDataStatsVo);
|
||||
batteryDataStatsListVo.add(batteryDataStatsVo);
|
||||
} else {
|
||||
// 有值情况:只添加匹配的数据
|
||||
if (batteryId.equals(batteryData.getDeviceId())) {
|
||||
BatteryDataStatsListVo batteryDataStatsVo = new BatteryDataStatsListVo();
|
||||
BeanUtils.copyProperties(batteryData, batteryDataStatsVo);
|
||||
batteryDataStatsListVo.add(batteryDataStatsVo);
|
||||
// 找到匹配项后可提前退出当前簇的循环
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user