Răsfoiți Sursa

配网电气模型接口预留

lisonglin 2 luni în urmă
părinte
comite
7a5f68c578

+ 6 - 0
api/load-transfer-si-api/src/main/java/com/hdkj/lt/feign/ISimulationPlatformApiClient.java

@@ -2,6 +2,8 @@ package com.hdkj.lt.feign;
 
 
 import com.hdkj.lt.base.constants.SystemGlobalConstant;
 import com.hdkj.lt.base.constants.SystemGlobalConstant;
 import com.hdkj.lt.feign.fallback.SimulationPlatformApiClientFallBack;
 import com.hdkj.lt.feign.fallback.SimulationPlatformApiClientFallBack;
+import com.hdkj.lt.modle.dto.simulation.ElectricalModelRequest;
+import com.hdkj.lt.modle.dto.simulation.ElectricalModelResponse;
 import com.hdkj.lt.modle.dto.simulation.FaultTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.FaultTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.OperationSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.OperationSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.PlanTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.PlanTransferSchemeDTO;
@@ -29,4 +31,8 @@ public interface ISimulationPlatformApiClient {
     @PostMapping("/getOperationScheme")
     @PostMapping("/getOperationScheme")
     String getOperationScheme(@RequestBody OperationSchemeDTO operationSchemeDTO);
     String getOperationScheme(@RequestBody OperationSchemeDTO operationSchemeDTO);
 
 
+    @ApiOperation(value = "获取配网电气模型")
+    @PostMapping("/getElectricalModel")
+    ElectricalModelResponse getElectricalModel(@RequestBody ElectricalModelRequest request);
+
 }
 }

+ 8 - 0
api/load-transfer-si-api/src/main/java/com/hdkj/lt/feign/fallback/SimulationPlatformApiClientFallBack.java

@@ -1,6 +1,8 @@
 package com.hdkj.lt.feign.fallback;
 package com.hdkj.lt.feign.fallback;
 
 
 import com.hdkj.lt.feign.ISimulationPlatformApiClient;
 import com.hdkj.lt.feign.ISimulationPlatformApiClient;
+import com.hdkj.lt.modle.dto.simulation.ElectricalModelRequest;
+import com.hdkj.lt.modle.dto.simulation.ElectricalModelResponse;
 import com.hdkj.lt.modle.dto.simulation.FaultTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.FaultTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.OperationSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.OperationSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.PlanTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.PlanTransferSchemeDTO;
@@ -35,6 +37,12 @@ public class SimulationPlatformApiClientFallBack implements FallbackFactory<ISim
             public String getOperationScheme(OperationSchemeDTO operationSchemeDTO) {
             public String getOperationScheme(OperationSchemeDTO operationSchemeDTO) {
                 return "推演平台服务异常";
                 return "推演平台服务异常";
             }
             }
+
+            @Override
+            public ElectricalModelResponse getElectricalModel(ElectricalModelRequest request) {
+                log.error("配网电气模型接口-远程调用服务异常, 参数:{},异常:{}", request, cause.getMessage());
+                return null;
+            }
         };
         };
     }
     }
 }
 }

+ 24 - 0
api/load-transfer-si-api/src/main/java/com/hdkj/lt/modle/dto/simulation/ElectricalModelRequest.java

@@ -0,0 +1,24 @@
+package com.hdkj.lt.modle.dto.simulation;
+
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 配网电气模型接口请求参数
+ * @author yiqu
+ * @date 2026/5/23
+ */
+@Data
+public class ElectricalModelRequest {
+
+    /** 地市ID */
+    private String cityId;
+
+    /** 需要包含在断面内的馈线ID列表 */
+    private List<String> feederList;
+
+    /** 断面数据提取的目标时间点 */
+    private Date time;
+}

+ 278 - 0
api/load-transfer-si-api/src/main/java/com/hdkj/lt/modle/dto/simulation/ElectricalModelResponse.java

