| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.google.common.util.concurrent.ThreadFactoryBuilder; | 
					 | 
					 | 
					 | 
					import com.google.common.util.concurrent.ThreadFactoryBuilder; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.EquipmentConstants; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.EquipmentConstants; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.equipment.entity.EmParamEntity; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.equipment.entity.EmParamEntity; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.equipment.entity.ThirtyGenerationEntity; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.equipment.entity.ThreeGenerationEntity; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.hzimsweather.feign.IHeWeatherWeatherClient; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.hzimsweather.feign.IHeWeatherWeatherClient; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -19,6 +21,8 @@ import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.operational.station.entity.StationEntity; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.operational.station.entity.StationEntity; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.scheduled.service.equipment.DeviceParamService; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.scheduled.service.equipment.DeviceParamService; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.scheduled.service.equipment.DeviceService; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.scheduled.service.equipment.DeviceService; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.scheduled.service.equipment.ThirtyGenerateService; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.scheduled.service.equipment.ThreeGenerateService; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.scheduled.service.operation.fill.*; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.scheduled.service.operation.fill.*; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.scheduled.service.operation.home.ModelStationService; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.scheduled.service.operation.home.ModelStationService; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.scheduled.service.operation.home.RealTargetService; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.scheduled.service.operation.home.RealTargetService; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -92,6 +96,10 @@ public class RealTargetServiceImpl implements RealTargetService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						private final ModelStationService modelStationService; | 
					 | 
					 | 
					 | 
						private final ModelStationService modelStationService; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						private final ThreeGenerateService threeGenerateService; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						private final ThirtyGenerateService thirtyGenerateService; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						private final RedisTemplate redisTemplate; | 
					 | 
					 | 
					 | 
						private final RedisTemplate redisTemplate; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						private final IHeWeatherWeatherClient heWeatherWeatherClient; | 
					 | 
					 | 
					 | 
						private final IHeWeatherWeatherClient heWeatherWeatherClient; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -102,6 +110,7 @@ public class RealTargetServiceImpl implements RealTargetService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						private final DeviceDataClient deviceDataClient; | 
					 | 
					 | 
					 | 
						private final DeviceDataClient deviceDataClient; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						@Value("${hzims.equipment.emInfo.emInfoList}") | 
					 | 
					 | 
					 | 
						@Value("${hzims.equipment.emInfo.emInfoList}") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						public String device_cache_cofig_final; | 
					 | 
					 | 
					 | 
						public String device_cache_cofig_final; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -272,10 +281,17 @@ public class RealTargetServiceImpl implements RealTargetService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if(CollectionUtil.isEmpty(stations)){ | 
					 | 
					 | 
					 | 
							if(CollectionUtil.isEmpty(stations)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								return; | 
					 | 
					 | 
					 | 
								return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							} | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							// 设备30日发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							List<ThirtyGenerationEntity> generations = this.thirtyGenerations(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							// 设备当年发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							List<ThreeGenerationEntity> generationYears = this.threeGenerations(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							// 设备去年发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							List<ThreeGenerationEntity> generationYesterYears = this.threeYesterGenerations(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							// 补充填补发电指标
 | 
					 | 
					 | 
					 | 
							// 补充填补发电指标
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							List<HydropowerUnitTargetVo> targets = this.generteFill(stations); | 
					 | 
					 | 
					 | 
							List<HydropowerUnitTargetVo> targets = this.generteFill(stations); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							// 水电站设备
 | 
					 | 
					 | 
					 | 
							// 水电站设备
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); | 
					 | 
					 | 
					 | 
							List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							Random random = new Random(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if(CollectionUtil.isNotEmpty(devices)){ | 
					 | 
					 | 
					 | 
							if(CollectionUtil.isNotEmpty(devices)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								CountDownLatch countDownLatch = new CountDownLatch(devices.size()); | 
					 | 
					 | 
					 | 
								CountDownLatch countDownLatch = new CountDownLatch(devices.size()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								for(EminfoAndEmParamVo device : devices) { | 
					 | 
					 | 
					 | 
								for(EminfoAndEmParamVo device : devices) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -283,19 +299,34 @@ public class RealTargetServiceImpl implements RealTargetService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										try{ | 
					 | 
					 | 
					 | 
										try{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											HydropowerUnitTargetVo target = new HydropowerUnitTargetVo(); | 
					 | 
					 | 
					 | 
											HydropowerUnitTargetVo target = new HydropowerUnitTargetVo(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											target.setDeptId(device.getCreateDept()); | 
					 | 
					 | 
					 | 
											target.setDeptId(device.getCreateDept()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											Optional<StationEntity> station = stations.stream().filter(o->o.getRefDept().equals(device.getCreateDept())).findFirst(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        station.ifPresent(stationEntity -> target.setDeptName(stationEntity.getName())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											target.setDeviceCode(device.getEmCode()); | 
					 | 
					 | 
					 | 
											target.setDeviceCode(device.getEmCode()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											target.setDeviceName(device.getName()); | 
					 | 
					 | 
					 | 
											target.setDeviceName(device.getName()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											target.setDeptName(device.getName()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											// 当年发电量
 | 
					 | 
					 | 
					 | 
											// 当年发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											target.setPowerYear(this.getGenerationPower(device, 0)); | 
					 | 
					 | 
					 | 
											target.setPowerYear(this.devicePowerYear(generationYears,device)); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											// 去年发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											target.setPowerYesterYear(this.devicePowerYesterYear(generationYesterYears,device)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											// 当月发电量
 | 
					 | 
					 | 
					 | 
											// 当月发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											target.setPowerMon(this.getGenerationPower(device, 1)); | 
					 | 
					 | 
					 | 
											target.setPowerMon(this.devicePowerMon(generationYears,device)); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											// 当日发电量
 | 
					 | 
					 | 
					 | 
											// 当日发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											target.setPowerDay(this.getGenerationPower(device, 2)); | 
					 | 
					 | 
					 | 
											target.setPowerDay(this.devicePowerDay(generations,device)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											// 当天有功功率
 | 
					 | 
					 | 
					 | 
											// 昨日发电量
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											target.setPowerYesterDay(this.devicePowerYesterDay(generations,device)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											// 近24小时有功功率
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											target.setActivePowerVoList(this.getLoadsByDay(device)); | 
					 | 
					 | 
					 | 
											target.setActivePowerVoList(this.getLoadsByDay(device)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											// 30天发电量
 | 
					 | 
					 | 
					 | 
											// 30天发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											target.setGenerationPowerVoList(this.getGenerationPowerList(device)); | 
					 | 
					 | 
					 | 
											target.setGenerationPowerVoList(this.getGenerationPowerList(generations,device)); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											// FIXME 本次开机/停机时间
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											Calendar calendar = Calendar.getInstance(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											calendar.add(Calendar.MINUTE,random.nextInt(1440)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											target.setStartDownTime(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											// FIXME 本次开/停机时长
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											target.setStartupDownDuration(random.nextDouble() * 24); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											// FIXME 今年开机时长
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											target.setStartupDurationYear(random.nextDouble() * 5024); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											// FIXME 今年停机时长
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											target.setShutDownDurationYear(5024 - target.getStartupDurationYear()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											targets.add(target); | 
					 | 
					 | 
					 | 
											targets.add(target); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											countDownLatch.countDown(); | 
					 | 
					 | 
					 | 
											countDownLatch.countDown(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										}catch (Exception exception){ | 
					 | 
					 | 
					 | 
										}catch (Exception exception){ | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -314,9 +345,79 @@ public class RealTargetServiceImpl implements RealTargetService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if(CollectionUtil.isEmpty(targets)){ | 
					 | 
					 | 
					 | 
							if(CollectionUtil.isEmpty(targets)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								return; | 
					 | 
					 | 
					 | 
								return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							} | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							redisTemplate.opsForValue().set(load_hydropower_unit_target_key,targets); | 
					 | 
					 | 
					 | 
							redisTemplate.opsForValue().set(load_hydropower_unit_target_key,targets); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * 去年发电量 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param generations | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param device | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						private Float devicePowerYesterYear(List<ThreeGenerationEntity> generations, EminfoAndEmParamVo device) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							if(CollectionUtil.isEmpty(generations)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								return 0f; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							return (float) generations.stream().filter(o -> StringUtil.isNotBlank(o.getDeviceCode()) && o.getDeviceCode().equals(device.getEmCode())).mapToDouble(o->o.getGenerate().doubleValue()).sum(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * 当年发电量 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param generations | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param device | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						private Float devicePowerYear(List<ThreeGenerationEntity> generations, EminfoAndEmParamVo device) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							if(CollectionUtil.isEmpty(generations)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								return 0f; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							return (float) generations.stream().filter(o -> StringUtil.isNotBlank(o.getDeviceCode()) && o.getDeviceCode().equals(device.getEmCode())).mapToDouble(o->o.getGenerate().doubleValue()).sum(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * 当月发电量 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param generations | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param device | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						private Float devicePowerMon(List<ThreeGenerationEntity> generations, EminfoAndEmParamVo device) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							if(CollectionUtil.isEmpty(generations)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								return 0f; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							return (float) generations.stream().filter(o-> StringUtil.isNotBlank(o.getDeviceCode()) && o.getDeviceCode().equals(device.getEmCode()) && o.getStrMonth().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(o->o.getGenerate().doubleValue()).sum(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * 设备当日发电量 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param generations | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param device | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						private Float devicePowerDay(List<ThirtyGenerationEntity> generations, EminfoAndEmParamVo device) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							if(CollectionUtil.isEmpty(generations)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								return 0f; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							return (float) generations.stream().filter(o->o.getDeviceCode().equals(device.getEmCode()) && o.getStrDay().contains(DateUtil.format(new Date(),DateUtil.PATTERN_DATE))).mapToDouble(o->o.getGenerate().doubleValue()).sum(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * 设备昨日发电量 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param generations | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param device | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						private Float devicePowerYesterDay(List<ThirtyGenerationEntity> generations, EminfoAndEmParamVo device) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							if(CollectionUtil.isEmpty(generations)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								return 0f; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							Calendar calendar = Calendar.getInstance(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							calendar.add(Calendar.DAY_OF_MONTH,-1); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							return (float) generations.stream().filter(o->o.getDeviceCode().equals(device.getEmCode()) && o.getStrDay().contains(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE))).mapToDouble(o->o.getGenerate().doubleValue()).sum(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/** | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * 水利-泵组实时加载 | 
					 | 
					 | 
					 | 
						 * 水利-泵组实时加载 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * @param param | 
					 | 
					 | 
					 | 
						 * @param param | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -1382,17 +1483,19 @@ public class RealTargetServiceImpl implements RealTargetService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * @return | 
					 | 
					 | 
					 | 
						 * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 */ | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) { | 
					 | 
					 | 
					 | 
						private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							// 开始日期
 | 
					 | 
					 | 
					 | 
							Calendar calendar = Calendar.getInstance(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							// 结束日期
 | 
					 | 
					 | 
					 | 
							// 结束日期
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59"; | 
					 | 
					 | 
					 | 
							String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							calendar.add(Calendar.DAY_OF_MONTH,-1); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							// 开始日期
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); | 
					 | 
					 | 
					 | 
					        List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 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 -> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								ActivePowerVo load = new ActivePowerVo(); | 
					 | 
					 | 
					 | 
								ActivePowerVo load = new ActivePowerVo(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            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"); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH")); | 
					 | 
					 | 
					 | 
								load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            load.setHour(time.getHours()); | 
					 | 
					 | 
					 | 
					            load.setHour(time.getHours()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								if(StringUtil.isNotBlank(record.getVal())){ | 
					 | 
					 | 
					 | 
								if(StringUtil.isNotBlank(record.getVal())){ | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -1469,10 +1572,14 @@ public class RealTargetServiceImpl implements RealTargetService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								target.setDeptName(station.getName()); | 
					 | 
					 | 
					 | 
								target.setDeptName(station.getName()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								// 当年发电量
 | 
					 | 
					 | 
					 | 
								// 当年发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								target.setPowerYear(generateService.generate(year,station.getCode())); | 
					 | 
					 | 
					 | 
								target.setPowerYear(generateService.generate(year,station.getCode())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								// FIXME 去年发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								target.setPowerYesterYear(0f); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								// 当月发电量
 | 
					 | 
					 | 
					 | 
								// 当月发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								target.setPowerMon(generateService.generate(mon,station.getCode())); | 
					 | 
					 | 
					 | 
								target.setPowerMon(generateService.generate(mon,station.getCode())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								// 当日发电量
 | 
					 | 
					 | 
					 | 
								// 当日发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								target.setPowerDay(generateService.generate(day,station.getCode())); | 
					 | 
					 | 
					 | 
								target.setPowerDay(generateService.generate(day,station.getCode())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								// FIXME 昨日发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								target.setPowerYesterDay(0f); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								// 30天发电量
 | 
					 | 
					 | 
					 | 
								// 30天发电量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								target.setGenerationPowerVoList(generateService.generate30Day(day,station.getCode())); | 
					 | 
					 | 
					 | 
								target.setGenerationPowerVoList(generateService.generate30Day(day,station.getCode())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								return target; | 
					 | 
					 | 
					 | 
								return target; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -1875,33 +1982,78 @@ public class RealTargetServiceImpl implements RealTargetService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							return dataService.periodTargetFloat(start,end,5,accessRules,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER); | 
					 | 
					 | 
					 | 
							return dataService.periodTargetFloat(start,end,5,accessRules,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/** | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * 近30天发电量 | 
					 | 
					 | 
					 | 
						 * 站点设备近30天发电量 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param stations | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						private List<ThirtyGenerationEntity> thirtyGenerations(List<String> stations) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							Calendar calendar = Calendar.getInstance(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							calendar.add(Calendar.DAY_OF_MONTH,-30); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							return thirtyGenerateService.list(Wrappers.<ThirtyGenerationEntity>lambdaQuery() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									.in(ThirtyGenerationEntity::getStationId,stations) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									.ge(ThirtyGenerationEntity::getStrDay,start) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									.le(ThirtyGenerationEntity::getStrDay,end) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * 站点设备今年发电量 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param stations | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						private List<ThreeGenerationEntity> threeGenerations(List<String> stations) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							return threeGenerateService.list(Wrappers.<ThreeGenerationEntity>lambdaQuery() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									.in(ThreeGenerationEntity::getStationId,stations) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									.like(ThreeGenerationEntity::getStrMonth,DateUtil.format(new Date(),"yyyy")) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * 查询设备去年发电量 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param stations | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						private List<ThreeGenerationEntity> threeYesterGenerations(List<String> stations) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							Calendar calendar = Calendar.getInstance(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							calendar.add(Calendar.YEAR,-1); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							return threeGenerateService.list(Wrappers.<ThreeGenerationEntity>lambdaQuery() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									.in(ThreeGenerationEntity::getStationId,stations) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									.like(ThreeGenerationEntity::getStrMonth,DateUtil.format(calendar.getTime(),"yyyy")) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * 设备近30天发电量组装 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @param generations | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * @param device | 
					 | 
					 | 
					 | 
						 * @param device | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * @return | 
					 | 
					 | 
					 | 
						 * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 */ | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) { | 
					 | 
					 | 
					 | 
						private List<GenerationPowerVo> getGenerationPowerList(List<ThirtyGenerationEntity> generations,EminfoAndEmParamVo device) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							Calendar calendar = Calendar.getInstance(); | 
					 | 
					 | 
					 | 
							Calendar calendar = Calendar.getInstance(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); | 
					 | 
					 | 
					 | 
							Date end = calendar.getTime(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							calendar.add(Calendar.DAY_OF_MONTH,-29); | 
					 | 
					 | 
					 | 
							calendar.add(Calendar.DAY_OF_MONTH,-30); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); | 
					 | 
					 | 
					 | 
							Date start = calendar.getTime(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE)); | 
					 | 
					 | 
					 | 
							List<GenerationPowerVo> powers = new ArrayList<>(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND)); | 
					 | 
					 | 
					 | 
							while (end.compareTo(start) > 0){ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); | 
					 | 
					 | 
					 | 
								GenerationPowerVo power = new GenerationPowerVo(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<AnalyseDataTaosVO>  records = dataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); | 
					 | 
					 | 
					 | 
								if (CollectionUtil.isEmpty(generations)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if(CollectionUtil.isEmpty(records)){ | 
					 | 
					 | 
					 | 
									power.setDate(DateUtil.format(start,DateUtil.PATTERN_DATE)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								return new ArrayList<>(); | 
					 | 
					 | 
					 | 
									power.setGenerate(0f); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							} | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							return records.stream().map(record -> { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								GenerationPowerVo generate = new GenerationPowerVo(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								if(StringUtil.isEmpty(record.getVal())){ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									generate.setGenerate(0f); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								}else{ | 
					 | 
					 | 
					 | 
								}else{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									generate.setGenerate(Float.parseFloat(String.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount()))); | 
					 | 
					 | 
					 | 
									String date = DateUtil.format(start,DateUtil.PATTERN_DATE); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									power.setDate(date); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									power.setGenerate((float) generations.stream().filter(iter->iter.getDeviceCode().equals(device.getEmCode()) && iter.getStrDay().contains(date)).mapToDouble(o->o.getGenerate().doubleValue()).sum()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								} | 
					 | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								return generate; | 
					 | 
					 | 
					 | 
								calendar.add(Calendar.DAY_OF_MONTH,1); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							}).collect(Collectors.toList()); | 
					 | 
					 | 
					 | 
								powers.add(power); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								start = calendar.getTime(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							return powers; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} |