|
|
@ -55,6 +55,7 @@ import org.springframework.util.CollectionUtils; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalTime; |
|
|
|
import java.time.LocalTime; |
|
|
@ -75,6 +76,8 @@ public class TargetServiceImpl implements TargetService { |
|
|
|
|
|
|
|
|
|
|
|
private final OverService overService; |
|
|
|
private final OverService overService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final WindService windService; |
|
|
|
|
|
|
|
|
|
|
|
private final PowerService powerService; |
|
|
|
private final PowerService powerService; |
|
|
|
|
|
|
|
|
|
|
|
private final SolveService solveService; |
|
|
|
private final SolveService solveService; |
|
|
@ -232,19 +235,19 @@ public class TargetServiceImpl implements TargetService { |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
// 查询填报数据
|
|
|
|
// 查询填报数据
|
|
|
|
String mon = DateUtil.format(new Date(),"yyyy"); |
|
|
|
String mon = DateUtil.format(new Date(),"yyyy"); |
|
|
|
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery() |
|
|
|
List<WindEntity> powers = windService.list(Wrappers.<WindEntity>lambdaQuery() |
|
|
|
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())) |
|
|
|
.in(WindEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())) |
|
|
|
.ge(PowerEntity::getMon, mon + "-01") |
|
|
|
.ge(WindEntity::getFillDate, mon + "-01") |
|
|
|
); |
|
|
|
); |
|
|
|
electrics = stations.stream().map(station -> { |
|
|
|
electrics = stations.stream().map(station -> { |
|
|
|
ElectricGenerationVo item = new ElectricGenerationVo(); |
|
|
|
ElectricGenerationVo item = new ElectricGenerationVo(); |
|
|
|
item.setStationName(station.getName()); |
|
|
|
item.setStationName(station.getName()); |
|
|
|
// 发电量
|
|
|
|
// 发电量
|
|
|
|
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
List<WindEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
if(CollectionUtils.isEmpty(stationPowers)){ |
|
|
|
if(CollectionUtils.isEmpty(stationPowers)){ |
|
|
|
item.setElectricGeneration(0.0); |
|
|
|
item.setElectricGeneration(0.0); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
item.setElectricGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear()); |
|
|
|
item.setElectricGeneration(stationPowers.stream().sorted(Comparator.comparing(WindEntity::getFillDate).reversed()).collect(Collectors.toList()).get(0).getPower()); |
|
|
|
} |
|
|
|
} |
|
|
|
item.setDetail("站点为填报数据,暂无设备装机发电量信息!"); |
|
|
|
item.setDetail("站点为填报数据,暂无设备装机发电量信息!"); |
|
|
|
return item; |
|
|
|
return item; |
|
|
@ -356,24 +359,32 @@ public class TargetServiceImpl implements TargetService { |
|
|
|
return item; |
|
|
|
return item; |
|
|
|
}).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList()); |
|
|
|
}).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList()); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
|
|
|
|
// 计划发电量
|
|
|
|
|
|
|
|
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy")); |
|
|
|
String mon = DateUtil.format(new Date(),"yyyy"); |
|
|
|
String mon = DateUtil.format(new Date(),"yyyy"); |
|
|
|
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery() |
|
|
|
List<WindEntity> powers = windService.list(Wrappers.<WindEntity>lambdaQuery() |
|
|
|
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())) |
|
|
|
.in(WindEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())) |
|
|
|
.ge(PowerEntity::getMon, mon + "-01") |
|
|
|
.ge(WindEntity::getFillDate, mon + "-01") |
|
|
|
); |
|
|
|
); |
|
|
|
generations = stations.stream().map(station -> { |
|
|
|
generations = stations.stream().map(station -> { |
|
|
|
CompleteGenerationVo item = new CompleteGenerationVo(); |
|
|
|
CompleteGenerationVo item = new CompleteGenerationVo(); |
|
|
|
item.setStationName(station.getName()); |
|
|
|
item.setStationName(station.getName()); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(plans)){ |
|
|
|
|
|
|
|
item.setPlanGeneration(0.0); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
item.setPlanGeneration(plans.stream().filter(plan->plan.getStationId().equals(station.getCode())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); |
|
|
|
|
|
|
|
} |
|
|
|
// 发电量
|
|
|
|
// 发电量
|
|
|
|
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
List<WindEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
if(CollectionUtils.isEmpty(stationPowers)){ |
|
|
|
if(CollectionUtils.isEmpty(stationPowers)){ |
|
|
|
item.setPlanGeneration(0.0); |
|
|
|
|
|
|
|
item.setRealityGeneration(0.0); |
|
|
|
item.setRealityGeneration(0.0); |
|
|
|
item.setCompleteRate(0.0); |
|
|
|
|
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
item.setPlanGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPlannedPowerYear()); |
|
|
|
item.setRealityGeneration(stationPowers.stream().mapToDouble(WindEntity::getPower).sum()); |
|
|
|
item.setRealityGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear()); |
|
|
|
} |
|
|
|
item.setCompleteRate(Double.valueOf(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerRateYear())); |
|
|
|
if(Math.abs(item.getPlanGeneration()) <= 0 || Math.abs(item.getRealityGeneration()) <= 0){ |
|
|
|
|
|
|
|
item.setCompleteRate(100.0); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
item.setCompleteRate(BigDecimal.valueOf(item.getRealityGeneration() / item.getPlanGeneration() * 100).setScale(1, RoundingMode.HALF_UP).doubleValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
return item; |
|
|
|
return item; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
}).collect(Collectors.toList()); |
|
|
@ -389,13 +400,6 @@ public class TargetServiceImpl implements TargetService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public IPage<CompleteTicketVo> completeTicket(IPage<CompleteTicketVo> page,String areaName,Integer type) { |
|
|
|
public IPage<CompleteTicketVo> completeTicket(IPage<CompleteTicketVo> page,String areaName,Integer type) { |
|
|
|
// 光伏/风电双票填报数据
|
|
|
|
|
|
|
|
if(HomePageConstant.WIND_POWER.equals(type) || HomePageConstant.PHOTOVOLTAIC.equals(type)){ |
|
|
|
|
|
|
|
List<CompleteTicketVo> completes = this.getcompleteFillTicket(areaName,type); |
|
|
|
|
|
|
|
page.setTotal(completes.size()); |
|
|
|
|
|
|
|
page.setRecords(completes.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
|
|
|
return page; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 平台业务数据
|
|
|
|
// 平台业务数据
|
|
|
|
List<Integer> types; |
|
|
|
List<Integer> types; |
|
|
|
if(HomePageConstant.WATER_CONSERVANCY.equals(type)){ |
|
|
|
if(HomePageConstant.WATER_CONSERVANCY.equals(type)){ |
|
|
@ -437,6 +441,7 @@ public class TargetServiceImpl implements TargetService { |
|
|
|
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate()); |
|
|
|
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate()); |
|
|
|
} |
|
|
|
} |
|
|
|
completes.add(completeTicketVo); |
|
|
|
completes.add(completeTicketVo); |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
for (Dept dept: areas) { |
|
|
|
for (Dept dept: areas) { |
|
|
@ -459,9 +464,9 @@ public class TargetServiceImpl implements TargetService { |
|
|
|
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate()); |
|
|
|
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate()); |
|
|
|
} |
|
|
|
} |
|
|
|
completes.add(completeTicketVo); |
|
|
|
completes.add(completeTicketVo); |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
// 等待所有线程执行完成
|
|
|
|
// 等待所有线程执行完成
|
|
|
|
try { |
|
|
|
try { |
|
|
|