@@ -0,0 +1,278 @@
+package com.hdkj.lt.modle.dto.simulation;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 配网电气模型接口响应结果
+ * @author yiqu
+ * @date 2026/5/23
+ */
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class ElectricalModelResponse {
+
+    /** 断面基本信息 */
+    private SectionInfo sectionInfo;
+
+    /** 电力对象集合 */
+    private DataObjects dataObjects;
+
+    /**
+     * 断面基本信息
+     */
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    public static class SectionInfo {
+        /** 断面唯一标识ID */
+        private String id;
+        /** 断面名称 */
+        private String name;
+        /** 断面标幺化采用的基准电压 (kV) */
+        private Double baseKv;
+        /** 断面标幺化采用的基准容量 (kVA) */
+        private Double baseKva;
+        /** 断面所属的时间点 */
+        private String time;
+    }
+
+    /**
+     * 电力对象集合
+     */
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    public static class DataObjects {
+        /** 关键节点 */
+        private List<Node> nodes;
+        /** 导线段 */
+        private List<Conductor> conductors;
+        /** 配电变压器 */
+        private List<Transformer> transformers;
+        /** 开关设备 */
+        private List<Switch> switches;
+        /** 注入设备 */
+        private List<InjectionDevice> injectionDevices;
+    }
+
+    /**
+     * 关键节点
+     */
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    public static class Node {
+        /** 节点ID */
+        private String id;
+        /** 名称 */
+        private String name;
+        /** 电压等级(kV) */
+        private Double voltageLevelKv;
+        /** 节点对地电导(p.u.) */
+        private Double gShuntPu;
+        /** 节点对地电纳(p.u.) */
+        private Double bShuntPu;
+        /** 是否有效 */
+        private Boolean isActive;
+        /** 节点类型(1=PQ, 2=PV, 3=Slack) */
+        private Integer type;
+        /** 电压幅值(p.u.) */
+        private Double vmPu;
+        /** 电压相角(deg) */
+        private Double vaDeg;
+        /** 有功注入(p.u.) */
+        private Double pInjPu;
+        /** 无功注入(p.u.) */
+        private Double qInjPu;
+        /** 所属馈线 */
+        private String feederId;
+        /** 杆塔/配网母线/电缆分接头/电缆终端/中压用户接入点 */
+        private String role;
+        /** 设备资源Type */
+        private String psrType;
+        /** 设备资源ID */
+        private String psrId;
+    }
+
+    /**
+     * 导线段
+     */
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    public static class Conductor {
+        /** 支路ID */
+        private String id;
+        /** 名称,T接点头尾两端拼接 */
+        private String name;
+        /** 电阻(p.u.) */
+        private Double rPu;
+        /** 电抗(p.u.) */
+        private Double xPu;
+        /** 电纳(p.u.) */
+        private Double bPu;
+        /** 是否有效 */
+        private Boolean isActive;
+        /** 起点节点 */
+        private String fbusId;
+        /** 终点节点 */
+        private String tbusId;
+        /** 长度 */
+        private Double lengthM;
+        /** 所属馈线 */
+        private String feederId;
+        /** 0=导线段, 1=电缆段, 2=混合线段 */
+        private Integer role;
+        /** 设备资源Type */
+        private String psrType;
+        /** 设备资源ID */
+        private String psrId;
+        /** 电流幅值(p.u.) */
+        private Double iMag;
+        /** 首端有功传输(p.u.) */
+        private Double pFromPu;
+        /** 首端无功传输(p.u.) */
+        private Double qFromPu;
+        /** 末端有功传输(p.u.) */
+        private Double pToPu;
+        /** 末端无功传输(p.u.) */
+        private Double qToPu;
+    }
+
+    /**
+     * 配电变压器
+     */
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    public static class Transformer {
+        /** 支路ID */
+        private String id;
+        /** 名称 */
+        private String name;
+        /** 电阻(p.u.) */
+        private Double rPu;
+        /** 电抗(p.u.) */
+        private Double xPu;
+        /** 电纳(p.u.) */
+        private Double bPu;
+        /** 是否有效 */
+        private Boolean isActive;
+        /** 起点节点 */
+        private String fbusId;
+        /** 终点节点 */
+        private String tbusId;
+        /** 变比 */
+        private Double ratioPu;
+        /** 相移角(deg) */
+        private Double angleDeg;
+        /** 额定容量(kVA) */
+        private Double rateCapacityKva;
+        /** 所属馈线 */
+        private String feederId;
+        /** 设备资源Type */
+        private String psrType;
+        /** 设备资源ID */
+        private String psrId;
+        /** 电流幅值(p.u.) */
+        private Double iMag;
+        /** 首端有功传输(p.u.) */
+        private Double pFromPu;
+        /** 首端无功传输(p.u.) */
+        private Double qFromPu;
+        /** 末端有功传输(p.u.) */
+        private Double pToPu;
+        /** 末端无功传输(p.u.) */
+        private Double qToPu;
+    }
+
+    /**
+     * 开关设备
+     */
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    public static class Switch {
+        /** 开关ID */
+        private String id;
+        /** 名称 */
+        private String name;
+        /** 起点节点 */
+        private String fbusId;
+        /** 终点节点 */
+        private String tbusId;
+        /** 相连支路 */
+        private String branchId;
+        /** 状态(1=合, 0=分) */
+        private Integer status;
+        /** 是否可量测 */
+        private Boolean measurable;
+        /** 是否可控制 */
+        private Boolean controllable;
+        /** 所属馈线 */
+        private String feederId;
+        /** 设备资源Type */
+        private String psrType;
+        /** 设备资源ID */
+        private String psrId;
+        /** 电流幅值(p.u.) */
+        private Double iMag;
+        /** 首端有功传输(p.u.) */
+        private Double pFromPu;
+        /** 首端无功传输(p.u.) */
+        private Double qFromPu;
+        /** 末端有功传输(p.u.) */
+        private Double pToPu;
+        /** 末端无功传输(p.u.) */
+        private Double qToPu;
+    }
+
+    /**
+     * 注入设备
+     */
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    public static class InjectionDevice {
+        /** ID */
+        private String id;
+        /** 名称 */
+        private String name;
+        /** 所属节点 */
+        private String busId;
+        /** 类型(1=一般用电负荷, 2=外部电源, 3=光伏, 4=储能, 5=充电桩) */
+        private Integer type;
+        /** 是否有效 */
+        private Boolean isActive;
+        /** 控制模式(1=恒功率, 2=恒电压) */
+        private Integer controlMode;
+        /** 电压幅值(p.u.) */
+        private Double vmPu;
+        /** 有功注入(p.u.) */
+        private Double pInjPu;
+        /** 无功注入(p.u.) */
+        private Double qInjPu;
+        /** 所属馈线 */
+        private String feederId;
+    }
+}

