|
|
|
@ -6,6 +6,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
|
|
|
|
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; |
|
|
|
|
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; |
|
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
|
import com.hnac.hzims.hzimsweather.feign.IRainfallClient; |
|
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.Daily; |
|
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; |
|
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; |
|
|
|
@ -17,11 +18,11 @@ import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
|
|
|
|
|
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; |
|
|
|
|
import com.hnac.hzims.operational.duty.service.IImsDutyMainService; |
|
|
|
|
import com.hnac.hzims.operational.duty.vo.DutyMainInfoVo; |
|
|
|
|
import com.hnac.hzims.operational.fill.entity.GenerateEntity; |
|
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
|
import com.hnac.hzims.operational.main.entity.UserDeptEntity; |
|
|
|
|
import com.hnac.hzims.operational.main.service.*; |
|
|
|
|
import com.hnac.hzims.operational.main.vo.*; |
|
|
|
|
import com.hnac.hzims.operational.main.vo.pv.PowerRainVo; |
|
|
|
|
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; |
|
|
|
|
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; |
|
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
@ -92,6 +93,8 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
|
|
|
|
|
private final ISysClient sysClient; |
|
|
|
|
|
|
|
|
|
private final IRainfallClient rainfallClient; |
|
|
|
|
|
|
|
|
|
private final ITicketInfoClient ticketInfoClient; |
|
|
|
|
|
|
|
|
|
private final IPlanGenertionClient planGenertionClient; |
|
|
|
@ -139,6 +142,8 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
Map<String, HeWeatherWeatherNowResponse> weather = this.getWeather(Collections.singletonList(station.getCode())); |
|
|
|
|
// 七天天气
|
|
|
|
|
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(Collections.singletonList(station.getCode())); |
|
|
|
|
// 近30天降雨
|
|
|
|
|
List<Map<String, Object>> rains = this.get30DayRain(station.getCode()); |
|
|
|
|
HydropowerStationVo response = new HydropowerStationVo(); |
|
|
|
|
// 近年发电量数据
|
|
|
|
|
Map<String, Map<String, Float>> map = (Map<String, Map<String, Float>>) redisTemplate.opsForValue().get(recent_year_power_data); |
|
|
|
@ -169,7 +174,7 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
response.setPlanPowerYear(this.getPlanPowerYear(station.getCode())); |
|
|
|
|
// 年发电量、月发电量
|
|
|
|
|
this.stationMonthPower(station.getCode(),map,response); |
|
|
|
|
// 水位、水位曲线
|
|
|
|
|
// 水位
|
|
|
|
|
this.handleWaterLeve(station.getCode(),response); |
|
|
|
|
// 今日,昨日发电量
|
|
|
|
|
this.powerDay(station,targetList,response); |
|
|
|
@ -177,10 +182,56 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
response.setPowerYearMap(this.handlePowerFinish(Collections.singletonList(station),map)); |
|
|
|
|
// 设备信息
|
|
|
|
|
response.setDeviceList(this.getDevices(station,realList,targetList)); |
|
|
|
|
// 降雨
|
|
|
|
|
response.setPowerRains(this.getPowerRains(station,response.getDeviceList(),rains)); |
|
|
|
|
return response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 站点发电、降雨曲线 |
|
|
|
|
* @param devices |
|
|
|
|
* @param rains |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<PowerRainVo> getPowerRains(StationEntity station,List<HydropowerUnitVo> devices, List<Map<String, Object>> rains) { |
|
|
|
|
List<GenerationPowerVo> powers = new ArrayList<>(); |
|
|
|
|
if(CollectionUtil.isNotEmpty(devices)){ |
|
|
|
|
devices.forEach(device->{ |
|
|
|
|
if(ObjectUtil.isNotEmpty(device.getHydropowerPumpTargetVo()) && CollectionUtil.isNotEmpty(device.getHydropowerPumpTargetVo().getGenerationPowerVoList())){ |
|
|
|
|
powers.addAll(device.getHydropowerPumpTargetVo().getGenerationPowerVoList()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
// 根据日期遍历
|
|
|
|
|
List<String> days = this.get30Day(); |
|
|
|
|
return days.stream().map(day->{ |
|
|
|
|
PowerRainVo powerRain = new PowerRainVo(); |
|
|
|
|
powerRain.setDate(day); |
|
|
|
|
if(CollectionUtil.isEmpty(powers)){ |
|
|
|
|
powerRain.setGenerate(0.0); |
|
|
|
|
}else{ |
|
|
|
|
powerRain.setGenerate(powers.stream().filter(o-> day.equals(o.getDate())).mapToDouble(GenerationPowerVo::getGenerate).sum()); |
|
|
|
|
} |
|
|
|
|
if(CollectionUtil.isEmpty(rains)){ |
|
|
|
|
powerRain.setRain(0.0); |
|
|
|
|
}else{ |
|
|
|
|
powerRain.setRain(rains.stream().mapToDouble(map->{ |
|
|
|
|
if (map.get("fx_date").equals(day)) { |
|
|
|
|
Object object = map.get("precip"); |
|
|
|
|
if(ObjectUtil.isEmpty(object)){ |
|
|
|
|
return 0.0; |
|
|
|
|
}else{ |
|
|
|
|
return Double.parseDouble(object.toString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return 0.0; |
|
|
|
|
}).sum()); |
|
|
|
|
} |
|
|
|
|
return powerRain; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 容量利用率 |
|
|
|
|
* @param response |
|
|
|
|
* @return |
|
|
|
@ -326,6 +377,50 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取30天 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<String> get30Day() { |
|
|
|
|
List<String> times = new ArrayList<>(); |
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
Date end = calendar.getTime(); |
|
|
|
|
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); |
|
|
|
|
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE)); |
|
|
|
|
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND)); |
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-29); |
|
|
|
|
Date start = calendar.getTime(); |
|
|
|
|
while (start.compareTo(end) < 0) { |
|
|
|
|
times.add(DateUtil.format(calendar.getTime(),"yyyy-MM-dd")); |
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,1); |
|
|
|
|
start = calendar.getTime(); |
|
|
|
|
} |
|
|
|
|
return times; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 近30天降雨 |
|
|
|
|
* @param code |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<Map<String, Object>> get30DayRain(String code) { |
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
String endTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
String rainEnd = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); |
|
|
|
|
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); |
|
|
|
|
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE)); |
|
|
|
|
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND)); |
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-29); |
|
|
|
|
String startTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
String rainStart = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); |
|
|
|
|
R<List<Map<String, Object>>> rains = rainfallClient.getDurationRainFall(code,rainStart,rainEnd); |
|
|
|
|
if(!rains.isSuccess() || CollectionUtil.isEmpty(rains.getData())){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
} |
|
|
|
|
return rains.getData(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取设备装机容量 |
|
|
|
|
* @param list |
|
|
|
|
* @param refDept |
|
|
|
@ -472,7 +567,6 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
WaterLevelVo level = validList.get(0); |
|
|
|
|
// 前池水位、当日水位曲线
|
|
|
|
|
response.setFrontWaterLevel(level.getFrontWaterLevel()); |
|
|
|
|
response.setFrontCurveMap(level.getFrontCurveMap()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|