dev #2
@ -426,8 +426,6 @@ public class DDSDataProcessServiceImpl extends AbstractBatteryDataProcessor impl
|
||||
});
|
||||
EmsDevicesSetting joken = new EmsDevicesSetting();
|
||||
|
||||
// 获取redis获取最新的BMSD01数据
|
||||
Map<String, Object> stackObj = redisCache.getCacheObject(RedisKeyConstants.ORIGINAL_BMSD +SITE_ID+"_BMSD01");
|
||||
|
||||
//BMSC 电池簇
|
||||
EmsBatteryCluster data = new EmsBatteryCluster();
|
||||
@ -448,6 +446,8 @@ public class DDSDataProcessServiceImpl extends AbstractBatteryDataProcessor impl
|
||||
} else {
|
||||
data.setStackDeviceId("1");
|
||||
}
|
||||
// 获取redis获取最新的BMSD数据
|
||||
Map<String, Object> stackObj = redisCache.getCacheObject(RedisKeyConstants.ORIGINAL_BMSD +SITE_ID+"_"+stackDeviceId);
|
||||
data.setDeviceId(deviceId);
|
||||
data.setClusterVoltage(StringUtils.getBigDecimal(obj.get("BMSC02ZLDY")));
|
||||
data.setClusterCurrent(StringUtils.getBigDecimal(obj.get("BMSC02ZLDL")));
|
||||
@ -459,6 +459,16 @@ public class DDSDataProcessServiceImpl extends AbstractBatteryDataProcessor impl
|
||||
data.setBatteryPackCurrent(StringUtils.getBigDecimal(stackObj.get("BMSD02DL")));
|
||||
data.setBatteryPackSoc(StringUtils.getBigDecimal(stackObj.get("BMSD02SOC")));
|
||||
data.setBatteryPackSoh(StringUtils.getBigDecimal(stackObj.get("BMSD02SOH")));
|
||||
data.setAvgCellTemp(StringUtils.getBigDecimal(stackObj.get("DTPJWD")));
|
||||
data.setMaxCellVoltage(StringUtils.getBigDecimal(stackObj.get("DTZDDY")));
|
||||
data.setMaxCellVoltageId(StringUtils.getString(stackObj.get("DTZDDYXH")));
|
||||
data.setMinCellVoltage(StringUtils.getBigDecimal(stackObj.get("DTZXDY")));
|
||||
data.setMinCellVoltageId(StringUtils.getString(stackObj.get("DTZXDYXH")));
|
||||
data.setMaxCellTemp(StringUtils.getBigDecimal(stackObj.get("DTZGWD")));
|
||||
data.setMaxCellTempId(StringUtils.getString(stackObj.get("DTZGWDXH")));
|
||||
data.setMinCellTemp(StringUtils.getBigDecimal(stackObj.get("DTZDWD")));
|
||||
data.setMinCellTempId(StringUtils.getString(stackObj.get("DTZDWDXH")));
|
||||
|
||||
emsBatteryClusterMapper.insertEmsBatteryCluster(data);
|
||||
redisCache.setCacheObject(RedisKeyConstants.CLUSTER + SITE_ID + "_" +deviceId, data);
|
||||
|
||||
@ -470,6 +480,8 @@ public class DDSDataProcessServiceImpl extends AbstractBatteryDataProcessor impl
|
||||
} else {
|
||||
data.setStackDeviceId("1");
|
||||
}
|
||||
// 获取redis获取最新的BMSD数据
|
||||
stackObj = redisCache.getCacheObject(RedisKeyConstants.ORIGINAL_BMSD +SITE_ID+"_"+stackDeviceId);
|
||||
data.setDeviceId(deviceId);
|
||||
data.setClusterVoltage(StringUtils.getBigDecimal(obj.get("BMSC01ZLDY")));
|
||||
data.setClusterCurrent(StringUtils.getBigDecimal(obj.get("BMSC01ZLDL")));
|
||||
|
||||
@ -64,6 +64,8 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
||||
private EmsDailyChargeDataMapper emsDailyChargeDataMapper;
|
||||
@Autowired
|
||||
private EmsDailyEnergyDataMapper emsDailyEnergyDataMapper;
|
||||
@Autowired
|
||||
private EmsEnergyPriceConfigMapper emsEnergyPriceConfigMapper;
|
||||
|
||||
@Override
|
||||
public SiteMonitorHomeVo getSiteMonitorDataVo(String siteId) {
|
||||
@ -124,12 +126,36 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
||||
}
|
||||
|
||||
private void setRevenueInfo(SiteMonitorHomeVo siteMonitorHomeVo, String siteId) {
|
||||
// 默认0
|
||||
BigDecimal totalRevenue = BigDecimal.ZERO;
|
||||
BigDecimal dayRevenue = BigDecimal.ZERO;
|
||||
Map<String,BigDecimal> realTimeRevenue = emsDailyEnergyDataMapper.getRealTimeRevenue(siteId);
|
||||
if (realTimeRevenue != null) {
|
||||
totalRevenue = realTimeRevenue.get("totalRevenue") == null ? BigDecimal.ZERO : realTimeRevenue.get("totalRevenue");
|
||||
dayRevenue = realTimeRevenue.get("dayRevenue") == null ? BigDecimal.ZERO : realTimeRevenue.get("dayRevenue");
|
||||
// 当日实时数据
|
||||
String today = DateUtils.getDate();
|
||||
EmsDailyEnergyData todayData = emsDailyEnergyDataMapper.getDataByDate(siteId,today);
|
||||
if (todayData == null) {
|
||||
Map<String, BigDecimal> lastData = emsDailyEnergyDataMapper.getRealTimeRevenue(siteId);
|
||||
if (lastData != null) {
|
||||
totalRevenue = lastData.get("totalRevenue") == null ? BigDecimal.ZERO : lastData.get("totalRevenue");
|
||||
}
|
||||
} else {
|
||||
totalRevenue = todayData.getTotalRevenue() == null ? BigDecimal.ZERO : todayData.getTotalRevenue();
|
||||
// 获取当月电价
|
||||
int currentMonth = LocalDate.now().getMonthValue();
|
||||
int currentYear = LocalDate.now().getYear();
|
||||
EmsEnergyPriceConfig priceConfig = emsEnergyPriceConfigMapper.getConfigListByYearAndMonth(siteId, String.valueOf(currentYear), String.valueOf(currentMonth));
|
||||
if (priceConfig != null) {
|
||||
// 计算各个时段单独收益=(放电量-充电量)*电价,累加即当日实时收益
|
||||
BigDecimal peakRevenue = todayData.getPeakDischargeDiff().subtract(todayData.getPeakChargeDiff())
|
||||
.multiply(priceConfig.getPeak() == null ? BigDecimal.ZERO : priceConfig.getPeak());
|
||||
BigDecimal highRevenue = todayData.getHighDischargeDiff().subtract(todayData.getHighChargeDiff())
|
||||
.multiply(priceConfig.getHigh() == null ? BigDecimal.ZERO : priceConfig.getHigh());
|
||||
BigDecimal flatRevenue = todayData.getFlatDischargeDiff().subtract(todayData.getFlatChargeDiff())
|
||||
.multiply(priceConfig.getFlat() == null ? BigDecimal.ZERO : priceConfig.getFlat());
|
||||
BigDecimal valleyRevenue = todayData.getValleyDischargeDiff().subtract(todayData.getValleyChargeDiff())
|
||||
.multiply(priceConfig.getValley() == null ? BigDecimal.ZERO : priceConfig.getValley());
|
||||
dayRevenue = dayRevenue.add(peakRevenue).add(highRevenue).add(flatRevenue).add(valleyRevenue)
|
||||
.setScale(4, RoundingMode.HALF_UP);
|
||||
}
|
||||
}
|
||||
siteMonitorHomeVo.setTotalRevenue(totalRevenue);
|
||||
siteMonitorHomeVo.setDayRevenue(dayRevenue);
|
||||
|
||||
Reference in New Issue
Block a user