电量指标-修改

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 siteId;
public Date getDateTime() {
return dateTime;
}
@ -44,4 +46,12 @@ public class StatisClusterDateRequest {
public void setClusterId(String 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 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();
// 开始日期和结束日期同一天,展示 0-24 小时数据
if (DateUtils.isSameDay(startDate, endDate)){
@ -70,15 +84,8 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
}
// 根据时间获取每天的充放电量
if (!CollectionUtils.isEmpty(dataList)){
// 总充、总放、效率
BigDecimal totalDischarge = new BigDecimal(0);
BigDecimal totalCharge = new BigDecimal(0);
BigDecimal efficiency = new BigDecimal(0);
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);
if ( siteMonitorDataVo.getChargedCap().compareTo(BigDecimal.ZERO)>0){
@ -87,14 +94,8 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
}
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.setTotalDisChargedCap(totalDischarge);
electricDataInfoVo.setTotalChargedCap(totalCharge);
electricDataInfoVo.setEfficiency(efficiency);
}
return electricDataInfoVo;
}