diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MaintenanceServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MaintenanceServiceImpl.java index 35b4ab5..47abb2b 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MaintenanceServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MaintenanceServiceImpl.java @@ -108,7 +108,7 @@ public class MaintenanceServiceImpl extends BaseServiceImpl id.toString()).collect(Collectors.joining(","))); + regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(Object::toString).collect(Collectors.joining(","))); regularWorkVO.setRegularWorkSum(regularWorkList.size()); // 定期工作任务完成数量 List regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java index 519f722..1e78dea 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java @@ -1,12 +1,14 @@ package com.hnac.hzims.operational.main.service.impl; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.feign.IPlanGenertionClient; +import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.operational.fill.entity.*; import com.hnac.hzims.operational.fill.service.*; import com.hnac.hzims.operational.main.constant.HomePageConstant; @@ -55,6 +57,8 @@ import java.util.stream.Collectors; @RequiredArgsConstructor public class HomeServiceImpl implements HomeService { + private final WindService windService; + private final OverService overService; private final OtherService otherService; @@ -82,6 +86,8 @@ public class HomeServiceImpl implements HomeService { @Value("${hzims.operation.homePage.charge.url}") public String charge_url; + public final static String device_cache_final = "hzims:equipment:emInfo:deviceCode.emInfoList"; + private final static String load_home_target_key = "load:operation:home:target:key"; private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key"; private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key"; @@ -234,27 +240,32 @@ public class HomeServiceImpl implements HomeService { if(CollectionUtil.isEmpty(stations)){ return target; } - QueryWrapper queryWrapper = new QueryWrapper() {{ - in("create_dept", stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); - eq("type", HomePageConstant.WIND_POWER_TYPE); - likeRight("mon", DateUtil.format(new Date(),"yyyy")); - }}; - List list = powerService.list(queryWrapper); - if(CollectionUtil.isEmpty(list)){ + List winds = windService.list(Wrappers.lambdaQuery() + .in(WindEntity::getStationCode, stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) + .likeRight(WindEntity::getFillDate, DateUtil.format(new Date(),"yyyy"))); + if(CollectionUtil.isEmpty(winds)){ return target; } - double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum(); - double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum(); + double plan = winds.stream().mapToDouble(WindEntity::getPlan).sum(); + double power = winds.stream().mapToDouble(WindEntity::getPower).sum(); + List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(), new TypeReference>() {}); // 装机容量 - target.setTaget_one(list.get(0).getInstalledCapacity()); + 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){ // 发电完成率 - target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + target.setTaget_three(BigDecimal.valueOf(power / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); } // 双票合格率 - target.setTaget_four(BigDecimal.valueOf(pass / list.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + LocalDate firstDay = LocalDate.now().withDayOfYear(1); + LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN); + R> result = sysClient.getDeptList(); + List 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 = ticketClient.getDoublePassRate(areas, firstDateTime, LocalDateTime.now()); + if (ObjectUtil.isNotEmpty(pass)) { + target.setTaget_four(Double.valueOf(pass.getDoublePassRate())); + } return target; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java index 7f22d06..a7143b1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java @@ -493,13 +493,13 @@ public class WindHomeServiceImpl implements WindHomeService { .like(WindEntity::getFillDate,DateUtil.format(new Date(),DateUtil.PATTERN_DATE)); }}); if(CollectionUtil.isNotEmpty(winds)){ - areaDuty.setSpeed(winds.stream().mapToDouble(WindEntity::getPower).average().orElse(0.0)); + areaDuty.setSpeed(winds.stream().mapToDouble(WindEntity::getSpeed).average().orElse(0.0)); areaDuty.setSurfPower(winds.stream().mapToDouble(WindEntity::getSurfPower).sum()); areaDuty.setBelowPower(winds.stream().mapToDouble(WindEntity::getBelowPower).sum()); areaDuty.setAvailable(winds.stream().mapToDouble(WindEntity::getAvailable).average().orElse(0.0)); areaDuty.setComprehensivePower(winds.stream().mapToDouble(WindEntity::getComprehensivePower).sum()); areaDuty.setPeakPower(winds.stream().mapToDouble(WindEntity::getPeakPower).average().orElse(0.0)); - areaDuty.setFaultHours(winds.stream().mapToDouble(WindEntity::getPeakPower).average().orElse(0.0)); + areaDuty.setFaultHours(winds.stream().mapToDouble(WindEntity::getFaultHours).average().orElse(0.0)); } List windMons = windService.list(new LambdaQueryWrapper() {{ in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList()))