|
|
@ -537,4 +537,53 @@ public class HomeServiceImpl implements HomeService { |
|
|
|
} |
|
|
|
} |
|
|
|
return stringBuilder.toString(); |
|
|
|
return stringBuilder.toString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 黔东南指标 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public TargetVo blackTarget() { |
|
|
|
|
|
|
|
TargetVo target = new TargetVo(); |
|
|
|
|
|
|
|
target.setType(HomePageConstant.HYDROPOWER); |
|
|
|
|
|
|
|
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.HYDROPOWER)); |
|
|
|
|
|
|
|
// 计划发电量
|
|
|
|
|
|
|
|
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
|
|
|
|
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) |
|
|
|
|
|
|
|
.eq(StationEntity::getType,HomePageConstant.HYDROPOWER)); |
|
|
|
|
|
|
|
// 实时数据
|
|
|
|
|
|
|
|
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); |
|
|
|
|
|
|
|
// 指标数据
|
|
|
|
|
|
|
|
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key); |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(reals)){ |
|
|
|
|
|
|
|
// 装机容量
|
|
|
|
|
|
|
|
target.setTaget_one(reals.stream().filter(real->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId())).mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(targets)){ |
|
|
|
|
|
|
|
// 发电量
|
|
|
|
|
|
|
|
target.setTaget_two(targets.stream().filter(tar->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(tar.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(stations)){ |
|
|
|
|
|
|
|
List<PlanGenerationEntity> plans = planService.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy")); |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(plans)){ |
|
|
|
|
|
|
|
double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); |
|
|
|
|
|
|
|
if(Math.abs(plan) > 0){ |
|
|
|
|
|
|
|
target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 双票合格率
|
|
|
|
|
|
|
|
R<List<Dept>> result = sysClient.getDeptList(); |
|
|
|
|
|
|
|
if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData()) && CollectionUtil.isNotEmpty(stations)){ |
|
|
|
|
|
|
|
List<Long> areas = result.getData().stream().filter(dept -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(dept.getId())).map(Dept::getParentId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(areas)){ |
|
|
|
|
|
|
|
LocalDateTime firstDateTime = LocalDateTime.of(LocalDate.now().withDayOfYear(1), LocalTime.MIN); |
|
|
|
|
|
|
|
DoublePassRateVO pass = ticketClient.getDoublePassRate(areas, firstDateTime, LocalDateTime.now()); |
|
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(pass)){ |
|
|
|
|
|
|
|
target.setTaget_four(Double.valueOf(pass.getDoublePassRate())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return target; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|