平台修改意见20251120-修改电表每日充放电数据hardcode
This commit is contained in:
@ -953,9 +953,9 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
|||||||
// 处理电表每日充放电数据
|
// 处理电表每日充放电数据
|
||||||
if (!deviceId.contains(SiteDevice.METEGF.name()) && !deviceId.contains(SiteDevice.METE0.name())) {
|
if (!deviceId.contains(SiteDevice.METEGF.name()) && !deviceId.contains(SiteDevice.METE0.name())) {
|
||||||
if (SiteEnum.FX.getCode().equals(siteId)) {
|
if (SiteEnum.FX.getCode().equals(siteId)) {
|
||||||
dealAmmeterDailyDate(siteId, obj, dataUpdateTime, lastAmmeterData);
|
dealAmmeterDailyDate(siteId, dataMete, dataUpdateTime, lastAmmeterData);
|
||||||
} else if (SiteEnum.DDS.getCode().equals(siteId)) {
|
} else if (SiteEnum.DDS.getCode().equals(siteId)) {
|
||||||
dealDDSDailyChargeDate(siteId, obj, deviceId);
|
dealDDSDailyChargeDate(siteId, dataMete, deviceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -976,13 +976,15 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
|||||||
return lastData;
|
return lastData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dealDDSDailyChargeDate(String siteId, Map<String, Object> obj, String deviceId) {
|
private void dealDDSDailyChargeDate(String siteId, EmsAmmeterData currentData, String deviceId) {
|
||||||
// 初始化今日充放电
|
// 初始化今日充放电
|
||||||
BigDecimal dailyDisChargeDate = new BigDecimal(0);
|
BigDecimal dailyDisChargeDate = new BigDecimal(0);
|
||||||
BigDecimal dailyChargeDate = new BigDecimal(0);
|
BigDecimal dailyChargeDate = new BigDecimal(0);
|
||||||
|
|
||||||
BigDecimal nowTotalDisChargeDate = StringUtils.getBigDecimal(obj.get("DQFXZYGDN"));
|
// BigDecimal nowTotalDisChargeDate = StringUtils.getBigDecimal(obj.get("DQFXZYGDN"));
|
||||||
BigDecimal nowTotalChargeDate = StringUtils.getBigDecimal(obj.get("DQZXZYGDN"));
|
// BigDecimal nowTotalChargeDate = StringUtils.getBigDecimal(obj.get("DQZXZYGDN"));
|
||||||
|
BigDecimal nowTotalDisChargeDate = currentData.getCurrentReverseActiveTotal();
|
||||||
|
BigDecimal nowTotalChargeDate = currentData.getCurrentForwardActiveTotal();
|
||||||
// 初始化当日数据-总的
|
// 初始化当日数据-总的
|
||||||
EmsDailyChargeData emsDailyChargeData = initDailyChargeData(siteId, deviceId, nowTotalChargeDate, nowTotalDisChargeDate);
|
EmsDailyChargeData emsDailyChargeData = initDailyChargeData(siteId, deviceId, nowTotalChargeDate, nowTotalDisChargeDate);
|
||||||
// 获取redis存放昨日最晚数据
|
// 获取redis存放昨日最晚数据
|
||||||
@ -1012,7 +1014,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
|||||||
// 初始化数据-尖峰平谷
|
// 初始化数据-尖峰平谷
|
||||||
EmsDailyEnergyData energyData = initEnergyData(siteId);
|
EmsDailyEnergyData energyData = initEnergyData(siteId);
|
||||||
// 计算尖峰平谷差值,更新表
|
// 计算尖峰平谷差值,更新表
|
||||||
calcEnergyDiffAndRevenue(siteId, energyData, obj, yestData);
|
calcEnergyDiffAndRevenue(siteId, energyData, currentData, yestData);
|
||||||
energyData.setCalcTime(DateUtils.getNowDate());
|
energyData.setCalcTime(DateUtils.getNowDate());
|
||||||
// 插入或更新电表每日差值数据表
|
// 插入或更新电表每日差值数据表
|
||||||
emsDailyEnergyDataMapper.insertOrUpdateData(energyData);
|
emsDailyEnergyDataMapper.insertOrUpdateData(energyData);
|
||||||
@ -1033,7 +1035,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
|||||||
return emsDailyChargeData;
|
return emsDailyChargeData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void calcEnergyDiffAndRevenue(String siteId, EmsDailyEnergyData energyData, Map<String, Object> obj, EmsAmmeterData yestData) {
|
private void calcEnergyDiffAndRevenue(String siteId, EmsDailyEnergyData energyData, EmsAmmeterData currentData, EmsAmmeterData yestData) {
|
||||||
|
|
||||||
// 获取当月电价
|
// 获取当月电价
|
||||||
String key = RedisKeyConstants.ENERGY_PRICE_TIME + siteId + "_" + LocalDate.now().getYear() + LocalDate.now().getMonthValue();
|
String key = RedisKeyConstants.ENERGY_PRICE_TIME + siteId + "_" + LocalDate.now().getYear() + LocalDate.now().getMonthValue();
|
||||||
@ -1041,31 +1043,47 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
|||||||
|
|
||||||
// 计算尖峰平谷差值
|
// 计算尖峰平谷差值
|
||||||
// 正反向-尖
|
// 正反向-尖
|
||||||
BigDecimal peakChargeDiff = StringUtils.getBigDecimal(obj.get("DQZXYGJDN"))
|
// BigDecimal peakChargeDiff = StringUtils.getBigDecimal(obj.get("DQZXYGJDN"))
|
||||||
|
// .subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentForwardActivePeak());
|
||||||
|
BigDecimal peakChargeDiff = currentData.getCurrentForwardActivePeak()
|
||||||
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentForwardActivePeak());
|
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentForwardActivePeak());
|
||||||
energyData.setPeakChargeDiff(peakChargeDiff);
|
energyData.setPeakChargeDiff(peakChargeDiff);
|
||||||
BigDecimal peakDischargeDiff = StringUtils.getBigDecimal(obj.get("DQFXYGJDN"))
|
// BigDecimal peakDischargeDiff = StringUtils.getBigDecimal(obj.get("DQFXYGJDN"))
|
||||||
|
// .subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentReverseActivePeak());
|
||||||
|
BigDecimal peakDischargeDiff = currentData.getCurrentReverseActivePeak()
|
||||||
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentReverseActivePeak());
|
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentReverseActivePeak());
|
||||||
energyData.setPeakDischargeDiff(peakDischargeDiff);
|
energyData.setPeakDischargeDiff(peakDischargeDiff);
|
||||||
// 正反向-峰
|
// 正反向-峰
|
||||||
BigDecimal highChargeDiff = StringUtils.getBigDecimal(obj.get("DQZXYGFDN"))
|
// BigDecimal highChargeDiff = StringUtils.getBigDecimal(obj.get("DQZXYGFDN"))
|
||||||
|
// .subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentForwardActiveHigh());
|
||||||
|
BigDecimal highChargeDiff = currentData.getCurrentForwardActiveHigh()
|
||||||
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentForwardActiveHigh());
|
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentForwardActiveHigh());
|
||||||
energyData.setHighChargeDiff(highChargeDiff);
|
energyData.setHighChargeDiff(highChargeDiff);
|
||||||
BigDecimal highDischargeDiff = StringUtils.getBigDecimal(obj.get("DQFXYGFDN"))
|
// BigDecimal highDischargeDiff = StringUtils.getBigDecimal(obj.get("DQFXYGFDN"))
|
||||||
|
// .subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentReverseActiveHigh());
|
||||||
|
BigDecimal highDischargeDiff = currentData.getCurrentReverseActiveHigh()
|
||||||
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentReverseActiveHigh());
|
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentReverseActiveHigh());
|
||||||
energyData.setHighDischargeDiff(highDischargeDiff);
|
energyData.setHighDischargeDiff(highDischargeDiff);
|
||||||
// 正反向-平
|
// 正反向-平
|
||||||
BigDecimal flatChargeDiff = StringUtils.getBigDecimal(obj.get("DQZXYGPDN"))
|
// BigDecimal flatChargeDiff = StringUtils.getBigDecimal(obj.get("DQZXYGPDN"))
|
||||||
|
// .subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentForwardActiveFlat());
|
||||||
|
BigDecimal flatChargeDiff = currentData.getCurrentForwardActiveFlat()
|
||||||
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentForwardActiveFlat());
|
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentForwardActiveFlat());
|
||||||
energyData.setFlatChargeDiff(flatChargeDiff);
|
energyData.setFlatChargeDiff(flatChargeDiff);
|
||||||
BigDecimal flatDisChargeDiff = StringUtils.getBigDecimal(obj.get("DQFXYGPDN"))
|
// BigDecimal flatDisChargeDiff = StringUtils.getBigDecimal(obj.get("DQFXYGPDN"))
|
||||||
|
// .subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentReverseActiveFlat());
|
||||||
|
BigDecimal flatDisChargeDiff = currentData.getCurrentReverseActiveFlat()
|
||||||
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentReverseActiveFlat());
|
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentReverseActiveFlat());
|
||||||
energyData.setFlatDischargeDiff(flatDisChargeDiff);
|
energyData.setFlatDischargeDiff(flatDisChargeDiff);
|
||||||
// 正反向-谷
|
// 正反向-谷
|
||||||
BigDecimal valleyChargeDiff = StringUtils.getBigDecimal(obj.get("DQZXYGGDN"))
|
// BigDecimal valleyChargeDiff = StringUtils.getBigDecimal(obj.get("DQZXYGGDN"))
|
||||||
|
// .subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentForwardActiveValley());
|
||||||
|
BigDecimal valleyChargeDiff = currentData.getCurrentForwardActiveValley()
|
||||||
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentForwardActiveValley());
|
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentForwardActiveValley());
|
||||||
energyData.setValleyChargeDiff(valleyChargeDiff);
|
energyData.setValleyChargeDiff(valleyChargeDiff);
|
||||||
BigDecimal valleyDisChargeDiff = StringUtils.getBigDecimal(obj.get("DQFXYGGDN"))
|
// BigDecimal valleyDisChargeDiff = StringUtils.getBigDecimal(obj.get("DQFXYGGDN"))
|
||||||
|
// .subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentReverseActiveValley());
|
||||||
|
BigDecimal valleyDisChargeDiff = currentData.getCurrentReverseActiveValley()
|
||||||
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentReverseActiveValley());
|
.subtract(yestData == null ? new BigDecimal(0) : yestData.getCurrentReverseActiveValley());
|
||||||
energyData.setValleyDischargeDiff(valleyDisChargeDiff);
|
energyData.setValleyDischargeDiff(valleyDisChargeDiff);
|
||||||
|
|
||||||
@ -1109,7 +1127,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
|||||||
return yestLastTotalRevenue;
|
return yestLastTotalRevenue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dealAmmeterDailyDate(String siteId, Map<String, Object> obj, Date dataUpdateTime, EmsAmmeterData lastData) {
|
private void dealAmmeterDailyDate(String siteId, EmsAmmeterData currentData, Date dataUpdateTime, EmsAmmeterData lastData) {
|
||||||
// 先获取当月电价配置,redis没有这查数据库,都没有则返回
|
// 先获取当月电价配置,redis没有这查数据库,都没有则返回
|
||||||
String priceKey = RedisKeyConstants.ENERGY_PRICE_TIME + siteId + "_" + LocalDate.now().getYear() + LocalDate.now().getMonthValue();
|
String priceKey = RedisKeyConstants.ENERGY_PRICE_TIME + siteId + "_" + LocalDate.now().getYear() + LocalDate.now().getMonthValue();
|
||||||
EnergyPriceVo priceVo = redisCache.getCacheObject(priceKey);
|
EnergyPriceVo priceVo = redisCache.getCacheObject(priceKey);
|
||||||
@ -1143,16 +1161,18 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
|||||||
EmsDailyEnergyData energyData = initEnergyData(siteId);
|
EmsDailyEnergyData energyData = initEnergyData(siteId);
|
||||||
|
|
||||||
// 根据 costType,计算本次与上次数据差值,累加到对应的数据类型里面
|
// 根据 costType,计算本次与上次数据差值,累加到对应的数据类型里面
|
||||||
setDiffByCostType(siteId, costType, energyData, lastData, obj, priceVo);
|
setDiffByCostType(siteId, costType, energyData, lastData, currentData, priceVo);
|
||||||
|
|
||||||
// 插入或更新电表每日差值数据表
|
// 插入或更新电表每日差值数据表
|
||||||
emsDailyEnergyDataMapper.insertOrUpdateData(energyData);
|
emsDailyEnergyDataMapper.insertOrUpdateData(energyData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDiffByCostType(String siteId, String costType, EmsDailyEnergyData energyData, EmsAmmeterData lastData,
|
private void setDiffByCostType(String siteId, String costType, EmsDailyEnergyData energyData, EmsAmmeterData lastData,
|
||||||
Map<String, Object> obj, EnergyPriceVo priceVo) {
|
EmsAmmeterData currentData, EnergyPriceVo priceVo) {
|
||||||
BigDecimal currentChargeData = StringUtils.getBigDecimal(obj.get("ZXYGDN"));
|
// BigDecimal currentChargeData = StringUtils.getBigDecimal(obj.get("ZXYGDN"));
|
||||||
BigDecimal currentDischargeData = StringUtils.getBigDecimal(obj.get("FXYGDN"));
|
// BigDecimal currentDischargeData = StringUtils.getBigDecimal(obj.get("FXYGDN"));
|
||||||
|
BigDecimal currentChargeData = currentData.getCurrentForwardActiveTotal();
|
||||||
|
BigDecimal currentDischargeData = currentData.getCurrentReverseActiveTotal();
|
||||||
currentChargeData = currentChargeData != null ? currentChargeData : BigDecimal.ZERO;
|
currentChargeData = currentChargeData != null ? currentChargeData : BigDecimal.ZERO;
|
||||||
currentDischargeData = currentDischargeData != null ? currentDischargeData : BigDecimal.ZERO;
|
currentDischargeData = currentDischargeData != null ? currentDischargeData : BigDecimal.ZERO;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user