单站监控-电表
This commit is contained in:
@ -108,6 +108,15 @@ public class EmsSiteMonitorController extends BaseController{
|
|||||||
@GetMapping("/getClusterDataInfoList")
|
@GetMapping("/getClusterDataInfoList")
|
||||||
public AjaxResult getClusterDataInfoList(@RequestParam Long clusterDeviceId)
|
public AjaxResult getClusterDataInfoList(@RequestParam Long clusterDeviceId)
|
||||||
{
|
{
|
||||||
return success(iEmsSiteService.getClusterDataInfoList(clusterDeviceId));
|
return success(iSingleSiteService.getClusterDataInfoList(clusterDeviceId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电表数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/getAmmeterDataList")
|
||||||
|
public AjaxResult getAmmeterDataList(@RequestParam Long siteId)
|
||||||
|
{
|
||||||
|
return success(iSingleSiteService.getAmmeterDataList(siteId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
166
ems-system/src/main/java/com/xzzn/ems/domain/EmsAmmeterData.java
Normal file
166
ems-system/src/main/java/com/xzzn/ems/domain/EmsAmmeterData.java
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
package com.xzzn.ems.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总数据对象 ems_ammeter_data
|
||||||
|
*
|
||||||
|
* @author xzzn
|
||||||
|
* @date 2025-06-27
|
||||||
|
*/
|
||||||
|
public class EmsAmmeterData extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 数据更新时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "数据更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date dataUpdateTime;
|
||||||
|
|
||||||
|
/** 类别 */
|
||||||
|
@Excel(name = "类别")
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
/** 总 (kWh) */
|
||||||
|
@Excel(name = "总 (kWh)")
|
||||||
|
private BigDecimal totalKwh;
|
||||||
|
|
||||||
|
/** 峰 (kWh) */
|
||||||
|
@Excel(name = "峰 (kWh)")
|
||||||
|
private BigDecimal peakKwh;
|
||||||
|
|
||||||
|
/** 平 (kWh) */
|
||||||
|
@Excel(name = "平 (kWh)")
|
||||||
|
private BigDecimal flatKwh;
|
||||||
|
|
||||||
|
/** 谷 (kWh) */
|
||||||
|
@Excel(name = "谷 (kWh)")
|
||||||
|
private BigDecimal valleyKwh;
|
||||||
|
|
||||||
|
/** 站点id */
|
||||||
|
@Excel(name = "站点id")
|
||||||
|
private Long siteId;
|
||||||
|
|
||||||
|
/** 设备唯一标识符 */
|
||||||
|
@Excel(name = "设备唯一标识符")
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataUpdateTime(Date dataUpdateTime)
|
||||||
|
{
|
||||||
|
this.dataUpdateTime = dataUpdateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataUpdateTime()
|
||||||
|
{
|
||||||
|
return dataUpdateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategory(String category)
|
||||||
|
{
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCategory()
|
||||||
|
{
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalKwh(BigDecimal totalKwh)
|
||||||
|
{
|
||||||
|
this.totalKwh = totalKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getTotalKwh()
|
||||||
|
{
|
||||||
|
return totalKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeakKwh(BigDecimal peakKwh)
|
||||||
|
{
|
||||||
|
this.peakKwh = peakKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPeakKwh()
|
||||||
|
{
|
||||||
|
return peakKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlatKwh(BigDecimal flatKwh)
|
||||||
|
{
|
||||||
|
this.flatKwh = flatKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getFlatKwh()
|
||||||
|
{
|
||||||
|
return flatKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValleyKwh(BigDecimal valleyKwh)
|
||||||
|
{
|
||||||
|
this.valleyKwh = valleyKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getValleyKwh()
|
||||||
|
{
|
||||||
|
return valleyKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSiteId(Long siteId)
|
||||||
|
{
|
||||||
|
this.siteId = siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSiteId()
|
||||||
|
{
|
||||||
|
return siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(Long deviceId)
|
||||||
|
{
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDeviceId()
|
||||||
|
{
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("dataUpdateTime", getDataUpdateTime())
|
||||||
|
.append("category", getCategory())
|
||||||
|
.append("totalKwh", getTotalKwh())
|
||||||
|
.append("peakKwh", getPeakKwh())
|
||||||
|
.append("flatKwh", getFlatKwh())
|
||||||
|
.append("valleyKwh", getValleyKwh())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.append("siteId", getSiteId())
|
||||||
|
.append("deviceId", getDeviceId())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,98 @@
|
|||||||
|
package com.xzzn.ems.domain.vo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总表详细数据
|
||||||
|
*/
|
||||||
|
public class AmmeterDataDetailInfo
|
||||||
|
{
|
||||||
|
/** 类别 */
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
/** 总 (kWh) */
|
||||||
|
private BigDecimal totalKwh;
|
||||||
|
|
||||||
|
/** 尖 (kWh) */
|
||||||
|
private BigDecimal sharpKwh;
|
||||||
|
|
||||||
|
/** 峰 (kWh) */
|
||||||
|
private BigDecimal peakKwh;
|
||||||
|
|
||||||
|
/** 平 (kWh) */
|
||||||
|
private BigDecimal flatKwh;
|
||||||
|
|
||||||
|
/** 谷 (kWh) */
|
||||||
|
private BigDecimal valleyKwh;
|
||||||
|
|
||||||
|
/** 总表设备Id */
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/** 数据更新时间 */
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
public BigDecimal getValleyKwh() {
|
||||||
|
return valleyKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValleyKwh(BigDecimal valleyKwh) {
|
||||||
|
this.valleyKwh = valleyKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getFlatKwh() {
|
||||||
|
return flatKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlatKwh(BigDecimal flatKwh) {
|
||||||
|
this.flatKwh = flatKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPeakKwh() {
|
||||||
|
return peakKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeakKwh(BigDecimal peakKwh) {
|
||||||
|
this.peakKwh = peakKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSharpKwh() {
|
||||||
|
return sharpKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSharpKwh(BigDecimal sharpKwh) {
|
||||||
|
this.sharpKwh = sharpKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getTotalKwh() {
|
||||||
|
return totalKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalKwh(BigDecimal totalKwh) {
|
||||||
|
this.totalKwh = totalKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCategory() {
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategory(String category) {
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(Long deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.xzzn.ems.domain.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电表数据
|
||||||
|
*/
|
||||||
|
public class AmmeterDataVo {
|
||||||
|
|
||||||
|
/** 通信状态 */
|
||||||
|
private String emsCommunicationStatus;
|
||||||
|
|
||||||
|
/** 数据更新时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date dataUpdateTime;
|
||||||
|
|
||||||
|
private List<AmmeterDataDetailInfo> ammeterDataDetailInfos;
|
||||||
|
|
||||||
|
public String getEmsCommunicationStatus() {
|
||||||
|
return emsCommunicationStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmsCommunicationStatus(String emsCommunicationStatus) {
|
||||||
|
this.emsCommunicationStatus = emsCommunicationStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataUpdateTime() {
|
||||||
|
return dataUpdateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataUpdateTime(Date dataUpdateTime) {
|
||||||
|
this.dataUpdateTime = dataUpdateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AmmeterDataDetailInfo> getAmmeterDataDetailInfos() {
|
||||||
|
return ammeterDataDetailInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmmeterDataDetailInfos(List<AmmeterDataDetailInfo> ammeterDataDetailInfos) {
|
||||||
|
this.ammeterDataDetailInfos = ammeterDataDetailInfos;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.xzzn.ems.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.xzzn.ems.domain.EmsAmmeterData;
|
||||||
|
import com.xzzn.ems.domain.vo.AmmeterDataDetailInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总数据Mapper接口
|
||||||
|
*
|
||||||
|
* @author xzzn
|
||||||
|
* @date 2025-06-27
|
||||||
|
*/
|
||||||
|
public interface EmsAmmeterDataMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询总数据
|
||||||
|
*
|
||||||
|
* @param id 总数据主键
|
||||||
|
* @return 总数据
|
||||||
|
*/
|
||||||
|
public EmsAmmeterData selectEmsAmmeterDataById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询总数据列表
|
||||||
|
*
|
||||||
|
* @param emsAmmeterData 总数据
|
||||||
|
* @return 总数据集合
|
||||||
|
*/
|
||||||
|
public List<EmsAmmeterData> selectEmsAmmeterDataList(EmsAmmeterData emsAmmeterData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增总数据
|
||||||
|
*
|
||||||
|
* @param emsAmmeterData 总数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertEmsAmmeterData(EmsAmmeterData emsAmmeterData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改总数据
|
||||||
|
*
|
||||||
|
* @param emsAmmeterData 总数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateEmsAmmeterData(EmsAmmeterData emsAmmeterData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除总数据
|
||||||
|
*
|
||||||
|
* @param id 总数据主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEmsAmmeterDataById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除总数据
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEmsAmmeterDataByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取总表详细数据
|
||||||
|
* @param siteId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<AmmeterDataDetailInfo> getAmmeterDetailInfo(Long siteId);
|
||||||
|
}
|
@ -74,4 +74,11 @@ public interface EmsDevicesSettingMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Map<String, Object>> getAllClusterInfoByStackId(Long stackDeviceId);
|
public List<Map<String, Object>> getAllClusterInfoByStackId(Long stackDeviceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备通信状态
|
||||||
|
* @param deviceId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getDeviceStatus(Long deviceId);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.xzzn.ems.service;
|
package com.xzzn.ems.service;
|
||||||
|
|
||||||
import com.xzzn.ems.domain.EmsSiteSetting;
|
import com.xzzn.ems.domain.EmsSiteSetting;
|
||||||
import com.xzzn.ems.domain.vo.BatteryDataStatsListVo;
|
|
||||||
import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
|
import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -23,5 +22,5 @@ public interface IEmsSiteService
|
|||||||
|
|
||||||
public List<Map<String,Object>> getAllClusterInfo(Long stackDeviceId);
|
public List<Map<String,Object>> getAllClusterInfo(Long stackDeviceId);
|
||||||
|
|
||||||
public BatteryDataStatsListVo getClusterDataInfoList(Long clusterDeviceId);
|
|
||||||
}
|
}
|
||||||
|
@ -26,4 +26,8 @@ public interface ISingleSiteService
|
|||||||
public List<BMSBatteryClusterVo> getBMSBatteryCluster(Long siteId);
|
public List<BMSBatteryClusterVo> getBMSBatteryCluster(Long siteId);
|
||||||
|
|
||||||
public List<EmsCoolingData> getCoolingDataList(Long siteId);
|
public List<EmsCoolingData> getCoolingDataList(Long siteId);
|
||||||
|
|
||||||
|
public BatteryDataStatsListVo getClusterDataInfoList(Long clusterDeviceId);
|
||||||
|
|
||||||
|
public List<AmmeterDataVo> getAmmeterDataList(Long siteId);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.xzzn.ems.service.impl;
|
package com.xzzn.ems.service.impl;
|
||||||
|
|
||||||
import com.xzzn.ems.domain.EmsSiteSetting;
|
import com.xzzn.ems.domain.EmsSiteSetting;
|
||||||
import com.xzzn.ems.domain.vo.BatteryDataStatsListVo;
|
|
||||||
import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
|
import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
|
||||||
import com.xzzn.ems.mapper.EmsDevicesSettingMapper;
|
import com.xzzn.ems.mapper.EmsDevicesSettingMapper;
|
||||||
import com.xzzn.ems.mapper.EmsSiteSettingMapper;
|
import com.xzzn.ems.mapper.EmsSiteSettingMapper;
|
||||||
@ -45,18 +44,14 @@ public class EmsSiteServiceImpl implements IEmsSiteService
|
|||||||
return emsDevicesMapper.getAllStackInfoBySiteId(siteId);
|
return emsDevicesMapper.getAllStackInfoBySiteId(siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据电池堆Id获取电池簇
|
||||||
|
* @param stackDeviceId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getAllClusterInfo(Long stackDeviceId) {
|
public List<Map<String, Object>> getAllClusterInfo(Long stackDeviceId) {
|
||||||
return emsDevicesMapper.getAllClusterInfoByStackId(stackDeviceId);
|
return emsDevicesMapper.getAllClusterInfoByStackId(stackDeviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据电池堆获取单体柱状数据
|
|
||||||
* @param clusterDeviceId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public BatteryDataStatsListVo getClusterDataInfoList(Long clusterDeviceId) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -41,6 +40,10 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
|||||||
private EmsPcsBranchDataMapper emsPcsBranchDataMapper;
|
private EmsPcsBranchDataMapper emsPcsBranchDataMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmsCoolingDataMapper emsCoolingDataMapper;
|
private EmsCoolingDataMapper emsCoolingDataMapper;
|
||||||
|
@Autowired
|
||||||
|
private EmsAmmeterDataMapper emsAmmeterDataMapper;
|
||||||
|
@Autowired
|
||||||
|
private EmsDevicesSettingMapper emsDevicesSettingMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SiteMonitorHomeVo getSiteMonitorDataVo(Long siteId) {
|
public SiteMonitorHomeVo getSiteMonitorDataVo(Long siteId) {
|
||||||
@ -258,4 +261,40 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
|||||||
return emsCoolingDataList;
|
return emsCoolingDataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据电池堆获取单体柱状数据
|
||||||
|
* @param clusterDeviceId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BatteryDataStatsListVo getClusterDataInfoList(Long clusterDeviceId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电表数据信息
|
||||||
|
* @param siteId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AmmeterDataVo> getAmmeterDataList(Long siteId) {
|
||||||
|
List<AmmeterDataVo> ammeterDataVos = new ArrayList<>();
|
||||||
|
AmmeterDataVo ammeterDataVo = new AmmeterDataVo();
|
||||||
|
if (siteId != null) {
|
||||||
|
List<AmmeterDataDetailInfo> ammeterDataDetailInfos = emsAmmeterDataMapper.getAmmeterDetailInfo(siteId);
|
||||||
|
ammeterDataVo.setAmmeterDataDetailInfos(ammeterDataDetailInfos);
|
||||||
|
if (!CollectionUtils.isEmpty(ammeterDataDetailInfos)) {
|
||||||
|
// 获取通信状态
|
||||||
|
Long deviceId = ammeterDataDetailInfos.get(0).getDeviceId();
|
||||||
|
Map<String,Object> map = emsDevicesSettingMapper.getDeviceStatus(deviceId);
|
||||||
|
ammeterDataVo.setEmsCommunicationStatus(map.get("communication_status").toString());
|
||||||
|
// 数据更新时间
|
||||||
|
ammeterDataVo.setDataUpdateTime(ammeterDataDetailInfos.get(0).getUpdateTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ammeterDataVos.add(ammeterDataVo);
|
||||||
|
return ammeterDataVos;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,125 @@
|
|||||||
|
<?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.EmsAmmeterDataMapper">
|
||||||
|
|
||||||
|
<resultMap type="EmsAmmeterData" id="EmsAmmeterDataResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="dataUpdateTime" column="data_update_time" />
|
||||||
|
<result property="category" column="category" />
|
||||||
|
<result property="totalKwh" column="total_kwh" />
|
||||||
|
<result property="peakKwh" column="peak_kwh" />
|
||||||
|
<result property="flatKwh" column="flat_kwh" />
|
||||||
|
<result property="valleyKwh" column="valley_kwh" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="siteId" column="site_id" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEmsAmmeterDataVo">
|
||||||
|
select id, data_update_time, category, total_kwh, peak_kwh, flat_kwh, valley_kwh, create_by, create_time, update_by, update_time, remark, site_id, device_id from ems_ammeter_data
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEmsAmmeterDataList" parameterType="EmsAmmeterData" resultMap="EmsAmmeterDataResult">
|
||||||
|
<include refid="selectEmsAmmeterDataVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="dataUpdateTime != null "> and data_update_time = #{dataUpdateTime}</if>
|
||||||
|
<if test="category != null and category != ''"> and category = #{category}</if>
|
||||||
|
<if test="totalKwh != null "> and total_kwh = #{totalKwh}</if>
|
||||||
|
<if test="peakKwh != null "> and peak_kwh = #{peakKwh}</if>
|
||||||
|
<if test="flatKwh != null "> and flat_kwh = #{flatKwh}</if>
|
||||||
|
<if test="valleyKwh != null "> and valley_kwh = #{valleyKwh}</if>
|
||||||
|
<if test="siteId != null "> and site_id = #{siteId}</if>
|
||||||
|
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEmsAmmeterDataById" parameterType="Long" resultMap="EmsAmmeterDataResult">
|
||||||
|
<include refid="selectEmsAmmeterDataVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEmsAmmeterData" parameterType="EmsAmmeterData" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into ems_ammeter_data
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataUpdateTime != null">data_update_time,</if>
|
||||||
|
<if test="category != null">category,</if>
|
||||||
|
<if test="totalKwh != null">total_kwh,</if>
|
||||||
|
<if test="peakKwh != null">peak_kwh,</if>
|
||||||
|
<if test="flatKwh != null">flat_kwh,</if>
|
||||||
|
<if test="valleyKwh != null">valley_kwh,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="siteId != null">site_id,</if>
|
||||||
|
<if test="deviceId != null">device_id,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataUpdateTime != null">#{dataUpdateTime},</if>
|
||||||
|
<if test="category != null">#{category},</if>
|
||||||
|
<if test="totalKwh != null">#{totalKwh},</if>
|
||||||
|
<if test="peakKwh != null">#{peakKwh},</if>
|
||||||
|
<if test="flatKwh != null">#{flatKwh},</if>
|
||||||
|
<if test="valleyKwh != null">#{valleyKwh},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="siteId != null">#{siteId},</if>
|
||||||
|
<if test="deviceId != null">#{deviceId},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEmsAmmeterData" parameterType="EmsAmmeterData">
|
||||||
|
update ems_ammeter_data
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="dataUpdateTime != null">data_update_time = #{dataUpdateTime},</if>
|
||||||
|
<if test="category != null">category = #{category},</if>
|
||||||
|
<if test="totalKwh != null">total_kwh = #{totalKwh},</if>
|
||||||
|
<if test="peakKwh != null">peak_kwh = #{peakKwh},</if>
|
||||||
|
<if test="flatKwh != null">flat_kwh = #{flatKwh},</if>
|
||||||
|
<if test="valleyKwh != null">valley_kwh = #{valleyKwh},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="siteId != null">site_id = #{siteId},</if>
|
||||||
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteEmsAmmeterDataById" parameterType="Long">
|
||||||
|
delete from ems_ammeter_data where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteEmsAmmeterDataByIds" parameterType="String">
|
||||||
|
delete from ems_ammeter_data where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
<select id="getAmmeterDetailInfo" parameterType="Long" resultType="com.xzzn.ems.domain.vo.AmmeterDataDetailInfo">
|
||||||
|
select t.category as category,
|
||||||
|
t.total_kwh as totalKwh,
|
||||||
|
t.flat_kwh as flatKwh,
|
||||||
|
t.peak_kwh as peakKwh,
|
||||||
|
t.valley_kwh as valleyKwh,
|
||||||
|
t.device_id as deviceId,
|
||||||
|
Max(t.data_update_time) as updateTime
|
||||||
|
from ems_ammeter_data t
|
||||||
|
where t.site_id = #{siteId}
|
||||||
|
and t.data_update_time = (select MAX(tmp.data_update_time) from ems_ammeter_data tmp where tmp.site_id = t.site_id and tmp.device_id = t.device_id)
|
||||||
|
group by t.category,t.total_kwh,t.flat_kwh,t.peak_kwh,t.valley_kwh,t.device_id
|
||||||
|
order by updateTime desc
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -145,4 +145,10 @@
|
|||||||
from ems_devices_setting
|
from ems_devices_setting
|
||||||
where id in (select distinct eb.device_id from ems_battery_cluster eb where eb.stack_device_id = #{stackDeviceId})
|
where id in (select distinct eb.device_id from ems_battery_cluster eb where eb.stack_device_id = #{stackDeviceId})
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getDeviceStatus" parameterType="Long" resultType="java.util.Map">
|
||||||
|
select id,communication_status
|
||||||
|
from ems_devices_setting
|
||||||
|
where id = #{deviceId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Reference in New Issue
Block a user