+ 7 - 0
services/load-transfer-si/src/main/java/com/hdkj/lt/si/controller/simulation/SimulationController.java

@@ -2,6 +2,8 @@ package com.hdkj.lt.si.controller.simulation;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.hdkj.lt.feign.ISimulationPlatformApiClient;
 import com.hdkj.lt.feign.ISimulationPlatformApiClient;
+import com.hdkj.lt.modle.dto.simulation.ElectricalModelRequest;
+import com.hdkj.lt.modle.dto.simulation.ElectricalModelResponse;
 import com.hdkj.lt.modle.dto.simulation.FaultTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.FaultTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.OperationSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.OperationSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.PlanTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.PlanTransferSchemeDTO;
@@ -41,4 +43,9 @@ public class SimulationController implements ISimulationPlatformApiClient {
     public String getOperationScheme(OperationSchemeDTO operationSchemeDTO) {
     public String getOperationScheme(OperationSchemeDTO operationSchemeDTO) {
         return simulationService.getOperationScheme(operationSchemeDTO);
         return simulationService.getOperationScheme(operationSchemeDTO);
     }
     }
+
+    @Override
+    public ElectricalModelResponse getElectricalModel(ElectricalModelRequest request) {
+        return simulationService.getElectricalModel(request);
+    }
 }
 }

+ 9 - 0
services/load-transfer-si/src/main/java/com/hdkj/lt/si/service/simulation/ISimulationService.java

@@ -1,5 +1,7 @@
 package com.hdkj.lt.si.service.simulation;
 package com.hdkj.lt.si.service.simulation;
 
 
