|
@@ -1,6 +1,5 @@
|
|
|
package com.hdkj.lt.si.service.simulation.impl;
|
|
package com.hdkj.lt.si.service.simulation.impl;
|
|
|
|
|
|
|
|
-import cn.hutool.core.lang.generator.SnowflakeGenerator;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
@@ -27,8 +26,10 @@ import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpEntity;
|
|
import org.springframework.http.HttpEntity;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
|
+import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
import org.springframework.web.client.RestTemplate;
|
|
@@ -53,6 +54,9 @@ public class SimulationServiceImpl implements ISimulationService {
|
|
|
private final FhzgOperationAbnormalityTransferAreaResultMapper operationAbnormalityTransferAreaResultMapper;
|
|
private final FhzgOperationAbnormalityTransferAreaResultMapper operationAbnormalityTransferAreaResultMapper;
|
|
|
private final String BASE_URL = "http://25.91.83.252:28081";
|
|
private final String BASE_URL = "http://25.91.83.252:28081";
|
|
|
|
|
|
|
|
|
|
+ @Value("simulation.xToken")
|
|
|
|
|
+ private String xToken;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
@Qualifier("simpleRestTemplate")
|
|
@Qualifier("simpleRestTemplate")
|
|
|
private RestTemplate simpleRestTemplate;
|
|
private RestTemplate simpleRestTemplate;
|
|
@@ -68,12 +72,16 @@ public class SimulationServiceImpl implements ISimulationService {
|
|
|
loopCheckRule.setVolDifMargin(5);
|
|
loopCheckRule.setVolDifMargin(5);
|
|
|
loopCheckRule.setFeederLoadRate(80);
|
|
loopCheckRule.setFeederLoadRate(80);
|
|
|
planTransferSchemeDTO.setLoopCheckRule(loopCheckRule);
|
|
planTransferSchemeDTO.setLoopCheckRule(loopCheckRule);
|
|
|
- log.info("计划-推演平台入参:{}", JSON.toJSONString(planTransferSchemeDTO));
|
|
|
|
|
|
|
+ log.info("计划:{} --请求推演平台参数:{}", planTransferSchemeDTO.getPlanId(), JSON.toJSONString(planTransferSchemeDTO));
|
|
|
FhzgPlanPowerCutSwitch planPowerCutSwitch = new FhzgPlanPowerCutSwitch();
|
|
FhzgPlanPowerCutSwitch planPowerCutSwitch = new FhzgPlanPowerCutSwitch();
|
|
|
planPowerCutSwitch.setPlanId(planTransferSchemeDTO.getPlanId());
|
|
planPowerCutSwitch.setPlanId(planTransferSchemeDTO.getPlanId());
|
|
|
planPowerCutSwitch.setAnalysisJson(JSON.toJSONString(planTransferSchemeDTO));
|
|
planPowerCutSwitch.setAnalysisJson(JSON.toJSONString(planTransferSchemeDTO));
|
|
|
planPowercutMapper.saveAnalysisJson(planPowerCutSwitch);
|
|
planPowercutMapper.saveAnalysisJson(planPowerCutSwitch);
|
|
|
- TyptResponseEntity rs = simpleRestTemplate.postForObject(url, planTransferSchemeDTO, TyptResponseEntity.class);
|
|
|
|
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
|
|
+ headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
|
|
+ headers.set("x-token", xToken);
|
|
|
|
|
+ HttpEntity<String> requestEntity = new HttpEntity<>(JSON.toJSONString(planTransferSchemeDTO), headers);
|
|
|
|
|
+ TyptResponseEntity rs = simpleRestTemplate.postForObject(url, requestEntity, TyptResponseEntity.class);
|
|
|
log.info("计划-推演平台结果:{}", JSONObject.toJSONString(rs.getSuccess()));
|
|
log.info("计划-推演平台结果:{}", JSONObject.toJSONString(rs.getSuccess()));
|
|
|
if (rs.getSuccess()) {
|
|
if (rs.getSuccess()) {
|
|
|
LambdaUpdateWrapper<PlanAwaitTransferAreaResultPO> wrapper = new LambdaUpdateWrapper<>();
|
|
LambdaUpdateWrapper<PlanAwaitTransferAreaResultPO> wrapper = new LambdaUpdateWrapper<>();
|
|
@@ -110,7 +118,7 @@ public class SimulationServiceImpl implements ISimulationService {
|
|
|
public String getFaultTransferScheme(FaultTransferSchemeDTO faultTransferSchemeDTO) {
|
|
public String getFaultTransferScheme(FaultTransferSchemeDTO faultTransferSchemeDTO) {
|
|
|
String url = BASE_URL + "/api/power/power-transfer/analysis";
|
|
String url = BASE_URL + "/api/power/power-transfer/analysis";
|
|
|
Long faultId = faultTransferSchemeDTO.getFaultId();
|
|
Long faultId = faultTransferSchemeDTO.getFaultId();
|
|
|
- log.info("故障:{} --推演平台入参:{}", faultId, faultTransferSchemeDTO.getFaultTransferSchemeParam());
|
|
|
|
|
|
|
+ log.info("故障:{} --请求推演平台参数:{}", faultId, faultTransferSchemeDTO.getFaultTransferSchemeParam());
|
|
|
LocalDateTime start = LocalDateTime.now();
|
|
LocalDateTime start = LocalDateTime.now();
|
|
|
long startTime = System.currentTimeMillis();
|
|
long startTime = System.currentTimeMillis();
|
|
|
TyptResponseEntity rs;
|
|
TyptResponseEntity rs;
|
|
@@ -118,6 +126,7 @@ public class SimulationServiceImpl implements ISimulationService {
|
|
|
try {
|
|
try {
|
|
|
HttpHeaders httpHeaders = new HttpHeaders();
|
|
HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
|
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
|
|
|
|
+ httpHeaders.set("x-token", xToken);
|
|
|
HttpEntity<String> httpEntity = new HttpEntity<>(faultTransferSchemeDTO.getFaultTransferSchemeParam(), httpHeaders);
|
|
HttpEntity<String> httpEntity = new HttpEntity<>(faultTransferSchemeDTO.getFaultTransferSchemeParam(), httpHeaders);
|
|
|
rs = simpleRestTemplate.postForObject(url, httpEntity, TyptResponseEntity.class);
|
|
rs = simpleRestTemplate.postForObject(url, httpEntity, TyptResponseEntity.class);
|
|
|
} finally {
|
|
} finally {
|
|
@@ -169,10 +178,14 @@ public class SimulationServiceImpl implements ISimulationService {
|
|
|
}
|
|
}
|
|
|
Long oaID = operationSchemeDTO.getOaID();
|
|
Long oaID = operationSchemeDTO.getOaID();
|
|
|
operationSchemeDTO.setOaID(null);
|
|
operationSchemeDTO.setOaID(null);
|
|
|
- String url = BASE_URL + "/api/power/operationMode/queryResult?id=" + operationSchemeDTO.getId();
|
|
|
|
|
- log.info("计划-推演平台入参:{}", JSON.toJSONString(operationSchemeDTO));
|
|
|
|
|
- TyptResponseEntity rs = simpleRestTemplate.getForObject(url, TyptResponseEntity.class);
|
|
|
|
|
- log.info("计划-推演平台结果:{}", JSONObject.toJSONString(rs.getSuccess()));
|
|
|
|
|
|
|
+ String url = BASE_URL + "/api/power/operationMode/queryResult?id={id}";
|
|
|
|
|
+ log.info("调优-请求推演平台参数:{}", JSON.toJSONString(operationSchemeDTO));
|
|
|
|
|
+ HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
|
|
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
|
|
|
|
+ httpHeaders.set("x-token", xToken);
|
|
|
|
|
+ HttpEntity<String> httpEntity = new HttpEntity<>(httpHeaders);
|
|
|
|
|
+ TyptResponseEntity rs = simpleRestTemplate.exchange(url, HttpMethod.GET,httpEntity,TyptResponseEntity.class,operationSchemeDTO.getId()).getBody();
|
|
|
|
|
+ log.info("调优-推演平台结果:{}", JSONObject.toJSONString(rs.getSuccess()));
|
|
|
if (rs.getSuccess()) {
|
|
if (rs.getSuccess()) {
|
|
|
operationAbnormalityTransferAreaResultMapper.delete(new LambdaUpdateWrapper<FhzgOperationAbnormalityTransferAreaResult>().eq(FhzgOperationAbnormalityTransferAreaResult::getOaId, operationSchemeDTO.getId()));
|
|
operationAbnormalityTransferAreaResultMapper.delete(new LambdaUpdateWrapper<FhzgOperationAbnormalityTransferAreaResult>().eq(FhzgOperationAbnormalityTransferAreaResult::getOaId, operationSchemeDTO.getId()));
|
|
|
FhzgOperationAbnormalityTransferAreaResult fhzgOperationAbnormalityTransferAreaResult = new FhzgOperationAbnormalityTransferAreaResult();
|
|
FhzgOperationAbnormalityTransferAreaResult fhzgOperationAbnormalityTransferAreaResult = new FhzgOperationAbnormalityTransferAreaResult();
|