|
|
|
@ -118,21 +118,21 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<InstalledCapacityVo> installedCapacity(String stationName,Integer type) { |
|
|
|
|
public IPage<InstalledCapacityVo> installedCapacity(IPage<InstalledCapacityVo> page,String stationName,Integer type) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.eq(StationEntity::getType, type); |
|
|
|
|
wappers.eq(StationEntity::getServeType,2); |
|
|
|
|
//wappers.eq(StationEntity::getServeType,2);
|
|
|
|
|
if(!StringUtils.isEmpty(stationName)){ |
|
|
|
|
wappers.like(StationEntity::getName,stationName); |
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 设备
|
|
|
|
|
List<EminfoAndEmParamVo> devices = maintenanceService.getEmInfoList(); |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<InstalledCapacityVo> capacitys = stations.stream().map(station->{ |
|
|
|
|
InstalledCapacityVo item = new InstalledCapacityVo(); |
|
|
|
|
item.setStationName(station.getName()); |
|
|
|
|
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device->device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
@ -149,6 +149,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
item.setDetail(String.join("|",details)); |
|
|
|
|
return item; |
|
|
|
|
}).filter(capacity->Math.abs(capacity.getInstalledCapacity()) > 0).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(capacitys.size()); |
|
|
|
|
page.setRecords(capacitys.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -156,26 +159,27 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<ElectricGenerationVo> electricGeneration(String stationName,Integer type) { |
|
|
|
|
public IPage<ElectricGenerationVo> electricGeneration(IPage<ElectricGenerationVo> page,String stationName,Integer type) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.eq(StationEntity::getType, type); |
|
|
|
|
wappers.eq(StationEntity::getServeType,2); |
|
|
|
|
//wappers.eq(StationEntity::getServeType,2);
|
|
|
|
|
if(!StringUtils.isEmpty(stationName)){ |
|
|
|
|
wappers.like(StationEntity::getName,stationName); |
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
List<ElectricGenerationVo> electrics; |
|
|
|
|
// 填报数据
|
|
|
|
|
if(HomePageConstant.HYDROPOWER.equals(type)){ |
|
|
|
|
// 设备指标数据
|
|
|
|
|
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key); |
|
|
|
|
if(CollectionUtils.isEmpty(targets)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
electrics = stations.stream().map(station->{ |
|
|
|
|
ElectricGenerationVo item = new ElectricGenerationVo(); |
|
|
|
|
item.setStationName(station.getName()); |
|
|
|
|
List<HydropowerUnitTargetVo> stationTargets = targets.stream().filter(device->device.getDeptId().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
@ -192,49 +196,52 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
item.setDetail(String.join("|",details)); |
|
|
|
|
return item; |
|
|
|
|
}).filter(generate->Math.abs(generate.getElectricGeneration()) > 0).collect(Collectors.toList()); |
|
|
|
|
}else if(HomePageConstant.PHOTOVOLTAIC.equals(type)){ |
|
|
|
|
}else if(HomePageConstant.PHOTOVOLTAIC.equals(type)) { |
|
|
|
|
List<PhotovoltaicTargetVo> targets = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key); |
|
|
|
|
if(CollectionUtil.isEmpty(targets)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
if (CollectionUtil.isEmpty(targets)) { |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
electrics = stations.stream().map(station -> { |
|
|
|
|
ElectricGenerationVo item = new ElectricGenerationVo(); |
|
|
|
|
item.setStationName(station.getName()); |
|
|
|
|
List<PhotovoltaicTargetVo> stationTargets = targets.stream().filter(device->device.getDeptId().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtils.isEmpty(stationTargets)){ |
|
|
|
|
List<PhotovoltaicTargetVo> stationTargets = targets.stream().filter(device -> device.getDeptId().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtils.isEmpty(stationTargets)) { |
|
|
|
|
item.setElectricGeneration(0.0); |
|
|
|
|
item.setDetail("站点暂无发电"); |
|
|
|
|
return item; |
|
|
|
|
} |
|
|
|
|
// 年发电量
|
|
|
|
|
double sum = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).mapToDouble(PhotovoltaicTargetVo::getGenerationYear).sum(); |
|
|
|
|
double sum = targets.stream().filter(target -> target.getDeptId().equals(station.getRefDept())).mapToDouble(PhotovoltaicTargetVo::getGenerationYear).sum(); |
|
|
|
|
item.setElectricGeneration(sum); |
|
|
|
|
// 发电量详情
|
|
|
|
|
List<String> details = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).map(target-> "[" + Optional.ofNullable(target.getDeviceCode()).orElse("填报电量") + " " + target.getGenerationYear() +"kWh]").collect(Collectors.toList()); |
|
|
|
|
item.setDetail(String.join("|",details)); |
|
|
|
|
List<String> details = targets.stream().filter(target -> target.getDeptId().equals(station.getRefDept())).map(target -> "[" + Optional.ofNullable(target.getDeviceCode()).orElse("填报电量") + " " + target.getGenerationYear() + "kWh]").collect(Collectors.toList()); |
|
|
|
|
item.setDetail(String.join("|", details)); |
|
|
|
|
return item; |
|
|
|
|
}).filter(generate->Math.abs(generate.getElectricGeneration()) > 0).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
}).filter(generate -> Math.abs(generate.getElectricGeneration()) > 0).collect(Collectors.toList()); |
|
|
|
|
}else{ |
|
|
|
|
// 查询填报数据
|
|
|
|
|
String mon = DateUtil.format(new Date(),"yyyy"); |
|
|
|
|
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery() |
|
|
|
|
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())) |
|
|
|
|
.ge(PowerEntity::getMon, mon + "-01") |
|
|
|
|
); |
|
|
|
|
electrics = stations.stream().map(station -> { |
|
|
|
|
ElectricGenerationVo item = new ElectricGenerationVo(); |
|
|
|
|
item.setStationName(station.getName()); |
|
|
|
|
// 发电量
|
|
|
|
|
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtils.isEmpty(stationPowers)){ |
|
|
|
|
item.setElectricGeneration(0.0); |
|
|
|
|
}else{ |
|
|
|
|
item.setElectricGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear()); |
|
|
|
|
} |
|
|
|
|
item.setDetail("站点为填报数据,暂无设备装机发电量信息!"); |
|
|
|
|
return item; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
// 查询填报数据
|
|
|
|
|
String mon = DateUtil.format(new Date(),"yyyy"); |
|
|
|
|
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery() |
|
|
|
|
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())) |
|
|
|
|
.ge(PowerEntity::getMon, mon + "-01") |
|
|
|
|
); |
|
|
|
|
return stations.stream().map(station -> { |
|
|
|
|
ElectricGenerationVo item = new ElectricGenerationVo(); |
|
|
|
|
item.setStationName(station.getName()); |
|
|
|
|
// 发电量
|
|
|
|
|
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtils.isEmpty(stationPowers)){ |
|
|
|
|
item.setElectricGeneration(0.0); |
|
|
|
|
}else{ |
|
|
|
|
item.setElectricGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear()); |
|
|
|
|
} |
|
|
|
|
item.setDetail("站点为填报数据,暂无设备装机发电量信息!"); |
|
|
|
|
return item; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(electrics.size()); |
|
|
|
|
page.setRecords(electrics.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -242,27 +249,28 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<CompleteGenerationVo> completeGeneration(String stationName,Integer type) { |
|
|
|
|
public IPage<CompleteGenerationVo> completeGeneration(IPage<CompleteGenerationVo> page,String stationName,Integer type) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.eq(StationEntity::getType, type); |
|
|
|
|
wappers.eq(StationEntity::getServeType,2); |
|
|
|
|
//wappers.eq(StationEntity::getServeType,2);
|
|
|
|
|
if(!StringUtils.isEmpty(stationName)){ |
|
|
|
|
wappers.like(StationEntity::getName,stationName); |
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
List<CompleteGenerationVo> generations; |
|
|
|
|
if(HomePageConstant.HYDROPOWER.equals(type)){ |
|
|
|
|
// 计划发电量
|
|
|
|
|
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy")); |
|
|
|
|
// 设备指标数据
|
|
|
|
|
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key); |
|
|
|
|
if(CollectionUtils.isEmpty(targets)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
generations = stations.stream().map(station->{ |
|
|
|
|
CompleteGenerationVo item = new CompleteGenerationVo(); |
|
|
|
|
item.setStationName(station.getName()); |
|
|
|
|
List<HydropowerUnitTargetVo> stationTargets = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
@ -303,9 +311,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
// 设备指标数据
|
|
|
|
|
List<PhotovoltaicTargetVo> targets = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key); |
|
|
|
|
if(CollectionUtils.isEmpty(targets)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
generations = stations.stream().map(station->{ |
|
|
|
|
CompleteGenerationVo item = new CompleteGenerationVo(); |
|
|
|
|
item.setStationName(station.getName()); |
|
|
|
|
List<PhotovoltaicTargetVo> stationTargets = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
@ -336,28 +344,32 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return item; |
|
|
|
|
}).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList()); |
|
|
|
|
}else{ |
|
|
|
|
String mon = DateUtil.format(new Date(),"yyyy"); |
|
|
|
|
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery() |
|
|
|
|
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())) |
|
|
|
|
.ge(PowerEntity::getMon, mon + "-01") |
|
|
|
|
); |
|
|
|
|
generations = stations.stream().map(station -> { |
|
|
|
|
CompleteGenerationVo item = new CompleteGenerationVo(); |
|
|
|
|
item.setStationName(station.getName()); |
|
|
|
|
// 发电量
|
|
|
|
|
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtils.isEmpty(stationPowers)){ |
|
|
|
|
item.setPlanGeneration(0.0); |
|
|
|
|
item.setRealityGeneration(0.0); |
|
|
|
|
item.setCompleteRate(0.0); |
|
|
|
|
}else{ |
|
|
|
|
item.setPlanGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPlannedPowerYear()); |
|
|
|
|
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())); |
|
|
|
|
} |
|
|
|
|
return item; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
String mon = DateUtil.format(new Date(),"yyyy"); |
|
|
|
|
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery() |
|
|
|
|
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())) |
|
|
|
|
.ge(PowerEntity::getMon, mon + "-01") |
|
|
|
|
); |
|
|
|
|
return stations.stream().map(station -> { |
|
|
|
|
CompleteGenerationVo item = new CompleteGenerationVo(); |
|
|
|
|
item.setStationName(station.getName()); |
|
|
|
|
// 发电量
|
|
|
|
|
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtils.isEmpty(stationPowers)){ |
|
|
|
|
item.setPlanGeneration(0.0); |
|
|
|
|
item.setRealityGeneration(0.0); |
|
|
|
|
item.setCompleteRate(0.0); |
|
|
|
|
}else{ |
|
|
|
|
item.setPlanGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPlannedPowerYear()); |
|
|
|
|
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())); |
|
|
|
|
} |
|
|
|
|
return item; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(generations.size()); |
|
|
|
|
page.setRecords(generations.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -365,10 +377,13 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<CompleteTicketVo> completeTicket(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)){ |
|
|
|
|
return this.getcompleteFillTicket(areaName,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; |
|
|
|
@ -379,7 +394,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
List<Dept> areas = this.areas(types); |
|
|
|
|
if(CollectionUtils.isEmpty(areas)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 开始时间
|
|
|
|
|
LocalDate firstDay = LocalDate.now().withDayOfYear(1); |
|
|
|
@ -388,26 +403,46 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(areas.size(), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|
|
|
|
//监控线程执行完后返回结果
|
|
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(areas.size()); |
|
|
|
|
List<CompleteTicketVo> completeTickets = new ArrayList<>(); |
|
|
|
|
List<CompleteTicketVo> completes = new ArrayList<>(); |
|
|
|
|
exe.execute(()-> { |
|
|
|
|
for (Dept dept: areas) { |
|
|
|
|
// 双票
|
|
|
|
|
DoublePassRateVO doublePass = ticketInfoAllClient.getDoublePassRate(Collections.singletonList(dept.getId()), firstDateTime, LocalDateTime.now()); |
|
|
|
|
CompleteTicketVo completeTicketVo = new CompleteTicketVo(); |
|
|
|
|
if (ObjectUtil.isEmpty(doublePass)) { |
|
|
|
|
completeTicketVo.setAreaName(dept.getDeptName()); |
|
|
|
|
completeTicketVo.setTicketCount("0"); |
|
|
|
|
completeTicketVo.setCompleteCount("0"); |
|
|
|
|
completeTicketVo.setCompleteRate("0.0"); |
|
|
|
|
} else { |
|
|
|
|
completeTicketVo.setAreaName(dept.getDeptName()); |
|
|
|
|
completeTicketVo.setTicketCount(doublePass.getDoubleTicketCount().toString()); |
|
|
|
|
completeTicketVo.setCompleteCount(doublePass.getDoubleTicketPassCount().toString()); |
|
|
|
|
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate()); |
|
|
|
|
if(!StringUtil.isEmpty(areaName)){ |
|
|
|
|
for (Dept dept: areas.stream().filter(area->area.getDeptName().equals(areaName)).collect(Collectors.toList())) { |
|
|
|
|
// 双票
|
|
|
|
|
DoublePassRateVO doublePass = ticketInfoAllClient.getDoublePassRate(Collections.singletonList(dept.getId()), firstDateTime, LocalDateTime.now()); |
|
|
|
|
CompleteTicketVo completeTicketVo = new CompleteTicketVo(); |
|
|
|
|
if (ObjectUtil.isEmpty(doublePass)) { |
|
|
|
|
completeTicketVo.setAreaName(dept.getDeptName()); |
|
|
|
|
completeTicketVo.setTicketCount("0"); |
|
|
|
|
completeTicketVo.setCompleteCount("0"); |
|
|
|
|
completeTicketVo.setCompleteRate("0.0"); |
|
|
|
|
} else { |
|
|
|
|
completeTicketVo.setAreaName(dept.getDeptName()); |
|
|
|
|
completeTicketVo.setTicketCount(doublePass.getDoubleTicketCount().toString()); |
|
|
|
|
completeTicketVo.setCompleteCount(doublePass.getDoubleTicketPassCount().toString()); |
|
|
|
|
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate()); |
|
|
|
|
} |
|
|
|
|
completes.add(completeTicketVo); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
for (Dept dept: areas) { |
|
|
|
|
// 双票
|
|
|
|
|
DoublePassRateVO doublePass = ticketInfoAllClient.getDoublePassRate(Collections.singletonList(dept.getId()), firstDateTime, LocalDateTime.now()); |
|
|
|
|
CompleteTicketVo completeTicketVo = new CompleteTicketVo(); |
|
|
|
|
if (ObjectUtil.isEmpty(doublePass)) { |
|
|
|
|
completeTicketVo.setAreaName(dept.getDeptName()); |
|
|
|
|
completeTicketVo.setTicketCount("0"); |
|
|
|
|
completeTicketVo.setCompleteCount("0"); |
|
|
|
|
completeTicketVo.setCompleteRate("0.0"); |
|
|
|
|
} else { |
|
|
|
|
completeTicketVo.setAreaName(dept.getDeptName()); |
|
|
|
|
completeTicketVo.setTicketCount(doublePass.getDoubleTicketCount().toString()); |
|
|
|
|
completeTicketVo.setCompleteCount(doublePass.getDoubleTicketPassCount().toString()); |
|
|
|
|
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate()); |
|
|
|
|
} |
|
|
|
|
completes.add(completeTicketVo); |
|
|
|
|
} |
|
|
|
|
completeTickets.add(completeTicketVo); |
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
} |
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
}); |
|
|
|
|
// 等待所有线程执行完成
|
|
|
|
|
try { |
|
|
|
@ -417,7 +452,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
|
} |
|
|
|
|
exe.shutdown(); |
|
|
|
|
return completeTickets.stream().filter(complete->Math.abs(Integer.parseInt(complete.getTicketCount())) > 0 || Math.abs(Integer.parseInt(complete.getCompleteCount())) > 0).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(completes.size()); |
|
|
|
|
page.setRecords(completes.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -454,7 +491,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
private List<CompleteTicketVo> getcompleteFillTicket(String stationName, Integer type) { |
|
|
|
|
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
|
.eq(StationEntity::getType, type) |
|
|
|
|
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) |
|
|
|
|
//.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
|
|
|
|
|
.like(StationEntity::getName,stationName)); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
@ -488,19 +525,20 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<CompleteDefectVo> defect(String areaName, Integer type) { |
|
|
|
|
public IPage<CompleteDefectVo> defect(IPage<CompleteDefectVo> page,String areaName, Integer type) { |
|
|
|
|
if(HomePageConstant.DISTRIBUTION_NETWORK.equals(type)){ |
|
|
|
|
return this.getFillDefect(areaName,type); |
|
|
|
|
List<CompleteDefectVo> defects = this.getFillDefect(areaName,type); |
|
|
|
|
page.setTotal(defects.size()); |
|
|
|
|
page.setRecords(defects.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获取区域机构
|
|
|
|
|
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE); |
|
|
|
|
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE,true); |
|
|
|
|
if(MapUtils.isEmpty(areas)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
List<Dept> depts = areas.keySet().stream().filter(dept -> StringUtils.isEmpty(areaName) || dept.getDeptName().contains(areaName)).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtils.isEmpty(depts)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
String startTime = this.getFristDayByYear(); |
|
|
|
|
String endTime = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); |
|
|
|
@ -534,7 +572,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
|
} |
|
|
|
|
exe.shutdown(); |
|
|
|
|
return completeDefects; |
|
|
|
|
page.setTotal(completeDefects.size()); |
|
|
|
|
page.setRecords(completeDefects.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -545,7 +585,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<ExamineCardVo> examineCard(String stationName, Integer type) { |
|
|
|
|
public IPage<ExamineCardVo> examineCard(IPage<ExamineCardVo> page,String stationName, Integer type) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.eq(StationEntity::getType, type); |
|
|
|
@ -555,7 +595,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 查询检修卡
|
|
|
|
|
String startTime = this.getFristDayByYear(); |
|
|
|
@ -566,19 +606,22 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
.le(OverEntity::getCreateTime,endTime) |
|
|
|
|
); |
|
|
|
|
if(CollectionUtils.isEmpty(overs)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
List<OverDetailsEntity> overDetails = overDetailsService.list(Wrappers.<OverDetailsEntity>lambdaQuery() |
|
|
|
|
.in(OverDetailsEntity::getOverId,overs.stream().map(OverEntity::getId).collect(Collectors.toList())) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return overs.stream().collect(Collectors.groupingBy(OverEntity::getCreateDept)).entrySet().stream().map(entry->{ |
|
|
|
|
List<ExamineCardVo> cards = overs.stream().collect(Collectors.groupingBy(OverEntity::getCreateDept)).entrySet().stream().map(entry->{ |
|
|
|
|
ExamineCardVo examineCard = new ExamineCardVo(); |
|
|
|
|
examineCard.setStationName(stations.stream().filter(station -> station.getRefDept().equals(entry.getKey())).collect(Collectors.toList()).get(0).getName()); |
|
|
|
|
examineCard.setCardTotal(entry.getValue().stream().mapToDouble(over-> Double.parseDouble(over.getTotalPrice().toString())).sum()); |
|
|
|
|
examineCard.setCardCount(overDetails.stream().filter(detail-> entry.getValue().stream().map(OverEntity::getId).collect(Collectors.toList()).contains(detail.getOverId())).mapToInt(OverDetailsEntity::getQuantity).sum()); |
|
|
|
|
return examineCard; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(cards.size()); |
|
|
|
|
page.setRecords(cards.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -589,7 +632,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<CompleteOtherVo> completeOther(String stationName, Integer type, Integer queryType) { |
|
|
|
|
public IPage<CompleteOtherVo> completeOther(IPage<CompleteOtherVo> page,String stationName, Integer type, Integer queryType) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.eq(StationEntity::getType, type); |
|
|
|
@ -599,7 +642,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 查询设备在线率/Fa投入条数
|
|
|
|
|
String startTime = this.getFristDayByYear(); |
|
|
|
@ -610,9 +653,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
.le(OtherEntity::getCreateTime,endTime) |
|
|
|
|
); |
|
|
|
|
if(CollectionUtils.isEmpty(others)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
return others.stream().collect(Collectors.groupingBy(OtherEntity::getCreateDept)).entrySet().stream().map(entry -> { |
|
|
|
|
List<CompleteOtherVo> records = others.stream().collect(Collectors.groupingBy(OtherEntity::getCreateDept)).entrySet().stream().map(entry -> { |
|
|
|
|
CompleteOtherVo other = new CompleteOtherVo(); |
|
|
|
|
other.setStationName(stations.stream().filter(station -> station.getRefDept().equals(entry.getKey())).collect(Collectors.toList()).get(0).getName()); |
|
|
|
|
if(CensusConstant.QUERY_TYPE_DEFAULT.equals(queryType)){ |
|
|
|
@ -622,6 +665,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return other; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -678,12 +724,12 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
@Override |
|
|
|
|
public R<IPage<OperMaintenanceTaskVO>> routineMaintenance(OperMaintenanceTaskDTO params, Query query, Integer type) { |
|
|
|
|
// 获取区域机构
|
|
|
|
|
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE); |
|
|
|
|
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE,true); |
|
|
|
|
if(MapUtils.isEmpty(areas)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
// 查询日常维护任务
|
|
|
|
|
params.setDeptIds(areas.entrySet().stream().map(entry->entry.getKey().getId()).collect(Collectors.toList())); |
|
|
|
|
params.setDeptIds(areas.keySet().stream().map(Dept::getId).collect(Collectors.toList())); |
|
|
|
|
return maintenanceTaskService.list(params,query); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -697,12 +743,12 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
@Override |
|
|
|
|
public R<IPage<OperAccessTaskVO>> examineRepair(OperAccessTaskDTO params, Query query, Integer type) { |
|
|
|
|
// 获取区域机构
|
|
|
|
|
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE); |
|
|
|
|
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE,true); |
|
|
|
|
if(MapUtils.isEmpty(areas)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
// 查询检修任务
|
|
|
|
|
params.setDeptIds(areas.keySet().stream().map(key-> key.getId()).collect(Collectors.toList())); |
|
|
|
|
params.setDeptIds(areas.keySet().stream().map(Dept::getId).collect(Collectors.toList())); |
|
|
|
|
return accessTaskService.list(params,query); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -713,7 +759,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<DeviceClassifyVo> deviceClassify(String stationName, Long deptId,Integer status) { |
|
|
|
|
public IPage<DeviceClassifyVo> deviceClassify(IPage<DeviceClassifyVo> page,String stationName, Long deptId,Integer status) { |
|
|
|
|
// 获取区域设备统计
|
|
|
|
|
Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_key); |
|
|
|
|
List<String> faultList = deviceClassifyMap.get(HomePageConstant.FAULT); |
|
|
|
@ -722,21 +768,21 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
//根据用户权限获取机构
|
|
|
|
|
R<List<Dept>> result = sysClient.getDeptByCurrentUser(); |
|
|
|
|
if (!result.isSuccess() || ObjectUtil.isEmpty(result.getData())) { |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 站点
|
|
|
|
|
List<StationEntity> stations = stationService.getStationList(result.getData(),deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE); |
|
|
|
|
List<StationEntity> stations = stationService.getStationList(result.getData(),deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE,true); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
List<Long> detpIds = stations.stream().filter(o-> StringUtils.isEmpty(stationName) || o.getName().contains(stationName)).map(StationEntity::getRefDept).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtils.isEmpty(detpIds)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 设备
|
|
|
|
|
List<EminfoAndEmParamVo> devices = maintenanceService.getEmInfoList(); |
|
|
|
|
if(CollectionUtils.isEmpty(devices)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 获取设备集合
|
|
|
|
|
List<DeviceClassifyVo> deviceClassifys = devices.stream().filter(device->detpIds.contains(device.getCreateDept())).sorted(Comparator.comparing(EminfoAndEmParamVo::getCreateDept)).map(device -> { |
|
|
|
@ -754,11 +800,16 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return deviceClassify; |
|
|
|
|
}).filter(deviceClass -> StringUtils.isEmpty(stationName) || deviceClass.getStationName().contains(stationName)).collect(Collectors.toList()); |
|
|
|
|
List<DeviceClassifyVo> records = new ArrayList<>(); |
|
|
|
|
// 状态过滤
|
|
|
|
|
if(ObjectUtil.isEmpty(status)){ |
|
|
|
|
return deviceClassifys.stream().sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList()); |
|
|
|
|
records = deviceClassifys.stream().sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList()); |
|
|
|
|
}else{ |
|
|
|
|
records = deviceClassifys.stream().filter(o->o.getDeviceStatus().equals(status)).sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
return deviceClassifys.stream().filter(o->o.getDeviceStatus().equals(status)).sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -768,7 +819,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<HydropowerTargetVo> hydropowerTarget(String stationName, Long deptId,Integer target) { |
|
|
|
|
public IPage<HydropowerTargetVo> hydropowerTarget(IPage<HydropowerTargetVo> page,String stationName, Long deptId,Integer target) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.eq(StationEntity::getType, HomePageConstant.HYDROPOWER); |
|
|
|
@ -781,13 +832,13 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 功率
|
|
|
|
|
if(HomePageConstant.POWER.equals(target)){ |
|
|
|
|
// 实时数据
|
|
|
|
|
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<HydropowerTargetVo> records = stations.stream().map(station->{ |
|
|
|
|
HydropowerTargetVo hydropower = new HydropowerTargetVo(); |
|
|
|
|
hydropower.setStationName(station.getName()); |
|
|
|
|
if(CollectionUtil.isEmpty(reals)){ |
|
|
|
@ -797,11 +848,14 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return hydropower; |
|
|
|
|
})/*.filter(hydropower -> Math.abs(hydropower.getPower()) > 0)*/.sorted(Comparator.comparing(HydropowerTargetVo::getPower).reversed()).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 指标数据
|
|
|
|
|
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key); |
|
|
|
|
// 发电量
|
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<HydropowerTargetVo> records = stations.stream().map(station->{ |
|
|
|
|
HydropowerTargetVo hydropowerTarget = new HydropowerTargetVo(); |
|
|
|
|
hydropowerTarget.setStationName(station.getName()); |
|
|
|
|
if(CollectionUtils.isEmpty(targets)){ |
|
|
|
@ -823,6 +877,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return hydropowerTarget; |
|
|
|
|
})/*.filter(hydropower -> Math.abs(hydropower.getElectric()) > 0)*/.sorted(Comparator.comparing(HydropowerTargetVo::getElectric).reversed()).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -832,7 +889,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<WaterTargetVo> waterTarget(String stationName, Long deptId,Integer target) { |
|
|
|
|
public IPage<WaterTargetVo> waterTarget(IPage<WaterTargetVo> page,String stationName, Long deptId,Integer target) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.in(StationEntity::getType, HomePageConstant.waterList); |
|
|
|
@ -846,12 +903,12 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 负荷
|
|
|
|
|
if(HomePageConstant.LOADING.equals(target)){ |
|
|
|
|
List<WaterPumpRealVo> pumps = (List<WaterPumpRealVo>) redisTemplate.opsForValue().get(load_waterpump_real_key); |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<WaterTargetVo> records = stations.stream().map(station->{ |
|
|
|
|
WaterTargetVo water = new WaterTargetVo(); |
|
|
|
|
water.setStationName(station.getName()); |
|
|
|
|
if(CollectionUtil.isEmpty(pumps)){ |
|
|
|
@ -862,10 +919,13 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
water.setLoad(Optional.ofNullable(use).orElse(0.0)); |
|
|
|
|
return water; |
|
|
|
|
})/*.filter(water -> Math.abs(water.getLoad()) > 0)*/.sorted(Comparator.comparing(WaterTargetVo::getLoad).reversed()).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 用电量
|
|
|
|
|
List<WaterPumpTargetVo> targets = (List<WaterPumpTargetVo>) redisTemplate.opsForValue().get(load_waterpump_target_key); |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<WaterTargetVo> records = stations.stream().map(station->{ |
|
|
|
|
WaterTargetVo water = new WaterTargetVo(); |
|
|
|
|
water.setStationName(station.getName()); |
|
|
|
|
if(CollectionUtil.isEmpty(targets)){ |
|
|
|
@ -887,10 +947,13 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return water; |
|
|
|
|
})/*.filter(water -> Math.abs(water.getUse()) > 0)*/.sorted(Comparator.comparing(WaterTargetVo::getUse).reversed()).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<PhotovoTargetVo> photovoltaicTarget(String stationName, Long deptId, Integer target) { |
|
|
|
|
public IPage<PhotovoTargetVo> photovoltaicTarget(IPage<PhotovoTargetVo> page,String stationName, Long deptId, Integer target) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.eq(StationEntity::getType, HomePageConstant.PHOTOVOLTAIC); |
|
|
|
@ -904,13 +967,13 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 负荷
|
|
|
|
|
if(HomePageConstant.LOADING.equals(target)){ |
|
|
|
|
// 实时数据
|
|
|
|
|
List<PhotovoltaicRealVo> reals = (List<PhotovoltaicRealVo>) redisTemplate.opsForValue().get(load_photovoltaic_real_key); |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<PhotovoTargetVo> records = stations.stream().map(station->{ |
|
|
|
|
PhotovoTargetVo photovo = new PhotovoTargetVo(); |
|
|
|
|
photovo.setStationName(station.getName()); |
|
|
|
|
if(CollectionUtil.isEmpty(reals)){ |
|
|
|
@ -920,10 +983,13 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return photovo; |
|
|
|
|
})/*.filter(photovoltaic -> Math.abs(photovoltaic.getLoad()) > 0)*/.sorted(Comparator.comparing(PhotovoTargetVo::getLoad).reversed()).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 发电量
|
|
|
|
|
List<PhotovoltaicTargetVo> targets = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key); |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<PhotovoTargetVo> records = stations.stream().map(station->{ |
|
|
|
|
PhotovoTargetVo photovo = new PhotovoTargetVo(); |
|
|
|
|
photovo.setStationName(station.getName()); |
|
|
|
|
if(CollectionUtil.isEmpty(targets)){ |
|
|
|
@ -945,61 +1011,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return photovo; |
|
|
|
|
})/*.filter(photovo -> Math.abs(photovo.getGenerate()) > 0)*/.sorted(Comparator.comparing(PhotovoTargetVo::getGenerate).reversed()).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 集团设备统计 |
|
|
|
|
* @param areaName |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<DeviceGroupVo> deviceGroup(String areaName) { |
|
|
|
|
// 获取区域机构
|
|
|
|
|
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE); |
|
|
|
|
if(MapUtils.isEmpty(areas)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
// 获取设备
|
|
|
|
|
List<EminfoAndEmParamVo> devices = maintenanceService.getEmInfoList(); |
|
|
|
|
// 获取设备状态
|
|
|
|
|
Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_key); |
|
|
|
|
List<String> faultList = deviceClassifyMap.get(HomePageConstant.FAULT); |
|
|
|
|
List<String> overhaultList = deviceClassifyMap.get(HomePageConstant.OVERHAUL); |
|
|
|
|
List<String> runtList = deviceClassifyMap.get(HomePageConstant.RUN); |
|
|
|
|
return areas.entrySet().stream().map(entry->{ |
|
|
|
|
DeviceGroupVo group = new DeviceGroupVo(); |
|
|
|
|
group.setDeptId(entry.getKey().getId()); |
|
|
|
|
group.setAreaName(entry.getKey().getDeptName()); |
|
|
|
|
if(CollectionUtils.isEmpty(devices)){ |
|
|
|
|
group.setFaultCount(0L); |
|
|
|
|
group.setOverhaultCount(0L); |
|
|
|
|
group.setRunCount(0L); |
|
|
|
|
group.setReserveCount(0L); |
|
|
|
|
return group; |
|
|
|
|
} |
|
|
|
|
List<String> numbers = devices.stream().filter(device-> entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(device.getCreateDept())).map(EminfoAndEmParamVo::getEmCode).collect(Collectors.toList()); |
|
|
|
|
// 故障
|
|
|
|
|
if(CollectionUtils.isEmpty(faultList)){ |
|
|
|
|
group.setFaultCount(0L); |
|
|
|
|
}else{ |
|
|
|
|
group.setFaultCount(numbers.stream().filter(number -> faultList.contains(number)).count()); |
|
|
|
|
} |
|
|
|
|
// 检修
|
|
|
|
|
if(CollectionUtils.isEmpty(overhaultList)){ |
|
|
|
|
group.setFaultCount(0L); |
|
|
|
|
}else{ |
|
|
|
|
group.setFaultCount(numbers.stream().filter(number -> overhaultList.contains(number)).count()); |
|
|
|
|
} |
|
|
|
|
// 运行
|
|
|
|
|
if(CollectionUtils.isEmpty(runtList)){ |
|
|
|
|
group.setFaultCount(0L); |
|
|
|
|
}else{ |
|
|
|
|
group.setFaultCount(numbers.stream().filter(number -> runtList.contains(number)).count()); |
|
|
|
|
} |
|
|
|
|
// 备用
|
|
|
|
|
group.setReserveCount(numbers.size() - group.getFaultCount() - group.getOverhaultCount() - group.getRunCount()); |
|
|
|
|
return group; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1009,15 +1023,15 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<DutyGroupVo> dutyGroup(String areaName, Long type) { |
|
|
|
|
public IPage<DutyGroupVo> dutyGroup(IPage<DutyGroupVo> page,String areaName, Long type) { |
|
|
|
|
// 获取区域机构
|
|
|
|
|
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE); |
|
|
|
|
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE,true); |
|
|
|
|
if(MapUtils.isEmpty(areas)){ |
|
|
|
|
return null; |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// redis中取区域数据
|
|
|
|
|
List<AreaDutyVo> areaDutyVoList = (List<AreaDutyVo>) redisTemplate.opsForValue().get(areaDutyInfoKey); |
|
|
|
|
return areas.keySet().stream().filter(stationEntities -> StringUtil.isEmpty(areaName) || stationEntities.getDeptName().contains(areaName)).map(stationEntities -> { |
|
|
|
|
List<DutyGroupVo> records = areas.keySet().stream().filter(stationEntities -> StringUtil.isEmpty(areaName) || stationEntities.getDeptName().contains(areaName)).map(stationEntities -> { |
|
|
|
|
DutyGroupVo duty = new DutyGroupVo(); |
|
|
|
|
duty.setDeptId(stationEntities.getId()); |
|
|
|
|
duty.setAreaName(stationEntities.getDeptName()); |
|
|
|
@ -1043,6 +1057,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return duty; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|