光伏今日放电统计逻辑修改
This commit is contained in:
@ -146,6 +146,7 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
BigDecimal pvActivePower = new BigDecimal(CommonConstant.ZERO);
|
BigDecimal pvActivePower = new BigDecimal(CommonConstant.ZERO);
|
||||||
BigDecimal totalRelease = new BigDecimal(CommonConstant.ZERO);
|
BigDecimal totalRelease = new BigDecimal(CommonConstant.ZERO);
|
||||||
BigDecimal dailyReleaseElec = new BigDecimal(CommonConstant.ZERO);
|
BigDecimal dailyReleaseElec = new BigDecimal(CommonConstant.ZERO);
|
||||||
|
String nowDay = DateUtil.format(new Date(), CommonConstant.DATE_YMD);
|
||||||
if (!pcsList.isEmpty()) {
|
if (!pcsList.isEmpty()) {
|
||||||
for (DeviceRespVO deviceRespVO : pcsList) {
|
for (DeviceRespVO deviceRespVO : pcsList) {
|
||||||
//在缓存里拿映射字段
|
//在缓存里拿映射字段
|
||||||
@ -155,11 +156,37 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
if (mpptMap != null) {
|
if (mpptMap != null) {
|
||||||
MpptVo vo = JSON.parseObject(JSON.toJSONString(mpptMap), MpptVo.class);
|
MpptVo vo = JSON.parseObject(JSON.toJSONString(mpptMap), MpptVo.class);
|
||||||
if (vo != null) {
|
if (vo != null) {
|
||||||
BigDecimal pvActivePowerMppt = vo.getPvActivePower() == null ? BigDecimal.ZERO : vo.getPvActivePower().getValue();
|
// 今日功率
|
||||||
|
BigDecimal pvActivePowerMppt = BigDecimal.ZERO;
|
||||||
|
if(vo.getPvActivePower() != null){
|
||||||
|
if(nowDay.equals(DateUtil.format(vo.getPvActivePower().getUpdateTime(), CommonConstant.DATE_YMD))){
|
||||||
|
pvActivePowerMppt = vo.getPvActivePower().getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 累计发电量
|
||||||
BigDecimal totalReleaseMppt = vo.getTotalRelease() == null ? BigDecimal.ZERO : vo.getTotalRelease().getValue();
|
BigDecimal totalReleaseMppt = vo.getTotalRelease() == null ? BigDecimal.ZERO : vo.getTotalRelease().getValue();
|
||||||
BigDecimal pvDailyReleaseStart = vo.getPvDailyReleaseStart() == null ? BigDecimal.ZERO : vo.getPvDailyReleaseStart().getValue();
|
// 今日发电起始值
|
||||||
BigDecimal dailyReleaseElecMppt = totalReleaseMppt.subtract(pvDailyReleaseStart);
|
BigDecimal pvDailyReleaseStart = BigDecimal.ZERO;
|
||||||
|
if(vo.getPvDailyReleaseStart() != null){
|
||||||
|
if(nowDay.equals(DateUtil.format(vo.getPvDailyReleaseStart().getUpdateTime(), CommonConstant.DATE_YMD))){
|
||||||
|
pvDailyReleaseStart = vo.getPvDailyReleaseStart().getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 今日更新的累计发电量
|
||||||
|
BigDecimal totalReleaseMppt1 = BigDecimal.ZERO;
|
||||||
|
if(vo.getTotalRelease() != null){
|
||||||
|
if(nowDay.equals(DateUtil.format(vo.getTotalRelease().getUpdateTime(), CommonConstant.DATE_YMD))){
|
||||||
|
totalReleaseMppt1 = vo.getTotalRelease().getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 计算今日发电量 = 今日更新的累计发电量 - 今日发电起始值
|
||||||
|
BigDecimal dailyReleaseElecMppt = BigDecimal.ZERO;
|
||||||
|
if(totalReleaseMppt1.compareTo(BigDecimal.ZERO)>0&&pvDailyReleaseStart.compareTo(BigDecimal.ZERO)>0){
|
||||||
|
dailyReleaseElecMppt = totalReleaseMppt1.subtract(pvDailyReleaseStart);
|
||||||
|
}
|
||||||
|
// 如果计算到的今日发电量小于0 则设置为0
|
||||||
dailyReleaseElecMppt = dailyReleaseElecMppt.compareTo(BigDecimal.ZERO)<0?BigDecimal.ZERO:dailyReleaseElecMppt;
|
dailyReleaseElecMppt = dailyReleaseElecMppt.compareTo(BigDecimal.ZERO)<0?BigDecimal.ZERO:dailyReleaseElecMppt;
|
||||||
|
// 最后组装值
|
||||||
pvActivePower = pvActivePower.add(pvActivePowerMppt);
|
pvActivePower = pvActivePower.add(pvActivePowerMppt);
|
||||||
totalRelease = totalRelease.add(totalReleaseMppt);
|
totalRelease = totalRelease.add(totalReleaseMppt);
|
||||||
dailyReleaseElec = dailyReleaseElec.add(dailyReleaseElecMppt);
|
dailyReleaseElec = dailyReleaseElec.add(dailyReleaseElecMppt);
|
||||||
|
|||||||
@ -1475,6 +1475,7 @@ public class Device001ApiController {
|
|||||||
}
|
}
|
||||||
if (stationHomeRespVos != null && stationHomeRespVos.size() > 0) {
|
if (stationHomeRespVos != null && stationHomeRespVos.size() > 0) {
|
||||||
BigDecimal startEle = stationHomeRespVos.get(0).getDigital();
|
BigDecimal startEle = stationHomeRespVos.get(0).getDigital();
|
||||||
|
query.setBegin(DateUtil.beginOfDay(new Date()));
|
||||||
cacheObj(query, DeviceTypeConstant.PV_DAILY_CHARGE_START, startEle);
|
cacheObj(query, DeviceTypeConstant.PV_DAILY_CHARGE_START, startEle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user