|
|
|
|
@ -271,6 +271,63 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
|
|
|
|
return siteMonitorHomeVo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public SiteMonitorHomeVo getSiteMonitorHomeRunningData(String siteId) {
|
|
|
|
|
SiteMonitorHomeVo siteMonitorHomeVo = new SiteMonitorHomeVo();
|
|
|
|
|
if (StringUtils.isEmpty(siteId)) {
|
|
|
|
|
return siteMonitorHomeVo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EmsDailyChargeData latestChargeData = emsDailyChargeDataMapper.selectLatestBySiteId(siteId);
|
|
|
|
|
BigDecimal totalChargedCap = latestChargeData == null || latestChargeData.getTotalChargeData() == null
|
|
|
|
|
? BigDecimal.ZERO
|
|
|
|
|
: latestChargeData.getTotalChargeData();
|
|
|
|
|
BigDecimal totalDischargedCap = latestChargeData == null || latestChargeData.getTotalDischargeData() == null
|
|
|
|
|
? BigDecimal.ZERO
|
|
|
|
|
: latestChargeData.getTotalDischargeData();
|
|
|
|
|
siteMonitorHomeVo.setTotalChargedCap(totalChargedCap);
|
|
|
|
|
siteMonitorHomeVo.setTotalDischargedCap(totalDischargedCap);
|
|
|
|
|
|
|
|
|
|
Date todayDate = DateUtils.toDate(LocalDate.now());
|
|
|
|
|
Date yesterdayDate = DateUtils.toDate(LocalDate.now().minusDays(1));
|
|
|
|
|
EmsDailyChargeData todayChargeData = emsDailyChargeDataMapper.selectBySiteIdAndDateTime(siteId, todayDate);
|
|
|
|
|
EmsDailyChargeData yesterdayChargeData = emsDailyChargeDataMapper.selectBySiteIdAndDateTime(siteId, yesterdayDate);
|
|
|
|
|
|
|
|
|
|
siteMonitorHomeVo.setDayChargedCap(todayChargeData == null || todayChargeData.getChargeData() == null
|
|
|
|
|
? BigDecimal.ZERO
|
|
|
|
|
: todayChargeData.getChargeData());
|
|
|
|
|
siteMonitorHomeVo.setDayDisChargedCap(todayChargeData == null || todayChargeData.getDischargeData() == null
|
|
|
|
|
? BigDecimal.ZERO
|
|
|
|
|
: todayChargeData.getDischargeData());
|
|
|
|
|
siteMonitorHomeVo.setYesterdayChargedCap(yesterdayChargeData == null || yesterdayChargeData.getChargeData() == null
|
|
|
|
|
? BigDecimal.ZERO
|
|
|
|
|
: yesterdayChargeData.getChargeData());
|
|
|
|
|
siteMonitorHomeVo.setYesterdayDisChargedCap(yesterdayChargeData == null || yesterdayChargeData.getDischargeData() == null
|
|
|
|
|
? BigDecimal.ZERO
|
|
|
|
|
: yesterdayChargeData.getDischargeData());
|
|
|
|
|
|
|
|
|
|
siteMonitorHomeVo.setTotalRevenue(latestChargeData == null || latestChargeData.getTotalRevenue() == null
|
|
|
|
|
? BigDecimal.ZERO
|
|
|
|
|
: latestChargeData.getTotalRevenue());
|
|
|
|
|
siteMonitorHomeVo.setDayRevenue(todayChargeData == null || todayChargeData.getDayRevenue() == null
|
|
|
|
|
? BigDecimal.ZERO
|
|
|
|
|
: todayChargeData.getDayRevenue());
|
|
|
|
|
siteMonitorHomeVo.setYesterdayRevenue(yesterdayChargeData == null || yesterdayChargeData.getDayRevenue() == null
|
|
|
|
|
? BigDecimal.ZERO
|
|
|
|
|
: yesterdayChargeData.getDayRevenue());
|
|
|
|
|
|
|
|
|
|
List<SiteMonitorHomeAlarmVo> alarmList = emsAlarmRecordsMapper.getAlarmRecordsBySiteId(siteId);
|
|
|
|
|
siteMonitorHomeVo.setSiteMonitorHomeAlarmVo(alarmList);
|
|
|
|
|
|
|
|
|
|
LocalDate sevenDaysAgo = LocalDate.now().minusDays(6);
|
|
|
|
|
Date startDate = DateUtils.toDate(sevenDaysAgo);
|
|
|
|
|
Date endDate = new Date();
|
|
|
|
|
List<SiteMonitorDataVo> siteMonitorDataVoList = emsDailyChargeDataMapper.getSingleSiteChargeData(siteId, startDate, endDate);
|
|
|
|
|
siteMonitorHomeVo.setSiteMonitorDataVo(siteMonitorDataVoList);
|
|
|
|
|
siteMonitorHomeVo.setEnergyStorageAvailElec(totalDischargedCap.subtract(totalChargedCap));
|
|
|
|
|
return siteMonitorHomeVo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取单站监控实时运行头部数据
|
|
|
|
|
@Override
|
|
|
|
|
public SiteMonitorRunningHeadInfoVo getSiteRunningHeadInfo(String siteId) {
|
|
|
|
|
|