|
|
@ -24,7 +24,10 @@ import com.hnac.hzims.operational.report.vo.DutyDefectVO; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.scheduled.service.equipment.PlanService; |
|
|
|
import com.hnac.hzims.scheduled.service.equipment.PlanService; |
|
|
|
import com.hnac.hzims.scheduled.service.inspect.TaskService; |
|
|
|
import com.hnac.hzims.scheduled.service.inspect.TaskService; |
|
|
|
import com.hnac.hzims.scheduled.service.operation.business.*; |
|
|
|
import com.hnac.hzims.scheduled.service.operation.business.AccessService; |
|
|
|
|
|
|
|
import com.hnac.hzims.scheduled.service.operation.business.DutyService; |
|
|
|
|
|
|
|
import com.hnac.hzims.scheduled.service.operation.business.MaintenanceService; |
|
|
|
|
|
|
|
import com.hnac.hzims.scheduled.service.operation.business.PhenomenonService; |
|
|
|
import com.hnac.hzims.scheduled.service.operation.fill.*; |
|
|
|
import com.hnac.hzims.scheduled.service.operation.fill.*; |
|
|
|
import com.hnac.hzims.scheduled.service.operation.home.ShowService; |
|
|
|
import com.hnac.hzims.scheduled.service.operation.home.ShowService; |
|
|
|
import com.hnac.hzims.scheduled.service.operation.plate.DataService; |
|
|
|
import com.hnac.hzims.scheduled.service.operation.plate.DataService; |
|
|
@ -77,6 +80,7 @@ public class ShowServiceImpl implements ShowService { |
|
|
|
private final OverService overService; |
|
|
|
private final OverService overService; |
|
|
|
private final PlanService planService; |
|
|
|
private final PlanService planService; |
|
|
|
private final PowerService powerService; |
|
|
|
private final PowerService powerService; |
|
|
|
|
|
|
|
private final WindService windService; |
|
|
|
private final SolveService solveService; |
|
|
|
private final SolveService solveService; |
|
|
|
private final OtherService otherService; |
|
|
|
private final OtherService otherService; |
|
|
|
private final AccessService accessService; |
|
|
|
private final AccessService accessService; |
|
|
@ -319,27 +323,35 @@ public class ShowServiceImpl implements ShowService { |
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
return target; |
|
|
|
return target; |
|
|
|
} |
|
|
|
} |
|
|
|
QueryWrapper<PowerEntity> queryWrapper = new QueryWrapper<PowerEntity>() {{ |
|
|
|
// 计划发电量
|
|
|
|
in("create_dept", stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); |
|
|
|
List<PlanGenerationEntity> plans = planService.planGeneration(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null, DateUtil.format(new Date(),"yyyy")); |
|
|
|
eq("type", HomePageConstant.WIND_POWER_TYPE); |
|
|
|
// 填报信息
|
|
|
|
likeRight("mon", DateUtil.format(new Date(),"yyyy")); |
|
|
|
List<WindEntity> winds = windService.list(Wrappers.<WindEntity>lambdaQuery() |
|
|
|
}}; |
|
|
|
.in(WindEntity::getStationCode, stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) |
|
|
|
List<PowerEntity> list = powerService.list(queryWrapper); |
|
|
|
.likeRight(WindEntity::getFillDate, DateUtil.format(new Date(),"yyyy"))); |
|
|
|
if(CollectionUtil.isEmpty(list)){ |
|
|
|
if(CollectionUtil.isEmpty(winds)){ |
|
|
|
return target; |
|
|
|
return target; |
|
|
|
} |
|
|
|
} |
|
|
|
double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum(); |
|
|
|
double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); |
|
|
|
double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum(); |
|
|
|
double power = winds.stream().mapToDouble(WindEntity::getPower).sum(); |
|
|
|
|
|
|
|
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {}); |
|
|
|
// 装机容量
|
|
|
|
// 装机容量
|
|
|
|
target.setTaget_one(list.stream().map(PowerEntity::getInstalledCapacity).collect(Collectors.toSet()).stream().mapToDouble(Double::valueOf).sum()); |
|
|
|
target.setTaget_one(devices.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getCreateDept())).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum()); |
|
|
|
// 发电量
|
|
|
|
// 发电量
|
|
|
|
target.setTaget_two(list.stream().mapToDouble(PowerEntity::getPowerMon).sum()); |
|
|
|
target.setTaget_two(power); |
|
|
|
if(Math.abs(plan) > 0){ |
|
|
|
if(Math.abs(plan) > 0){ |
|
|
|
// 发电完成率
|
|
|
|
// 发电完成率
|
|
|
|
target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
|
|
|
target.setTaget_three(BigDecimal.valueOf(power / plan * 100).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
// 双票合格率
|
|
|
|
// 双票合格率
|
|
|
|
target.setTaget_four(BigDecimal.valueOf(pass / list.size()).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
|
|
|
LocalDate firstDay = LocalDate.now().withDayOfYear(1); |
|
|
|
|
|
|
|
LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN); |
|
|
|
|
|
|
|
R<List<Dept>> result = sysClient.getDeptList(); |
|
|
|
|
|
|
|
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()); |
|
|
|
|
|
|
|
DoublePassRateVO pass = ticketService.doublePassRate(areas, firstDateTime, LocalDateTime.now()); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(pass)) { |
|
|
|
|
|
|
|
target.setTaget_four(Double.valueOf(pass.getDoublePassRate())); |
|
|
|
|
|
|
|
} |
|
|
|
return target; |
|
|
|
return target; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -433,6 +445,12 @@ public class ShowServiceImpl implements ShowService { |
|
|
|
TargetVo target = new TargetVo(); |
|
|
|
TargetVo target = new TargetVo(); |
|
|
|
target.setType(HomePageConstant.DISTRIBUTION_NETWORK); |
|
|
|
target.setType(HomePageConstant.DISTRIBUTION_NETWORK); |
|
|
|
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.DISTRIBUTION_NETWORK)); |
|
|
|
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.DISTRIBUTION_NETWORK)); |
|
|
|
|
|
|
|
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
|
|
|
|
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) |
|
|
|
|
|
|
|
.eq(StationEntity::getType,HomePageConstant.DISTRIBUTION_NETWORK)); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
|
|
|
|
return target; |
|
|
|
|
|
|
|
} |
|
|
|
// 线程池
|
|
|
|
// 线程池
|
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("network-taget-pool-%d").build(); |
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("network-taget-pool-%d").build(); |
|
|
|
ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(3, namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|
|
|
ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(3, namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|
|
@ -446,6 +464,7 @@ public class ShowServiceImpl implements ShowService { |
|
|
|
List<OverEntity> overs = overService.list(new QueryWrapper<OverEntity>() {{ |
|
|
|
List<OverEntity> overs = overService.list(new QueryWrapper<OverEntity>() {{ |
|
|
|
ge("create_time", firstDateTime); |
|
|
|
ge("create_time", firstDateTime); |
|
|
|
le("create_time", LocalDateTime.now()); |
|
|
|
le("create_time", LocalDateTime.now()); |
|
|
|
|
|
|
|
in("create_dept",stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
if(CollectionUtil.isEmpty(overs)){ |
|
|
|
if(CollectionUtil.isEmpty(overs)){ |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
@ -468,6 +487,7 @@ public class ShowServiceImpl implements ShowService { |
|
|
|
List<SolveEntity> solves = solveService.list(new QueryWrapper<SolveEntity>() {{ |
|
|
|
List<SolveEntity> solves = solveService.list(new QueryWrapper<SolveEntity>() {{ |
|
|
|
ge("create_time", firstDateTime); |
|
|
|
ge("create_time", firstDateTime); |
|
|
|
le("create_time", LocalDateTime.now()); |
|
|
|
le("create_time", LocalDateTime.now()); |
|
|
|
|
|
|
|
in("create_dept",stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
if(CollectionUtil.isEmpty(solves)){ |
|
|
|
if(CollectionUtil.isEmpty(solves)){ |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
@ -481,6 +501,7 @@ public class ShowServiceImpl implements ShowService { |
|
|
|
List<OtherEntity> others = otherService.list(new QueryWrapper<OtherEntity>() {{ |
|
|
|
List<OtherEntity> others = otherService.list(new QueryWrapper<OtherEntity>() {{ |
|
|
|
ge("create_time", firstDateTime); |
|
|
|
ge("create_time", firstDateTime); |
|
|
|
le("create_time", LocalDateTime.now()); |
|
|
|
le("create_time", LocalDateTime.now()); |
|
|
|
|
|
|
|
in("create_dept",stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
if(CollectionUtil.isEmpty(others)){ |
|
|
|
if(CollectionUtil.isEmpty(others)){ |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
@ -648,6 +669,7 @@ public class ShowServiceImpl implements ShowService { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
list = R.getData(); |
|
|
|
list = R.getData(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 根据参数查询有效站点
|
|
|
|
// 根据参数查询有效站点
|
|
|
|
List<StationEntity> stationList = this.stationByParams(list,deptId,typeList,serveType); |
|
|
|
List<StationEntity> stationList = this.stationByParams(list,deptId,typeList,serveType); |
|
|
|