数据20250904优化
This commit is contained in:
@ -100,7 +100,7 @@ public class EmsStatisticalReportController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 概率统计-获取总表
|
* 概率统计-获取站点下所有电表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getLoadNameList")
|
@GetMapping("/getLoadNameList")
|
||||||
public AjaxResult getLoadNameList(String siteId)
|
public AjaxResult getLoadNameList(String siteId)
|
||||||
|
|||||||
@ -57,6 +57,9 @@ public class BMSBatteryClusterVo {
|
|||||||
/** 设备唯一标识符 */
|
/** 设备唯一标识符 */
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
|
/** 父类设备名称 */
|
||||||
|
private String parentDeviceName;
|
||||||
|
|
||||||
private List<BMSBatteryClusterDataList> batteryDataList;
|
private List<BMSBatteryClusterDataList> batteryDataList;
|
||||||
|
|
||||||
public String getDeviceName() {
|
public String getDeviceName() {
|
||||||
@ -194,4 +197,12 @@ public class BMSBatteryClusterVo {
|
|||||||
public void setBatteryDataList(List<BMSBatteryClusterDataList> batteryDataList) {
|
public void setBatteryDataList(List<BMSBatteryClusterDataList> batteryDataList) {
|
||||||
this.batteryDataList = batteryDataList;
|
this.batteryDataList = batteryDataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getParentDeviceName() {
|
||||||
|
return parentDeviceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentDeviceName(String parentDeviceName) {
|
||||||
|
this.parentDeviceName = parentDeviceName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,10 @@ public class SiteMonitorDataVo {
|
|||||||
|
|
||||||
private BigDecimal dailyEfficiency;
|
private BigDecimal dailyEfficiency;
|
||||||
|
|
||||||
|
private BigDecimal totalChargedCap;
|
||||||
|
|
||||||
|
private BigDecimal totalDisChargedCap;
|
||||||
|
|
||||||
public String getAmmeterDate() {
|
public String getAmmeterDate() {
|
||||||
return ammeterDate;
|
return ammeterDate;
|
||||||
}
|
}
|
||||||
@ -55,4 +59,20 @@ public class SiteMonitorDataVo {
|
|||||||
public void setDailyEfficiency(BigDecimal dailyEfficiency) {
|
public void setDailyEfficiency(BigDecimal dailyEfficiency) {
|
||||||
this.dailyEfficiency = dailyEfficiency;
|
this.dailyEfficiency = dailyEfficiency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getTotalChargedCap() {
|
||||||
|
return totalChargedCap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalChargedCap(BigDecimal totalChargedCap) {
|
||||||
|
this.totalChargedCap = totalChargedCap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getTotalDisChargedCap() {
|
||||||
|
return totalDisChargedCap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalDisChargedCap(BigDecimal totalDisChargedCap) {
|
||||||
|
this.totalDisChargedCap = totalDisChargedCap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.xzzn.ems.domain.EmsDailyChargeData;
|
import com.xzzn.ems.domain.EmsDailyChargeData;
|
||||||
|
import com.xzzn.ems.domain.vo.ElectricIndexList;
|
||||||
import com.xzzn.ems.domain.vo.SiteMonitorDataVo;
|
import com.xzzn.ems.domain.vo.SiteMonitorDataVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -76,4 +77,9 @@ public interface EmsDailyChargeDataMapper
|
|||||||
|
|
||||||
// 按天获取站点每日总充总放
|
// 按天获取站点每日总充总放
|
||||||
public List<SiteMonitorDataVo> getTotalChargeDataByDay(@Param("siteId")String siteId,@Param("startDate")Date startDate, @Param("endDate")Date endDate);
|
public List<SiteMonitorDataVo> getTotalChargeDataByDay(@Param("siteId")String siteId,@Param("startDate")Date startDate, @Param("endDate")Date endDate);
|
||||||
|
|
||||||
|
// 按月获取站点每日总充总放
|
||||||
|
public List<SiteMonitorDataVo> getTotalChargeDataByMonth(@Param("siteId")String siteId,@Param("startDate")Date startDate, @Param("endDate")Date endDate);
|
||||||
|
|
||||||
|
public List<ElectricIndexList> getAllSiteChargeDataByMonth();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,11 +77,11 @@ public interface EmsDevicesSettingMapper
|
|||||||
public List<Map<String, Object>> getDeviceInfosBySiteIdAndCategory(@Param("siteId")String siteId, @Param("deviceCategory")String deviceCategory);
|
public List<Map<String, Object>> getDeviceInfosBySiteIdAndCategory(@Param("siteId")String siteId, @Param("deviceCategory")String deviceCategory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取该设备下的总表
|
* 获取该设备下所有的电表
|
||||||
* @param siteId
|
* @param siteId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Map<String, Object>> getLoadNameList(String siteId);
|
public List<Map<String, Object>> getAmmeterNameList(String siteId);
|
||||||
|
|
||||||
public EmsDevicesSetting getDeviceBySiteAndDeviceId(@Param("deviceId")String deviceId, @Param("siteId")String siteId);
|
public EmsDevicesSetting getDeviceBySiteAndDeviceId(@Param("deviceId")String deviceId, @Param("siteId")String siteId);
|
||||||
|
|
||||||
|
|||||||
@ -92,12 +92,6 @@ public interface EmsPcsDataMapper
|
|||||||
*/
|
*/
|
||||||
public List<PcsDetailInfoVo> getPcsDetailInfoBySiteId(String siteId);
|
public List<PcsDetailInfoVo> getPcsDetailInfoBySiteId(String siteId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取总充+总放
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Map<String, BigDecimal> getPcsTotalChargeData(String siteId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据时间按天获取充放电量
|
* 根据时间按天获取充放电量
|
||||||
* @param siteId
|
* @param siteId
|
||||||
@ -106,14 +100,7 @@ public interface EmsPcsDataMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<SiteMonitorDataVo> getPcsDataByDay(@Param("siteId")String siteId, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
|
public List<SiteMonitorDataVo> getPcsDataByDay(@Param("siteId")String siteId, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
|
||||||
/**
|
|
||||||
* 根据时间按月获取充放电量
|
|
||||||
* @param siteId
|
|
||||||
* @param startDate
|
|
||||||
* @param endDate
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<SiteMonitorDataVo> getPcsDataByMonth(@Param("siteId")String siteId, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
|
|
||||||
/**
|
/**
|
||||||
* 根据时间按小时获取充放电量
|
* 根据时间按小时获取充放电量
|
||||||
* @param siteId
|
* @param siteId
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.xzzn.ems.service.impl;
|
package com.xzzn.ems.service.impl;
|
||||||
|
|
||||||
import com.xzzn.common.utils.DateUtils;
|
import com.xzzn.common.utils.DateUtils;
|
||||||
|
import com.xzzn.ems.domain.EmsAmmeterData;
|
||||||
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.IEmsStatsReportService;
|
import com.xzzn.ems.service.IEmsStatsReportService;
|
||||||
@ -70,37 +71,38 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
|
|||||||
|
|
||||||
String siteId = requestVo.getSiteId();
|
String siteId = requestVo.getSiteId();
|
||||||
String deviceId = requestVo.getDeviceId();
|
String deviceId = requestVo.getDeviceId();
|
||||||
if ("021_DDS_01".equals(siteId)){
|
|
||||||
deviceId = "METE";
|
|
||||||
} else if ("021_FXX_01".equals(siteId)){
|
|
||||||
deviceId = "LOAD";
|
|
||||||
}
|
|
||||||
// 日期筛选
|
// 日期筛选
|
||||||
List<SiteMonitorDataVo> dataList = new ArrayList();
|
List<SiteMonitorDataVo> dataList = new ArrayList();
|
||||||
// 开始日期和结束日期同一天,展示 0-24 小时数据
|
// 开始日期和结束日期同一天,展示 0-24 小时数据
|
||||||
if (DateUtils.isSameDay(startDate, endDate)){
|
if (DateUtils.isSameDay(startDate, endDate)){
|
||||||
electricDataInfoVo.setUnit("时");
|
electricDataInfoVo.setUnit("时");
|
||||||
//endDate = DateUtils.addDays(endDate, 1);
|
if ("021_DDS_01".equals(siteId)) {
|
||||||
//dataList = emsPcsDataMapper.getPcsDataByHour(requestVo.getSiteId(), startDate, endDate);
|
deviceId = "METE";
|
||||||
dataList = emsAmmeterDataMapper.getChargeDataByHour(siteId,deviceId,startDate);
|
dataList = emsAmmeterDataMapper.getChargeDataByHour(siteId,deviceId,startDate);
|
||||||
|
} else if ("021_FXX_01".equals(siteId)) {
|
||||||
|
endDate = DateUtils.addDays(endDate, 1);
|
||||||
|
dataList = emsPcsDataMapper.getPcsDataByHour(requestVo.getSiteId(), startDate, endDate);
|
||||||
|
}
|
||||||
} else if (DateUtils.differentDaysByMillisecond(endDate, startDate) >= 1
|
} else if (DateUtils.differentDaysByMillisecond(endDate, startDate) >= 1
|
||||||
&& DateUtils.differentDaysByMillisecond(endDate, startDate) < 30){
|
&& DateUtils.differentDaysByMillisecond(endDate, startDate) < 30){
|
||||||
electricDataInfoVo.setUnit("日");
|
electricDataInfoVo.setUnit("日");
|
||||||
// 开始日期-结束日期大于 1 天,小于30 天,按天展示数据
|
// 开始日期-结束日期大于 1 天,小于30 天,按天展示数据
|
||||||
//dataList = emsPcsDataMapper.getPcsDataByDay(requestVo.getSiteId(), startDate, endDate);
|
|
||||||
dataList = emsDailyChargeDataMapper.getTotalChargeDataByDay(siteId,startDate,endDate);
|
dataList = emsDailyChargeDataMapper.getTotalChargeDataByDay(siteId,startDate,endDate);
|
||||||
} else if (DateUtils.differentDaysByMillisecond(endDate, startDate) >= 30){
|
} else if (DateUtils.differentDaysByMillisecond(endDate, startDate) >= 30){
|
||||||
electricDataInfoVo.setUnit("月");
|
electricDataInfoVo.setUnit("月");
|
||||||
// 开始日期-结束日期大于 1 个月,按月展示数据
|
// 开始日期-结束日期大于 1 个月,按月展示数据
|
||||||
dataList = emsAmmeterDataMapper.getChargeDataByMonth(requestVo.getSiteId(),deviceId, startDate, endDate);
|
dataList = emsDailyChargeDataMapper.getTotalChargeDataByMonth(siteId,startDate, endDate);
|
||||||
}
|
}
|
||||||
// 根据时间获取每天的充放电量
|
// 获取昨天昨晚一条数据,计算第一个小时的差值
|
||||||
|
//setFirstDataDiff(dataList,siteId,deviceId);
|
||||||
|
// 计算充放电效率
|
||||||
if (!CollectionUtils.isEmpty(dataList)){
|
if (!CollectionUtils.isEmpty(dataList)){
|
||||||
|
|
||||||
for (SiteMonitorDataVo siteMonitorDataVo : dataList) {
|
for (SiteMonitorDataVo siteMonitorDataVo : dataList) {
|
||||||
// 计算单天的效率
|
// 计算单天的效率
|
||||||
BigDecimal dailyEfficiency = new BigDecimal(0);
|
BigDecimal dailyEfficiency = new BigDecimal(0);
|
||||||
if ( siteMonitorDataVo.getChargedCap().compareTo(BigDecimal.ZERO)>0){
|
if ( siteMonitorDataVo.getChargedCap() != null &&
|
||||||
|
siteMonitorDataVo.getChargedCap().compareTo(BigDecimal.ZERO)>0){
|
||||||
dailyEfficiency = siteMonitorDataVo.getDisChargedCap().divide(siteMonitorDataVo.getChargedCap(), 2, RoundingMode.HALF_UP);
|
dailyEfficiency = siteMonitorDataVo.getDisChargedCap().divide(siteMonitorDataVo.getChargedCap(), 2, RoundingMode.HALF_UP);
|
||||||
dailyEfficiency = dailyEfficiency.multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
dailyEfficiency = dailyEfficiency.multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||||
}
|
}
|
||||||
@ -112,6 +114,29 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
|
|||||||
return electricDataInfoVo;
|
return electricDataInfoVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setFirstDataDiff(List<SiteMonitorDataVo> dataList, String siteId, String deviceId) {
|
||||||
|
BigDecimal yestTotalDisChargeDate = new BigDecimal(0);
|
||||||
|
BigDecimal yestTotalChargeDate = new BigDecimal(0);
|
||||||
|
|
||||||
|
String yestDate = DateUtils.getYesterdayDate();
|
||||||
|
if (dataList != null && dataList.size()>0){
|
||||||
|
SiteMonitorDataVo firstData = dataList.get(0);
|
||||||
|
if ("021_DDS_01".equals(siteId)){
|
||||||
|
EmsAmmeterData yestData = emsAmmeterDataMapper.getYestLatestDate(siteId,deviceId,yestDate);
|
||||||
|
if (yestData != null) {
|
||||||
|
yestTotalDisChargeDate = yestData.getCurrentReverseActiveTotal();
|
||||||
|
yestTotalChargeDate = yestData.getCurrentForwardActiveTotal();
|
||||||
|
}
|
||||||
|
} else if ("021_FXX_01".equals(siteId)) {
|
||||||
|
|
||||||
|
}
|
||||||
|
firstData.setChargedCap(firstData.getTotalChargedCap() == null ? BigDecimal.ZERO
|
||||||
|
: firstData.getTotalChargedCap().subtract(yestTotalChargeDate));
|
||||||
|
firstData.setDisChargedCap(firstData.getTotalDisChargedCap() == null ? BigDecimal.ZERO
|
||||||
|
: firstData.getTotalDisChargedCap().subtract(yestTotalDisChargeDate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// pcs曲线数据
|
// pcs曲线数据
|
||||||
@Override
|
@Override
|
||||||
public List<PcsStatisListVo> getPCSDataResult(DateSearchRequest requestVo) {
|
public List<PcsStatisListVo> getPCSDataResult(DateSearchRequest requestVo) {
|
||||||
@ -188,7 +213,7 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getLoadNameList(String siteId) {
|
public List<Map<String, Object>> getLoadNameList(String siteId) {
|
||||||
return emsDevicesSettingMapper.getLoadNameList(siteId);
|
return emsDevicesSettingMapper.getAmmeterNameList(siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 电表报表
|
// 电表报表
|
||||||
|
|||||||
@ -113,7 +113,7 @@ public class HomePageServiceImpl implements IHomePageService
|
|||||||
HomePageDataViewVo homePageDataViewVo = new HomePageDataViewVo();
|
HomePageDataViewVo homePageDataViewVo = new HomePageDataViewVo();
|
||||||
// 电量指标
|
// 电量指标
|
||||||
//List<ElectricIndexList> electricDataList = emsPcsDataMapper.getElectDataList();
|
//List<ElectricIndexList> electricDataList = emsPcsDataMapper.getElectDataList();
|
||||||
List<ElectricIndexList> electricDataList = getElectricDataList();
|
List<ElectricIndexList> electricDataList = getElectricDataList2();
|
||||||
homePageDataViewVo.setElecDataList(electricDataList);
|
homePageDataViewVo.setElecDataList(electricDataList);
|
||||||
// 系统效率
|
// 系统效率
|
||||||
List<SystemEfficiencyList> systemEfficiencyLists = new ArrayList<>();
|
List<SystemEfficiencyList> systemEfficiencyLists = new ArrayList<>();
|
||||||
@ -159,6 +159,12 @@ public class HomePageServiceImpl implements IHomePageService
|
|||||||
return homePageDataViewVo;
|
return homePageDataViewVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<ElectricIndexList> getElectricDataList2() {
|
||||||
|
List<ElectricIndexList> electricDataList = new ArrayList<>();
|
||||||
|
electricDataList = emsDailyChargeDataMapper.getAllSiteChargeDataByMonth();
|
||||||
|
return electricDataList;
|
||||||
|
}
|
||||||
|
|
||||||
private List<ElectricIndexList> getElectricDataList() {
|
private List<ElectricIndexList> getElectricDataList() {
|
||||||
List<ElectricIndexList> electricDataList = new ArrayList<>();
|
List<ElectricIndexList> electricDataList = new ArrayList<>();
|
||||||
// 获取每个月最早和最晚的时间
|
// 获取每个月最早和最晚的时间
|
||||||
|
|||||||
@ -321,9 +321,11 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
|||||||
for (Map<String, Object> clusterDevice : clusterIds) {
|
for (Map<String, Object> clusterDevice : clusterIds) {
|
||||||
BMSBatteryClusterVo bmsBatteryClusterVo = new BMSBatteryClusterVo();
|
BMSBatteryClusterVo bmsBatteryClusterVo = new BMSBatteryClusterVo();
|
||||||
bmsBatteryClusterVo.setDeviceName(clusterDevice.get("deviceName").toString());
|
bmsBatteryClusterVo.setDeviceName(clusterDevice.get("deviceName").toString());
|
||||||
|
bmsBatteryClusterVo.setParentDeviceName(clusterDevice.get("parentDeviceName").toString());
|
||||||
// 从redis取单个簇详细数据
|
// 从redis取单个簇详细数据
|
||||||
String clusterId = clusterDevice.get("id").toString();
|
String clusterId = clusterDevice.get("id").toString();
|
||||||
EmsBatteryCluster clusterData = redisCache.getCacheObject(RedisKeyConstants.CLUSTER +siteId+"_"+clusterId);
|
EmsBatteryCluster clusterData = redisCache.getCacheObject(RedisKeyConstants.CLUSTER +siteId+"_"+clusterId);
|
||||||
|
String parentDeviceId = "";
|
||||||
if (clusterData != null) {
|
if (clusterData != null) {
|
||||||
BeanUtils.copyProperties(clusterData, bmsBatteryClusterVo);
|
BeanUtils.copyProperties(clusterData, bmsBatteryClusterVo);
|
||||||
// 处理单体电池数据-平均/最大/最小
|
// 处理单体电池数据-平均/最大/最小
|
||||||
@ -331,7 +333,6 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
|||||||
dealWithBatteryClusterData(clusterData,clusterDataList);
|
dealWithBatteryClusterData(clusterData,clusterDataList);
|
||||||
bmsBatteryClusterVo.setBatteryDataList(clusterDataList);
|
bmsBatteryClusterVo.setBatteryDataList(clusterDataList);
|
||||||
}
|
}
|
||||||
|
|
||||||
bmsBatteryClusterVoList.add(bmsBatteryClusterVo);
|
bmsBatteryClusterVoList.add(bmsBatteryClusterVo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -918,24 +918,25 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getChargeDataByHour" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
<select id="getChargeDataByHour" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
||||||
SELECT hour AS ammeterDate,
|
SELECT ammeterDate,
|
||||||
data_update_time AS dataUpdateTime,
|
dataUpdateTime,
|
||||||
current_forward_active_total AS chargedCap,
|
totalChargedCap,
|
||||||
current_reverse_active_total AS disChargedCap
|
totalDisChargedCap,
|
||||||
FROM (
|
totalChargedCap - LAG(totalChargedCap) OVER (ORDER BY ammeterDate) AS chargedCap,
|
||||||
SELECT data_update_time,
|
totalDisChargedCap - LAG(totalDisChargedCap) OVER (ORDER BY ammeterDate) AS disChargedCap
|
||||||
current_forward_active_total,
|
FROM ( SELECT data_update_time AS dataUpdateTime,
|
||||||
current_reverse_active_total,
|
current_forward_active_total AS totalChargedCap,
|
||||||
DATE_FORMAT(data_update_time, '%H:00') AS hour,
|
current_reverse_active_total AS totalDisChargedCap,
|
||||||
ROW_NUMBER() OVER (
|
DATE_FORMAT(data_update_time, '%H:00') AS ammeterDate,
|
||||||
PARTITION BY DATE_FORMAT(data_update_time, '%H:00')
|
ROW_NUMBER() OVER (
|
||||||
ORDER BY data_update_time DESC
|
PARTITION BY DATE_FORMAT(data_update_time, '%H:00')
|
||||||
|
ORDER BY data_update_time DESC
|
||||||
) AS rn
|
) AS rn
|
||||||
FROM ems_ammeter_data
|
FROM ems_ammeter_data
|
||||||
WHERE site_id = #{siteId}
|
WHERE site_id = #{siteId}
|
||||||
AND device_id = #{deviceId}
|
AND device_id = #{deviceId}
|
||||||
AND DATE(data_update_time) = #{startDate}
|
AND DATE(data_update_time) = #{startDate}
|
||||||
) AS hourly_data
|
) AS hourly_data
|
||||||
WHERE rn = 1
|
WHERE rn = 1
|
||||||
ORDER BY ammeterDate
|
ORDER BY ammeterDate
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@ -428,8 +428,8 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getSiteSumStackInfo" parameterType="String" resultType="com.xzzn.ems.domain.EmsBatteryStack">
|
<select id="getSiteSumStackInfo" parameterType="String" resultType="com.xzzn.ems.domain.EmsBatteryStack">
|
||||||
select SUM(t.stack_soc) as stackSoc,
|
select AVG(t.stack_soc) as stackSoc,
|
||||||
sum(t.stack_soh) as stackSoh
|
AVG(t.stack_soh) as stackSoh
|
||||||
from ems_battery_stack t
|
from ems_battery_stack t
|
||||||
INNER JOIN (
|
INNER JOIN (
|
||||||
select p.site_id,p.device_id,MAX(p.create_time) as max_time
|
select p.site_id,p.device_id,MAX(p.create_time) as max_time
|
||||||
|
|||||||
@ -143,16 +143,25 @@
|
|||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="getAllSiteChargeData" resultType="map">
|
<select id="getAllSiteChargeData" resultType="map">
|
||||||
SELECT SUM(t.total_charge_data) AS totalChargedCap,
|
SELECT
|
||||||
SUM(t.total_discharge_data) AS totalDischargedCap
|
SUM(t.total_charge_data) AS totalChargedCap,
|
||||||
|
SUM(t.total_discharge_data) AS totalDischargedCap
|
||||||
FROM ems_daily_charge_data t
|
FROM ems_daily_charge_data t
|
||||||
LEFT JOIN ems_site_setting ss ON t.site_id = ss.site_id
|
LEFT JOIN ems_site_setting ss ON t.site_id = ss.site_id
|
||||||
WHERE t.date_time = #{nowData}
|
INNER JOIN (
|
||||||
|
SELECT site_id,MAX(date_time) AS latest_date FROM ems_daily_charge_data
|
||||||
|
WHERE date_time <= #{nowData}
|
||||||
<if test="siteId != null">
|
<if test="siteId != null">
|
||||||
and t.site_id = #{siteId}
|
and site_id = #{siteId}
|
||||||
</if>
|
</if>
|
||||||
AND t.total_charge_data IS NOT NULL
|
AND total_charge_data IS NOT NULL
|
||||||
AND t.total_discharge_data IS NOT NULL
|
AND total_discharge_data IS NOT NULL
|
||||||
|
GROUP BY site_id
|
||||||
|
) AS latest ON t.date_time = latest.latest_date
|
||||||
|
and t.site_id = latest.site_id
|
||||||
|
<if test="siteId != null">
|
||||||
|
where t.site_id = #{siteId}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getSingleSiteChargeData" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
<select id="getSingleSiteChargeData" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
||||||
@ -168,11 +177,34 @@
|
|||||||
|
|
||||||
<select id="getTotalChargeDataByDay" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
<select id="getTotalChargeDataByDay" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
||||||
SELECT t.date_time AS ammeterDate,
|
SELECT t.date_time AS ammeterDate,
|
||||||
t.total_charge_Data as chargedCap,
|
SUM(t.charge_data) as chargedCap,
|
||||||
t.total_discharge_Data as disChargedCap
|
SUM(t.discharge_data) as disChargedCap
|
||||||
FROM ems_daily_charge_data t
|
FROM ems_daily_charge_data t
|
||||||
WHERE t.site_id = #{siteId}
|
WHERE t.site_id = #{siteId}
|
||||||
AND t.date_time BETWEEN #{startDate} AND #{endDate}
|
AND t.date_time BETWEEN #{startDate} AND #{endDate}
|
||||||
|
group BY ammeterDate
|
||||||
order by ammeterDate
|
order by ammeterDate
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getTotalChargeDataByMonth" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
||||||
|
SELECT
|
||||||
|
DATE_FORMAT(t.date_time, '%Y-%m') AS ammeterMonth,
|
||||||
|
SUM(t.charge_data) AS chargedCap,
|
||||||
|
SUM(t.discharge_data) AS disChargedCap
|
||||||
|
FROM ems_daily_charge_data t
|
||||||
|
WHERE t.site_id = #{siteId}
|
||||||
|
AND t.date_time BETWEEN #{startDate} AND #{endDate}
|
||||||
|
GROUP BY ammeterMonth
|
||||||
|
ORDER BY ammeterMonth
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getAllSiteChargeDataByMonth" resultType="com.xzzn.ems.domain.vo.ElectricIndexList">
|
||||||
|
SELECT
|
||||||
|
DATE_FORMAT(t.date_time, '%Y-%m') AS dateMonth,
|
||||||
|
SUM(t.charge_data) AS chargeEnergy,
|
||||||
|
SUM(t.discharge_data) AS disChargeEnergy
|
||||||
|
FROM ems_daily_charge_data t
|
||||||
|
GROUP BY dateMonth
|
||||||
|
ORDER BY dateMonth
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -182,10 +182,15 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDeviceInfosBySiteIdAndCategory" resultType="java.util.Map">
|
<select id="getDeviceInfosBySiteIdAndCategory" resultType="java.util.Map">
|
||||||
select DISTINCT device_id as id,
|
select DISTINCT t1.device_id as id,
|
||||||
device_name as deviceName,
|
t1.device_name as deviceName,
|
||||||
communication_status as communicationStatus
|
t1.communication_status as communicationStatus,
|
||||||
from ems_devices_setting where site_id = #{siteId} and device_category = #{deviceCategory}
|
t1.parent_id as parentDeviceId,
|
||||||
|
t2.device_name as parentDeviceName
|
||||||
|
from ems_devices_setting t1
|
||||||
|
LEFT JOIN ems_devices_setting t2
|
||||||
|
ON t1.parent_id = t2.device_id and t1.site_id = t2.site_id
|
||||||
|
where t1.site_id = #{siteId} and t1.device_category = #{deviceCategory}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDeviceBySiteAndDeviceId" parameterType="String" resultMap="EmsDevicesSettingResult">
|
<select id="getDeviceBySiteAndDeviceId" parameterType="String" resultMap="EmsDevicesSettingResult">
|
||||||
@ -195,8 +200,8 @@
|
|||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getLoadNameList" parameterType="String" resultType="java.util.Map">
|
<select id="getAmmeterNameList" parameterType="String" resultType="java.util.Map">
|
||||||
select distinct device_id as id,device_name as deviceName from ems_devices_setting where site_id = #{siteId} and device_id like '%LOAD%'
|
select distinct device_id as id,device_name as deviceName from ems_devices_setting where site_id = #{siteId} and device_category = 'AMMETER'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getClusterIdsByFuzzyQuery" resultType="java.util.Map">
|
<select id="getClusterIdsByFuzzyQuery" resultType="java.util.Map">
|
||||||
|
|||||||
@ -454,8 +454,8 @@
|
|||||||
|
|
||||||
<select id="getPcsDataByHour" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
<select id="getPcsDataByHour" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
||||||
select latest.dateHour as ammeterDate,
|
select latest.dateHour as ammeterDate,
|
||||||
sum(t.total_ac_charge_energy) as chargedCap,
|
sum(t.daily_ac_charge_energy) as chargedCap,
|
||||||
sum(t.total_ac_discharge_energy) as disChargedCap
|
sum(t.daily_ac_discharge_energy) as disChargedCap
|
||||||
from ( SELECT p.site_id, p.device_id,DATE_FORMAT(p.data_update_time, '%H')+1 AS dateHour,MAX(p.data_update_time) as max_update_time
|
from ( SELECT p.site_id, p.device_id,DATE_FORMAT(p.data_update_time, '%H')+1 AS dateHour,MAX(p.data_update_time) as max_update_time
|
||||||
FROM ems_pcs_data p
|
FROM ems_pcs_data p
|
||||||
<include refid="commonFilter"/>
|
<include refid="commonFilter"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user