Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@ -131,8 +131,8 @@ xss:
|
|||||||
mqtt:
|
mqtt:
|
||||||
broker.url: tcp://122.51.194.184:1883
|
broker.url: tcp://122.51.194.184:1883
|
||||||
client.id: ems-cloud
|
client.id: ems-cloud
|
||||||
username: admin
|
username: dmbroker
|
||||||
password: pass123
|
password: Setri@64335270
|
||||||
connection-timeout: 15
|
connection-timeout: 15
|
||||||
keep-alive-interval: 30
|
keep-alive-interval: 30
|
||||||
automatic-reconnect: true
|
automatic-reconnect: true
|
@ -4,7 +4,7 @@ import java.math.BigDecimal;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 总表详细数据
|
* 电表详细数据
|
||||||
*/
|
*/
|
||||||
public class AmmeterDataDetailInfo
|
public class AmmeterDataDetailInfo
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class AmmeterDataVo {
|
public class AmmeterDataVo {
|
||||||
|
|
||||||
|
/** 电表名称 */
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
/** 通信状态 */
|
/** 通信状态 */
|
||||||
private String emsCommunicationStatus;
|
private String emsCommunicationStatus;
|
||||||
|
|
||||||
@ -19,6 +22,14 @@ public class AmmeterDataVo {
|
|||||||
|
|
||||||
private List<AmmeterDataDetailInfo> ammeterDataDetailInfos;
|
private List<AmmeterDataDetailInfo> ammeterDataDetailInfos;
|
||||||
|
|
||||||
|
public String getDeviceName() {
|
||||||
|
return deviceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceName(String deviceName) {
|
||||||
|
this.deviceName = deviceName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getEmsCommunicationStatus() {
|
public String getEmsCommunicationStatus() {
|
||||||
return emsCommunicationStatus;
|
return emsCommunicationStatus;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,51 @@ public class BMSBatteryClusterVo {
|
|||||||
/** 设备唯一标识符 */
|
/** 设备唯一标识符 */
|
||||||
private String deviceId;
|
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;
|
private List<BMSBatteryClusterDataList> batteryDataList;
|
||||||
|
|
||||||
public String getDeviceName() {
|
public String getDeviceName() {
|
||||||
@ -194,4 +239,124 @@ public class BMSBatteryClusterVo {
|
|||||||
public void setBatteryDataList(List<BMSBatteryClusterDataList> batteryDataList) {
|
public void setBatteryDataList(List<BMSBatteryClusterDataList> batteryDataList) {
|
||||||
this.batteryDataList = 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ public class BMSBatteryDataList {
|
|||||||
/**
|
/**
|
||||||
* 簇号
|
* 簇号
|
||||||
*/
|
*/
|
||||||
private Long clusterId;
|
private String clusterId;
|
||||||
|
|
||||||
/** 簇电压 (V) */
|
/** 簇电压 (V) */
|
||||||
private BigDecimal clusterVoltage;
|
private BigDecimal clusterVoltage;
|
||||||
@ -38,11 +38,11 @@ public class BMSBatteryDataList {
|
|||||||
/** 堆id */
|
/** 堆id */
|
||||||
private String stackDeviceId;
|
private String stackDeviceId;
|
||||||
|
|
||||||
public Long getClusterId() {
|
public String getClusterId() {
|
||||||
return clusterId;
|
return clusterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClusterId(Long clusterId) {
|
public void setClusterId(String clusterId) {
|
||||||
this.clusterId = clusterId;
|
this.clusterId = clusterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,11 @@ public class SiteMonitorRunningHeadInfoVo {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal dayDisChargedCap;
|
private BigDecimal dayDisChargedCap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点id
|
||||||
|
*/
|
||||||
|
private String siteId;
|
||||||
|
|
||||||
public BigDecimal getTotalActivePower() {
|
public BigDecimal getTotalActivePower() {
|
||||||
return totalActivePower;
|
return totalActivePower;
|
||||||
}
|
}
|
||||||
@ -84,4 +89,12 @@ public class SiteMonitorRunningHeadInfoVo {
|
|||||||
public void setDayDisChargedCap(BigDecimal dayDisChargedCap) {
|
public void setDayDisChargedCap(BigDecimal dayDisChargedCap) {
|
||||||
this.dayDisChargedCap = dayDisChargedCap;
|
this.dayDisChargedCap = dayDisChargedCap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSiteId() {
|
||||||
|
return siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSiteId(String siteId) {
|
||||||
|
this.siteId = siteId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.xzzn.ems.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.xzzn.ems.domain.EmsAmmeterData;
|
import com.xzzn.ems.domain.EmsAmmeterData;
|
||||||
import com.xzzn.ems.domain.vo.AmmeterDataDetailInfo;
|
import com.xzzn.ems.domain.vo.AmmeterDataDetailInfo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 总数据Mapper接口
|
* 总数据Mapper接口
|
||||||
@ -65,5 +66,5 @@ public interface EmsAmmeterDataMapper
|
|||||||
* @param siteId
|
* @param siteId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<AmmeterDataDetailInfo> getAmmeterDetailInfo(String siteId);
|
public List<AmmeterDataDetailInfo> getAmmeterDetailInfo(@Param("siteId")String siteId,@Param("deviceId") String deviceId);
|
||||||
}
|
}
|
||||||
|
@ -74,11 +74,10 @@ public interface EmsDevicesSettingMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Map<String, Object>> getAllClusterInfoByStackId(String stackDeviceId);
|
public List<Map<String, Object>> getAllClusterInfoByStackId(String stackDeviceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设备通信状态
|
* 获取该设备下的所有电表
|
||||||
* @param deviceId
|
* @param siteId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> getDeviceStatus(String deviceId);
|
public List<EmsDevicesSetting> getAllBatteryDeviceBySiteId(String siteId);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package com.xzzn.ems.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.xzzn.ems.domain.EmsPcsBranchData;
|
import com.xzzn.ems.domain.EmsPcsBranchData;
|
||||||
import com.xzzn.ems.domain.vo.PcsBranchInfo;
|
import com.xzzn.ems.domain.vo.PcsBranchInfo;
|
||||||
import io.lettuce.core.dynamic.annotation.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pcs支路数据Mapper接口
|
* pcs支路数据Mapper接口
|
||||||
|
@ -9,6 +9,7 @@ import com.xzzn.ems.domain.vo.ElectricIndexList;
|
|||||||
import com.xzzn.ems.domain.vo.PcsDetailInfoVo;
|
import com.xzzn.ems.domain.vo.PcsDetailInfoVo;
|
||||||
import com.xzzn.ems.domain.vo.SiteMonitorDataVo;
|
import com.xzzn.ems.domain.vo.SiteMonitorDataVo;
|
||||||
import com.xzzn.ems.domain.vo.SiteMonitorRunningHeadInfoVo;
|
import com.xzzn.ems.domain.vo.SiteMonitorRunningHeadInfoVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PCS数据Mapper接口
|
* PCS数据Mapper接口
|
||||||
@ -71,14 +72,7 @@ public interface EmsPcsDataMapper
|
|||||||
* @param siteId
|
* @param siteId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<SiteMonitorDataVo> getPcsDataBySiteId(String siteId);
|
public List<SiteMonitorDataVo> getPcsDataBySiteId(@Param("siteId")String siteId, @Param("limitTime")int limitTime);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据站点获取电网实时功率=sum(总交流有功电率)
|
|
||||||
* @param siteId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public BigDecimal getGridNrtPower(String siteId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据站点获取设备监控的实时运行头信息
|
* 根据站点获取设备监控的实时运行头信息
|
||||||
@ -104,5 +98,5 @@ public interface EmsPcsDataMapper
|
|||||||
* 获取总充+总放
|
* 获取总充+总放
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Map<String, BigDecimal> getPcsTotalChargeData();
|
public Map<String, BigDecimal> getPcsTotalChargeData(String siteId);
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import java.util.*;
|
|||||||
@Service
|
@Service
|
||||||
public class HomePageServiceImpl implements IHomePageService
|
public class HomePageServiceImpl implements IHomePageService
|
||||||
{
|
{
|
||||||
|
private static final int LIMIT_TIME = 6;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IEmsSiteService emsSiteService;
|
private IEmsSiteService emsSiteService;
|
||||||
@ -37,10 +38,11 @@ public class HomePageServiceImpl implements IHomePageService
|
|||||||
SiteTotalInfoVo siteTotalInfoVo = new SiteTotalInfoVo();
|
SiteTotalInfoVo siteTotalInfoVo = new SiteTotalInfoVo();
|
||||||
siteTotalInfoVo = emsSiteService.getSiteTotalInfo();
|
siteTotalInfoVo = emsSiteService.getSiteTotalInfo();
|
||||||
// 获取总充+总放
|
// 获取总充+总放
|
||||||
Map<String,BigDecimal> pcsMap = new HashMap<>();
|
Map<String,BigDecimal> pcsMap = emsPcsDataMapper.getPcsTotalChargeData(null);
|
||||||
pcsMap = emsPcsDataMapper.getPcsTotalChargeData();
|
if(pcsMap != null){
|
||||||
siteTotalInfoVo.setTotalChargedCap(pcsMap.get("totalChargedCap"));
|
siteTotalInfoVo.setTotalChargedCap(pcsMap.get("totalChargedCap"));
|
||||||
siteTotalInfoVo.setTotalDischargedCap(pcsMap.get("totalDischargedCap"));
|
siteTotalInfoVo.setTotalDischargedCap(pcsMap.get("totalDischargedCap"));
|
||||||
|
}
|
||||||
return siteTotalInfoVo;
|
return siteTotalInfoVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +54,7 @@ public class HomePageServiceImpl implements IHomePageService
|
|||||||
if (!StringUtils.isEmpty(siteId)) {
|
if (!StringUtils.isEmpty(siteId)) {
|
||||||
// 站点基本信息
|
// 站点基本信息
|
||||||
EmsSiteSetting emsSite = emsSiteMapper.selectEmsSiteSettingBySiteId(siteId);
|
EmsSiteSetting emsSite = emsSiteMapper.selectEmsSiteSettingBySiteId(siteId);
|
||||||
if (StringUtils.isNotEmpty(siteId)) {
|
if (emsSite != null) {
|
||||||
// 装机功率+装机容量
|
// 装机功率+装机容量
|
||||||
singleSiteBaseInfo.setSiteName(emsSite.getSiteName());
|
singleSiteBaseInfo.setSiteName(emsSite.getSiteName());
|
||||||
singleSiteBaseInfo.setInstalledCap(emsSite.getInstallCapacity());
|
singleSiteBaseInfo.setInstalledCap(emsSite.getInstallCapacity());
|
||||||
@ -64,8 +66,14 @@ public class HomePageServiceImpl implements IHomePageService
|
|||||||
singleSiteBaseInfo.setSiteAddress(emsSite.getSiteAddress());
|
singleSiteBaseInfo.setSiteAddress(emsSite.getSiteAddress());
|
||||||
singleSiteBaseInfo.setRunningTime(emsSite.getRunningTime() == null ? null :
|
singleSiteBaseInfo.setRunningTime(emsSite.getRunningTime() == null ? null :
|
||||||
DateUtils.parseDateToStr("yyyy-MM-dd",emsSite.getRunningTime()));//投运时间
|
DateUtils.parseDateToStr("yyyy-MM-dd",emsSite.getRunningTime()));//投运时间
|
||||||
|
// 获取单站点的总充+总放
|
||||||
|
Map<String,BigDecimal> pcsMap = emsPcsDataMapper.getPcsTotalChargeData(siteId);
|
||||||
|
if (pcsMap != null) {
|
||||||
|
singleSiteBaseInfo.setTotalChargedCap(pcsMap.get("totalChargedCap"));
|
||||||
|
singleSiteBaseInfo.setTotalDisChargedCap(pcsMap.get("totalDischargedCap"));
|
||||||
|
}
|
||||||
// 七天放电数据统计
|
// 七天放电数据统计
|
||||||
List<SiteMonitorDataVo> siteMonitorDataVoList = emsPcsDataMapper.getPcsDataBySiteId(siteId);
|
List<SiteMonitorDataVo> siteMonitorDataVoList = emsPcsDataMapper.getPcsDataBySiteId(siteId,LIMIT_TIME);
|
||||||
singleSiteBaseInfo.setSevenDayDisChargeStats(siteMonitorDataVoList);
|
singleSiteBaseInfo.setSevenDayDisChargeStats(siteMonitorDataVoList);
|
||||||
// 充放电基本数据处理
|
// 充放电基本数据处理
|
||||||
dealSitePCSDate(singleSiteBaseInfo,siteMonitorDataVoList);
|
dealSitePCSDate(singleSiteBaseInfo,siteMonitorDataVoList);
|
||||||
@ -77,27 +85,15 @@ public class HomePageServiceImpl implements IHomePageService
|
|||||||
|
|
||||||
private void dealSitePCSDate(SingleSiteBaseInfo singleSiteBaseInfo, List<SiteMonitorDataVo> siteMonitorDataVoList) {
|
private void dealSitePCSDate(SingleSiteBaseInfo singleSiteBaseInfo, List<SiteMonitorDataVo> siteMonitorDataVoList) {
|
||||||
if (siteMonitorDataVoList != null && !siteMonitorDataVoList.isEmpty()) {
|
if (siteMonitorDataVoList != null && !siteMonitorDataVoList.isEmpty()) {
|
||||||
BigDecimal dayChargeCap = new BigDecimal(0);
|
|
||||||
BigDecimal dayDisChargeCap = new BigDecimal(0);
|
|
||||||
BigDecimal totalChargeCap = new BigDecimal(0);
|
|
||||||
BigDecimal totalDisChargeCap = new BigDecimal(0);
|
|
||||||
for (SiteMonitorDataVo sitePcsData : siteMonitorDataVoList) {
|
for (SiteMonitorDataVo sitePcsData : siteMonitorDataVoList) {
|
||||||
// 总充电量
|
|
||||||
totalChargeCap = totalChargeCap.add(sitePcsData.getChargedCap());
|
|
||||||
// 总放电量
|
|
||||||
totalDisChargeCap = totalDisChargeCap.add(sitePcsData.getDisChargedCap());
|
|
||||||
// 获取当天的充电量+放电量
|
// 获取当天的充电量+放电量
|
||||||
String pcsDate = sitePcsData.getAmmeterDate();
|
String pcsDate = sitePcsData.getAmmeterDate();
|
||||||
boolean isToday= checkIsToday(pcsDate);
|
boolean isToday= checkIsToday(pcsDate);
|
||||||
if(isToday){
|
if(isToday){
|
||||||
dayChargeCap = dayChargeCap.add(sitePcsData.getChargedCap());
|
singleSiteBaseInfo.setDayChargedCap(sitePcsData.getChargedCap());
|
||||||
dayDisChargeCap = dayDisChargeCap.add(sitePcsData.getDisChargedCap());
|
singleSiteBaseInfo.setDayDisChargedCap(sitePcsData.getDisChargedCap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
singleSiteBaseInfo.setDayChargedCap(dayChargeCap);
|
|
||||||
singleSiteBaseInfo.setDayDisChargedCap(dayDisChargeCap);
|
|
||||||
singleSiteBaseInfo.setTotalChargedCap(totalChargeCap);
|
|
||||||
singleSiteBaseInfo.setTotalDisChargedCap(totalDisChargeCap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package com.xzzn.ems.service.impl;
|
|||||||
import com.xzzn.common.utils.StringUtils;
|
import com.xzzn.common.utils.StringUtils;
|
||||||
import com.xzzn.ems.domain.EmsBatteryData;
|
import com.xzzn.ems.domain.EmsBatteryData;
|
||||||
import com.xzzn.ems.domain.EmsCoolingData;
|
import com.xzzn.ems.domain.EmsCoolingData;
|
||||||
|
import com.xzzn.ems.domain.EmsDevicesSetting;
|
||||||
import com.xzzn.ems.domain.vo.*;
|
import com.xzzn.ems.domain.vo.*;
|
||||||
import com.xzzn.ems.mapper.*;
|
import com.xzzn.ems.mapper.*;
|
||||||
import com.xzzn.ems.service.ISingleSiteService;
|
import com.xzzn.ems.service.ISingleSiteService;
|
||||||
@ -50,40 +51,33 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
|||||||
SiteMonitorHomeVo siteMonitorHomeVo = new SiteMonitorHomeVo();
|
SiteMonitorHomeVo siteMonitorHomeVo = new SiteMonitorHomeVo();
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(siteId)) {
|
if (!StringUtils.isEmpty(siteId)) {
|
||||||
|
// 获取单站点的总充+总放+电网实时功率
|
||||||
|
Map<String,BigDecimal> pcsMap = emsPcsDataMapper.getPcsTotalChargeData(siteId);
|
||||||
|
if (pcsMap != null) {
|
||||||
|
siteMonitorHomeVo.setTotalChargedCap(pcsMap.get("totalChargedCap"));
|
||||||
|
siteMonitorHomeVo.setTotalDischargedCap(pcsMap.get("totalDischargedCap"));
|
||||||
|
siteMonitorHomeVo.setGridNrtPower(pcsMap.get("gridNrtPower"));
|
||||||
|
}
|
||||||
// 实时告警数据 名称+状态+告警内容
|
// 实时告警数据 名称+状态+告警内容
|
||||||
List<SiteMonitorHomeAlarmVo> siteMonitorHomeAlarmVo = emsAlarmRecordsMapper.getAlarmRecordsBySiteId(siteId);
|
List<SiteMonitorHomeAlarmVo> siteMonitorHomeAlarmVo = emsAlarmRecordsMapper.getAlarmRecordsBySiteId(siteId);
|
||||||
siteMonitorHomeVo.setSiteMonitorHomeAlarmVo(siteMonitorHomeAlarmVo);
|
siteMonitorHomeVo.setSiteMonitorHomeAlarmVo(siteMonitorHomeAlarmVo);
|
||||||
// 能量数据
|
// 能量数据
|
||||||
List<SiteMonitorDataVo> siteMonitorDataVoList = emsPcsDataMapper.getPcsDataBySiteId(siteId);
|
List<SiteMonitorDataVo> siteMonitorDataVoList = emsPcsDataMapper.getPcsDataBySiteId(siteId,6);
|
||||||
if (!CollectionUtils.isEmpty(siteMonitorDataVoList)) {
|
if (!CollectionUtils.isEmpty(siteMonitorDataVoList)) {
|
||||||
BigDecimal dayChargeCap = new BigDecimal(0);
|
|
||||||
BigDecimal dayDisChargeCap = new BigDecimal(0);
|
|
||||||
BigDecimal totalChargeCap = new BigDecimal(0);
|
|
||||||
BigDecimal totalDisChargeCap = new BigDecimal(0);
|
|
||||||
for (SiteMonitorDataVo sitePcsData : siteMonitorDataVoList) {
|
for (SiteMonitorDataVo sitePcsData : siteMonitorDataVoList) {
|
||||||
// 总充电量
|
|
||||||
totalChargeCap = totalChargeCap.add(sitePcsData.getChargedCap());
|
|
||||||
// 总放电量
|
|
||||||
totalDisChargeCap = totalDisChargeCap.add(sitePcsData.getDisChargedCap());
|
|
||||||
// 获取当天的充电量+放电量
|
// 获取当天的充电量+放电量
|
||||||
String pcsDate = sitePcsData.getAmmeterDate();
|
String pcsDate = sitePcsData.getAmmeterDate();
|
||||||
boolean isToday= checkIsToday(pcsDate);
|
boolean isToday= checkIsToday(pcsDate);
|
||||||
if(isToday){
|
if(isToday){
|
||||||
dayChargeCap = dayChargeCap.add(sitePcsData.getChargedCap());
|
siteMonitorHomeVo.setDayChargedCap(sitePcsData.getChargedCap());
|
||||||
dayDisChargeCap = dayDisChargeCap.add(sitePcsData.getDisChargedCap());
|
siteMonitorHomeVo.setDayDisChargedCap(sitePcsData.getDisChargedCap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
siteMonitorHomeVo.setDayChargedCap(dayChargeCap);
|
|
||||||
siteMonitorHomeVo.setDayDisChargedCap(dayDisChargeCap);
|
|
||||||
siteMonitorHomeVo.setTotalChargedCap(totalChargeCap);
|
|
||||||
siteMonitorHomeVo.setTotalDischargedCap(totalDisChargeCap);
|
|
||||||
// 储能可用电量
|
// 储能可用电量
|
||||||
BigDecimal energyStorageAvailElec = siteMonitorHomeVo.getTotalDischargedCap().subtract(siteMonitorHomeVo.getTotalChargedCap());
|
BigDecimal energyStorageAvailElec = siteMonitorHomeVo.getTotalDischargedCap().subtract(siteMonitorHomeVo.getTotalChargedCap());
|
||||||
siteMonitorHomeVo.setEnergyStorageAvailElec(energyStorageAvailElec);
|
siteMonitorHomeVo.setEnergyStorageAvailElec(energyStorageAvailElec);
|
||||||
}
|
}
|
||||||
siteMonitorHomeVo.setSiteMonitorDataVo(siteMonitorDataVoList);
|
siteMonitorHomeVo.setSiteMonitorDataVo(siteMonitorDataVoList);
|
||||||
// 电网实时功率
|
|
||||||
siteMonitorHomeVo.setGridNrtPower(emsPcsDataMapper.getGridNrtPower(siteId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return siteMonitorHomeVo;
|
return siteMonitorHomeVo;
|
||||||
@ -172,8 +166,7 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
|||||||
// 获取单体电池数据
|
// 获取单体电池数据
|
||||||
String stackDeviceId = bmsOverViewVo.getDeviceId();
|
String stackDeviceId = bmsOverViewVo.getDeviceId();
|
||||||
if (!StringUtils.isEmpty(stackDeviceId)) {
|
if (!StringUtils.isEmpty(stackDeviceId)) {
|
||||||
List<BMSBatteryDataList> batteryDataList = new ArrayList<>();
|
List<BMSBatteryDataList> batteryDataList = emsBatteryClusterMapper.getBmsBatteryData(siteId,stackDeviceId);
|
||||||
batteryDataList = emsBatteryClusterMapper.getBmsBatteryData(siteId,stackDeviceId);
|
|
||||||
bmsOverViewVo.setBatteryDataList(batteryDataList);
|
bmsOverViewVo.setBatteryDataList(batteryDataList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,53 +189,34 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
|||||||
List<BMSBatteryClusterDataList> clusterDataList = new ArrayList<>();
|
List<BMSBatteryClusterDataList> clusterDataList = new ArrayList<>();
|
||||||
if (!StringUtils.isEmpty(clusterDeviceId)) {
|
if (!StringUtils.isEmpty(clusterDeviceId)) {
|
||||||
// 获取单体电池数据-平均/最大/最小
|
// 获取单体电池数据-平均/最大/最小
|
||||||
BatteryClusterDataDetailVo batteryClusterDataDetailVo = emsBatteryDataMapper.getBatteryDataByClusterId(siteId,clusterDeviceId);
|
//BatteryClusterDataDetailVo batteryClusterDataDetailVo = emsBatteryDataMapper.getBatteryDataByClusterId(siteId,clusterDeviceId);
|
||||||
// 处理数据
|
// 处理数据
|
||||||
if (batteryClusterDataDetailVo != null) {
|
BMSBatteryClusterDataList voltageData = new BMSBatteryClusterDataList();
|
||||||
BMSBatteryClusterDataList voltageData = new BMSBatteryClusterDataList();
|
BMSBatteryClusterDataList tempData = new BMSBatteryClusterDataList();
|
||||||
BMSBatteryClusterDataList tempData = new BMSBatteryClusterDataList();
|
BMSBatteryClusterDataList socData = new BMSBatteryClusterDataList();
|
||||||
BMSBatteryClusterDataList socData = new BMSBatteryClusterDataList();
|
// 设值
|
||||||
// 设值
|
voltageData.setDataName(CLUSTER_DATA_VOLTAGE);
|
||||||
voltageData.setDataName(CLUSTER_DATA_VOLTAGE);
|
voltageData.setAvgData(bmsBatteryClusterVo.getAvgVoltage());
|
||||||
voltageData.setAvgData(batteryClusterDataDetailVo.getAvgVoltage());
|
voltageData.setMaxData(bmsBatteryClusterVo.getMaxVoltage());
|
||||||
voltageData.setMaxData(batteryClusterDataDetailVo.getMaxVoltage());
|
voltageData.setMaxDataID(bmsBatteryClusterVo.getMaxVoltageID());
|
||||||
voltageData.setMinData(batteryClusterDataDetailVo.getMinVoltage());
|
voltageData.setMinData(bmsBatteryClusterVo.getMinVoltage());
|
||||||
tempData.setDataName(CLUSTER_DATA_TEP);
|
voltageData.setMinDataID(bmsBatteryClusterVo.getMinVoltageID());
|
||||||
tempData.setAvgData(batteryClusterDataDetailVo.getAvgTemp());
|
tempData.setDataName(CLUSTER_DATA_TEP);
|
||||||
tempData.setMaxData(batteryClusterDataDetailVo.getMaxTemp());
|
tempData.setAvgData(bmsBatteryClusterVo.getAvgTemp());
|
||||||
tempData.setMinData(batteryClusterDataDetailVo.getMinTemp());
|
tempData.setMaxData(bmsBatteryClusterVo.getMaxTemp());
|
||||||
socData.setDataName(CLUSTER_DATA_SOC);
|
tempData.setMaxDataID(bmsBatteryClusterVo.getMaxTempID());
|
||||||
socData.setAvgData(batteryClusterDataDetailVo.getAvgSoc());
|
tempData.setMinData(bmsBatteryClusterVo.getMinTemp());
|
||||||
socData.setMaxData(batteryClusterDataDetailVo.getMaxSoc());
|
tempData.setMinDataID(bmsBatteryClusterVo.getMinTempID());
|
||||||
socData.setMinData(batteryClusterDataDetailVo.getMinSoc());
|
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());
|
||||||
|
|
||||||
// 设置对应单体id
|
clusterDataList.add(voltageData);
|
||||||
List<Map<String,Object>> dataIdMapList = emsBatteryDataMapper.getDataIdsMap(batteryClusterDataDetailVo);
|
clusterDataList.add(tempData);
|
||||||
Map<String,String> resultIdMap = new HashMap<>();
|
clusterDataList.add(socData);
|
||||||
if (!CollectionUtils.isEmpty(dataIdMapList)) {
|
|
||||||
resultIdMap = dataIdMapList.stream()
|
|
||||||
.filter(map -> map.containsKey("type") && map.containsKey("device_id")) // 过滤无效数据
|
|
||||||
.filter(map -> map.get("type") instanceof String && map.get("device_id") instanceof Number) // 确保类型正确
|
|
||||||
.collect(Collectors.toMap(
|
|
||||||
map -> (String) map.get("type"), // 键:type 字段
|
|
||||||
map -> (String) map.get("device_id"), // 值:device_id 转为 int
|
|
||||||
(existing, replacement) -> existing // 处理键冲突的策略
|
|
||||||
));
|
|
||||||
|
|
||||||
// 电压
|
|
||||||
voltageData.setMaxDataID(resultIdMap.get("maxVoltageId"));
|
|
||||||
voltageData.setMaxDataID(resultIdMap.get("maxVoltageId"));
|
|
||||||
// 温度
|
|
||||||
tempData.setMaxDataID(resultIdMap.get("maxTempId"));
|
|
||||||
tempData.setMinDataID(resultIdMap.get("minTempId"));
|
|
||||||
// soc
|
|
||||||
socData.setMaxDataID(resultIdMap.get("maxSocId"));
|
|
||||||
socData.setMinDataID(resultIdMap.get("minSocId"));
|
|
||||||
}
|
|
||||||
clusterDataList.add(voltageData);
|
|
||||||
clusterDataList.add(tempData);
|
|
||||||
clusterDataList.add(socData);
|
|
||||||
}
|
|
||||||
bmsBatteryClusterVo.setBatteryDataList(clusterDataList);
|
bmsBatteryClusterVo.setBatteryDataList(clusterDataList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -282,20 +256,26 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
|||||||
@Override
|
@Override
|
||||||
public List<AmmeterDataVo> getAmmeterDataList(String siteId) {
|
public List<AmmeterDataVo> getAmmeterDataList(String siteId) {
|
||||||
List<AmmeterDataVo> ammeterDataVos = new ArrayList<>();
|
List<AmmeterDataVo> ammeterDataVos = new ArrayList<>();
|
||||||
AmmeterDataVo ammeterDataVo = new AmmeterDataVo();
|
|
||||||
if (!StringUtils.isEmpty(siteId)) {
|
if (!StringUtils.isEmpty(siteId)) {
|
||||||
List<AmmeterDataDetailInfo> ammeterDataDetailInfos = emsAmmeterDataMapper.getAmmeterDetailInfo(siteId);
|
// 先获取所有电表设备
|
||||||
ammeterDataVo.setAmmeterDataDetailInfos(ammeterDataDetailInfos);
|
List<EmsDevicesSetting> devicesList = emsDevicesSettingMapper.getAllBatteryDeviceBySiteId(siteId);
|
||||||
if (!CollectionUtils.isEmpty(ammeterDataDetailInfos)) {
|
if (!CollectionUtils.isEmpty(devicesList)) {
|
||||||
// 获取通信状态
|
for (EmsDevicesSetting devicesSetting : devicesList) {
|
||||||
String deviceId = ammeterDataDetailInfos.get(0).getDeviceId();
|
AmmeterDataVo ammeterDataVo = new AmmeterDataVo();
|
||||||
Map<String,Object> map = emsDevicesSettingMapper.getDeviceStatus(deviceId);
|
ammeterDataVo.setDeviceName(devicesSetting.getDeviceName());
|
||||||
ammeterDataVo.setEmsCommunicationStatus(map.get("communication_status").toString());
|
ammeterDataVo.setEmsCommunicationStatus(devicesSetting.getCommunicationStatus());
|
||||||
// 数据更新时间
|
String deviceId = devicesSetting.getDeviceId();
|
||||||
ammeterDataVo.setDataUpdateTime(ammeterDataDetailInfos.get(0).getUpdateTime());
|
// 获取类别数据
|
||||||
|
List<AmmeterDataDetailInfo> ammeterDataDetailInfos = emsAmmeterDataMapper.getAmmeterDetailInfo(siteId,deviceId);
|
||||||
|
ammeterDataVo.setAmmeterDataDetailInfos(ammeterDataDetailInfos);
|
||||||
|
// 数据更新时间
|
||||||
|
ammeterDataVo.setDataUpdateTime(ammeterDataDetailInfos.get(0).getUpdateTime());
|
||||||
|
|
||||||
|
ammeterDataVos.add(ammeterDataVo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ammeterDataVos.add(ammeterDataVo);
|
|
||||||
return ammeterDataVos;
|
return ammeterDataVos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,19 +114,24 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="getAmmeterDetailInfo" parameterType="String" resultType="com.xzzn.ems.domain.vo.AmmeterDataDetailInfo">
|
<select id="getAmmeterDetailInfo" resultType="com.xzzn.ems.domain.vo.AmmeterDataDetailInfo">
|
||||||
select t.category as category,
|
SELECT t.category as category,
|
||||||
t.total_kwh as totalKwh,
|
t.total_kwh as totalKwh,
|
||||||
t.sharp_kwh as sharpKwh,
|
t.sharp_kwh as sharpKwh,
|
||||||
t.flat_kwh as flatKwh,
|
t.flat_kwh as flatKwh,
|
||||||
t.peak_kwh as peakKwh,
|
t.peak_kwh as peakKwh,
|
||||||
t.valley_kwh as valleyKwh,
|
|
||||||
t.device_id as deviceId,
|
t.device_id as deviceId,
|
||||||
|
t.valley_kwh as valleyKwh,
|
||||||
Max(t.data_update_time) as updateTime
|
Max(t.data_update_time) as updateTime
|
||||||
from ems_ammeter_data t
|
FROM ems_ammeter_data t
|
||||||
where t.site_id = #{siteId}
|
INNER JOIN (
|
||||||
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)
|
SELECT p.site_id, p.device_id,p.category,MAX(p.data_update_time) AS max_update_time
|
||||||
group by t.category,t.total_kwh,t.flat_kwh,t.peak_kwh,t.valley_kwh,t.device_id
|
FROM ems_ammeter_data p
|
||||||
|
WHERE p.site_id = #{siteId} and p.device_id = #{deviceId}
|
||||||
|
GROUP BY p.site_id,p.device_id,p.category
|
||||||
|
) latest on t.device_id = latest.device_id and t.data_update_time = latest.max_update_time
|
||||||
|
WHERE t.site_id = #{siteId} and t.device_id = #{deviceId}
|
||||||
|
group by t.category,t.total_kwh,t.sharp_kwh,t.flat_kwh,t.peak_kwh,t.valley_kwh,t.device_id
|
||||||
order by updateTime desc
|
order by updateTime desc
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -311,27 +311,45 @@
|
|||||||
|
|
||||||
<select id="getBMSBatteryCluster" parameterType="String" resultType="com.xzzn.ems.domain.vo.BMSBatteryClusterVo">
|
<select id="getBMSBatteryCluster" parameterType="String" resultType="com.xzzn.ems.domain.vo.BMSBatteryClusterVo">
|
||||||
select td.device_name as deviceName, tmp.work_status as workStatus,
|
select td.device_name as deviceName, tmp.work_status as workStatus,
|
||||||
tmp.pcs_communication_status as pcsCommunicationStatus, tmp.ems_communication_status as emsCommunicationStatus,
|
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_voltage as clusterVoltage,tmp.chargeable_capacity as chargeableCapacity,
|
||||||
tmp.cluster_current as clusterCurrent,tmp.dischargeable_capacity as dischargeableCapacity, tmp.total_discharged_capacity as totalDischargedCapacity,
|
tmp.total_charged_capacity as totalChargedCapacity,
|
||||||
tmp.soh as soh,tmp.average_temperature as averageTemperature,tmp.insulation_resistance as insulationResistance,
|
tmp.cluster_current as clusterCurrent,tmp.dischargeable_capacity as dischargeableCapacity,
|
||||||
tmp.current_soc as currentSoc,tmp.site_id as siteId,tmp.device_id as deviceId
|
tmp.total_discharged_capacity as totalDischargedCapacity,
|
||||||
from ems_battery_cluster tmp left join ems_devices_setting td on tmp.device_id = td.id and tmp.site_id = td.site_id
|
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,
|
||||||
|
tmp.avg_cell_voltage as avgVoltage,tmp.avg_cell_temp as avgTemp,tmp.avg_cell_temp as avgSoc,
|
||||||
|
tmp.max_cell_voltage as maxVoltage,tmp.max_cell_voltage_id as maxVoltageId,
|
||||||
|
tmp.min_cell_voltage as minVolatage,tmp.min_cell_voltage_id as minVoltageId,
|
||||||
|
tmp.max_cell_temp as maxTem,tmp.max_cell_temp_id as maxTempId,
|
||||||
|
tmp.min_cell_temp as minTemp,tmp.min_cell_temp_id as minTempId,
|
||||||
|
tmp.max_cell_soc as maxSoc,tmp.max_cell_soc_id as maxSocId,
|
||||||
|
tmp.min_cell_soc as minSoc,tmp.min_cell_soc_id as minSocId
|
||||||
|
from ems_battery_cluster tmp left join ems_devices_setting td on tmp.device_id = td.device_id and tmp.site_id = td.site_id
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT p.site_id, p.device_id, MAX(p.update_time) AS max_update_time
|
||||||
|
FROM ems_battery_cluster p
|
||||||
|
WHERE p.site_id = #{siteId}
|
||||||
|
GROUP BY p.site_id,p.device_id
|
||||||
|
) latest on tmp.device_id = latest.device_id and tmp.update_time = latest.max_update_time
|
||||||
where tmp.site_id = #{siteId}
|
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
|
order by tmp.device_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getBmsBatteryData" resultType="com.xzzn.ems.domain.vo.BMSBatteryDataList">
|
<select id="getBmsBatteryData" resultType="com.xzzn.ems.domain.vo.BMSBatteryDataList">
|
||||||
select t.cluster_voltage as clusterVoltage,t.cluster_current as clusterCurrent,
|
SELECT t.cluster_voltage as clusterVoltage,t.cluster_current as clusterCurrent,
|
||||||
t.current_soc as currentSoc,MAX(tb.voltage) as maxVoltage,MIN(tb.voltage) as minVoltage,
|
t.current_soc as currentSoc,t.site_id as siteId,t.device_id as clusterId,
|
||||||
MAX(tb.temperature) as maxTemperature,MIN(tb.temperature) as minTemperature,
|
t.max_cell_voltage as maxVoltage,t.min_cell_voltage as minVoltage,
|
||||||
tb.site_id as siteId,tb.cluster_device_id as clusterId,tb.device_id as stackDeviceId
|
t.max_cell_temp as maxTemperature,t.min_cell_temp as minTemperature
|
||||||
from ems_battery_cluster t left join ems_battery_data tb on t.device_id = tb.cluster_device_id
|
FROM ems_battery_cluster t
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT p.site_id, p.device_id, MAX(p.update_time) AS max_update_time
|
||||||
|
FROM ems_battery_cluster p
|
||||||
|
WHERE p.site_id = #{siteId} and p.stack_device_id = #{stackDeviceId}
|
||||||
|
GROUP BY p.site_id,p.device_id
|
||||||
|
) latest on t.device_id = latest.device_id and t.update_time = latest.max_update_time
|
||||||
where t.site_id = #{siteId} and t.stack_device_id = #{stackDeviceId}
|
where t.site_id = #{siteId} and t.stack_device_id = #{stackDeviceId}
|
||||||
and t.update_time = (select MAX(update_time) FROM ems_battery_cluster where site_id = t.site_id
|
group by t.cluster_voltage,t.cluster_current,t.current_soc,t.site_id,t.device_id,t.max_cell_voltage,t.min_cell_voltage,
|
||||||
and device_id = t.device_id and stack_device_id = t.stack_device_id)
|
t.max_cell_temp,t.min_cell_temp
|
||||||
group by t.cluster_voltage,t.cluster_current,t.current_soc,tb.site_id,tb.cluster_device_id,tb.device_id
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -126,8 +126,8 @@
|
|||||||
|
|
||||||
<select id="getBatteryDataBySiteId" parameterType="String" resultMap="EmsBatteryDataResult">
|
<select id="getBatteryDataBySiteId" parameterType="String" resultMap="EmsBatteryDataResult">
|
||||||
<include refid="selectEmsBatteryDataVo"/>
|
<include refid="selectEmsBatteryDataVo"/>
|
||||||
where site_id = #{siteId}
|
WHERE site_id = #{siteId} AND data_timestamp >= CURDATE()
|
||||||
and DATE(data_timestamp) = DATE(NOW())
|
ORDER BY data_timestamp desc limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getBatteryDataByClusterId" resultType="com.xzzn.ems.domain.vo.BatteryClusterDataDetailVo">
|
<select id="getBatteryDataByClusterId" resultType="com.xzzn.ems.domain.vo.BatteryClusterDataDetailVo">
|
||||||
|
@ -305,16 +305,23 @@
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="selectEmsBatteryStackBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.BMSOverViewVo">
|
<select id="selectEmsBatteryStackBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.BMSOverViewVo">
|
||||||
select td.device_name as deviceName,tmp.work_status as workStatus,
|
SELECT td.device_name as deviceName,tmp.work_status as workStatus,
|
||||||
tmp.pcs_communication_status as pcsCommunicationStatus,tmp.ems_communication_status as emsCommunicationStatus,
|
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_voltage as totalVoltage,tmp.chargeable_capacity as chargeableCapacity,
|
||||||
tmp.total_current as totalCurrent,tmp.dischargeable_capacity as dischargeableCapacity,tmp.total_discharged_capacity as totalDischargedCapacity,
|
tmp.total_charged_capacity as totalChargedCapacity,
|
||||||
tmp.soh as soh,tmp.average_temperature as averageTemperature,tmp.insulation_resistance as insulationResistance,
|
tmp.total_current as totalCurrent,tmp.dischargeable_capacity as dischargeableCapacity,
|
||||||
tmp.current_soc as currentSoc,tmp.site_id as siteId,tmp.device_id as deviceId
|
tmp.total_discharged_capacity as totalDischargedCapacity,
|
||||||
from ems_battery_stack tmp left join ems_devices_setting td on tmp.device_id = td.device_id and tmp.site_id = td.site_id
|
tmp.soh as soh,tmp.average_temperature as averageTemperature,tmp.insulation_resistance as insulationResistance,
|
||||||
where tmp.site_id = #{siteId}
|
tmp.current_soc as currentSoc,tmp.site_id as siteId,tmp.device_id as deviceId
|
||||||
and tmp.update_time = (select MAX(t.update_time) FROM ems_battery_stack t where t.site_id = tmp.site_id
|
FROM ems_battery_stack tmp
|
||||||
and t.device_id = tmp.device_id)
|
left join ems_devices_setting td on tmp.device_id = td.device_id and tmp.site_id = td.site_id
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT p.site_id, p.device_id, MAX(p.update_time) AS max_update_time
|
||||||
|
FROM ems_battery_stack p
|
||||||
|
WHERE p.site_id = #{siteId}
|
||||||
|
GROUP BY p.site_id,p.device_id
|
||||||
|
) latest on tmp.device_id = latest.device_id and tmp.update_time = latest.max_update_time
|
||||||
|
WHERE tmp.site_id = #{siteId}
|
||||||
order by tmp.device_id
|
order by tmp.device_id
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -151,9 +151,11 @@
|
|||||||
where device_id in (select distinct eb.device_id from ems_battery_cluster eb where eb.stack_device_id = #{stackDeviceId})
|
where device_id in (select distinct eb.device_id from ems_battery_cluster eb where eb.stack_device_id = #{stackDeviceId})
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDeviceStatus" parameterType="String" resultType="java.util.Map">
|
<select id="getAllBatteryDeviceBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.EmsDevicesSetting">
|
||||||
select device_id as id,communication_status
|
select distinct e.device_id as deviceId,
|
||||||
from ems_devices_setting
|
t.device_name as deviceName,
|
||||||
where device_id = #{deviceId}
|
t.communication_status as communicationStatus
|
||||||
|
from ems_devices_setting t INNER JOIN ems_ammeter_data e on t.site_id = e.site_id and t.device_id = e.device_id
|
||||||
|
where t.site_id = #{siteId}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -214,7 +214,7 @@
|
|||||||
WHERE t.site_id = #{siteId} AND t.device_id = #{deviceId}
|
WHERE t.site_id = #{siteId} AND t.device_id = #{deviceId}
|
||||||
) tmp
|
) tmp
|
||||||
WHERE rn = 1
|
WHERE rn = 1
|
||||||
ORDER BY tmp.branch_id;
|
ORDER BY tmp.branch_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertPcsBranchDataList" parameterType="java.util.List">
|
<insert id="insertPcsBranchDataList" parameterType="java.util.List">
|
||||||
|
@ -279,45 +279,57 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="getPcsDataBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
<select id="getPcsDataBySiteId" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
||||||
select CONCAT(date_month,'/',date_day) as ammeterDate,
|
select CONCAT(t.date_month,'/',t.date_day) as ammeterDate,
|
||||||
sum(daily_ac_charge_energy) as chargedCap,
|
sum(t.daily_ac_charge_energy) as chargedCap,
|
||||||
sum(daily_ac_discharge_energy) as disChargedCap
|
sum(t.daily_ac_discharge_energy) as disChargedCap
|
||||||
from ems_pcs_data
|
from (
|
||||||
where site_id = #{siteId}
|
SELECT p.site_id, p.device_id,p.date_month,p.date_day, MAX(p.data_update_time) AS max_update_time
|
||||||
and date_sub(CURDATE(), interval 6 day) <= create_time
|
FROM ems_pcs_data p
|
||||||
group by date_month,date_day
|
where p.site_id = #{siteId} and p.create_time >= CURDATE() - INTERVAL #{limitTime} DAY
|
||||||
</select>
|
GROUP BY p.site_id,p.device_id,p.date_month,p.date_day
|
||||||
|
) latest inner join ems_pcs_data t ON latest.site_id = t.site_id
|
||||||
<select id="getGridNrtPower" parameterType="String" resultType="java.math.BigDecimal">
|
AND latest.device_id = t.device_id
|
||||||
select sum(total_active_power) as gridNrtPower
|
AND latest.max_update_time = t.data_update_time
|
||||||
from ems_pcs_data
|
and latest.date_month = t.date_month
|
||||||
where site_id = #{siteId}
|
and latest.date_day = t.date_day
|
||||||
|
group by ammeterDate
|
||||||
|
order by ammeterDate desc;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPcsTotalChargeData" resultType="map">
|
<select id="getPcsTotalChargeData" resultType="map">
|
||||||
select SUM(t.daily_ac_charge_energy) as totalChargedCap,
|
SELECT
|
||||||
SUM(t.daily_ac_discharge_energy) as totalDischargedCap
|
SUM(t.total_ac_charge_energy) AS totalChargedCap,
|
||||||
from ems_pcs_data t
|
SUM(t.total_ac_discharge_energy) AS totalDischargedCap,
|
||||||
where t.data_update_time = (select MAX(data_update_time) FROM ems_pcs_data
|
SUM(t.total_active_power) as gridNrtPower
|
||||||
where site_id = t.site_id and device_id = t.device_id and date_month = t.date_month and date_day = t.date_day)
|
FROM (
|
||||||
|
SELECT p.site_id, p.device_id, MAX(p.data_update_time) AS max_update_time
|
||||||
|
FROM ems_pcs_data p inner join ems_site_setting s on p.site_id = s.site_id
|
||||||
|
<if test="siteId != null and siteId != ''">
|
||||||
|
where p.site_id = #{siteId}
|
||||||
|
</if>
|
||||||
|
GROUP BY p.site_id,p.device_id
|
||||||
|
) latest inner join ems_pcs_data t ON latest.site_id = t.site_id
|
||||||
|
AND latest.device_id = t.device_id
|
||||||
|
AND latest.max_update_time = t.data_update_time
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getSiteRunningHeadInfo" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteMonitorRunningHeadInfoVo">
|
<select id="getSiteRunningHeadInfo" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteMonitorRunningHeadInfoVo">
|
||||||
select sum(a.total_active_power) as totalActivePower,
|
SELECT
|
||||||
sum(a.total_reactive_power) as totalReactivePower,
|
SUM(t.total_active_power) as totalActivePower,
|
||||||
sum(a.daily_ac_charge_energy) as dayChargedCap,
|
SUM(t.total_reactive_power) as totalReactivePower,
|
||||||
sum(a.daily_ac_discharge_energy) as dayDisChargedCap
|
sum(t.daily_ac_charge_energy) as dayChargedCap,
|
||||||
from (
|
sum(t.daily_ac_discharge_energy) as dayDisChargedCap,
|
||||||
select t.total_active_power,t.total_reactive_power,
|
#{siteId} as siteId
|
||||||
t.daily_ac_charge_energy,t.daily_ac_discharge_energy,
|
FROM (
|
||||||
t.device_id,t.site_id,t.create_time
|
SELECT p.device_id, MAX(p.data_update_time) AS max_update_time
|
||||||
from ems_pcs_data t
|
FROM ems_pcs_data p
|
||||||
where t.site_id = #{siteId}
|
where p.site_id = #{siteId}
|
||||||
and t.create_time = (select MAX(create_time) FROM ems_pcs_data where site_id = t.site_id and device_id = t.device_id)
|
and p.data_update_time >= CURDATE()
|
||||||
group by t.device_id,t.total_active_power, total_reactive_power,
|
GROUP BY p.device_id
|
||||||
t.daily_ac_charge_energy,t.daily_ac_discharge_energy,t.site_id,t.create_time
|
) latest inner join ems_pcs_data t ON latest.device_id = t.device_id
|
||||||
) a
|
AND latest.max_update_time = t.data_update_time
|
||||||
|
AND t.site_id = #{siteId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getElectDataList" resultType="com.xzzn.ems.domain.vo.ElectricIndexList">
|
<select id="getElectDataList" resultType="com.xzzn.ems.domain.vo.ElectricIndexList">
|
||||||
@ -335,7 +347,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPcsDetailInfoBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.PcsDetailInfoVo">
|
<select id="getPcsDetailInfoBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.PcsDetailInfoVo">
|
||||||
select td.device_name as deviceName,
|
SELECT td.device_name as deviceName,
|
||||||
td.communication_status as communicationStatus,
|
td.communication_status as communicationStatus,
|
||||||
tmp.site_id as siteId,
|
tmp.site_id as siteId,
|
||||||
tmp.device_id as deviceId,
|
tmp.device_id as deviceId,
|
||||||
@ -349,10 +361,14 @@
|
|||||||
tmp.c_phase_current as cPhaseVoltage,tmp.c_phase_current as cPhaseCurrent,
|
tmp.c_phase_current as cPhaseVoltage,tmp.c_phase_current as cPhaseCurrent,
|
||||||
tmp.total_power_factor as totalPowerFactor,
|
tmp.total_power_factor as totalPowerFactor,
|
||||||
tmp.pcs_environment_temperature as pcsEnvironmentTemperature,tmp.ac_frequency as acFrequency
|
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.device_id and tmp.site_id = td.site_id
|
FROM ems_pcs_data tmp
|
||||||
where tmp.site_id = #{siteId}
|
LEFT JOIN ems_devices_setting td on tmp.device_id = td.device_id and tmp.site_id = td.site_id
|
||||||
and tmp.data_update_time = (select MAX(data_update_time) FROM ems_pcs_data where site_id = tmp.site_id
|
INNER JOIN ( SELECT p.site_id, p.device_id, MAX(p.data_update_time) AS max_update_time
|
||||||
and device_id = tmp.device_id)
|
FROM ems_pcs_data p
|
||||||
|
WHERE p.site_id = #{siteId}
|
||||||
|
GROUP BY p.site_id,p.device_id
|
||||||
|
) latest on tmp.device_id = latest.device_id and tmp.data_update_time = latest.max_update_time
|
||||||
|
WHERE tmp.site_id = #{siteId}
|
||||||
order by tmp.device_id
|
order by tmp.device_id
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
107
ems-system/src/main/resources/mapper/ems/EmsTicketMapper.xml
Normal file
107
ems-system/src/main/resources/mapper/ems/EmsTicketMapper.xml
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<?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.EmsTicketMapper">
|
||||||
|
|
||||||
|
<resultMap type="EmsTicket" id="EmsTicketResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="ticketNo" column="ticket_no" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="title" column="title" />
|
||||||
|
<result property="content" column="content" />
|
||||||
|
<result property="images" column="images" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="completeTime" column="complete_time" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="workUserId" column="work_user_id" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEmsTicketVo">
|
||||||
|
select id, ticket_no, user_id, title, content, images, status, create_time, complete_time, create_by, update_by, update_time, work_user_id from ems_ticket
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEmsTicketList" parameterType="EmsTicket" resultMap="EmsTicketResult">
|
||||||
|
<include refid="selectEmsTicketVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="ticketNo != null and ticketNo != ''"> and ticket_no = #{ticketNo}</if>
|
||||||
|
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
|
||||||
|
<if test="title != null and title != ''"> and title = #{title}</if>
|
||||||
|
<if test="content != null and content != ''"> and content = #{content}</if>
|
||||||
|
<if test="images != null and images != ''"> and images = #{images}</if>
|
||||||
|
<if test="status != null "> and status = #{status}</if>
|
||||||
|
<if test="completeTime != null "> and complete_time = #{completeTime}</if>
|
||||||
|
<if test="workUserId != null "> and work_user_id = #{workUserId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEmsTicketById" parameterType="String" resultMap="EmsTicketResult">
|
||||||
|
<include refid="selectEmsTicketVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEmsTicket" parameterType="EmsTicket" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into ems_ticket
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="ticketNo != null and ticketNo != ''">ticket_no,</if>
|
||||||
|
<if test="userId != null and userId != ''">user_id,</if>
|
||||||
|
<if test="title != null and title != ''">title,</if>
|
||||||
|
<if test="content != null and content != ''">content,</if>
|
||||||
|
<if test="images != null">images,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="completeTime != null">complete_time,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="workUserId != null">work_user_id,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="ticketNo != null and ticketNo != ''">#{ticketNo},</if>
|
||||||
|
<if test="userId != null and userId != ''">#{userId},</if>
|
||||||
|
<if test="title != null and title != ''">#{title},</if>
|
||||||
|
<if test="content != null and content != ''">#{content},</if>
|
||||||
|
<if test="images != null">#{images},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="completeTime != null">#{completeTime},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="workUserId != null">#{workUserId},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEmsTicket" parameterType="EmsTicket">
|
||||||
|
update ems_ticket
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="ticketNo != null and ticketNo != ''">ticket_no = #{ticketNo},</if>
|
||||||
|
<if test="userId != null and userId != ''">user_id = #{userId},</if>
|
||||||
|
<if test="title != null and title != ''">title = #{title},</if>
|
||||||
|
<if test="content != null and content != ''">content = #{content},</if>
|
||||||
|
<if test="images != null">images = #{images},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="completeTime != null">complete_time = #{completeTime},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="workUserId != null">work_user_id = #{workUserId},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteEmsTicketById" parameterType="String">
|
||||||
|
delete from ems_ticket where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteEmsTicketByIds" parameterType="String">
|
||||||
|
delete from ems_ticket where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
Reference in New Issue
Block a user