@ -2,6 +2,7 @@ package com.hnac.hzims.operational.main.service.impl;
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.alibaba.fastjson.JSONObject ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.alibaba.fastjson.TypeReference ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.baomidou.mybatisplus.core.toolkit.Wrappers ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.EquipmentConstants ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.equipment.feign.IPlanGenertionClient ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.equipment.vo.EminfoAndEmParamVo ;  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -9,9 +10,10 @@ import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.hzimsweather.response.weather.Daily ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.operational.fill.service.GenerateService ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.operational.main.constant.HomePageConstant ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.operational.main.service.* ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.operational.main.vo.* ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.operational.main.constant.HomePageConstant ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.operational.station.entity.StationEntity ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.operational.station.service.IStationAttributeService ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.hnac.hzims.operational.station.service.IStationService ;  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -44,23 +46,25 @@ import java.util.stream.Collectors;
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					@RequiredArgsConstructor  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					public  class  HydropowerServiceImpl  implements  HydropowerService  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IAnalyseDataService  analyseDataService ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IHomePageService  homePageService ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IWaterService  waterService ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IMainSystemMonitoringService  maintenanceTask Service ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IWeatherService  weatherService ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IStationService  stationService ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IStationAttributeService  attribu teService;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  GenerateService  genera teService;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IWaterService  water Service ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IHomePageService  homePage Service ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IPlanGenertionClient  planGenertionClient ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IAnalyseDataService  analyseDataService ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IStationAttributeService  attributeService ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IMainSystemMonitoringService  maintenanceTaskService ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  ISoeClient  soeClient ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IWeatherService  weatherService ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  IPlanGenertionClient  planGenertionClient  ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  final  RedisTemplate  redisTemplate ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -79,63 +83,54 @@ public class HydropowerServiceImpl implements HydropowerService {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						@Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						public  void  loadHydropowerReal ( String  param )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 有效设备
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < EminfoAndEmParamVo >  valid  =  this . getValidDeviceList ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( valid ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 水电站站点
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < StationEntity >  stations  =  stationService . list ( Wrappers . < StationEntity > lambdaQuery ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									. eq ( StationEntity : : getServeType , HomePageConstant . HYDROPOWER_SERVETYPE )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									. eq ( StationEntity : : getType , HomePageConstant . HYDROPOWER )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( stations ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 水电站设备
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < EminfoAndEmParamVo >  devices  =  this . pumpDevices ( stations . stream ( ) . map ( StationEntity : : getRefDept ) . collect ( Collectors . toList ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( devices ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 实时数据
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							Map < String ,  String >  map  =  this . getRealMap ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 单位
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							Map < String ,  String >  unitMap  =  this . attributeService . getPointUnit ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < HydropowerUnitRealVo >  list  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							valid . forEach ( device - > {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								HydropowerUnitRealVo  realVo   =  new  HydropowerUnitRealVo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								realVo  . setDeptId ( device . getCreateDept ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								realVo  . setDeviceCode ( device . getEmCode ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								realVo  . setDeptName ( device . getName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								realVo  . setDeviceName ( device . getName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 实时数据
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < HydropowerUnitRealVo >  reals  =  devices . stream ( ) . map ( device - > {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								HydropowerUnitRealVo  real  =  new  HydropowerUnitRealVo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								real . setDeptId ( device . getCreateDept ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								real . setDeviceCode ( device . getEmCode ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								real . setDeptName ( device . getName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								real . setDeviceName ( device . getName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 开关机状态
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								String  state  =  this . getSignageValue ( device , map , HomePageConstant . JOINT_RELAY ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								realVo . setState ( state ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								real . setState ( this . getSignageValue ( device , map , HomePageConstant . JOINT_RELAY ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 有功功率
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								String  activePower  =  this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_ACTIVE_POWER ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								realVo . setActivePower ( activePower ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								real . setActivePower ( this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_ACTIVE_POWER ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 无功功率
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								String  reactivePower  =  this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_REACTIVE_POWER ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								realVo . setReactivePower ( reactivePower ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								real . setReactivePower ( this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_REACTIVE_POWER ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 功率因数
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								String  powerFactor  =  this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_POWERFACTOR ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								realVo . setPowerFactor ( powerFactor ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								real . setPowerFactor ( this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_POWERFACTOR ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 机组频率
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								String  frequency  =  this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_FREQUENCY ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								realVo . setFrequency ( frequency ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								real . setFrequency ( this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_FREQUENCY ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 导叶开度
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								String  guideOpen  =  this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_GUIDEOPEN ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								realVo . setGuideOpen ( guideOpen ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								real . setGuideOpen ( this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_GUIDEOPEN ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 定子电压
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								String  statorVoltage  =  this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_VOLTAGE ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								realVo . setStatorVoltage ( statorVoltage ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								real . setStatorVoltage ( this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_VOLTAGE ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 定子电流
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								String  statorCurrent  =  this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_CURRENT ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								realVo . setStatorCurrent ( statorCurrent ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								real . setStatorCurrent ( this . getSignageValue ( device , map , HomePageConstant . HYDROPOWER_CURRENT ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 单位设置
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								this . setttingUnit ( device , unitMap , realVo ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								list . add ( realVo ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							} ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							redisTemplate . opsForValue ( ) . set ( load_hydropower_unit_real_key , list ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						/ * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  获取实时数据   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  Map < String ,  String >  getRealMap ( )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							String  json  =  ( String )  redisTemplate . opsForValue ( ) . get ( real_id_key ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( StringUtil . isBlank ( json ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								this . setttingUnit ( device , unitMap , real ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  real ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							} ) . collect ( Collectors . toList ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( reals ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  JSONObject . parseObject ( json ,  new  TypeReference < Map < String ,  String > > ( )  { } ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							redisTemplate . opsForValue ( ) . set ( load_hydropower_unit_real_key , reals ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						/ * *   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -144,59 +139,98 @@ public class HydropowerServiceImpl implements HydropowerService {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						@Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						public  void  loadHydropowerTarget ( String  param )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 有效设备
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < EminfoAndEmParamVo >  valid  =  this . getValidDeviceList ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( valid ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 水电站站点
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < StationEntity >  stations  =  stationService . list ( Wrappers . < StationEntity > lambdaQuery ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									. eq ( StationEntity : : getServeType , HomePageConstant . HYDROPOWER_SERVETYPE )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									. eq ( StationEntity : : getType , HomePageConstant . HYDROPOWER )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( stations ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < HydropowerUnitTargetVo >  list  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							valid . forEach ( device - > {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								HydropowerUnitTargetVo  targetVo  =  new  HydropowerUnitTargetVo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								targetVo . setDeptId ( device . getCreateDept ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								targetVo . setDeviceCode ( device . getEmCode ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								targetVo . setDeviceName ( device . getName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								targetVo . setDeptName ( device . getName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 补充填补发电指标
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < HydropowerUnitTargetVo >  targets  =  this . generteFill ( stations ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 水电站设备
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < EminfoAndEmParamVo >  devices  =  this . pumpDevices ( stations . stream ( ) . map ( StationEntity : : getRefDept ) . collect ( Collectors . toList ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isNotEmpty ( devices ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								targets . addAll ( devices . stream ( ) . map ( device - > {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									HydropowerUnitTargetVo  target  =  new  HydropowerUnitTargetVo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									target . setDeptId ( device . getCreateDept ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									target . setDeviceCode ( device . getEmCode ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									target . setDeviceName ( device . getName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									target . setDeptName ( device . getName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									// 当年发电量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								float  powerYear  =  this . getGenerationPower ( device , 0 ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								targetVo . setPowerYear ( powerYear ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									target . setPowerYear ( this . getGenerationPower ( device , 0 ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									// 当月发电量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								float  powerMon  =  this . getGenerationPower ( device , 1 ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								targetVo . setPowerMon ( powerMon ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									target . setPowerMon ( this . getGenerationPower ( device , 1 ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									// 当日发电量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								float  powerDay  =  this . getGenerationPower ( device , 2 ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									target . setPowerDay (  this . getGenerationPower ( device , 2 ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									// 当天有功功率
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								List < ActivePowerVo >  activePowerVoList  =  waterService . getActivePowerVoList ( device ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								targetVo . setActivePowerVoList ( activePowerVoList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									target . setActivePowerVoList ( waterService . getActivePowerVoList ( device ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									// 30天发电量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									target . setGenerationPowerVoList ( this . getGenerationPowerList ( device ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									return  target ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								} ) . collect ( Collectors . toList ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 站点指标数据为空
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( targets ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							redisTemplate . opsForValue ( ) . set ( load_hydropower_unit_target_key , targets ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						/ * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  获取填报用电量   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @param  stations   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  List < HydropowerUnitTargetVo >  generteFill ( List < StationEntity >  stations )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							Calendar  calendar  =  Calendar . getInstance ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							String  day  =  DateUtil . format ( calendar . getTime ( ) , DateUtil . PATTERN_DATE ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							String  mon  =  DateUtil . format ( calendar . getTime ( ) , "yyyy-MM" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							String  year  =  String . valueOf ( calendar . get ( Calendar . YEAR ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  stations . stream ( ) . map ( station  - > {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								HydropowerUnitTargetVo  target  =  new  HydropowerUnitTargetVo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								target . setDeptId ( station . getRefDept ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								target . setDeptName ( station . getName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 当年发电量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								target . setPowerYear ( generateService . generate ( year , station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 当月发电量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								target . setPowerMon ( generateService . generate ( mon , station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 当日发电量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								target . setPowerDay ( generateService . generate ( day , station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 30天发电量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								List < GenerationPowerVo >  generationPowerVoList  =  this . getGenerationPowerList ( device ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								targetVo . setGenerationPowerVoList ( generationPowerVoList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								targetVo . setPowerDay ( powerDay ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								list . add ( targetVo ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							} ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							redisTemplate . opsForValue ( ) . set ( load_hydropower_unit_target_key , list ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								target . setGenerationPowerVoList ( generateService . generate30Day ( day , station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  target ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							} ) . collect ( Collectors . toList ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						/ * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  获取有效设备   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  泵站设备   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @param  stations   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  List < EminfoAndEmParamVo >  getValidDeviceList ( )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 水利站点(All)
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < StationEntity >  stationList  =  stationService . getStationType ( HomePageConstant . HYDROPOWER_SERVETYPE ,  Collections . singletonList ( HomePageConstant . HYDROPOWER ) ,  null ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( stationList ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  List < EminfoAndEmParamVo >  pumpDevices ( List < Long >  stations ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( stations ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 获取所有设备
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < EminfoAndEmParamVo >  deviceList  =  maintenanceTaskService . getEmInfoList ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( deviceList ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < EminfoAndEmParamVo >  devices  =  maintenanceTaskService . getEmInfoList ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( devices ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  devices . stream ( ) . filter ( device - > stations . contains ( device . getCreateDept ( ) ) ) . collect ( Collectors . toList ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 有效泵租设备
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < Long >  deptIdList  =  stationList . stream ( ) . map ( StationEntity : : getRefDept ) . collect ( Collectors . toList ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( deptIdList ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						/ * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  获取实时数据   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  Map < String ,  String >  getRealMap ( )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							String  json  =  ( String )  redisTemplate . opsForValue ( ) . get ( real_id_key ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( StringUtil . isBlank ( json ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  deviceList . stream ( ) . filter ( o - > deptIdList . contains ( o . getCreateDept ( ) ) ) . collect ( Collectors . toList ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  JSONObject . parseObject ( json ,  new  TypeReference < Map < String ,  String > > ( )  { } ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -334,7 +368,7 @@ public class HydropowerServiceImpl implements HydropowerService {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						@Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						public  HydropowerStationVo  webS tation( Long  deptId )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						public  HydropowerStationVo  s tation( Long  deptId )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( ObjectUtil . isEmpty ( deptId ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -343,22 +377,6 @@ public class HydropowerServiceImpl implements HydropowerService {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( ObjectUtil . isEmpty ( station ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < HydropowerStationVo >  list  =  this . getHydropowerStationList ( Collections . singletonList ( station ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( list ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  list . get ( 0 ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						/ * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  获取首页站点信息   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @param  list   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private  List < HydropowerStationVo >  getHydropowerStationList ( List < StationEntity >  list )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( list ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 实时监测点数据
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < HydropowerUnitRealVo >  realList  =  ( List < HydropowerUnitRealVo > )  redisTemplate . opsForValue ( ) . get ( load_hydropower_unit_real_key ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 获取站点机组指标数据
   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -366,63 +384,69 @@ public class HydropowerServiceImpl implements HydropowerService {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 所有设备
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < EminfoAndEmParamVo >  deviceList  =  maintenanceTaskService . getEmInfoList ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 实时天气
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							Map < String ,  HeWeatherWeatherNowResponse >  weather  =  this . getWeather ( list . stream ( ) . map ( StationEntity : : getCode ) . collect ( Collectors . toList ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							Map < String ,  HeWeatherWeatherNowResponse >  weather  =  this . getWeather ( Collections . singletonList ( station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 七天天气
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							Map < String ,  HeWeatherWeatherDailyResponse >  weekWeather  =  this . getWeekWeather ( list . stream ( ) . map ( StationEntity : : getCode ) . collect ( Collectors . toList ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < HydropowerStationVo >  result  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							list . forEach ( station  - > {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							Map < String ,  HeWeatherWeatherDailyResponse >  weekWeather  =  this . getWeekWeather ( Collections . singletonList ( station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							HydropowerStationVo  response  =  new  HydropowerStationVo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setDeptId ( station . getRefDept ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setDeptName ( station . getName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setStationCode ( station . getCode ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 站点状态
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < SoeData >  soeDataList  =  soeClient . getByLastLimitTime ( null ,  station . getCode ( ) ,  1 ) . getData ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if  ( CollectionUtil . isNotEmpty ( soeDataList ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									response . setStationStatus ( false ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									response . setStationStatus ( true ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setStationStatus ( ! CollectionUtil . isNotEmpty ( soeDataList ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 站点实时天气
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								String  temp  =  this . getTemp ( weather , station . getCode ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								response . setTemp ( temp ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setTemp ( this . getTemp ( weather , station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 站点七天天气
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								List < Daily >  dailys  =  this . getDailyList ( weekWeather , station . getCode ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								response . setWeather ( dailys ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setWeather ( this . getDailyList ( weekWeather , station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 限制水位
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setLimitWaterLevel ( station . getLimitWaterLevel ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 运行天数
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								int  runDay  =  this . getRunDay ( station ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								response . setRunDay ( runDay ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setRunDay ( this . getRunDay ( station ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 装机容量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								double  installedCapacity  =  this . getInstalledCapacity ( deviceList , station . getRefDept ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								response . setInstalledCapacity ( installedCapacity ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setInstalledCapacity ( this . getInstalledCapacity ( deviceList , station . getRefDept ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 总有功功率(总发电负荷)
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								double  powerSum  =  this . getPowerSum ( realList , station . getRefDept ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								response . setPowerSum ( powerSum ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setPowerSum ( this . getPowerSum ( realList , station . getRefDept ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 总有功单位
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								String  unit  =  this . getPowerUnit ( realList , station . getRefDept ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								response . setPowerUnit ( unit ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setPowerUnit ( this . getPowerUnit ( realList , station . getRefDept ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 月计划发电量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								float  planPowerMon  =  this . getPlanPowerrMon ( station . getCode ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								response . setPlanPowerMon ( planPowerMon ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setPlanPowerMon ( this . getPlanPowerrMon ( station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 年计划发电量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								float  planPowerYear  =  this . getPlanPowerYear ( station . getCode ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								response . setPlanPowerYear ( planPowerYear ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setPlanPowerYear ( this . getPlanPowerYear ( station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 月发电量、年发电量、年发电完成率
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							this . handleStationInfo ( station . getRefDept ( ) , response ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 水位、水位曲线
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							this . handleWaterLeve ( station . getCode ( ) , response ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 年发电量完成百分比
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								List < PowerMonthVo >  powerYearList  =  this . handlePowerFinish ( station ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								response . setPowerYearMap ( powerYearList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setPowerYearMap ( this . handlePowerFinish ( station ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 设备信息
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								List < HydropowerUnitVo >  devices  =  this . getDevices ( station , realList , targetList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								response . setDeviceList ( devices ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								result . add ( response ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							} ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  result ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							response . setDeviceList ( this . getDevices ( station , realList , targetList ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  response ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						/ * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  水电站 - 机组列表   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @param  deptId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						@Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						public  List < HydropowerUnitVo >  hydropowerDevice ( Long  deptId )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( ObjectUtil . isEmpty ( deptId ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 查询站点
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							StationEntity  station  =  stationService . getStationByCodeOrRefDept ( null , deptId ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( ObjectUtil . isEmpty ( station ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 实时监测点数据
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < HydropowerUnitRealVo >  realList  =  ( List < HydropowerUnitRealVo > )  redisTemplate . opsForValue ( ) . get ( load_hydropower_unit_real_key ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 获取站点机组指标数据
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < HydropowerUnitTargetVo >  targetList  =  ( List < HydropowerUnitTargetVo > )  redisTemplate . opsForValue ( ) . get ( load_hydropower_unit_target_key ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  this . getDevices ( station , realList , targetList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						/ * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  获取站点设备信息   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @param  station   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -705,39 +729,63 @@ public class HydropowerServiceImpl implements HydropowerService {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							} ) . collect ( Collectors . toList ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						/ * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  水电站 - 机组 列表  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  水电站站点 列表   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @param  deptId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						@Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						public  List < HydropowerUnitVo >  hydropowerDevice ( Long  deptId )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( ObjectUtil . isEmpty ( deptId ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 查询站点
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							StationEntity  station  =  stationService . getStationByCodeOrRefDept ( null , deptId ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( ObjectUtil . isEmpty ( station ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						public  List < HydropowerStationVo >  webStationList ( Long  deptId )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < StationEntity >  stations  =  stationService . getStationType ( HomePageConstant . HYDROPOWER_SERVETYPE , Collections . singletonList ( HomePageConstant . HYDROPOWER ) , null ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( stations ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 实时监测点数据
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < HydropowerUnitRealVo >  realList  =  ( List < HydropowerUnitRealVo > )  redisTemplate . opsForValue ( ) . get ( load_hydropower_unit_real_key ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 获取站点机组指标数据
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < HydropowerUnitTargetVo >  targetList  =  ( List < HydropowerUnitTargetVo > )  redisTemplate . opsForValue ( ) . get ( load_hydropower_unit_target_key ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  this . getDevices ( station , realList , targetList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						/ * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  水电站站点列表   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @param  deptId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						@Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						public  List < HydropowerStationVo >  webStationList ( Long  deptId )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < StationEntity >  list  =  stationService . getStationType ( null , Collections . singletonList ( HomePageConstant . HYDROPOWER ) , null ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ( CollectionUtil . isEmpty ( list ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  this . getHydropowerStationList ( list ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 所有设备
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							List < EminfoAndEmParamVo >  deviceList  =  maintenanceTaskService . getEmInfoList ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 实时天气
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							Map < String ,  HeWeatherWeatherNowResponse >  weather  =  this . getWeather ( stations . stream ( ) . map ( StationEntity : : getCode ) . collect ( Collectors . toList ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// 七天天气
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							Map < String ,  HeWeatherWeatherDailyResponse >  weekWeather  =  this . getWeekWeather ( stations . stream ( ) . map ( StationEntity : : getCode ) . collect ( Collectors . toList ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  stations . stream ( ) . map ( station - > {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								HydropowerStationVo  hydropower  =  new  HydropowerStationVo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setDeptId ( station . getRefDept ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setDeptName ( station . getName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setStationCode ( station . getCode ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 站点状态
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								List < SoeData >  soeDataList  =  soeClient . getByLastLimitTime ( null ,  station . getCode ( ) ,  1 ) . getData ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setStationStatus ( ! CollectionUtil . isNotEmpty ( soeDataList ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 站点实时天气
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setTemp ( this . getTemp ( weather , station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 站点七天天气
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setWeather ( this . getDailyList ( weekWeather , station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 限制水位
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setLimitWaterLevel ( station . getLimitWaterLevel ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 运行天数
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setRunDay ( this . getRunDay ( station ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 装机容量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setInstalledCapacity ( this . getInstalledCapacity ( deviceList , station . getRefDept ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 总有功功率(总发电负荷)
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setPowerSum ( this . getPowerSum ( realList , station . getRefDept ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 总有功单位
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setPowerUnit ( this . getPowerUnit ( realList , station . getRefDept ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 月计划发电量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setPlanPowerMon ( this . getPlanPowerrMon ( station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 年计划发电量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setPlanPowerYear ( this . getPlanPowerYear ( station . getCode ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 月发电量、年发电量、年发电完成率
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								this . handleStationInfo ( station . getRefDept ( ) , hydropower ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 水位、水位曲线
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								this . handleWaterLeve ( station . getCode ( ) , hydropower ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 年发电量完成百分比
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setPowerYearMap ( this . handlePowerFinish ( station ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 设备信息
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								hydropower . setDeviceList ( this . getDevices ( station , realList , targetList ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  hydropower ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							} ) . collect ( Collectors . toList ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					}