Przeglądaj źródła

指标计算断面数据获取

raojiang 2 miesięcy temu
rodzic
commit
c97fe6a7a9

+ 1 - 1
api/load-transfer-bf-api/src/main/java/com/hdkj/fhzg/optimization/response/FeederMetrics.java → api/load-transfer-bf-api/src/main/java/com/hdkj/fhzg/optimization/response/FeederMetricsResponse.java

@@ -20,7 +20,7 @@ import java.math.BigDecimal;
 @Builder
 @NoArgsConstructor
 @AllArgsConstructor
-public class FeederMetrics {
+public class FeederMetricsResponse {
 
     /**
      * 运行问题

+ 85 - 2
services/load-transfer-bf/src/main/java/com/hdkj/lt/bf/application/OptimizationApplication.java

@@ -1,10 +1,15 @@
 package com.hdkj.lt.bf.application;
 
 import cn.hutool.core.util.IdUtil;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.hdkj.fhzg.optimization.response.FeederMetricsResponse;
 import com.hdkj.fhzg.optimization.response.StationSvgResponse;
+import com.hdkj.lt.bf.entity.*;
 import com.hdkj.lt.bf.entity.convert.EntityToVOConvertor;
-import com.hdkj.lt.bf.service.IXlRelService;
+import com.hdkj.lt.bf.entity.dto.FeederSectionDTO;
+import com.hdkj.lt.bf.mapper.FeederTopoMapper;
+import com.hdkj.lt.bf.service.*;
 import com.hdkj.lt.core.bizms.modle.po.DwdShbDsFeederBase;
 import com.hdkj.lt.core.bizms.modle.po.XlRel;
 import com.hdkj.lt.core.sys.service.DwdShbDsFeederBaseService;
@@ -12,7 +17,9 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -28,13 +35,24 @@ public class OptimizationApplication {
 
     private final IXlRelService xlRelService;
     private final DwdShbDsFeederBaseService feederBaseService;
-
+    private final FhzgElectricalModelConductorService conductorService;
+    private final FhzgElectricalModelNodeService nodeService;
+    private final FhzgElectricalModelTransformerService transformerService;
+    private final FhzgElectricalModelSwitchService switchService;
+    private final FhzgElectricalModelInjectionService injectionService;
+    private final FhzgElectricalModelSectionService sectionService;
+    private final FeederTopoMapper feederTopoMapper;
 
     public List<StationSvgResponse> getStationSvg() {
         List<DwdShbDsFeederBase> feederListByMaintOrg = feederBaseService.getFeederListByMaintOrg("60FDC66B3FC143DC9C39001215DDCC61");
+        Map<String, String> stationMap = feederListByMaintOrg.stream().collect(Collectors.toMap(DwdShbDsFeederBase::getStartStationName, DwdShbDsFeederBase::getStartStation, (i, j) -> i));
         List<String> feederIdList = feederListByMaintOrg.stream().map(DwdShbDsFeederBase::getPsrId).collect(Collectors.toList());
         //有联络的线路
         List<XlRel> contactFeederlist = xlRelService.list(new LambdaQueryWrapper<XlRel>().in(XlRel::getXlIdOne, feederIdList));
+        for (XlRel xlRel : contactFeederlist) {
+            xlRel.setBdzIdOne(stationMap.get(xlRel.getBdzNameOne()));
+            xlRel.setBdzIdTwo(stationMap.get(xlRel.getBdzNameTwo()));
+        }
         Set<String> contactFeederIdlist = contactFeederlist.stream().map(XlRel::getXlIdOne).collect(Collectors.toSet());
         //单辐射线路
         List<DwdShbDsFeederBase> collect = feederListByMaintOrg.stream().filter(i -> !contactFeederIdlist.contains(i.getPsrId())).collect(Collectors.toList());
@@ -49,4 +67,69 @@ public class OptimizationApplication {
         }
         return EntityToVOConvertor.INSTANCE.toStationSvgResponseList(contactFeederlist);
     }
+
+    public FeederMetricsResponse getFeederMetrics(String feederId) {
+        String json = "{\n" +
+                "  \"operationIssue\": {\n" +
+                "    \"operationIssueScore\": 0.00,\n" +
+                "    \"currentLineLoadRate\": 0.00,\n" +
+                "    \"currentOverlimitSegmentCount\": 0,\n" +
+                "    \"voltageViolationNodeCount\": 0,\n" +
+                "    \"insufficientTransferCapacityLineCount\": 0,\n" +
+                "    \"lineN1Check\": false\n" +
+                "  },\n" +
+                "  \"reliability\": {\n" +
+                "    \"reliabilityScore\": 0.00,\n" +
+                "    \"lineStatus\": \"Status_b\",\n" +
+                "    \"outageTransformerCount\": 0.00,\n" +
+                "    \"theoreticalReliability\": 0.00,\n" +
+                "    \"affectedLowVoltageUserCount\": 0,\n" +
+                "    \"importantSensitiveUserLossCount\": 0\n" +
+                "  },\n" +
+                "  \"networkLossImpact\": {\n" +
+                "    \"networkLossImpactScore\": 0.00,\n" +
+                "    \"activePowerLoss\": 0.00,\n" +
+                "    \"lossRate\": 0.00,\n" +
+                "    \"exportPowerFactor\": 0.00\n" +
+                "  },\n" +
+                "  \"networkStructureIssue\": {\n" +
+                "    \"networkStructureIssueScore\": 0.00,\n" +
+                "    \"lineConnectionType\": \"Type_f\",\n" +
+                "    \"lineContactSwitchCount\": 0,\n" +
+                "    \"totalInstalledCapacity\": 0.00,\n" +
+                "    \"lineUserCount\": 0,\n" +
+                "    \"abnormalLoadGroupCount\": \"Count_b\",\n" +
+                "    \"loadGroupSegmentCount\": 0,\n" +
+                "    \"largeBranchCount\": 0,\n" +
+                "    \"linePowerSupplyRadius\": 0.00\n" +
+                "  }\n" +
+                "}";
+        FeederMetricsResponse feederMetrics = JSON.parseObject(json, FeederMetricsResponse.class);
+        //1.获取当前线路的断面数据
+        this.getFeederSectionData("15DKX-5800",new Date());
+        //查询线路的出线开关
+
+
+
+        return feederMetrics;
+    }
+
+    public FeederSectionDTO getFeederSectionData(String feederId, Date date) {
+        //目前仅长阳15DKX-5800一条断面
+        FhzgElectricalModelSection section = sectionService.getOne(new LambdaQueryWrapper<FhzgElectricalModelSection>().eq(FhzgElectricalModelSection::getFeederId, feederId));
+        String sectionId = section.getSectionId();
+        List<FhzgElectricalModelConductor> conductorList = conductorService.list(new LambdaQueryWrapper<FhzgElectricalModelConductor>().eq(FhzgElectricalModelConductor::getSectionId, sectionId));
+        List<FhzgElectricalModelNode> nodeList = nodeService.list(new LambdaQueryWrapper<FhzgElectricalModelNode>().eq(FhzgElectricalModelNode::getSectionId, sectionId));
+        List<FhzgElectricalModelTransformer> transformerList = transformerService.list(new LambdaQueryWrapper<FhzgElectricalModelTransformer>().eq(FhzgElectricalModelTransformer::getSectionId, sectionId));
+        List<FhzgElectricalModelSwitch> switchList = switchService.list(new LambdaQueryWrapper<FhzgElectricalModelSwitch>().eq(FhzgElectricalModelSwitch::getSectionId, sectionId));
+        List<FhzgElectricalModelInjection> injectionList = injectionService.list(new LambdaQueryWrapper<FhzgElectricalModelInjection>().eq(FhzgElectricalModelInjection::getSectionId, sectionId));
+        return new FeederSectionDTO().setSection(section)
+                .setNodeList(nodeList)
+                .setTransformerList(transformerList)
+                .setSwitchList(switchList)
+                .setConductorList(conductorList)
+                .setInjectionList(injectionList);
+    }
+
+
 }

+ 3 - 39
services/load-transfer-bf/src/main/java/com/hdkj/lt/bf/controller/optimization/OptimizationController.java

@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.hdkj.fhzg.optimization.request.FeederGroupRequest;
 import com.hdkj.fhzg.optimization.request.FeederMetricsRequest;
 import com.hdkj.fhzg.optimization.response.FeederGroupMetrics;
-import com.hdkj.fhzg.optimization.response.FeederMetrics;
+import com.hdkj.fhzg.optimization.response.FeederMetricsResponse;
 import com.hdkj.fhzg.optimization.response.StationSvgResponse;
 import com.hdkj.hussar.ApiResponse;
 import com.hdkj.lt.bf.application.OptimizationApplication;
@@ -87,43 +87,8 @@ public class OptimizationController {
      * @return
      */
     @PostMapping("/getFeederMetrics")
-    public ApiResponse<FeederMetrics> getFeederGroupMetrics(@RequestBody FeederMetricsRequest request) {
-        String json = "{\n" +
-                "  \"operationIssue\": {\n" +
-                "    \"operationIssueScore\": 0.00,\n" +
-                "    \"currentLineLoadRate\": 0.00,\n" +
-                "    \"currentOverlimitSegmentCount\": 0,\n" +
-                "    \"voltageViolationNodeCount\": 0,\n" +
-                "    \"insufficientTransferCapacityLineCount\": 0,\n" +
-                "    \"lineN1Check\": false\n" +
-                "  },\n" +
-                "  \"reliability\": {\n" +
-                "    \"reliabilityScore\": 0.00,\n" +
-                "    \"lineStatus\": \"Status_b\",\n" +
-                "    \"outageTransformerCount\": 0.00,\n" +
-                "    \"theoreticalReliability\": 0.00,\n" +
-                "    \"affectedLowVoltageUserCount\": 0,\n" +
-                "    \"importantSensitiveUserLossCount\": 0\n" +
-                "  },\n" +
-                "  \"networkLossImpact\": {\n" +
-                "    \"networkLossImpactScore\": 0.00,\n" +
-                "    \"activePowerLoss\": 0.00,\n" +
-                "    \"lossRate\": 0.00,\n" +
-                "    \"exportPowerFactor\": 0.00\n" +
-                "  },\n" +
-                "  \"networkStructureIssue\": {\n" +
-                "    \"networkStructureIssueScore\": 0.00,\n" +
-                "    \"lineConnectionType\": \"Type_f\",\n" +
-                "    \"lineContactSwitchCount\": 0,\n" +
-                "    \"totalInstalledCapacity\": 0.00,\n" +
-                "    \"lineUserCount\": 0,\n" +
-                "    \"abnormalLoadGroupCount\": \"Count_b\",\n" +
-                "    \"loadGroupSegmentCount\": 0,\n" +
-                "    \"largeBranchCount\": 0,\n" +
-                "    \"linePowerSupplyRadius\": 0.00\n" +
-                "  }\n" +
-                "}";
-        FeederMetrics feederMetrics = JSON.parseObject(json, FeederMetrics.class);
+    public ApiResponse<FeederMetricsResponse> getFeederMetrics(@RequestBody FeederMetricsRequest request) {
+        FeederMetricsResponse feederMetrics = optimizationApplication.getFeederMetrics(request.getFeederId());
         return ApiResponse.success(feederMetrics);
     }
 
@@ -138,5 +103,4 @@ public class OptimizationController {
     }
 
 
-
 }

+ 5 - 0
services/load-transfer-bf/src/main/java/com/hdkj/lt/bf/entity/FhzgElectricalModelSection.java

@@ -27,6 +27,11 @@ public class FhzgElectricalModelSection implements Serializable {
      */
     private String sectionId;
 
+    /**
+     * 线路id
+     */
+    private String feederId;
+
     /**
      * 断面名称
      */

+ 23 - 0
services/load-transfer-bf/src/main/java/com/hdkj/lt/bf/entity/dto/FeederSectionDTO.java

@@ -0,0 +1,23 @@
+package com.hdkj.lt.bf.entity.dto;
+
+import com.hdkj.lt.bf.entity.*;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * @author rj
+ * @date 2026/5/28 14:48
+ * @description
+ */
+@Data
+@Accessors(chain = true)
+public class FeederSectionDTO {
+    private FhzgElectricalModelSection section;
+    private List<FhzgElectricalModelNode> nodeList;
+    private List<FhzgElectricalModelConductor> conductorList;
+    private List<FhzgElectricalModelTransformer> transformerList;
+    private List<FhzgElectricalModelSwitch> switchList;
+    private List<FhzgElectricalModelInjection> injectionList;
+}