bug调整
This commit is contained in:
@@ -34,24 +34,24 @@ public class NacosLogbackConfigLoader implements SpringApplicationRunListener, A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void environmentPrepared(ConfigurableEnvironment environment) {
|
public void environmentPrepared(ConfigurableEnvironment environment) {
|
||||||
// String serverAddr = environment.getProperty("spring.cloud.nacos.config.server-addr");
|
/* String serverAddr = environment.getProperty("spring.cloud.nacos.config.server-addr");
|
||||||
// String namespace = environment.getProperty("spring.cloud.nacos.config.namespace");
|
String namespace = environment.getProperty("spring.cloud.nacos.config.namespace");
|
||||||
// String projectName = environment.getProperty("microservice.ename");
|
String projectName = environment.getProperty("microservice.ename");
|
||||||
// String logLevel = environment.getProperty("logging.level.root");
|
String logLevel = environment.getProperty("logging.level.root");
|
||||||
// String url = String.format("http://%s/nacos/v1/cs/configs?tenant=%s&group=DEFAULT_GROUP&dataId=logback.xml", serverAddr, namespace);
|
String url = String.format("http://%s/nacos/v1/cs/configs?tenant=%s&group=DEFAULT_GROUP&dataId=logback.xml", serverAddr, namespace);
|
||||||
// HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
// headers.set("cndl408125hawen", "lanxia201");
|
headers.set("cndl408125hawen", "lanxia201");
|
||||||
// HttpEntity<String> entity = new HttpEntity<>(headers);
|
HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||||
// RestTemplate restTemplate = new RestTemplate();
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
// ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
|
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
|
||||||
// if (response.getStatusCode().is2xxSuccessful()) {
|
if (response.getStatusCode().is2xxSuccessful()) {
|
||||||
// String logbackConfigContent = response.getBody();
|
String logbackConfigContent = response.getBody();
|
||||||
// //替换项目名称
|
//替换项目名称
|
||||||
// logbackConfigContent = logbackConfigContent.replace("projectDefaultName",projectName);
|
logbackConfigContent = logbackConfigContent.replace("projectDefaultName",projectName);
|
||||||
// logbackConfigContent = logbackConfigContent.replace("logDefaultLevel",logLevel);
|
logbackConfigContent = logbackConfigContent.replace("logDefaultLevel",logLevel);
|
||||||
// // 应用获取到的Logback配置
|
// 应用获取到的Logback配置
|
||||||
// applyLogbackConfig(logbackConfigContent);
|
applyLogbackConfig(logbackConfigContent);
|
||||||
// }
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyLogbackConfig(String logbackConfigContent) {
|
private void applyLogbackConfig(String logbackConfigContent) {
|
||||||
|
|||||||
@@ -1464,9 +1464,6 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
|||||||
waveTypeVO.setAdvanceReason(dictData.getName());
|
waveTypeVO.setAdvanceReason(dictData.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//抛出异常,当前暂态原因为空
|
|
||||||
throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waveTypeVO.getAdvanceType() != null) {
|
if (waveTypeVO.getAdvanceType() != null) {
|
||||||
@@ -1476,9 +1473,6 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
|||||||
waveTypeVO.setAdvanceType(dictData.getName());
|
waveTypeVO.setAdvanceType(dictData.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//抛出异常,当前暂态类型为空
|
|
||||||
throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
waveTypeVOS.add(waveTypeVO);
|
waveTypeVOS.add(waveTypeVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ public class HistoryDataResultVO implements Serializable {
|
|||||||
@ApiModelProperty("接线方式 0.星型 1.星三角 2.三角")
|
@ApiModelProperty("接线方式 0.星型 1.星三角 2.三角")
|
||||||
private String wiringMethod;
|
private String wiringMethod;
|
||||||
|
|
||||||
|
@ApiModelProperty("排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
@ApiModelProperty("暂降事件详情")
|
@ApiModelProperty("暂降事件详情")
|
||||||
private List<EventDetailVO> eventDetail;
|
private List<EventDetailVO> eventDetail;
|
||||||
|
|
||||||
|
|||||||
@@ -161,24 +161,26 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
|||||||
number = historyParam.getInHarmonic();
|
number = historyParam.getInHarmonic();
|
||||||
}
|
}
|
||||||
//每个指标独立一个线程去查库,针对现场网络环境比较复杂的场景,正常场景看不太出来效果
|
//每个指标独立一个线程去查库,针对现场网络环境比较复杂的场景,正常场景看不太出来效果
|
||||||
asyncMethodWithCustomExecutor(contions[j],number,historyParam,eventDetailVOList,points[i],pqsDeviceUnit,lineDetailDataVO,overlimit,historyDataResultVOList,futures);
|
asyncMethodWithCustomExecutor(j,contions[j],number,historyParam,eventDetailVOList,points[i],pqsDeviceUnit,lineDetailDataVO,overlimit,historyDataResultVOList,futures);
|
||||||
}
|
}
|
||||||
// 等待所有任务完成
|
// 等待所有任务完成
|
||||||
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
historyDataResultVOList.sort(Comparator.comparing(HistoryDataResultVO::getSort));
|
||||||
System.out.println("end============================="+LocalDateTime.now());
|
System.out.println("end============================="+LocalDateTime.now());
|
||||||
System.out.println("共计耗时:"+timeInterval.intervalMs()/1000.0);
|
System.out.println("共计耗时:"+timeInterval.intervalMs()/1000.0);
|
||||||
|
|
||||||
return historyDataResultVOList;
|
return historyDataResultVOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//处理指标查询
|
//处理指标查询
|
||||||
public void asyncMethodWithCustomExecutor(String target,Integer number,HistoryParam historyParam,List<EventDetailVO> eventDetailVOList,String point,PqsDeviceUnit pqsDeviceUnit,LineDevGetDTO lineDetailDataVO,Overlimit overlimit,List<HistoryDataResultVO> historyDataResultVOList,List<CompletableFuture<Void>> futures) {
|
public void asyncMethodWithCustomExecutor(Integer sort,String target,Integer number,HistoryParam historyParam,List<EventDetailVO> eventDetailVOList,String point,PqsDeviceUnit pqsDeviceUnit,LineDevGetDTO lineDetailDataVO,Overlimit overlimit,List<HistoryDataResultVO> historyDataResultVOList,List<CompletableFuture<Void>> futures) {
|
||||||
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
||||||
HistoryDataResultVO historyDataResultVO = getCondition(historyParam.getSearchBeginTime(), historyParam.getSearchEndTime(), point, target, number, historyParam.getValueType(), historyParam.getPtType(),pqsDeviceUnit,lineDetailDataVO,overlimit);
|
HistoryDataResultVO historyDataResultVO = getCondition(historyParam.getSearchBeginTime(), historyParam.getSearchEndTime(), point, target, number, historyParam.getValueType(), historyParam.getPtType(),pqsDeviceUnit,lineDetailDataVO,overlimit);
|
||||||
historyDataResultVO.setEventDetail(eventDetailVOList);
|
historyDataResultVO.setEventDetail(eventDetailVOList);
|
||||||
|
historyDataResultVO.setSort(sort);
|
||||||
synchronized (historyDataResultVOList) { // 同步块保证线程安全
|
synchronized (historyDataResultVOList) { // 同步块保证线程安全
|
||||||
historyDataResultVOList.add(historyDataResultVO);
|
historyDataResultVOList.add(historyDataResultVO);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user