PCS+BMS总览+电池簇抽数逻辑
This commit is contained in:
@ -0,0 +1,296 @@
|
||||
package com.xzzn.ems.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xzzn.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xzzn.common.annotation.Excel;
|
||||
|
||||
/**
|
||||
* Modbus设备配置对象 ems_devices_setting
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-06-24
|
||||
*/
|
||||
public class EmsDevicesSetting extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 设备ID,主键自增长 */
|
||||
private Long id;
|
||||
|
||||
/** 设备名称,用于标识设备 */
|
||||
@Excel(name = "设备名称,用于标识设备")
|
||||
private String deviceName;
|
||||
|
||||
/** 设备类型: TCP (网络设备),RTU(串口设备) */
|
||||
@Excel(name = "设备类型: TCP ", readConverterExp = "网=络设备")
|
||||
private String deviceType;
|
||||
|
||||
/** 从站地址,默认为1 */
|
||||
@Excel(name = "从站地址,默认为1")
|
||||
private Long slaveId;
|
||||
|
||||
/** 通信超时时间(毫秒),默认1000ms */
|
||||
@Excel(name = "通信超时时间(毫秒),默认1000ms")
|
||||
private Long timeoutMs;
|
||||
|
||||
/** 通信失败重试次数,默认3次 */
|
||||
@Excel(name = "通信失败重试次数,默认3次")
|
||||
private Long retries;
|
||||
|
||||
/** TCP设备的IP地址,仅TCP类型需要 */
|
||||
@Excel(name = "TCP设备的IP地址,仅TCP类型需要")
|
||||
private String ipAddress;
|
||||
|
||||
/** TCP端口号,通常502,仅TCP类型需要 */
|
||||
@Excel(name = "TCP端口号,通常502,仅TCP类型需要")
|
||||
private Long ipPort;
|
||||
|
||||
/** 串口路径(如COM3或/dev/ttyUSB0),仅RTU类型需要 */
|
||||
@Excel(name = "串口路径(如COM3或/dev/ttyUSB0),仅RTU类型需要")
|
||||
private String serialPort;
|
||||
|
||||
/** 波特率(如9600,19200),仅RTU类型需要 */
|
||||
@Excel(name = "波特率(如9600,19200),仅RTU类型需要")
|
||||
private Long baudRate;
|
||||
|
||||
/** 数据位(通常8),仅RTU类型需要 */
|
||||
@Excel(name = "数据位(通常8),仅RTU类型需要")
|
||||
private Long dataBits;
|
||||
|
||||
/** 停止位(1或2),仅RTU类型需要 */
|
||||
@Excel(name = "停止位(1或2),仅RTU类型需要")
|
||||
private Long stopBits;
|
||||
|
||||
/** 校验位(NONE无校验/EVEN偶校验/ODD奇校验),仅RTU类型需要 */
|
||||
@Excel(name = "校验位(NONE无校验/EVEN偶校验/ODD奇校验),仅RTU类型需要")
|
||||
private String parity;
|
||||
|
||||
/** 设备描述信息 */
|
||||
@Excel(name = "设备描述信息")
|
||||
private String description;
|
||||
|
||||
/** 记录创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "记录创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date createdAt;
|
||||
|
||||
/** 记录最后更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "记录最后更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date updatedAt;
|
||||
|
||||
/** 站点id */
|
||||
@Excel(name = "站点id")
|
||||
private Long siteId;
|
||||
|
||||
/** 通信状态 */
|
||||
@Excel(name = "通信状态")
|
||||
private String communicationStatus;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setDeviceName(String deviceName)
|
||||
{
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getDeviceName()
|
||||
{
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setDeviceType(String deviceType)
|
||||
{
|
||||
this.deviceType = deviceType;
|
||||
}
|
||||
|
||||
public String getDeviceType()
|
||||
{
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public void setSlaveId(Long slaveId)
|
||||
{
|
||||
this.slaveId = slaveId;
|
||||
}
|
||||
|
||||
public Long getSlaveId()
|
||||
{
|
||||
return slaveId;
|
||||
}
|
||||
|
||||
public void setTimeoutMs(Long timeoutMs)
|
||||
{
|
||||
this.timeoutMs = timeoutMs;
|
||||
}
|
||||
|
||||
public Long getTimeoutMs()
|
||||
{
|
||||
return timeoutMs;
|
||||
}
|
||||
|
||||
public void setRetries(Long retries)
|
||||
{
|
||||
this.retries = retries;
|
||||
}
|
||||
|
||||
public Long getRetries()
|
||||
{
|
||||
return retries;
|
||||
}
|
||||
|
||||
public void setIpAddress(String ipAddress)
|
||||
{
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
public String getIpAddress()
|
||||
{
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
public void setIpPort(Long ipPort)
|
||||
{
|
||||
this.ipPort = ipPort;
|
||||
}
|
||||
|
||||
public Long getIpPort()
|
||||
{
|
||||
return ipPort;
|
||||
}
|
||||
|
||||
public void setSerialPort(String serialPort)
|
||||
{
|
||||
this.serialPort = serialPort;
|
||||
}
|
||||
|
||||
public String getSerialPort()
|
||||
{
|
||||
return serialPort;
|
||||
}
|
||||
|
||||
public void setBaudRate(Long baudRate)
|
||||
{
|
||||
this.baudRate = baudRate;
|
||||
}
|
||||
|
||||
public Long getBaudRate()
|
||||
{
|
||||
return baudRate;
|
||||
}
|
||||
|
||||
public void setDataBits(Long dataBits)
|
||||
{
|
||||
this.dataBits = dataBits;
|
||||
}
|
||||
|
||||
public Long getDataBits()
|
||||
{
|
||||
return dataBits;
|
||||
}
|
||||
|
||||
public void setStopBits(Long stopBits)
|
||||
{
|
||||
this.stopBits = stopBits;
|
||||
}
|
||||
|
||||
public Long getStopBits()
|
||||
{
|
||||
return stopBits;
|
||||
}
|
||||
|
||||
public void setParity(String parity)
|
||||
{
|
||||
this.parity = parity;
|
||||
}
|
||||
|
||||
public String getParity()
|
||||
{
|
||||
return parity;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt)
|
||||
{
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Date getCreatedAt()
|
||||
{
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Date updatedAt)
|
||||
{
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public Date getUpdatedAt()
|
||||
{
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setSiteId(Long siteId)
|
||||
{
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public Long getSiteId()
|
||||
{
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setCommunicationStatus(String communicationStatus)
|
||||
{
|
||||
this.communicationStatus = communicationStatus;
|
||||
}
|
||||
|
||||
public String getCommunicationStatus()
|
||||
{
|
||||
return communicationStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("deviceName", getDeviceName())
|
||||
.append("deviceType", getDeviceType())
|
||||
.append("slaveId", getSlaveId())
|
||||
.append("timeoutMs", getTimeoutMs())
|
||||
.append("retries", getRetries())
|
||||
.append("ipAddress", getIpAddress())
|
||||
.append("ipPort", getIpPort())
|
||||
.append("serialPort", getSerialPort())
|
||||
.append("baudRate", getBaudRate())
|
||||
.append("dataBits", getDataBits())
|
||||
.append("stopBits", getStopBits())
|
||||
.append("parity", getParity())
|
||||
.append("description", getDescription())
|
||||
.append("createdAt", getCreatedAt())
|
||||
.append("updatedAt", getUpdatedAt())
|
||||
.append("siteId", getSiteId())
|
||||
.append("communicationStatus", getCommunicationStatus())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -138,10 +138,6 @@ public class EmsPcsData extends BaseEntity
|
||||
@Excel(name = "日")
|
||||
private int dateDay;
|
||||
|
||||
/** 通信状态 */
|
||||
@Excel(name = "通信状态")
|
||||
private String communicationStatus;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
@ -438,16 +434,6 @@ public class EmsPcsData extends BaseEntity
|
||||
this.dateDay = dateDay;
|
||||
}
|
||||
|
||||
public void setCommunicationStatus(String communicationStatus)
|
||||
{
|
||||
this.communicationStatus = communicationStatus;
|
||||
}
|
||||
|
||||
public String getCommunicationStatus()
|
||||
{
|
||||
return communicationStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@ -486,7 +472,6 @@ public class EmsPcsData extends BaseEntity
|
||||
.append("deviceId", getDeviceId())
|
||||
.append("dateMonth", getDateMonth())
|
||||
.append("dateDay", getDateDay())
|
||||
.append("communicationStatus", getCommunicationStatus())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import java.util.List;
|
||||
*/
|
||||
public class BMSBatteryClusterVo {
|
||||
|
||||
|
||||
private Long id;
|
||||
/** 设备名称 */
|
||||
private String deviceName;
|
||||
|
||||
/** 工作状态 */
|
||||
private String workStatus;
|
||||
@ -51,14 +51,20 @@ public class BMSBatteryClusterVo {
|
||||
/** 当前SOC (%) */
|
||||
private BigDecimal currentSoc;
|
||||
|
||||
/** 站点id */
|
||||
private Long siteId;
|
||||
|
||||
/** 设备唯一标识符 */
|
||||
private Long deviceId;
|
||||
|
||||
private List<BMSBatteryClusterDataList> batteryDataList;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
public void setDeviceName(String deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getWorkStatus() {
|
||||
@ -165,6 +171,22 @@ public class BMSBatteryClusterVo {
|
||||
this.currentSoc = currentSoc;
|
||||
}
|
||||
|
||||
public Long getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setSiteId(Long siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public List<BMSBatteryClusterDataList> getBatteryDataList() {
|
||||
return batteryDataList;
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import java.util.List;
|
||||
*/
|
||||
public class BMSOverViewVo {
|
||||
|
||||
|
||||
private Long id;
|
||||
/** 设备名称 */
|
||||
private String deviceName;
|
||||
|
||||
/** 工作状态 */
|
||||
private String workStatus;
|
||||
@ -51,14 +51,20 @@ public class BMSOverViewVo {
|
||||
/** 当前SOC (%) */
|
||||
private BigDecimal currentSoc;
|
||||
|
||||
/** 站点id */
|
||||
private Long siteId;
|
||||
|
||||
/** 设备唯一标识符 */
|
||||
private Long deviceId;
|
||||
|
||||
private List<BMSBatteryDataList> batteryDataList;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
public void setDeviceName(String deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getWorkStatus() {
|
||||
@ -165,6 +171,22 @@ public class BMSOverViewVo {
|
||||
this.currentSoc = currentSoc;
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setSiteId(Long siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public List<BMSBatteryDataList> getBatteryDataList() {
|
||||
return batteryDataList;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package com.xzzn.ems.domain.vo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xzzn.common.annotation.Excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -14,8 +13,7 @@ import java.util.List;
|
||||
* @author xzzn
|
||||
* @date 2025-06-24
|
||||
*/
|
||||
public class PcsDetailInfoVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
public class PcsDetailInfoVo {
|
||||
|
||||
/** 通讯状态 */
|
||||
private String communicationStatus;
|
||||
@ -88,6 +86,9 @@ public class PcsDetailInfoVo implements Serializable {
|
||||
/** 设备唯一标识符 */
|
||||
private Long deviceId;
|
||||
|
||||
/** 设备名称 */
|
||||
private String deviceName;
|
||||
|
||||
private List<PcsBranchInfo> pcsBranchInfoList;
|
||||
|
||||
public Long getDeviceId() {
|
||||
@ -281,4 +282,12 @@ public class PcsDetailInfoVo implements Serializable {
|
||||
public void setPcsBranchInfoList(List<PcsBranchInfo> pcsBranchInfoList) {
|
||||
this.pcsBranchInfoList = pcsBranchInfoList;
|
||||
}
|
||||
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setDeviceName(String deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.xzzn.ems.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.ems.domain.EmsBatteryCluster;
|
||||
import com.xzzn.ems.domain.vo.BMSBatteryClusterVo;
|
||||
|
||||
/**
|
||||
* 电池簇数据Mapper接口
|
||||
@ -64,5 +65,5 @@ public interface EmsBatteryClusterMapper
|
||||
* @param siteId
|
||||
* @return
|
||||
*/
|
||||
public EmsBatteryCluster getBMSBatteryCluster(Long siteId);
|
||||
public List<BMSBatteryClusterVo> getBMSBatteryCluster(Long siteId);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.xzzn.ems.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.ems.domain.EmsBatteryStack;
|
||||
import com.xzzn.ems.domain.vo.BMSOverViewVo;
|
||||
|
||||
/**
|
||||
* 电池堆数据Mapper接口
|
||||
@ -64,5 +65,5 @@ public interface EmsBatteryStackMapper
|
||||
* @param siteId
|
||||
* @return
|
||||
*/
|
||||
public EmsBatteryStack selectEmsBatteryStackBySiteId(Long siteId);
|
||||
public List<BMSOverViewVo> selectEmsBatteryStackBySiteId(Long siteId);
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
package com.xzzn.ems.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.ems.domain.EmsDevicesSetting;
|
||||
|
||||
/**
|
||||
* Modbus设备配置Mapper接口
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-06-24
|
||||
*/
|
||||
public interface EmsDevicesSettingMapper
|
||||
{
|
||||
/**
|
||||
* 查询Modbus设备配置
|
||||
*
|
||||
* @param id Modbus设备配置主键
|
||||
* @return Modbus设备配置
|
||||
*/
|
||||
public EmsDevicesSetting selectEmsDevicesSettingById(Long id);
|
||||
|
||||
/**
|
||||
* 查询Modbus设备配置列表
|
||||
*
|
||||
* @param emsDevicesSetting Modbus设备配置
|
||||
* @return Modbus设备配置集合
|
||||
*/
|
||||
public List<EmsDevicesSetting> selectEmsDevicesSettingList(EmsDevicesSetting emsDevicesSetting);
|
||||
|
||||
/**
|
||||
* 新增Modbus设备配置
|
||||
*
|
||||
* @param emsDevicesSetting Modbus设备配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmsDevicesSetting(EmsDevicesSetting emsDevicesSetting);
|
||||
|
||||
/**
|
||||
* 修改Modbus设备配置
|
||||
*
|
||||
* @param emsDevicesSetting Modbus设备配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmsDevicesSetting(EmsDevicesSetting emsDevicesSetting);
|
||||
|
||||
/**
|
||||
* 删除Modbus设备配置
|
||||
*
|
||||
* @param id Modbus设备配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsDevicesSettingById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除Modbus设备配置
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsDevicesSettingByIds(Long[] ids);
|
||||
}
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.xzzn.ems.domain.EmsPcsData;
|
||||
import com.xzzn.ems.domain.vo.ElectricIndexList;
|
||||
import com.xzzn.ems.domain.vo.PcsDetailInfoVo;
|
||||
import com.xzzn.ems.domain.vo.SiteMonitorDataVo;
|
||||
import com.xzzn.ems.domain.vo.SiteMonitorRuningHeadInfoVo;
|
||||
|
||||
@ -96,5 +97,5 @@ public interface EmsPcsDataMapper
|
||||
* @param siteId
|
||||
* @return
|
||||
*/
|
||||
public List<EmsPcsData> getPcsDetailInfoBySiteId(Long siteId);
|
||||
public List<PcsDetailInfoVo> getPcsDetailInfoBySiteId(Long siteId);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public interface ISingleSiteService
|
||||
|
||||
public List<PcsDetailInfoVo> getPcsDetailInfo(Long siteId);
|
||||
|
||||
public BMSOverViewVo getBMSOverView(Long siteId);
|
||||
public List<BMSOverViewVo> getBMSOverView(Long siteId);
|
||||
|
||||
public BMSBatteryClusterVo getBMSBatteryCluster(Long siteId);
|
||||
public List<BMSBatteryClusterVo> getBMSBatteryCluster(Long siteId);
|
||||
}
|
||||
|
@ -1,11 +1,7 @@
|
||||
package com.xzzn.ems.service.impl;
|
||||
|
||||
import com.xzzn.common.utils.StringUtils;
|
||||
import com.xzzn.common.utils.bean.BeanUtils;
|
||||
import com.xzzn.ems.domain.EmsBatteryCluster;
|
||||
import com.xzzn.ems.domain.EmsBatteryData;
|
||||
import com.xzzn.ems.domain.EmsBatteryStack;
|
||||
import com.xzzn.ems.domain.EmsPcsData;
|
||||
import com.xzzn.ems.domain.vo.*;
|
||||
import com.xzzn.ems.mapper.*;
|
||||
import com.xzzn.ems.service.ISingleSiteService;
|
||||
@ -136,20 +132,15 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
||||
|
||||
if (siteId != null) {
|
||||
// 获取pcs最新数据
|
||||
List<EmsPcsData> emsPcsDataList = emsPcsDataMapper.getPcsDetailInfoBySiteId(siteId);
|
||||
if (!CollectionUtils.isEmpty(emsPcsDataList)) {
|
||||
for (EmsPcsData sitePcsData : emsPcsDataList) {
|
||||
// 赋值
|
||||
PcsDetailInfoVo pcsDetailInfoVo = new PcsDetailInfoVo();
|
||||
BeanUtils.copyProperties(sitePcsData, pcsDetailInfoVo);
|
||||
|
||||
Long deviceId = sitePcsData.getDeviceId();
|
||||
pcsDetailInfoVoList = emsPcsDataMapper.getPcsDetailInfoBySiteId(siteId);
|
||||
if (!CollectionUtils.isEmpty(pcsDetailInfoVoList)) {
|
||||
for (PcsDetailInfoVo pcsDetailInfoVo : pcsDetailInfoVoList) {
|
||||
Long deviceId = pcsDetailInfoVo.getDeviceId();
|
||||
// 获取支路最新数据
|
||||
if (deviceId != null) {
|
||||
List<PcsBranchInfo> pcsBranchInfoList = emsPcsBranchDataMapper.getPcsBranchInfoList(siteId, deviceId);
|
||||
pcsDetailInfoVo.setPcsBranchInfoList(pcsBranchInfoList);
|
||||
}
|
||||
pcsDetailInfoVoList.add(pcsDetailInfoVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -158,20 +149,42 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
||||
|
||||
// 获取BMS总览数据
|
||||
@Override
|
||||
public BMSOverViewVo getBMSOverView(Long siteId) {
|
||||
BMSOverViewVo bmsOverViewVo = new BMSOverViewVo();
|
||||
EmsBatteryStack emsBatteryStack = emsBatteryStackMapper.selectEmsBatteryStackBySiteId(siteId);
|
||||
BeanUtils.copyProperties(emsBatteryStack, bmsOverViewVo);
|
||||
return bmsOverViewVo;
|
||||
public List<BMSOverViewVo> getBMSOverView(Long siteId) {
|
||||
List<BMSOverViewVo> bmsOverViewVoList = new ArrayList<>();
|
||||
|
||||
if (siteId != null) {
|
||||
// 获取电池堆list
|
||||
bmsOverViewVoList = emsBatteryStackMapper.selectEmsBatteryStackBySiteId(siteId);
|
||||
if (!CollectionUtils.isEmpty(bmsOverViewVoList)) {
|
||||
for (BMSOverViewVo bmsOverViewVo : bmsOverViewVoList) {
|
||||
// 获取单体电池数据-待确认
|
||||
Long deviceId = bmsOverViewVo.getDeviceId();
|
||||
if (deviceId != null) {
|
||||
List<BMSBatteryDataList> batteryDataList = new ArrayList();
|
||||
bmsOverViewVo.setBatteryDataList(batteryDataList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return bmsOverViewVoList;
|
||||
}
|
||||
|
||||
// 获取BMS电池簇数据
|
||||
@Override
|
||||
public BMSBatteryClusterVo getBMSBatteryCluster(Long siteId) {
|
||||
BMSBatteryClusterVo bmsBatteryClusterVo = new BMSBatteryClusterVo();
|
||||
EmsBatteryCluster emsBatteryCluster = emsBatteryClusterMapper.getBMSBatteryCluster(siteId);
|
||||
BeanUtils.copyProperties(emsBatteryCluster, bmsBatteryClusterVo);
|
||||
return bmsBatteryClusterVo;
|
||||
public List<BMSBatteryClusterVo> getBMSBatteryCluster(Long siteId) {
|
||||
List<BMSBatteryClusterVo> bmsBatteryClusterVoList = new ArrayList<>();
|
||||
|
||||
if (siteId != null) {
|
||||
bmsBatteryClusterVoList = emsBatteryClusterMapper.getBMSBatteryCluster(siteId);
|
||||
if (!CollectionUtils.isEmpty(bmsBatteryClusterVoList)) {
|
||||
for (BMSBatteryClusterVo bmsBatteryClusterVo : bmsBatteryClusterVoList) {
|
||||
// 获取单体电池数据
|
||||
Long deviceId = bmsBatteryClusterVo.getDeviceId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bmsBatteryClusterVoList;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -144,8 +144,17 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getBMSBatteryCluster" parameterType="Long" resultMap="EmsBatteryClusterResult">
|
||||
<include refid="selectEmsBatteryClusterVo"/>
|
||||
where site_id = #{siteId}
|
||||
<select id="getBMSBatteryCluster" parameterType="Long" resultType="com.xzzn.ems.domain.vo.BMSBatteryClusterVo">
|
||||
select td.device_name as deviceName, tmp.work_status as workStatus,
|
||||
tmp.pcs_communication_status as pcsCommunicationStatus, tmp.ems_communication_status as emsCommunicationStatus,
|
||||
tmp.cluster_voltage as clusterVoltage,tmp.chargeable_capacity as chargeableCapacity, tmp.total_charged_capacity as totalChargedCapacity,
|
||||
tmp.cluster_current as clusterCurrent,tmp.dischargeable_capacity as dischargeableCapacity, tmp.total_discharged_capacity as totalDischargedCapacity,
|
||||
tmp.soh as soh,tmp.average_temperature as averageTemperature,tmp.insulation_resistance as insulationResistance,
|
||||
tmp.current_soc as currentSoc,tmp.site_id as siteId,tmp.device_id as deviceId
|
||||
from ems_battery_cluster tmp left join ems_devices_setting td on tmp.device_id = td.id and tmp.site_id = td.site_id
|
||||
where tmp.site_id = #{siteId}
|
||||
and tmp.update_time = (select MAX(t.update_time) FROM ems_battery_cluster t where t.site_id = tmp.site_id
|
||||
and t.device_id = tmp.device_id)
|
||||
order by tmp.device_id
|
||||
</select>
|
||||
</mapper>
|
@ -144,8 +144,17 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectEmsBatteryStackBySiteId" parameterType="Long" resultMap="EmsBatteryStackResult">
|
||||
<include refid="selectEmsBatteryStackVo"/>
|
||||
where site_id = #{siteId} order by update_time desc limit 1
|
||||
<select id="selectEmsBatteryStackBySiteId" parameterType="Long" resultType="com.xzzn.ems.domain.vo.BMSOverViewVo">
|
||||
select td.device_name as deviceName,tmp.work_status as workStatus,
|
||||
tmp.pcs_communication_status as pcsCommunicationStatus,tmp.ems_communication_status as emsCommunicationStatus,
|
||||
tmp.total_voltage as totalVoltage,tmp.chargeable_capacity as chargeableCapacity,tmp.total_charged_capacity as totalChargedCapacity,
|
||||
tmp.total_current as totalCurrent,tmp.dischargeable_capacity as dischargeableCapacity,tmp.total_discharged_capacity as totalDischargedCapacity,
|
||||
tmp.soh as soh,tmp.average_temperature as averageTemperature,tmp.insulation_resistance as insulationResistance,
|
||||
tmp.current_soc as currentSoc,tmp.site_id as siteId,tmp.device_id as deviceId
|
||||
from ems_battery_stack tmp left join ems_devices_setting td on tmp.device_id = td.id and tmp.site_id = td.site_id
|
||||
where tmp.site_id = #{siteId}
|
||||
and tmp.update_time = (select MAX(t.update_time) FROM ems_battery_stack t where t.site_id = tmp.site_id
|
||||
and t.device_id = tmp.device_id)
|
||||
order by tmp.device_id
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xzzn.ems.mapper.EmsDevicesSettingMapper">
|
||||
|
||||
<resultMap type="EmsDevicesSetting" id="EmsDevicesSettingResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deviceName" column="device_name" />
|
||||
<result property="deviceType" column="device_type" />
|
||||
<result property="slaveId" column="slave_id" />
|
||||
<result property="timeoutMs" column="timeout_ms" />
|
||||
<result property="retries" column="retries" />
|
||||
<result property="ipAddress" column="ip_address" />
|
||||
<result property="ipPort" column="ip_port" />
|
||||
<result property="serialPort" column="serial_port" />
|
||||
<result property="baudRate" column="baud_rate" />
|
||||
<result property="dataBits" column="data_bits" />
|
||||
<result property="stopBits" column="stop_bits" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="description" column="description" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
<result property="updatedAt" column="updated_at" />
|
||||
<result property="siteId" column="site_id" />
|
||||
<result property="communicationStatus" column="communication_status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsDevicesSettingVo">
|
||||
select id, device_name, device_type, slave_id, timeout_ms, retries, ip_address, ip_port, serial_port, baud_rate, data_bits, stop_bits, parity, description, created_at, updated_at, site_id, communication_status from ems_devices_setting
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsDevicesSettingList" parameterType="EmsDevicesSetting" resultMap="EmsDevicesSettingResult">
|
||||
<include refid="selectEmsDevicesSettingVo"/>
|
||||
<where>
|
||||
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
||||
<if test="deviceType != null and deviceType != ''"> and device_type = #{deviceType}</if>
|
||||
<if test="slaveId != null "> and slave_id = #{slaveId}</if>
|
||||
<if test="timeoutMs != null "> and timeout_ms = #{timeoutMs}</if>
|
||||
<if test="retries != null "> and retries = #{retries}</if>
|
||||
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
|
||||
<if test="ipPort != null "> and ip_port = #{ipPort}</if>
|
||||
<if test="serialPort != null and serialPort != ''"> and serial_port = #{serialPort}</if>
|
||||
<if test="baudRate != null "> and baud_rate = #{baudRate}</if>
|
||||
<if test="dataBits != null "> and data_bits = #{dataBits}</if>
|
||||
<if test="stopBits != null "> and stop_bits = #{stopBits}</if>
|
||||
<if test="parity != null and parity != ''"> and parity = #{parity}</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="createdAt != null "> and created_at = #{createdAt}</if>
|
||||
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
|
||||
<if test="siteId != null "> and site_id = #{siteId}</if>
|
||||
<if test="communicationStatus != null and communicationStatus != ''"> and communication_status = #{communicationStatus}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEmsDevicesSettingById" parameterType="Long" resultMap="EmsDevicesSettingResult">
|
||||
<include refid="selectEmsDevicesSettingVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEmsDevicesSetting" parameterType="EmsDevicesSetting" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ems_devices_setting
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != ''">device_name,</if>
|
||||
<if test="deviceType != null and deviceType != ''">device_type,</if>
|
||||
<if test="slaveId != null">slave_id,</if>
|
||||
<if test="timeoutMs != null">timeout_ms,</if>
|
||||
<if test="retries != null">retries,</if>
|
||||
<if test="ipAddress != null">ip_address,</if>
|
||||
<if test="ipPort != null">ip_port,</if>
|
||||
<if test="serialPort != null">serial_port,</if>
|
||||
<if test="baudRate != null">baud_rate,</if>
|
||||
<if test="dataBits != null">data_bits,</if>
|
||||
<if test="stopBits != null">stop_bits,</if>
|
||||
<if test="parity != null">parity,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="createdAt != null">created_at,</if>
|
||||
<if test="updatedAt != null">updated_at,</if>
|
||||
<if test="siteId != null">site_id,</if>
|
||||
<if test="communicationStatus != null">communication_status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||
<if test="deviceType != null and deviceType != ''">#{deviceType},</if>
|
||||
<if test="slaveId != null">#{slaveId},</if>
|
||||
<if test="timeoutMs != null">#{timeoutMs},</if>
|
||||
<if test="retries != null">#{retries},</if>
|
||||
<if test="ipAddress != null">#{ipAddress},</if>
|
||||
<if test="ipPort != null">#{ipPort},</if>
|
||||
<if test="serialPort != null">#{serialPort},</if>
|
||||
<if test="baudRate != null">#{baudRate},</if>
|
||||
<if test="dataBits != null">#{dataBits},</if>
|
||||
<if test="stopBits != null">#{stopBits},</if>
|
||||
<if test="parity != null">#{parity},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="createdAt != null">#{createdAt},</if>
|
||||
<if test="updatedAt != null">#{updatedAt},</if>
|
||||
<if test="siteId != null">#{siteId},</if>
|
||||
<if test="communicationStatus != null">#{communicationStatus},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEmsDevicesSetting" parameterType="EmsDevicesSetting">
|
||||
update ems_devices_setting
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
|
||||
<if test="deviceType != null and deviceType != ''">device_type = #{deviceType},</if>
|
||||
<if test="slaveId != null">slave_id = #{slaveId},</if>
|
||||
<if test="timeoutMs != null">timeout_ms = #{timeoutMs},</if>
|
||||
<if test="retries != null">retries = #{retries},</if>
|
||||
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
|
||||
<if test="ipPort != null">ip_port = #{ipPort},</if>
|
||||
<if test="serialPort != null">serial_port = #{serialPort},</if>
|
||||
<if test="baudRate != null">baud_rate = #{baudRate},</if>
|
||||
<if test="dataBits != null">data_bits = #{dataBits},</if>
|
||||
<if test="stopBits != null">stop_bits = #{stopBits},</if>
|
||||
<if test="parity != null">parity = #{parity},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||
<if test="siteId != null">site_id = #{siteId},</if>
|
||||
<if test="communicationStatus != null">communication_status = #{communicationStatus},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmsDevicesSettingById" parameterType="Long">
|
||||
delete from ems_devices_setting where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmsDevicesSettingByIds" parameterType="String">
|
||||
delete from ems_devices_setting where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -268,9 +268,20 @@
|
||||
group by dateMonth
|
||||
</select>
|
||||
|
||||
<select id="getPcsDetailInfoBySiteId" parameterType="Long" resultMap="EmsPcsDataResult">
|
||||
select tmp.*
|
||||
from ems_pcs_data tmp
|
||||
<select id="getPcsDetailInfoBySiteId" parameterType="Long" resultType="com.xzzn.ems.domain.vo.PcsDetailInfoVo">
|
||||
select td.device_name as deviceName,td.communication_status as communicationStatus,
|
||||
tmp.site_id as siteId,tmp.device_id as deviceId,
|
||||
tmp.data_update_time as dataUpdateTime,tmp.work_status as workStatus,
|
||||
tmp.grid_status as gridStatus,tmp.device_status as deviceStatus,tmp.control_mode as controlMode,
|
||||
tmp.total_active_power as totalActivePower,tmp.daily_ac_charge_energy as dailyAcChargeEnergy,
|
||||
tmp.a_phase_voltage as aPhaseVoltage,tmp.a_phase_current as aPhaseCurrent,
|
||||
tmp.total_reactive_power as totalReactivePower,tmp.daily_ac_discharge_energy as dailyAcDischargeEnergy,
|
||||
tmp.b_phase_voltage as bPhaseVoltage,tmp.b_phase_current as bPhaseCurrent,
|
||||
tmp.total_apparent_power as totalApparentPower,tmp.pcs_module_temperature as pcsModuleTemperature,
|
||||
tmp.c_phase_current as cPhaseVoltage,tmp.c_phase_current as cPhaseCurrent,
|
||||
tmp.total_power_factor as totalPowerFactor,
|
||||
tmp.pcs_environment_temperature as pcsEnvironmentTemperature,tmp.ac_frequency as acFrequency
|
||||
from ems_pcs_data tmp left join ems_devices_setting td on tmp.device_id = td.id and tmp.site_id = td.site_id
|
||||
where tmp.site_id = #{siteId}
|
||||
and tmp.data_update_time = (select MAX(data_update_time) FROM ems_pcs_data where site_id = tmp.site_id
|
||||
and device_id = tmp.device_id)
|
||||
|
Reference in New Issue
Block a user