|
@@ -2,13 +2,15 @@ package com.hdkj.lt.bf.service.staticgrid.impl;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import com.hdkj.fhzg.optimization.response.FeederGroupTreeNode;
|
|
|
|
|
+import com.hdkj.lt.bf.application.FeederGroupApplication;
|
|
|
import com.hdkj.lt.bf.entity.staticgrid.StaticIndicatorMetric;
|
|
import com.hdkj.lt.bf.entity.staticgrid.StaticIndicatorMetric;
|
|
|
import com.hdkj.lt.bf.entity.staticgrid.StaticIndicatorResult;
|
|
import com.hdkj.lt.bf.entity.staticgrid.StaticIndicatorResult;
|
|
|
-import com.hdkj.lt.bf.entity.staticgrid.StaticProblemDetail;
|
|
|
|
|
import com.hdkj.lt.bf.entity.vo.StaticGridDashboardVO;
|
|
import com.hdkj.lt.bf.entity.vo.StaticGridDashboardVO;
|
|
|
import com.hdkj.lt.bf.mapper.staticgrid.StaticIndicatorMetricMapper;
|
|
import com.hdkj.lt.bf.mapper.staticgrid.StaticIndicatorMetricMapper;
|
|
|
import com.hdkj.lt.bf.mapper.staticgrid.StaticIndicatorResultMapper;
|
|
import com.hdkj.lt.bf.mapper.staticgrid.StaticIndicatorResultMapper;
|
|
|
import com.hdkj.lt.bf.mapper.staticgrid.StaticProblemDetailMapper;
|
|
import com.hdkj.lt.bf.mapper.staticgrid.StaticProblemDetailMapper;
|
|
|
|
|
+import com.hdkj.lt.bf.service.SjztPwwyyqxtPrmPdrOutageMvDsService;
|
|
|
import com.hdkj.lt.bf.service.staticgrid.StaticGridDashboardService;
|
|
import com.hdkj.lt.bf.service.staticgrid.StaticGridDashboardService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -41,6 +43,8 @@ public class StaticGridDashboardServiceImpl
|
|
|
|
|
|
|
|
private final StaticIndicatorMetricMapper metricMapper;
|
|
private final StaticIndicatorMetricMapper metricMapper;
|
|
|
private final StaticProblemDetailMapper problemDetailMapper;
|
|
private final StaticProblemDetailMapper problemDetailMapper;
|
|
|
|
|
+ private final FeederGroupApplication feederGroupApplication;
|
|
|
|
|
+ private final SjztPwwyyqxtPrmPdrOutageMvDsService pwwyyqxtPrmPdrOutageMvDsService;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public StaticGridDashboardVO queryLatestDashboard() {
|
|
public StaticGridDashboardVO queryLatestDashboard() {
|
|
@@ -82,7 +86,7 @@ public class StaticGridDashboardServiceImpl
|
|
|
.eq(StaticIndicatorMetric::getResultId, resultId)
|
|
.eq(StaticIndicatorMetric::getResultId, resultId)
|
|
|
.eq(StaticIndicatorMetric::getLevel, "county");
|
|
.eq(StaticIndicatorMetric::getLevel, "county");
|
|
|
List<StaticIndicatorMetric> countyMetrics = metricMapper.selectList(metricWrapper);
|
|
List<StaticIndicatorMetric> countyMetrics = metricMapper.selectList(metricWrapper);
|
|
|
- Map<String, String> countyMetricMap = new HashMap<String, String>();
|
|
|
|
|
|
|
+ Map<String, String> countyMetricMap = new HashMap<>();
|
|
|
for (StaticIndicatorMetric m : countyMetrics) {
|
|
for (StaticIndicatorMetric m : countyMetrics) {
|
|
|
countyMetricMap.put(m.getMetricCode(), m.getValue());
|
|
countyMetricMap.put(m.getMetricCode(), m.getValue());
|
|
|
}
|
|
}
|
|
@@ -120,15 +124,15 @@ public class StaticGridDashboardServiceImpl
|
|
|
.wiringStandardizationRate(toBigDecimal(countyMetricMap.get("wiring_standardization_rate")))
|
|
.wiringStandardizationRate(toBigDecimal(countyMetricMap.get("wiring_standardization_rate")))
|
|
|
.mainTrunkSectionStandardizationRate(toBigDecimal(countyMetricMap.get("main_trunk_section_standardization_rate")))
|
|
.mainTrunkSectionStandardizationRate(toBigDecimal(countyMetricMap.get("main_trunk_section_standardization_rate")))
|
|
|
// 二、供电可靠性
|
|
// 二、供电可靠性
|
|
|
- .outageDurationHoursHouseholds(null) // 预留:运行台账
|
|
|
|
|
|
|
+ .outageDurationHoursHouseholds(handleOutageDurationHoursHouseholds("BD69707EA19E4FED85C595AFB5D06720","BA6481B8F34143FDA7E1C35A76846911")) // 暂时写死:洪湖7.1—现在的停电时户数
|
|
|
.lineNMinus1PassRate(toBigDecimal(countyMetricMap.get("n_minus_1_pass_rate")))
|
|
.lineNMinus1PassRate(toBigDecimal(countyMetricMap.get("n_minus_1_pass_rate")))
|
|
|
- .interSubstationNoConnectionCount(toInteger(countyMetricMap.get("inter_substation_interconnection_rate"))) // 站间联络率相关
|
|
|
|
|
|
|
+ .interSubstationNoConnectionCount(toInteger(countyMetricMap.get("inter_substation_interconnection_rate")))
|
|
|
.sameBusInterconnectionIssueCount(toInteger(countyMetricMap.get("same_bus_interconnection_issue_count")))
|
|
.sameBusInterconnectionIssueCount(toInteger(countyMetricMap.get("same_bus_interconnection_issue_count")))
|
|
|
.excessiveTiePointFeederCount(toInteger(countyMetricMap.get("excessive_tie_point_feeder_count")))
|
|
.excessiveTiePointFeederCount(toInteger(countyMetricMap.get("excessive_tie_point_feeder_count")))
|
|
|
.singleRadialFeederCount(toInteger(countyMetricMap.get("single_radial_feeder_count")))
|
|
.singleRadialFeederCount(toInteger(countyMetricMap.get("single_radial_feeder_count")))
|
|
|
.largeBranchFeederCount(toInteger(countyMetricMap.get("large_branch_issue_feeder_count")))
|
|
.largeBranchFeederCount(toInteger(countyMetricMap.get("large_branch_issue_feeder_count")))
|
|
|
.unreasonableSegmentCount(toInteger(countyMetricMap.get("unreasonable_segment_count_feeder_count")))
|
|
.unreasonableSegmentCount(toInteger(countyMetricMap.get("unreasonable_segment_count_feeder_count")))
|
|
|
- .mainTrunkSegmentDenseCount(null) // 预留
|
|
|
|
|
|
|
+ .mainTrunkSegmentDenseCount(toInteger(countyMetricMap.get("main_trunk_lantern_issue_feeder_count")))
|
|
|
// 三、电压质量
|
|
// 三、电压质量
|
|
|
.iecUserVoltageIndex(null) // 预留
|
|
.iecUserVoltageIndex(null) // 预留
|
|
|
.supplyRadiusExceedFeederCount(toInteger(countyMetricMap.get("supply_radius_exceed_feeder_count")))
|
|
.supplyRadiusExceedFeederCount(toInteger(countyMetricMap.get("supply_radius_exceed_feeder_count")))
|
|
@@ -137,7 +141,7 @@ public class StaticGridDashboardServiceImpl
|
|
|
.regionalMaxLoadRate(null) // 预留:运行态指标
|
|
.regionalMaxLoadRate(null) // 预留:运行态指标
|
|
|
.regionalAvgLoadRate(null) // 预留:运行态指标
|
|
.regionalAvgLoadRate(null) // 预留:运行态指标
|
|
|
.lineOverloadCount(null) // 预留:运行态指标
|
|
.lineOverloadCount(null) // 预留:运行态指标
|
|
|
- .mainTrunkSectionMismatchCount(null) // 预留
|
|
|
|
|
|
|
+ .mainTrunkSectionMismatchCount(toInteger(countyMetricMap.get("main_trunk_bottleneck_feeder_count")))
|
|
|
.connectedCapacityExceedFeederCount(toInteger(countyMetricMap.get("connected_capacity_exceed_feeder_count")))
|
|
.connectedCapacityExceedFeederCount(toInteger(countyMetricMap.get("connected_capacity_exceed_feeder_count")))
|
|
|
.loadGroupCapacityAnomalyCount(toInteger(countyMetricMap.get("load_group_capacity_anomaly_count")))
|
|
.loadGroupCapacityAnomalyCount(toInteger(countyMetricMap.get("load_group_capacity_anomaly_count")))
|
|
|
.comprehensiveLossRate(null) // 预留:运行态指标
|
|
.comprehensiveLossRate(null) // 预留:运行态指标
|
|
@@ -147,6 +151,51 @@ public class StaticGridDashboardServiceImpl
|
|
|
.build();
|
|
.build();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //处理停电时户数
|
|
|
|
|
+ public BigDecimal handleOutageDurationHoursHouseholds(String cityId, String maintOrgId){
|
|
|
|
|
+ List<FeederGroupTreeNode> feederGroupTree = feederGroupApplication.getFeederGroupTree();
|
|
|
|
|
+ FeederGroupTreeNode type1 = findNodeRecursively(feederGroupTree,1,cityId);
|
|
|
|
|
+ if (type1 == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ FeederGroupTreeNode type2 = findNodeRecursively(feederGroupTree,2,maintOrgId);
|
|
|
|
|
+ if (type2 == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<String> type4Result = new ArrayList<>();
|
|
|
|
|
+ collectNodesByType(type2.getChildren(),type4Result);
|
|
|
|
|
+ return pwwyyqxtPrmPdrOutageMvDsService.selectStaticOutageDurationHoursHouseholds(type4Result);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //递归树
|
|
|
|
|
+ private FeederGroupTreeNode findNodeRecursively(List<FeederGroupTreeNode> nodes,int nodeType, String targetId){
|
|
|
|
|
+ if (nodes == null || nodes.isEmpty()) return null;
|
|
|
|
|
+ for (FeederGroupTreeNode node : nodes) {
|
|
|
|
|
+ if (node.getType() == nodeType && node.getId().equals(targetId)){
|
|
|
|
|
+ return node;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (node.getChildren() != null && !node.getChildren().isEmpty()){
|
|
|
|
|
+ FeederGroupTreeNode found = findNodeRecursively(node.getChildren(), nodeType, targetId);
|
|
|
|
|
+ if (found != null) return found;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //收集树线路节点
|
|
|
|
|
+ private void collectNodesByType(List<FeederGroupTreeNode> nodes, List<String> collector) {
|
|
|
|
|
+ if (nodes == null || nodes.isEmpty()) return;
|
|
|
|
|
+ for (FeederGroupTreeNode node : nodes) {
|
|
|
|
|
+ if (node.getType() == 4) {
|
|
|
|
|
+ collector.add(node.getName());
|
|
|
|
|
+ } else if (node.getChildren()!= null && !node.getChildren().isEmpty()) {
|
|
|
|
|
+ collectNodesByType(node.getChildren(),collector);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private BigDecimal toBigDecimal(String value) {
|
|
private BigDecimal toBigDecimal(String value) {
|
|
|
if (StringUtils.isBlank(value)) {
|
|
if (StringUtils.isBlank(value)) {
|
|
|
return null;
|
|
return null;
|