|
|
@ -108,7 +108,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
} |
|
|
|
} |
|
|
|
// 取redis实时数据
|
|
|
|
// 取redis实时数据
|
|
|
|
Map<String, String> map = this.getRealData(); |
|
|
|
Map<String, String> map = this.getRealData(); |
|
|
|
if(MapUtils.isEmpty(map)){ |
|
|
|
if (MapUtils.isEmpty(map)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// redis缓存设备实时数据
|
|
|
|
// redis缓存设备实时数据
|
|
|
@ -119,19 +119,115 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
real.setDeptId(device.getCreateDept()); |
|
|
|
real.setDeptId(device.getCreateDept()); |
|
|
|
real.setDeviceCode(device.getEmCode()); |
|
|
|
real.setDeviceCode(device.getEmCode()); |
|
|
|
real.setDeviceName(device.getName()); |
|
|
|
real.setDeviceName(device.getName()); |
|
|
|
real.setState(this.getPhotovoltaicState(device,map)); |
|
|
|
real.setState(this.getPhotovoltaicState(device, map)); |
|
|
|
// 容量
|
|
|
|
// 容量
|
|
|
|
real.setCapacity(device.getInstalledCapacity()); |
|
|
|
real.setCapacity(device.getInstalledCapacity()); |
|
|
|
// 发电量
|
|
|
|
// 发电量
|
|
|
|
real.setGenerate(Double.valueOf(this.getSignageValue(device,map,HomePageConstant.PV_GENERATION_CAPACITY))); |
|
|
|
real.setGenerate(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_GENERATION_CAPACITY))); |
|
|
|
// 功率
|
|
|
|
// 功率
|
|
|
|
real.setLoad(Double.valueOf(this.getSignageValue(device,map,HomePageConstant.PV_LOAD))); |
|
|
|
real.setLoad(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_LOAD))); |
|
|
|
// 电压
|
|
|
|
// 电压
|
|
|
|
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; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
// 存储redis
|
|
|
|
// 存储redis
|
|
|
@ -160,13 +256,13 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
// 当日运行时长
|
|
|
|
// 当日运行时长
|
|
|
|
//target.setRunHours(this.runHours(device.getPoint().get(HomePageConstant.PV_JOINT_RELAY)));
|
|
|
|
//target.setRunHours(this.runHours(device.getPoint().get(HomePageConstant.PV_JOINT_RELAY)));
|
|
|
|
// 年发电量
|
|
|
|
// 年发电量
|
|
|
|
target.setGenerationYear((double) this.sumValueByTime(device.getEmCode(),device.getRideCount(),"0")); |
|
|
|
target.setGenerationYear((double) this.sumValueByTime(device.getEmCode(), device.getRideCount(), "0")); |
|
|
|
// 月发电量
|
|
|
|
// 月发电量
|
|
|
|
target.setGenerationMon((double) this.sumValueByTime(device.getEmCode(),device.getRideCount(),"1")); |
|
|
|
target.setGenerationMon((double) this.sumValueByTime(device.getEmCode(), device.getRideCount(), "1")); |
|
|
|
// 日发电量
|
|
|
|
// 日发电量
|
|
|
|
target.setGenerationDay((double) this.sumValueByTime(device.getEmCode(),device.getRideCount(),"2")); |
|
|
|
target.setGenerationDay((double) this.sumValueByTime(device.getEmCode(), device.getRideCount(), "2")); |
|
|
|
// 昨日发电量
|
|
|
|
// 昨日发电量
|
|
|
|
target.setGenerationYesterday((double) this.sumValueByTime(device.getEmCode(),device.getRideCount(),"3")); |
|
|
|
target.setGenerationYesterday((double) this.sumValueByTime(device.getEmCode(), device.getRideCount(), "3")); |
|
|
|
// 收益
|
|
|
|
// 收益
|
|
|
|
target.setIncome(target.getGenerationDay() * 0.34); |
|
|
|
target.setIncome(target.getGenerationDay() * 0.34); |
|
|
|
// 节约标准煤
|
|
|
|
// 节约标准煤
|
|
|
@ -186,14 +282,15 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 当天有功功率 |
|
|
|
* 当天有功功率 |
|
|
|
|
|
|
|
* |
|
|
|
* @param device |
|
|
|
* @param device |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<PhotovoltaicPowerVo> getLoadsByDay(EminfoAndEmParamVo device) { |
|
|
|
private List<PhotovoltaicPowerVo> getLoadsByDay(EminfoAndEmParamVo device) { |
|
|
|
String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,1,2,device.getEmCode(),HomePageConstant.PV_LOAD); |
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); |
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
if (CollectionUtil.isEmpty(records)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
|
return records.stream().map(record -> { |
|
|
|
return records.stream().map(record -> { |
|
|
@ -207,6 +304,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 近30天发电量 |
|
|
|
* 近30天发电量 |
|
|
|
|
|
|
|
* |
|
|
|
* @param device |
|
|
|
* @param device |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -218,14 +316,14 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); |
|
|
|
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); |
|
|
|
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); |
|
|
|
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); |
|
|
|
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,3,device.getEmCode(),HomePageConstant.PV_GENERATION_CAPACITY); |
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 5, 3, device.getEmCode(), HomePageConstant.PV_GENERATION_CAPACITY); |
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
if (CollectionUtil.isEmpty(records)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
|
return records.stream().map(record -> { |
|
|
|
return records.stream().map(record -> { |
|
|
|
GenerationPowerVo generate = new GenerationPowerVo(); |
|
|
|
GenerationPowerVo generate = new GenerationPowerVo(); |
|
|
|
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); |
|
|
|
generate.setDate(DateUtil.format(time, DateUtil.PATTERN_DATE)); |
|
|
|
generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); |
|
|
|
generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); |
|
|
|
return generate; |
|
|
|
return generate; |
|
|
|
}).sorted(Comparator.comparing(GenerationPowerVo::getDate)).collect(Collectors.toList()); |
|
|
|
}).sorted(Comparator.comparing(GenerationPowerVo::getDate)).collect(Collectors.toList()); |
|
|
@ -234,65 +332,67 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据事件查询数据值 |
|
|
|
* 根据事件查询数据值 |
|
|
|
|
|
|
|
* |
|
|
|
* @param deviceCode |
|
|
|
* @param deviceCode |
|
|
|
* @param rideCount |
|
|
|
* @param rideCount |
|
|
|
* @param type |
|
|
|
* @param type |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private float sumValueByTime(String deviceCode, int rideCount,String type) { |
|
|
|
private float sumValueByTime(String deviceCode, int rideCount, String type) { |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
String start = null,end = null; |
|
|
|
String start = null, end = null; |
|
|
|
Integer cycleType = 3; |
|
|
|
Integer cycleType = 3; |
|
|
|
switch (type){ |
|
|
|
switch (type) { |
|
|
|
//年
|
|
|
|
//年
|
|
|
|
case "0": |
|
|
|
case "0": |
|
|
|
calendar.add(Calendar.HOUR_OF_DAY, + 1); |
|
|
|
calendar.add(Calendar.HOUR_OF_DAY, +1); |
|
|
|
end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
calendar.setTime(new Date()); |
|
|
|
calendar.setTime(new Date()); |
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, -calendar.get(Calendar.DATE) + 1); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, -calendar.get(Calendar.DATE) + 1); |
|
|
|
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY)); |
|
|
|
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY)); |
|
|
|
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); |
|
|
|
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); |
|
|
|
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); |
|
|
|
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); |
|
|
|
start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
cycleType = 6; |
|
|
|
cycleType = 6; |
|
|
|
break; |
|
|
|
break; |
|
|
|
//月
|
|
|
|
//月
|
|
|
|
case "1": |
|
|
|
case "1": |
|
|
|
start = DateUtil.format(new Date(),"yyyy-MM") + "-01 00:00:00"; |
|
|
|
start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; |
|
|
|
end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
cycleType = 5; |
|
|
|
cycleType = 5; |
|
|
|
break; |
|
|
|
break; |
|
|
|
//日
|
|
|
|
//日
|
|
|
|
case "2": |
|
|
|
case "2": |
|
|
|
start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
break; |
|
|
|
break; |
|
|
|
//昨日
|
|
|
|
//昨日
|
|
|
|
case "3": |
|
|
|
case "3": |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, - 1); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, -1); |
|
|
|
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY)); |
|
|
|
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY)); |
|
|
|
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); |
|
|
|
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); |
|
|
|
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); |
|
|
|
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); |
|
|
|
start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
end = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
end = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
return analyseDataService.periodTargetFloat(start,end,5,cycleType,deviceCode,rideCount,HomePageConstant.PV_GENERATION_CAPACITY); |
|
|
|
return analyseDataService.periodTargetFloat(start, end, 5, cycleType, deviceCode, rideCount, HomePageConstant.PV_GENERATION_CAPACITY); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取上一次功率 |
|
|
|
* 获取上一次功率 |
|
|
|
|
|
|
|
* |
|
|
|
* @param device |
|
|
|
* @param device |
|
|
|
* @param history |
|
|
|
* @param history |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Double getLastLoad(EminfoAndEmParamVo device, List<PhotovoltaicRealVo> history) { |
|
|
|
private Double getLastLoad(EminfoAndEmParamVo device, List<PhotovoltaicRealVo> history) { |
|
|
|
if(CollectionUtil.isEmpty(history)){ |
|
|
|
if (CollectionUtil.isEmpty(history)) { |
|
|
|
return 0.0; |
|
|
|
return 0.0; |
|
|
|
} |
|
|
|
} |
|
|
|
List<PhotovoltaicRealVo> historyDevice = history.stream().filter(o -> o.getDeviceCode().equals(device.getEmCode())).collect(Collectors.toList()); |
|
|
|
List<PhotovoltaicRealVo> historyDevice = history.stream().filter(o -> o.getDeviceCode().equals(device.getEmCode())).collect(Collectors.toList()); |
|
|
|
if(CollectionUtil.isEmpty(historyDevice)){ |
|
|
|
if (CollectionUtil.isEmpty(historyDevice)) { |
|
|
|
return 0.0; |
|
|
|
return 0.0; |
|
|
|
} |
|
|
|
} |
|
|
|
return historyDevice.get(0).getLoad(); |
|
|
|
return historyDevice.get(0).getLoad(); |
|
|
@ -300,12 +400,13 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取开机状态 |
|
|
|
* 获取开机状态 |
|
|
|
|
|
|
|
* |
|
|
|
* @param device |
|
|
|
* @param device |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private int getPhotovoltaicState(EminfoAndEmParamVo device,Map<String,String> map) { |
|
|
|
private int getPhotovoltaicState(EminfoAndEmParamVo device, Map<String, String> map) { |
|
|
|
// 获取开关机监测点实时数据
|
|
|
|
// 获取开关机监测点实时数据
|
|
|
|
String value = this.getSignageValue(device,map,HomePageConstant.PV_JOINT_RELAY); |
|
|
|
String value = this.getSignageValue(device, map, HomePageConstant.PV_JOINT_RELAY); |
|
|
|
// 开机状态
|
|
|
|
// 开机状态
|
|
|
|
if (HomePageConstant.OFF.equals(value)) { |
|
|
|
if (HomePageConstant.OFF.equals(value)) { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
@ -315,25 +416,26 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取监测点实时数据 |
|
|
|
* 获取监测点实时数据 |
|
|
|
|
|
|
|
* |
|
|
|
* @param em |
|
|
|
* @param em |
|
|
|
* @param map |
|
|
|
* @param map |
|
|
|
* @param targets |
|
|
|
* @param targets |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private String getSignageValue(EminfoAndEmParamVo em,Map<String,String> map, String targets) { |
|
|
|
private String getSignageValue(EminfoAndEmParamVo em, Map<String, String> map, String targets) { |
|
|
|
if(ObjectUtil.isEmpty(em) || MapUtils.isEmpty(map)){ |
|
|
|
if (ObjectUtil.isEmpty(em) || MapUtils.isEmpty(map)) { |
|
|
|
return "0"; |
|
|
|
return "0"; |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String,String> point = em.getPoint(); |
|
|
|
Map<String, String> point = em.getPoint(); |
|
|
|
if(MapUtils.isEmpty(point)){ |
|
|
|
if (MapUtils.isEmpty(point)) { |
|
|
|
return "0"; |
|
|
|
return "0"; |
|
|
|
} |
|
|
|
} |
|
|
|
String realId = point.get(targets); |
|
|
|
String realId = point.get(targets); |
|
|
|
if(StringUtil.isEmpty(realId)){ |
|
|
|
if (StringUtil.isEmpty(realId)) { |
|
|
|
return "0"; |
|
|
|
return "0"; |
|
|
|
} |
|
|
|
} |
|
|
|
String value = map.get(realId); |
|
|
|
String value = map.get(realId); |
|
|
|
if(StringUtil.isEmpty(realId)){ |
|
|
|
if (StringUtil.isEmpty(realId)) { |
|
|
|
return "0"; |
|
|
|
return "0"; |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取value
|
|
|
|
// 获取value
|
|
|
@ -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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -992,7 +1026,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
// 容量、实时功率、今日发电量
|
|
|
|
// 容量、实时功率、今日发电量
|
|
|
|
this.subordinateTargetData(subordinate, entry.getValue().stream().collect(Collectors.toList()), deviceReals, deviceTargets); |
|
|
|
this.subordinateTargetData(subordinate, entry.getValue().stream().collect(Collectors.toList()), deviceReals, deviceTargets); |
|
|
|
// 当月任务执行情况
|
|
|
|
// 当月任务执行情况
|
|
|
|
this.subordinateTaskMon(subordinate,Collections.singletonList(entry.getKey().getId())); |
|
|
|
this.subordinateTaskMon(subordinate, Collections.singletonList(entry.getKey().getId())); |
|
|
|
subordinates.add(subordinate); |
|
|
|
subordinates.add(subordinate); |
|
|
|
} |
|
|
|
} |
|
|
|
return subordinates; |
|
|
|
return subordinates; |
|
|
@ -1000,9 +1034,10 @@ 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) { |
|
|
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME); |
|
|
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME); |
|
|
|
LocalDate firstDay = LocalDate.now().withDayOfMonth(1); |
|
|
|
LocalDate firstDay = LocalDate.now().withDayOfMonth(1); |
|
|
|
LocalDateTime startTime = LocalDateTime.of(firstDay, LocalTime.MIN); |
|
|
|
LocalDateTime startTime = LocalDateTime.of(firstDay, LocalTime.MIN); |
|
|
@ -1012,23 +1047,23 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
//监控线程执行完后返回结果
|
|
|
|
//监控线程执行完后返回结果
|
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(POOL_QUANTITY); |
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(POOL_QUANTITY); |
|
|
|
// 日常维护
|
|
|
|
// 日常维护
|
|
|
|
exe.execute(()->{ |
|
|
|
exe.execute(() -> { |
|
|
|
MaintainVo maintainVo = taskService.getMaintain(dtf.format(startTime),dtf.format(endTime),depts); |
|
|
|
MaintainVo maintainVo = taskService.getMaintain(dtf.format(startTime), dtf.format(endTime), depts); |
|
|
|
subordinate.setMaintenanceCount(maintainVo.getMaintain()); |
|
|
|
subordinate.setMaintenanceCount(maintainVo.getMaintain()); |
|
|
|
subordinate.setMaintenanceFinishCount(maintainVo.getMaintainFinish()); |
|
|
|
subordinate.setMaintenanceFinishCount(maintainVo.getMaintainFinish()); |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 消缺
|
|
|
|
// 消缺
|
|
|
|
exe.execute(()->{ |
|
|
|
exe.execute(() -> { |
|
|
|
ShortagesVo shortages = taskService.getShortages(depts); |
|
|
|
ShortagesVo shortages = taskService.getShortages(depts); |
|
|
|
subordinate.setDefectCount(shortages.getShortagesSum()); |
|
|
|
subordinate.setDefectCount(shortages.getShortagesSum()); |
|
|
|
subordinate.setDefectFinishCount(shortages.getShortages()); |
|
|
|
subordinate.setDefectFinishCount(shortages.getShortages()); |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 检修
|
|
|
|
// 检修
|
|
|
|
exe.execute(()->{ |
|
|
|
exe.execute(() -> { |
|
|
|
OverhaulVo overhaulVo = taskService.getOverhaul(dtf.format(startTime),dtf.format(endTime),depts); |
|
|
|
OverhaulVo overhaulVo = taskService.getOverhaul(dtf.format(startTime), dtf.format(endTime), depts); |
|
|
|
int overhaul = overhaulVo.getOverhaul(); |
|
|
|
int overhaul = overhaulVo.getOverhaul(); |
|
|
|
int overhaulFinish = overhaulVo.getOverhaulFinish(); |
|
|
|
int overhaulFinish = overhaulVo.getOverhaulFinish(); |
|
|
|
subordinate.setOverhaulCount(overhaul); |
|
|
|
subordinate.setOverhaulCount(overhaul); |
|
|
@ -1036,11 +1071,11 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 操作票&工作票
|
|
|
|
// 操作票&工作票
|
|
|
|
exe.execute(()->{ |
|
|
|
exe.execute(() -> { |
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("startDate",dtf.format(startTime)); |
|
|
|
map.put("startDate", dtf.format(startTime)); |
|
|
|
map.put("endDate",dtf.format(endTime)); |
|
|
|
map.put("endDate", dtf.format(endTime)); |
|
|
|
map.put("deptList",depts); |
|
|
|
map.put("deptList", depts); |
|
|
|
R<TicketMonthVO> R = ticketInfoClient.getOperateWorkStatistic(map); |
|
|
|
R<TicketMonthVO> R = ticketInfoClient.getOperateWorkStatistic(map); |
|
|
|
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) { |
|
|
|
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -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()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|