+import com.hdkj.lt.modle.dto.simulation.ElectricalModelRequest;
+import com.hdkj.lt.modle.dto.simulation.ElectricalModelResponse;
 import com.hdkj.lt.modle.dto.simulation.FaultTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.FaultTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.OperationSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.OperationSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.PlanTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.PlanTransferSchemeDTO;
@@ -16,4 +18,11 @@ public interface ISimulationService {
     String getFaultTransferScheme(FaultTransferSchemeDTO faultTransferSchemeDTO);
     String getFaultTransferScheme(FaultTransferSchemeDTO faultTransferSchemeDTO);
 
 
     String getOperationScheme(OperationSchemeDTO operationSchemeDTO);
     String getOperationScheme(OperationSchemeDTO operationSchemeDTO);
+
+    /**
+     * 获取配网电气模型
+     * @param request 请求参数
+     * @return 电气模型响应
+     */
+    ElectricalModelResponse getElectricalModel(ElectricalModelRequest request);
 }
 }

+ 38 - 0
services/load-transfer-si/src/main/java/com/hdkj/lt/si/service/simulation/impl/SimulationServiceImpl.java

@@ -16,6 +16,8 @@ import com.hdkj.lt.core.bizms.modle.po.plan.FhzgPlanPowerCutSwitch;
 import com.hdkj.lt.core.bizms.modle.po.plan.PlanAwaitTransferAreaResultPO;
 import com.hdkj.lt.core.bizms.modle.po.plan.PlanAwaitTransferAreaResultPO;
 import com.hdkj.lt.core.log.exception.ExceptionErrorLogCast;
 import com.hdkj.lt.core.log.exception.ExceptionErrorLogCast;
 import com.hdkj.lt.core.log.model.param.ErrorLogParam;
 import com.hdkj.lt.core.log.model.param.ErrorLogParam;
+import com.hdkj.lt.modle.dto.simulation.ElectricalModelRequest;
+import com.hdkj.lt.modle.dto.simulation.ElectricalModelResponse;
 import com.hdkj.lt.modle.dto.simulation.FaultTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.FaultTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.OperationSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.OperationSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.PlanTransferSchemeDTO;
 import com.hdkj.lt.modle.dto.simulation.PlanTransferSchemeDTO;
@@ -213,4 +215,40 @@ public class SimulationServiceImpl implements ISimulationService {
         }
         }
     }
     }
 
 
+    @Override
+    public ElectricalModelResponse getElectricalModel(ElectricalModelRequest request) {
+        // TODO: 配置化接口地址
+        String url =  "/requestURL";
+        log.info("配网电气模型查询-请求参数:{}", JSON.toJSONString(request));
+
+        HttpHeaders headers = new HttpHeaders();
+        headers.setContentType(MediaType.APPLICATION_JSON);
+        // TODO: 配置化接口鉴权
+        headers.set("x-token", xToken);
+
+        HttpEntity<String> requestEntity = new HttpEntity<>(JSON.toJSONString(request), headers);
+        try {
+            ElectricalModelResponse rs  = simpleRestTemplate.postForObject(url, requestEntity, ElectricalModelResponse.class);
+            log.info("配网电气模型查询-响应:{}", JSON.toJSONString(rs));
+            return rs;
+        } catch (Exception e) {
+            log.error("配网电气模型查询失败", e);
+            ErrorLogParam errorLogParam = new ErrorLogParam()
+                    .setErrorTime(LocalDateTime.now())
+                    .setEventType(EventTypeEnum.PLAN.getCode())
+                    .setEventId(request.getCityId())
+                    .setErrorCategory("配网电气模型接口调用失败")
+                    .setErrorLevel("Warning")
+                    .setSourceSystem("1")
+                    .setOperationStep("调用配网电气模型接口")
+                    .setRelatedId(request.getCityId())
+                    .setStage("7")
+                    .setRelatedCategory("electrical_model")
+                    .setDetails("配网电气模型查询失败,请求参数:" + JSON.toJSONString(request))
+                    .setAdditionalInfo(e.getMessage());
+            ExceptionErrorLogCast.cast(errorLogParam);
+            throw new RuntimeException("配网电气模型查询失败: " + e.getMessage(), e);
+        }
+    }
+
 }
 }