|
|
|
@ -9,6 +9,7 @@ import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
|
|
|
|
|
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo; |
|
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
|
import com.hnac.hzims.equipment.vo.PlanPowerYearVo; |
|
|
|
|
import com.hnac.hzims.equipment.vo.StartStopTimeVO; |
|
|
|
|
import com.hnac.hzims.hzimsweather.feign.IRainfallClient; |
|
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.Daily; |
|
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; |
|
|
|
@ -66,6 +67,7 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
|
|
|
|
|
private final static String LOADWATER_LEVEL_KEY = "hzims:operation:loadwater:level:key"; |
|
|
|
|
private final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data"; |
|
|
|
|
private final static String START_STOP_TIME_KEY = "hzims:operation:start:stop:key"; |
|
|
|
|
private final static String LOAD_HYDROPOWER_REAL_KEY = "hzims:operation:loadhydropowerunit:real:key"; |
|
|
|
|
private final static String LOAD_HYDROPOWER_TARGET_KEY = "hzims:operation:loadhydropowerunit:target:key"; |
|
|
|
|
private final static String DEVICE_CACHE_COFIG_FINAL = "hzims:equipment:emInfo:deviceCode.emInfoList"; |
|
|
|
@ -99,6 +101,8 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
List<PlanPowerYearVo> plans = planClient.getPlanPowerByYear(station.getCode(), Integer.parseInt(DateUtil.format(new Date(),"yyyy"))); |
|
|
|
|
// 水位数据
|
|
|
|
|
List<WaterLevelVo> waterLevels = (List<WaterLevelVo>) redisTemplate.opsForValue().get(LOADWATER_LEVEL_KEY); |
|
|
|
|
// 设备开停机
|
|
|
|
|
List<StartStopTimeVO> startStopTimes = (List<StartStopTimeVO>) redisTemplate.opsForValue().get(START_STOP_TIME_KEY); |
|
|
|
|
|
|
|
|
|
// 步骤3.数据处理、赋值
|
|
|
|
|
HydroelectricStationVo result = new HydroelectricStationVo(); |
|
|
|
@ -147,8 +151,6 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
device.setPowerYear(target.get().getPowerYear()); |
|
|
|
|
device.setPowerYesterYear(target.get().getPowerYesterYear()); |
|
|
|
|
device.setPowerMon(target.get().getPowerMon()); |
|
|
|
|
device.setStartDownTime(target.get().getStartDownTime()); |
|
|
|
|
device.setStartupDownDuration(target.get().getStartupDownDuration()); |
|
|
|
|
device.setStartupDurationYear(target.get().getStartupDurationYear()); |
|
|
|
|
device.setShutDownDurationYear(target.get().getShutDownDurationYear()); |
|
|
|
|
if(CollectionUtil.isNotEmpty(target.get().getActivePowerVoList())){ |
|
|
|
@ -157,6 +159,34 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
if(CollectionUtil.isNotEmpty(target.get().getActivePowerVoList())){ |
|
|
|
|
device.setGenerates(target.get().getGenerationPowerVoList().stream().map(o-> BeanUtil.copy(o, HydroelectricDeviceGenerateVo.class)).collect(Collectors.toList())); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
device.setPowerDay(0f); |
|
|
|
|
device.setPowerYesterDay(0f); |
|
|
|
|
device.setPowerYear(0f); |
|
|
|
|
device.setPowerYesterYear(0f); |
|
|
|
|
device.setPowerMon(0f); |
|
|
|
|
device.setStartupDurationYear(-1.0); |
|
|
|
|
device.setShutDownDurationYear(-1.0); |
|
|
|
|
} |
|
|
|
|
// 开停机数据
|
|
|
|
|
Optional<StartStopTimeVO> startStop = startStopTimes.stream().filter(o->iter.getEmCode().equals(o.getDeviceCode())).findFirst(); |
|
|
|
|
if(startStop.isPresent()){ |
|
|
|
|
if(startStop.get().getQuality() == 0){ |
|
|
|
|
Date time; |
|
|
|
|
if(startStop.get().getTime().contains(".000")){ |
|
|
|
|
time = DateUtil.parse(startStop.get().getTime(), "yyyy-MM-dd HH:mm:ss.sss"); |
|
|
|
|
}else{ |
|
|
|
|
time = DateUtil.parse(startStop.get().getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
|
} |
|
|
|
|
device.setStartDownTime(DateUtil.format(time,DateUtil.PATTERN_DATETIME)); |
|
|
|
|
device.setStartupDownDuration(BigDecimal.valueOf((System.currentTimeMillis() - time.getTime()) / (1000 * 60 * 60.00)).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
|
|
|
|
}else{ |
|
|
|
|
device.setStartDownTime("-1"); |
|
|
|
|
device.setStartupDownDuration(-1.0); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
device.setStartDownTime("-1"); |
|
|
|
|
device.setStartupDownDuration(-1.0); |
|
|
|
|
} |
|
|
|
|
return device; |
|
|
|
|
}).collect(Collectors.toList())); |
|
|
|
@ -177,7 +207,7 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
}else{ |
|
|
|
|
result.setPowerMonPlan(0.0); |
|
|
|
|
} |
|
|
|
|
result.setPowerMon(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerMon).sum()); |
|
|
|
|
result.setPowerMon(targets.stream().filter(o->o.getDeptId().equals(station.getRefDept())).mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum()); |
|
|
|
|
if(result.getPowerMonPlan() <= 0 || result.getPowerMon() <= 0){ |
|
|
|
|
result.setPowerRateMon(0.0); |
|
|
|
|
}else{ |
|
|
|
@ -190,7 +220,7 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
}else{ |
|
|
|
|
result.setPowerYearPlan(0.0); |
|
|
|
|
} |
|
|
|
|
result.setPowerYear(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerYear).sum()); |
|
|
|
|
result.setPowerYear(targets.stream().filter(o->ObjectUtil.isNotEmpty(o.getPowerYear()) && o.getDeptId().equals(station.getRefDept())).mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum()); |
|
|
|
|
if(result.getPowerYearPlan() <= 0 || result.getPowerYear() <= 0){ |
|
|
|
|
result.setPowerRateYear(0.0); |
|
|
|
|
}else{ |
|
|
|
@ -198,11 +228,12 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 今日发电量、昨日发电量
|
|
|
|
|
result.setPowerDay(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerDay).sum()); |
|
|
|
|
result.setPowerYesterDay(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerYesterDay).sum()); |
|
|
|
|
result.setPowerDay(result.getDevices().stream().filter(o->ObjectUtil.isNotEmpty(o.getPowerDay())).mapToDouble(HydroelectricDeviceVo::getPowerDay).sum()); |
|
|
|
|
result.setPowerYesterDay(result.getDevices().stream().filter(o->ObjectUtil.isNotEmpty(o.getPowerYesterDay())).mapToDouble(HydroelectricDeviceVo::getPowerYesterDay).sum()); |
|
|
|
|
} |
|
|
|
|
// 站点水位
|
|
|
|
|
result.setWater(this.water(waterLevels,station.getCode())); |
|
|
|
|
|
|
|
|
|
// 近30日降雨量/发电量
|
|
|
|
|
//result.setPowerRains(this.stationPowerRains(result.getDevices(),rains));
|
|
|
|
|
// 近24小时总有功率/水位
|
|
|
|
@ -304,6 +335,7 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
|
|
|
|
|
// 查询用户当前权限站点
|
|
|
|
|
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
|
.ne(StationEntity::getStatus,HydroelectricConstant.INVALID_STATION) |
|
|
|
|
.eq(StationEntity::getServeType,HydroelectricConstant.PROXY_OPEARIONAL) |
|
|
|
|
.eq(StationEntity::getType,HydroelectricConstant.HYDROPOWER) |
|
|
|
|
); |
|
|
|
@ -338,6 +370,7 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
List<Long> refDepts = stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()); |
|
|
|
|
// 站点数量
|
|
|
|
|
group.setCount(stations.size()); |
|
|
|
|
group.setGeneratePlanYear(plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); |
|
|
|
|
// 实时数据
|
|
|
|
|
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(LOAD_HYDROPOWER_REAL_KEY); |
|
|
|
|
if (CollectionUtil.isNotEmpty(reals)) { |
|
|
|
@ -372,10 +405,6 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
// 日发电量
|
|
|
|
|
group.setGenerateDay(stationTargets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerDay).sum()); |
|
|
|
|
// 年计划发电量
|
|
|
|
|
DevicePlanGenerationVo planParam = new DevicePlanGenerationVo(); |
|
|
|
|
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); |
|
|
|
|
param.setDate(DateUtil.format(new Date(),"yyyy")); |
|
|
|
|
group.setGeneratePlanYear(planClient.getPlanPowerYear(planParam)); |
|
|
|
|
if(group.getGeneratePlanYear() <= 0 || group.getGenerateYear() <= 0){ |
|
|
|
|
group.setGenerateRate(0.0); |
|
|
|
|
}else{ |
|
|
|
@ -703,6 +732,7 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
} |
|
|
|
|
return stationService.list(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
|
.ne(StationEntity::getStatus,HydroelectricConstant.INVALID_STATION) |
|
|
|
|
.eq(StationEntity::getType, HydroelectricConstant.HYDROPOWER) |
|
|
|
|
.eq(StationEntity::getServeType,HydroelectricConstant.PROXY_OPEARIONAL) |
|
|
|
|
.in(StationEntity::getRefDept,deptIds) |
|
|
|
|