概率统计-电量指标
This commit is contained in:
@ -0,0 +1,47 @@
|
||||
package com.xzzn.ems.domain.vo;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 入参-时间
|
||||
*
|
||||
*/
|
||||
public class DateSearchRequest {
|
||||
|
||||
/** 开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date startDate;
|
||||
|
||||
/** 结束时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endDate;
|
||||
|
||||
private String siteId;
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public String getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setSiteId(String siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.xzzn.ems.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 概率统计-电量指标返回
|
||||
*
|
||||
*/
|
||||
public class ElectricDataInfoVo {
|
||||
|
||||
/**
|
||||
* 总充电量
|
||||
*/
|
||||
private BigDecimal totalChargedCap;
|
||||
|
||||
/**
|
||||
* 总放电量
|
||||
*/
|
||||
private BigDecimal totalDisChargedCap;
|
||||
|
||||
/**
|
||||
* 综合效率 = 放电量/充电量
|
||||
*/
|
||||
private BigDecimal efficiency;
|
||||
|
||||
/**
|
||||
* 按天放电统计
|
||||
*/
|
||||
private List<SiteMonitorDataVo> sevenDayDisChargeStats;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public BigDecimal getEfficiency() {
|
||||
return efficiency;
|
||||
}
|
||||
|
||||
public void setEfficiency(BigDecimal efficiency) {
|
||||
this.efficiency = efficiency;
|
||||
}
|
||||
|
||||
public List<SiteMonitorDataVo> getSevenDayDisChargeStats() {
|
||||
return sevenDayDisChargeStats;
|
||||
}
|
||||
|
||||
public void setSevenDayDisChargeStats(List<SiteMonitorDataVo> sevenDayDisChargeStats) {
|
||||
this.sevenDayDisChargeStats = sevenDayDisChargeStats;
|
||||
}
|
||||
}
|
||||
@ -22,6 +22,8 @@ public class SiteMonitorDataVo {
|
||||
*/
|
||||
private BigDecimal chargedCap;
|
||||
|
||||
private BigDecimal dailyEfficiency;
|
||||
|
||||
public String getAmmeterDate() {
|
||||
return ammeterDate;
|
||||
}
|
||||
@ -45,4 +47,12 @@ public class SiteMonitorDataVo {
|
||||
public void setChargedCap(BigDecimal chargedCap) {
|
||||
this.chargedCap = chargedCap;
|
||||
}
|
||||
|
||||
public BigDecimal getDailyEfficiency() {
|
||||
return dailyEfficiency;
|
||||
}
|
||||
|
||||
public void setDailyEfficiency(BigDecimal dailyEfficiency) {
|
||||
this.dailyEfficiency = dailyEfficiency;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,10 +6,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.xzzn.ems.domain.EmsPcsData;
|
||||
import com.xzzn.ems.domain.vo.ElectricIndexList;
|
||||
import com.xzzn.ems.domain.vo.PcsDetailInfoVo;
|
||||
import com.xzzn.ems.domain.vo.SiteMonitorDataVo;
|
||||
import com.xzzn.ems.domain.vo.SiteMonitorRunningHeadInfoVo;
|
||||
import com.xzzn.ems.domain.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
@ -103,9 +100,8 @@ public interface EmsPcsDataMapper
|
||||
|
||||
/**
|
||||
* 根据时间按天获取充放电量
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @param requestVo
|
||||
* @return
|
||||
*/
|
||||
public List<SiteMonitorDataVo> getPcsDataByDate(Date startDate, Date endDate);
|
||||
public List<SiteMonitorDataVo> getPcsDataByDate(DateSearchRequest requestVo);
|
||||
}
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xzzn.ems.service;
|
||||
|
||||
import com.xzzn.ems.domain.vo.DateSearchRequest;
|
||||
import com.xzzn.ems.domain.vo.ElectricDataInfoVo;;import java.util.Date;
|
||||
|
||||
/**
|
||||
* 统计报表数据Service接口
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-06-29
|
||||
*/
|
||||
public interface IEmsStatsReportService
|
||||
{
|
||||
|
||||
public ElectricDataInfoVo getElectricDataResult(DateSearchRequest requestVo);
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.xzzn.ems.service.impl;
|
||||
|
||||
import com.xzzn.ems.domain.vo.DateSearchRequest;
|
||||
import com.xzzn.ems.domain.vo.ElectricDataInfoVo;
|
||||
import com.xzzn.ems.domain.vo.SiteMonitorDataVo;
|
||||
import com.xzzn.ems.mapper.EmsPcsDataMapper;
|
||||
import com.xzzn.ems.service.IEmsStatsReportService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 统计报表数据Service业务层处理
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-06-29
|
||||
*/
|
||||
@Service
|
||||
public class EmsStatsReportServiceImpl implements IEmsStatsReportService
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private EmsPcsDataMapper emsPcsDataMapper;
|
||||
|
||||
@Override
|
||||
public ElectricDataInfoVo getElectricDataResult(DateSearchRequest requestVo) {
|
||||
ElectricDataInfoVo electricDataInfoVo = new ElectricDataInfoVo();
|
||||
|
||||
// 根据时间获取每天的充放电量
|
||||
List<SiteMonitorDataVo> dataList = emsPcsDataMapper.getPcsDataByDate(requestVo);
|
||||
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.getDisChargedCap().compareTo(BigDecimal.ZERO)>0){
|
||||
dailyEfficiency = siteMonitorDataVo.getDisChargedCap().divide(siteMonitorDataVo.getChargedCap(), 2, RoundingMode.HALF_UP);
|
||||
}
|
||||
siteMonitorDataVo.setDailyEfficiency(dailyEfficiency);
|
||||
}
|
||||
if ( totalCharge.compareTo(BigDecimal.ZERO)>0){
|
||||
efficiency = totalDischarge.divide(totalCharge, 2, RoundingMode.HALF_UP);
|
||||
}
|
||||
electricDataInfoVo.setSevenDayDisChargeStats(dataList);
|
||||
electricDataInfoVo.setTotalDisChargedCap(totalDischarge);
|
||||
electricDataInfoVo.setTotalChargedCap(totalCharge);
|
||||
electricDataInfoVo.setEfficiency(efficiency);
|
||||
}
|
||||
return electricDataInfoVo;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user