电量指标-修改

This commit is contained in:
2025-07-22 13:54:07 +08:00
parent cbcaaaffb6
commit b4cbf0b34e
4 changed files with 28 additions and 17 deletions

View File

@ -21,6 +21,8 @@ public class StatisClusterDateRequest {
private String clusterId; private String clusterId;
private String siteId;
public Date getDateTime() { public Date getDateTime() {
return dateTime; return dateTime;
} }
@ -44,4 +46,12 @@ public class StatisClusterDateRequest {
public void setClusterId(String clusterId) { public void setClusterId(String clusterId) {
this.clusterId = clusterId; this.clusterId = clusterId;
} }
public String getSiteId() {
return siteId;
}
public void setSiteId(String siteId) {
this.siteId = siteId;
}
} }

View File

@ -50,6 +50,20 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
Date startDate = requestVo.getStartDate(); Date startDate = requestVo.getStartDate();
Date endDate = requestVo.getEndDate(); Date endDate = requestVo.getEndDate();
// 总充总放
Map<String, BigDecimal> totalMap = emsPcsDataMapper.getPcsTotalChargeData(requestVo.getSiteId());
BigDecimal totalDischarge = totalMap.get("totalDischargedCap") != null ? totalMap.get("totalDischargedCap") : BigDecimal.ZERO;
BigDecimal totalCharge = totalMap.get("totalChargedCap") != null ? totalMap.get("totalChargedCap") : BigDecimal.ZERO;
BigDecimal efficiency = new BigDecimal(0);
if ( totalCharge.compareTo(BigDecimal.ZERO)>0){
efficiency = totalDischarge.divide(totalCharge, 2, RoundingMode.HALF_UP)
.multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
}
electricDataInfoVo.setTotalDisChargedCap(totalDischarge);
electricDataInfoVo.setTotalChargedCap(totalCharge);
electricDataInfoVo.setEfficiency(efficiency);
// 日期筛选
List<SiteMonitorDataVo> dataList = new ArrayList(); List<SiteMonitorDataVo> dataList = new ArrayList();
// 开始日期和结束日期同一天,展示 0-24 小时数据 // 开始日期和结束日期同一天,展示 0-24 小时数据
if (DateUtils.isSameDay(startDate, endDate)){ if (DateUtils.isSameDay(startDate, endDate)){
@ -70,15 +84,8 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
} }
// 根据时间获取每天的充放电量 // 根据时间获取每天的充放电量
if (!CollectionUtils.isEmpty(dataList)){ if (!CollectionUtils.isEmpty(dataList)){
// 总充、总放、效率
BigDecimal totalDischarge = new BigDecimal(0);
BigDecimal totalCharge = new BigDecimal(0);
BigDecimal efficiency = new BigDecimal(0);
for (SiteMonitorDataVo siteMonitorDataVo : dataList) { for (SiteMonitorDataVo siteMonitorDataVo : dataList) {
totalDischarge = totalDischarge.add(siteMonitorDataVo.getDisChargedCap() == null ? BigDecimal.ZERO : siteMonitorDataVo.getDisChargedCap());
totalCharge = totalCharge.add(siteMonitorDataVo.getChargedCap() == null ? BigDecimal.ZERO : siteMonitorDataVo.getChargedCap());
// 计算单天的效率 // 计算单天的效率
BigDecimal dailyEfficiency = new BigDecimal(0); BigDecimal dailyEfficiency = new BigDecimal(0);
if ( siteMonitorDataVo.getChargedCap().compareTo(BigDecimal.ZERO)>0){ if ( siteMonitorDataVo.getChargedCap().compareTo(BigDecimal.ZERO)>0){
@ -87,14 +94,8 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
} }
siteMonitorDataVo.setDailyEfficiency(dailyEfficiency); siteMonitorDataVo.setDailyEfficiency(dailyEfficiency);
} }
if ( totalCharge.compareTo(BigDecimal.ZERO)>0){
efficiency = totalDischarge.divide(totalCharge, 2, RoundingMode.HALF_UP);
efficiency = efficiency.multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
}
electricDataInfoVo.setSevenDayDisChargeStats(dataList); electricDataInfoVo.setSevenDayDisChargeStats(dataList);
electricDataInfoVo.setTotalDisChargedCap(totalDischarge);
electricDataInfoVo.setTotalChargedCap(totalCharge);
electricDataInfoVo.setEfficiency(efficiency);
} }
return electricDataInfoVo; return electricDataInfoVo;
} }

View File

@ -362,7 +362,8 @@
t.min_cell_voltage_id as minVoltageId t.min_cell_voltage_id as minVoltageId
FROM ( SELECT p.site_id, p.device_id, DATE_FORMAT( p.update_time, '%H' ) AS statisDate, MAX(p.update_time) AS max_update_time FROM ( SELECT p.site_id, p.device_id, DATE_FORMAT( p.update_time, '%H' ) AS statisDate, MAX(p.update_time) AS max_update_time
FROM ems_battery_cluster p FROM ems_battery_cluster p
WHERE p.stack_device_id = #{stackId} WHERE p.site_id = #{siteId}
AND p.stack_device_id = #{stackId}
AND p.device_id = #{clusterId} AND p.device_id = #{clusterId}
AND p.update_time &gt;= #{dateTime} AND p.update_time &gt;= #{dateTime}
AND p.update_time &lt; DATE_ADD(#{dateTime}, INTERVAL 1 DAY) AND p.update_time &lt; DATE_ADD(#{dateTime}, INTERVAL 1 DAY)

View File

@ -339,8 +339,7 @@
SUM(t.total_active_power) as totalActivePower, SUM(t.total_active_power) as totalActivePower,
SUM(t.total_reactive_power) as totalReactivePower, SUM(t.total_reactive_power) as totalReactivePower,
sum(t.daily_ac_charge_energy) as dayChargedCap, sum(t.daily_ac_charge_energy) as dayChargedCap,
sum(t.daily_ac_discharge_energy) as dayDisChargedCap, sum(t.daily_ac_discharge_energy) as dayDisChargedCap
#{siteId} as siteId
FROM ( FROM (
SELECT p.device_id, MAX(p.data_update_time) AS max_update_time SELECT p.device_id, MAX(p.data_update_time) AS max_update_time
FROM ems_pcs_data p FROM ems_pcs_data p