|
|
@ -130,6 +130,102 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
real.setVoltage(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_VOLTAGE))); |
|
|
|
real.setVoltage(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_VOLTAGE))); |
|
|
|
// 电流
|
|
|
|
// 电流
|
|
|
|
real.setCurrent(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_CURRENT))); |
|
|
|
real.setCurrent(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_CURRENT))); |
|
|
|
|
|
|
|
// 直流电流1
|
|
|
|
|
|
|
|
real.setDirect_one(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_ONE))); |
|
|
|
|
|
|
|
// 直流电流2
|
|
|
|
|
|
|
|
real.setDirect_two(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_TWO))); |
|
|
|
|
|
|
|
// 直流电流3
|
|
|
|
|
|
|
|
real.setDirect_three(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_THREE))); |
|
|
|
|
|
|
|
// 直流电流4
|
|
|
|
|
|
|
|
real.setDirect_four(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_FOUR))); |
|
|
|
|
|
|
|
// 直流电流5
|
|
|
|
|
|
|
|
real.setDirect_five(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_FIVE))); |
|
|
|
|
|
|
|
// 直流电流6
|
|
|
|
|
|
|
|
real.setDirect_six(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_SIX))); |
|
|
|
|
|
|
|
// 直流电流7
|
|
|
|
|
|
|
|
real.setDirect_seven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_SEVEN))); |
|
|
|
|
|
|
|
// 直流电流8
|
|
|
|
|
|
|
|
real.setDirect_eight(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_EIGHT))); |
|
|
|
|
|
|
|
// 直流电流9
|
|
|
|
|
|
|
|
real.setDirect_nine(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_NINE))); |
|
|
|
|
|
|
|
// 直流电流10
|
|
|
|
|
|
|
|
real.setDirect_ten(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_TEN))); |
|
|
|
|
|
|
|
// 直流电流11
|
|
|
|
|
|
|
|
real.setDirect_eleven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_ELEVEN))); |
|
|
|
|
|
|
|
// 直流电流12
|
|
|
|
|
|
|
|
real.setDirect_twelve(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_TWELVE))); |
|
|
|
|
|
|
|
// 直流电压1
|
|
|
|
|
|
|
|
real.setDc_voltage_one(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_ONE))); |
|
|
|
|
|
|
|
// 直流电压2
|
|
|
|
|
|
|
|
real.setDc_voltage_two(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_TWO))); |
|
|
|
|
|
|
|
// 直流电压3
|
|
|
|
|
|
|
|
real.setDc_voltage_three(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_THREE))); |
|
|
|
|
|
|
|
// 直流电压4
|
|
|
|
|
|
|
|
real.setDc_voltage_four(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_FOUR))); |
|
|
|
|
|
|
|
// 直流电压5
|
|
|
|
|
|
|
|
real.setDc_voltage_five(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_FIVE))); |
|
|
|
|
|
|
|
// 直流电压6
|
|
|
|
|
|
|
|
real.setDc_voltage_six(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_SIX))); |
|
|
|
|
|
|
|
// 直流电压7
|
|
|
|
|
|
|
|
real.setDc_voltage_seven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_SEVEN))); |
|
|
|
|
|
|
|
// 直流电压8
|
|
|
|
|
|
|
|
real.setDc_voltage_eight(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_EIGHT))); |
|
|
|
|
|
|
|
// 直流电压9
|
|
|
|
|
|
|
|
real.setDc_voltage_nine(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_NINE))); |
|
|
|
|
|
|
|
// 直流电压10
|
|
|
|
|
|
|
|
real.setDc_voltage_ten(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_TEN))); |
|
|
|
|
|
|
|
// 直流电压11
|
|
|
|
|
|
|
|
real.setDc_voltage_eleven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_ELEVEN))); |
|
|
|
|
|
|
|
// 直流电压12
|
|
|
|
|
|
|
|
real.setDc_voltage_twelve(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_TWELVE))); |
|
|
|
|
|
|
|
// 串流电流1
|
|
|
|
|
|
|
|
real.setDirect_one(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_ONE))); |
|
|
|
|
|
|
|
// 串流电流2
|
|
|
|
|
|
|
|
real.setSeries_two(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_TWO))); |
|
|
|
|
|
|
|
// 串流电流3
|
|
|
|
|
|
|
|
real.setSeries_three(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_THREE))); |
|
|
|
|
|
|
|
// 串流电流4
|
|
|
|
|
|
|
|
real.setSeries_four(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_FOUR))); |
|
|
|
|
|
|
|
// 串流电流5
|
|
|
|
|
|
|
|
real.setSeries_five(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_FIVE))); |
|
|
|
|
|
|
|
// 串流电流6
|
|
|
|
|
|
|
|
real.setSeries_six(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_SIX))); |
|
|
|
|
|
|
|
// 串流电流7
|
|
|
|
|
|
|
|
real.setSeries_seven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_SEVEN))); |
|
|
|
|
|
|
|
// 串流电流8
|
|
|
|
|
|
|
|
real.setSeries_eight(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_EIGHT))); |
|
|
|
|
|
|
|
// 串流电流9
|
|
|
|
|
|
|
|
real.setSeries_nine(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_NINE))); |
|
|
|
|
|
|
|
// 串流电流10
|
|
|
|
|
|
|
|
real.setSeries_ten(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_TEN))); |
|
|
|
|
|
|
|
// 串流电流11
|
|
|
|
|
|
|
|
real.setSeries_eleven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_ELEVEN))); |
|
|
|
|
|
|
|
// 串流电流12
|
|
|
|
|
|
|
|
real.setSeries_twelve(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_TWELVE))); |
|
|
|
|
|
|
|
// 串流电压1
|
|
|
|
|
|
|
|
real.setSe_voltage_one(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_ONE))); |
|
|
|
|
|
|
|
// 串流电压2
|
|
|
|
|
|
|
|
real.setSe_voltage_two(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_TWO))); |
|
|
|
|
|
|
|
// 串流电压3
|
|
|
|
|
|
|
|
real.setSe_voltage_three(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_THREE))); |
|
|
|
|
|
|
|
// 串流电压4
|
|
|
|
|
|
|
|
real.setSe_voltage_four(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_FOUR))); |
|
|
|
|
|
|
|
// 串流电压5
|
|
|
|
|
|
|
|
real.setSe_voltage_five(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_FIVE))); |
|
|
|
|
|
|
|
// 串流电压6
|
|
|
|
|
|
|
|
real.setSe_voltage_six(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_SIX))); |
|
|
|
|
|
|
|
// 串流电压7
|
|
|
|
|
|
|
|
real.setSe_voltage_seven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_SEVEN))); |
|
|
|
|
|
|
|
// 串流电压8
|
|
|
|
|
|
|
|
real.setSe_voltage_eight(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_EIGHT))); |
|
|
|
|
|
|
|
// 串流电压9
|
|
|
|
|
|
|
|
real.setSe_voltage_nine(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_NINE))); |
|
|
|
|
|
|
|
// 串流电压10
|
|
|
|
|
|
|
|
real.setSe_voltage_ten(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_TEN))); |
|
|
|
|
|
|
|
// 串流电压11
|
|
|
|
|
|
|
|
real.setSe_voltage_eleven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_ELEVEN))); |
|
|
|
|
|
|
|
// 串流电压12
|
|
|
|
|
|
|
|
real.setSe_voltage_twelve(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_TWELVE))); |
|
|
|
// 上次功率
|
|
|
|
// 上次功率
|
|
|
|
real.setLastLoad(this.getLastLoad(device, history)); |
|
|
|
real.setLastLoad(this.getLastLoad(device, history)); |
|
|
|
return real; |
|
|
|
return real; |
|
|
@ -186,6 +282,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 当天有功功率 |
|
|
|
* 当天有功功率 |
|
|
|
|
|
|
|
* |
|
|
|
* @param device |
|
|
|
* @param device |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -207,6 +304,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 近30天发电量 |
|
|
|
* 近30天发电量 |
|
|
|
|
|
|
|
* |
|
|
|
* @param device |
|
|
|
* @param device |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -234,6 +332,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据事件查询数据值 |
|
|
|
* 根据事件查询数据值 |
|
|
|
|
|
|
|
* |
|
|
|
* @param deviceCode |
|
|
|
* @param deviceCode |
|
|
|
* @param rideCount |
|
|
|
* @param rideCount |
|
|
|
* @param type |
|
|
|
* @param type |
|
|
@ -283,6 +382,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取上一次功率 |
|
|
|
* 获取上一次功率 |
|
|
|
|
|
|
|
* |
|
|
|
* @param device |
|
|
|
* @param device |
|
|
|
* @param history |
|
|
|
* @param history |
|
|
|
* @return |
|
|
|
* @return |
|
|
@ -300,6 +400,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取开机状态 |
|
|
|
* 获取开机状态 |
|
|
|
|
|
|
|
* |
|
|
|
* @param device |
|
|
|
* @param device |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -315,6 +416,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取监测点实时数据 |
|
|
|
* 获取监测点实时数据 |
|
|
|
|
|
|
|
* |
|
|
|
* @param em |
|
|
|
* @param em |
|
|
|
* @param map |
|
|
|
* @param map |
|
|
|
* @param targets |
|
|
|
* @param targets |
|
|
@ -463,74 +565,6 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取年、月、日发电量 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param device |
|
|
|
|
|
|
|
* @param scope |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private float getGenerationPower(EminfoAndEmParamVo device, int scope) { |
|
|
|
|
|
|
|
// 日期格式化yyyy-mm-dd
|
|
|
|
|
|
|
|
SimpleDateFormat df = new SimpleDateFormat(DateUtil.PATTERN_DATE); |
|
|
|
|
|
|
|
// 日期格式化yyyy-mm-dd
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
String startTime, endTime; |
|
|
|
|
|
|
|
int cycle; |
|
|
|
|
|
|
|
switch (scope) { |
|
|
|
|
|
|
|
// 年
|
|
|
|
|
|
|
|
case 0: |
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
endTime = sdf.format(calendar.getTime()); |
|
|
|
|
|
|
|
calendar.setTime(new Date()); |
|
|
|
|
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
|
|
|
|
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); |
|
|
|
|
|
|
|
startTime = df.format(calendar.getTime()) + " 00:00:00"; |
|
|
|
|
|
|
|
cycle = EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
// 月
|
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
startTime = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; |
|
|
|
|
|
|
|
endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
cycle = EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
// 日
|
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
|
|
|
|
String time = df.format(cal.getTime()); |
|
|
|
|
|
|
|
startTime = time + " 00:00:00"; |
|
|
|
|
|
|
|
endTime = time + " 23:59:59"; |
|
|
|
|
|
|
|
cycle = EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
throw new IllegalStateException("Unexpected value: " + scope); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return homePageService.getAnalyzeCodeAndSignages(device, startTime, endTime, cycle, HomePageConstant.PV_GENERATION_CAPACITY); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 当天功率 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<String> getTestDay() { |
|
|
|
|
|
|
|
// 日期格式化yyyy-mm-dd
|
|
|
|
|
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH"); |
|
|
|
|
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
|
|
|
|
// 开始日期
|
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
calendar.setTime(new Date()); |
|
|
|
|
|
|
|
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY)); |
|
|
|
|
|
|
|
calendar.add(Calendar.HOUR_OF_DAY, +1); |
|
|
|
|
|
|
|
list.add(df.format(calendar.getTime())); |
|
|
|
|
|
|
|
// 获取时间
|
|
|
|
|
|
|
|
while (calendar.getTime().compareTo(new Date()) <= 0) { |
|
|
|
|
|
|
|
calendar.add(Calendar.HOUR_OF_DAY, +1); |
|
|
|
|
|
|
|
list.add(df.format(calendar.getTime())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return list.stream().sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取近30天集合 |
|
|
|
* 获取近30天集合 |
|
|
|
* |
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return |
|
|
@ -950,8 +984,8 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
photovoltaic.setCharts(this.deviceCharts(photovoltaic.getDevices())); |
|
|
|
photovoltaic.setCharts(this.deviceCharts(photovoltaic.getDevices())); |
|
|
|
// 站点实时数据: 装机容量、总发电量、功率、收益
|
|
|
|
// 站点实时数据: 装机容量、总发电量、功率、收益
|
|
|
|
this.real_data(photovoltaic); |
|
|
|
this.real_data(photovoltaic); |
|
|
|
// 年发电量比较概括
|
|
|
|
// 站点今日功率,近年发电量
|
|
|
|
photovoltaic.setGenerateSurvey(this.generateSurvey(station.getId())); |
|
|
|
this.target_data(photovoltaic); |
|
|
|
return photovoltaic; |
|
|
|
return photovoltaic; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1000,6 +1034,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 当月任务执行情况 |
|
|
|
* 当月任务执行情况 |
|
|
|
|
|
|
|
* |
|
|
|
* @param subordinate |
|
|
|
* @param subordinate |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void subordinateTaskMon(PhotovoltaicSubordinateAppVo subordinate, List<Long> depts) { |
|
|
|
private void subordinateTaskMon(PhotovoltaicSubordinateAppVo subordinate, List<Long> depts) { |
|
|
@ -1419,6 +1454,53 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
photovoltaic.setGenerateDay(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum()); |
|
|
|
photovoltaic.setGenerateDay(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum()); |
|
|
|
// 功率
|
|
|
|
// 功率
|
|
|
|
photovoltaic.setLoad(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLoad).sum()); |
|
|
|
photovoltaic.setLoad(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLoad).sum()); |
|
|
|
|
|
|
|
double generationDay = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum(); |
|
|
|
|
|
|
|
double generationYesterday = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerationYesterday).sum(); |
|
|
|
|
|
|
|
// 环比发电量
|
|
|
|
|
|
|
|
if (Math.abs(generationDay) <= 0 || Math.abs(generationYesterday) <= 0) { |
|
|
|
|
|
|
|
photovoltaic.setGenerateDayRatio(0.0); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
photovoltaic.setGenerateDayRatio(BigDecimal.valueOf((generationDay - generationYesterday) / generationYesterday * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
double load = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLoad).sum(); |
|
|
|
|
|
|
|
double lastLoad = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLastLoad).sum(); |
|
|
|
|
|
|
|
// 环比功率
|
|
|
|
|
|
|
|
if (Math.abs(load) <= 0 || Math.abs(lastLoad) <= 0) { |
|
|
|
|
|
|
|
photovoltaic.setLoadRatio(0.0); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
photovoltaic.setLoadRatio(BigDecimal.valueOf((load - lastLoad) / lastLoad * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 站点指标数据统计 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param photovoltaic |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void target_data(PhotovoltaicStationVo photovoltaic) { |
|
|
|
|
|
|
|
List<PhotovoltaicDeviceVo> devices = photovoltaic.getDevices(); |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(devices)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 功率
|
|
|
|
|
|
|
|
photovoltaic.setActivePowerVoList( |
|
|
|
|
|
|
|
devices.stream().map(PhotovoltaicDeviceVo::getActivePowerVoList).flatMap(Collection::stream).collect(Collectors.groupingBy(PhotovoltaicPowerVo::getHour)).entrySet().stream().map(entry -> { |
|
|
|
|
|
|
|
PhotovoltaicPowerVo load = new PhotovoltaicPowerVo(); |
|
|
|
|
|
|
|
load.setHour(entry.getKey()); |
|
|
|
|
|
|
|
load.setActivePower(String.valueOf(entry.getValue().stream().mapToDouble(o -> Double.valueOf(o.getActivePower())).sum())); |
|
|
|
|
|
|
|
return load; |
|
|
|
|
|
|
|
}).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
// 发电量
|
|
|
|
|
|
|
|
photovoltaic.setGenerationPowerVoList( |
|
|
|
|
|
|
|
devices.stream().map(PhotovoltaicDeviceVo::getGenerationPowerVoList).flatMap(Collection::stream).collect(Collectors.groupingBy(GenerationPowerVo::getDate)).entrySet().stream().map(entry -> { |
|
|
|
|
|
|
|
GenerationPowerVo generate = new GenerationPowerVo(); |
|
|
|
|
|
|
|
generate.setDate(entry.getKey()); |
|
|
|
|
|
|
|
generate.setGenerate((float) entry.getValue().stream().mapToDouble(o -> Double.valueOf(o.getGenerate())).sum()); |
|
|
|
|
|
|
|
return generate; |
|
|
|
|
|
|
|
}).sorted(Comparator.comparing(GenerationPowerVo::getDate)).collect(Collectors.toList()) |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1446,6 +1528,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
// 总发电量、实时功率、电压、电流、环比功率
|
|
|
|
// 总发电量、实时功率、电压、电流、环比功率
|
|
|
|
item.setGenerate(mateReals.get(0).getGenerate()); |
|
|
|
item.setGenerate(mateReals.get(0).getGenerate()); |
|
|
|
item.setLoad(mateReals.get(0).getLoad()); |
|
|
|
item.setLoad(mateReals.get(0).getLoad()); |
|
|
|
|
|
|
|
item.setLastLoad(mateReals.get(0).getLastLoad()); |
|
|
|
item.setVoltage(mateReals.get(0).getVoltage()); |
|
|
|
item.setVoltage(mateReals.get(0).getVoltage()); |
|
|
|
item.setCurrent(mateReals.get(0).getCurrent()); |
|
|
|
item.setCurrent(mateReals.get(0).getCurrent()); |
|
|
|
// 环比功率
|
|
|
|
// 环比功率
|
|
|
@ -1463,6 +1546,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
item.setGenerateYear(mateTargets.get(0).getGenerationYear()); |
|
|
|
item.setGenerateYear(mateTargets.get(0).getGenerationYear()); |
|
|
|
item.setGenerateMon(mateTargets.get(0).getGenerationMon()); |
|
|
|
item.setGenerateMon(mateTargets.get(0).getGenerationMon()); |
|
|
|
item.setGenerateDay(mateTargets.get(0).getGenerationDay()); |
|
|
|
item.setGenerateDay(mateTargets.get(0).getGenerationDay()); |
|
|
|
|
|
|
|
item.setGenerationYesterday(mateTargets.get(0).getGenerationYesterday()); |
|
|
|
item.setCo2(mateTargets.get(0).getCo2()); |
|
|
|
item.setCo2(mateTargets.get(0).getCo2()); |
|
|
|
item.setTec(mateTargets.get(0).getTec()); |
|
|
|
item.setTec(mateTargets.get(0).getTec()); |
|
|
|
item.setDeforest(mateTargets.get(0).getDeforest()); |
|
|
|
item.setDeforest(mateTargets.get(0).getDeforest()); |
|
|
@ -1501,40 +1585,4 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
}).sorted(Comparator.comparing(PhotovoltaicDeviceChartsVo::getGenerate)).collect(Collectors.toList()); |
|
|
|
}).sorted(Comparator.comparing(PhotovoltaicDeviceChartsVo::getGenerate)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 年发电量比较概括 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<PowerYearVo> generateSurvey(Long station) { |
|
|
|
|
|
|
|
Map<Long, Map<String, Float>> map = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(recent_year_power_data); |
|
|
|
|
|
|
|
if (MapUtils.isEmpty(map)) { |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 站点发电数据
|
|
|
|
|
|
|
|
if (!map.containsKey(station)) { |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 转换成集合
|
|
|
|
|
|
|
|
List<PowerMonthVo> generates = new ArrayList<>(); |
|
|
|
|
|
|
|
map.get(station).forEach((key, value) -> { |
|
|
|
|
|
|
|
PowerMonthVo generate = new PowerMonthVo(); |
|
|
|
|
|
|
|
LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), key), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); |
|
|
|
|
|
|
|
generate.setYear(localDate.getYear()); |
|
|
|
|
|
|
|
generate.setMonth(localDate.getMonthValue()); |
|
|
|
|
|
|
|
generate.setStrMonth(key); |
|
|
|
|
|
|
|
generate.setPower(value); |
|
|
|
|
|
|
|
generates.add(generate); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// 根据年份分组
|
|
|
|
|
|
|
|
Map<Integer, List<PowerMonthVo>> year = generates.stream().collect(Collectors.groupingBy(PowerMonthVo::getYear)); |
|
|
|
|
|
|
|
// 返回结果集
|
|
|
|
|
|
|
|
return year.entrySet().stream().map(entry -> { |
|
|
|
|
|
|
|
PowerYearVo powerYearVo = new PowerYearVo(); |
|
|
|
|
|
|
|
powerYearVo.setYear(entry.getKey()); |
|
|
|
|
|
|
|
List<PowerMonthVo> sortValue = entry.getValue().stream().sorted(Comparator.comparing(PowerMonthVo::getMonth)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
powerYearVo.setPowerMonthVoList(sortValue); |
|
|
|
|
|
|
|
return powerYearVo; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|