bug调整

This commit is contained in:
cdf
2026-01-14 11:04:12 +08:00
parent c576bd3bf7
commit eb689c9852
4 changed files with 26 additions and 27 deletions

View File

@@ -34,24 +34,24 @@ public class NacosLogbackConfigLoader implements SpringApplicationRunListener, A
@Override
public void environmentPrepared(ConfigurableEnvironment environment) {
// String serverAddr = environment.getProperty("spring.cloud.nacos.config.server-addr");
// String namespace = environment.getProperty("spring.cloud.nacos.config.namespace");
// String projectName = environment.getProperty("microservice.ename");
// 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);
// HttpHeaders headers = new HttpHeaders();
// headers.set("cndl408125hawen", "lanxia201");
// HttpEntity<String> entity = new HttpEntity<>(headers);
// RestTemplate restTemplate = new RestTemplate();
// ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
// if (response.getStatusCode().is2xxSuccessful()) {
// String logbackConfigContent = response.getBody();
// //替换项目名称
// logbackConfigContent = logbackConfigContent.replace("projectDefaultName",projectName);
// logbackConfigContent = logbackConfigContent.replace("logDefaultLevel",logLevel);
// // 应用获取到的Logback配置
// applyLogbackConfig(logbackConfigContent);
// }
/* String serverAddr = environment.getProperty("spring.cloud.nacos.config.server-addr");
String namespace = environment.getProperty("spring.cloud.nacos.config.namespace");
String projectName = environment.getProperty("microservice.ename");
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);
HttpHeaders headers = new HttpHeaders();
headers.set("cndl408125hawen", "lanxia201");
HttpEntity<String> entity = new HttpEntity<>(headers);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
if (response.getStatusCode().is2xxSuccessful()) {
String logbackConfigContent = response.getBody();
//替换项目名称
logbackConfigContent = logbackConfigContent.replace("projectDefaultName",projectName);
logbackConfigContent = logbackConfigContent.replace("logDefaultLevel",logLevel);
// 应用获取到的Logback配置
applyLogbackConfig(logbackConfigContent);
}*/
}
private void applyLogbackConfig(String logbackConfigContent) {

View File

@@ -1464,9 +1464,6 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
waveTypeVO.setAdvanceReason(dictData.getName());
}
}
} else {
//抛出异常,当前暂态原因为空
throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND);
}
if (waveTypeVO.getAdvanceType() != null) {
@@ -1476,9 +1473,6 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
waveTypeVO.setAdvanceType(dictData.getName());
}
}
} else {
//抛出异常,当前暂态类型为空
throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND);
}
waveTypeVOS.add(waveTypeVO);
}

View File

@@ -48,6 +48,9 @@ public class HistoryDataResultVO implements Serializable {
@ApiModelProperty("接线方式 0.星型 1.星三角 2.三角")
private String wiringMethod;
@ApiModelProperty("排序")
private Integer sort;
@ApiModelProperty("暂降事件详情")
private List<EventDetailVO> eventDetail;

View File

@@ -161,24 +161,26 @@ public class HistoryResultServiceImpl implements HistoryResultService {
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();
}
historyDataResultVOList.sort(Comparator.comparing(HistoryDataResultVO::getSort));
System.out.println("end============================="+LocalDateTime.now());
System.out.println("共计耗时:"+timeInterval.intervalMs()/1000.0);
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(() -> {
HistoryDataResultVO historyDataResultVO = getCondition(historyParam.getSearchBeginTime(), historyParam.getSearchEndTime(), point, target, number, historyParam.getValueType(), historyParam.getPtType(),pqsDeviceUnit,lineDetailDataVO,overlimit);
historyDataResultVO.setEventDetail(eventDetailVOList);
historyDataResultVO.setSort(sort);
synchronized (historyDataResultVOList) { // 同步块保证线程安全
historyDataResultVOList.add(historyDataResultVO);
}