Browse Source

#首页统计数据修改

zhongwei
yang_shj 1 year ago
parent
commit
e7284804aa
  1. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MaintenanceServiceImpl.java
  2. 37
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
  3. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java

2
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<MaintenanceMapper, O
regularWorkVO.setRegularWork(0); regularWorkVO.setRegularWork(0);
return regularWorkVO; return regularWorkVO;
} }
regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(id -> id.toString()).collect(Collectors.joining(","))); regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(Object::toString).collect(Collectors.joining(",")));
regularWorkVO.setRegularWorkSum(regularWorkList.size()); regularWorkVO.setRegularWorkSum(regularWorkList.size());
// 定期工作任务完成数量 // 定期工作任务完成数量
List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList()); List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList());

37
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; package com.hnac.hzims.operational.main.service.impl;
import com.alibaba.fastjson.JSONObject; 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; 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.entity.*;
import com.hnac.hzims.operational.fill.service.*; import com.hnac.hzims.operational.fill.service.*;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
@ -55,6 +57,8 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class HomeServiceImpl implements HomeService { public class HomeServiceImpl implements HomeService {
private final WindService windService;
private final OverService overService; private final OverService overService;
private final OtherService otherService; private final OtherService otherService;
@ -82,6 +86,8 @@ public class HomeServiceImpl implements HomeService {
@Value("${hzims.operation.homePage.charge.url}") @Value("${hzims.operation.homePage.charge.url}")
public String 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_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_real_key = "hzims:operation:loadhydropowerunit:real:key";
private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target: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)){ if(CollectionUtil.isEmpty(stations)){
return target; return target;
} }
QueryWrapper<PowerEntity> queryWrapper = new QueryWrapper<PowerEntity>() {{ List<WindEntity> winds = windService.list(Wrappers.<WindEntity>lambdaQuery()
in("create_dept", stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); .in(WindEntity::getStationCode, stations.stream().map(StationEntity::getCode).collect(Collectors.toList()))
eq("type", HomePageConstant.WIND_POWER_TYPE); .likeRight(WindEntity::getFillDate, DateUtil.format(new Date(),"yyyy")));
likeRight("mon", DateUtil.format(new Date(),"yyyy")); if(CollectionUtil.isEmpty(winds)){
}};
List<PowerEntity> list = powerService.list(queryWrapper);
if(CollectionUtil.isEmpty(list)){
return target; return target;
} }
double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum(); double plan = winds.stream().mapToDouble(WindEntity::getPlan).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_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
// 装机容量 // 装机容量
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){ 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<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 = ticketClient.getDoublePassRate(areas, firstDateTime, LocalDateTime.now());
if (ObjectUtil.isNotEmpty(pass)) {
target.setTaget_four(Double.valueOf(pass.getDoublePassRate()));
}
return target; return target;
} }

4
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)); .like(WindEntity::getFillDate,DateUtil.format(new Date(),DateUtil.PATTERN_DATE));
}}); }});
if(CollectionUtil.isNotEmpty(winds)){ 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.setSurfPower(winds.stream().mapToDouble(WindEntity::getSurfPower).sum());
areaDuty.setBelowPower(winds.stream().mapToDouble(WindEntity::getBelowPower).sum()); areaDuty.setBelowPower(winds.stream().mapToDouble(WindEntity::getBelowPower).sum());
areaDuty.setAvailable(winds.stream().mapToDouble(WindEntity::getAvailable).average().orElse(0.0)); areaDuty.setAvailable(winds.stream().mapToDouble(WindEntity::getAvailable).average().orElse(0.0));
areaDuty.setComprehensivePower(winds.stream().mapToDouble(WindEntity::getComprehensivePower).sum()); areaDuty.setComprehensivePower(winds.stream().mapToDouble(WindEntity::getComprehensivePower).sum());
areaDuty.setPeakPower(winds.stream().mapToDouble(WindEntity::getPeakPower).average().orElse(0.0)); 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<WindEntity> windMons = windService.list(new LambdaQueryWrapper<WindEntity>() {{ List<WindEntity> windMons = windService.list(new LambdaQueryWrapper<WindEntity>() {{
in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList()))

Loading…
Cancel
Save