暂态原因计算问题

This commit is contained in:
hzj
2026-06-17 16:06:29 +08:00
parent 368103cad5
commit bf9779c06e
3 changed files with 16 additions and 8 deletions

View File

@@ -25,6 +25,8 @@ import java.io.File;
import java.io.InputStream;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* @author hongawen
@@ -42,10 +44,14 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
private final FileStorageUtil fileStorageUtil;
private final Lock lock = new ReentrantLock();
@Override
public EventAnalysisDTO analysisCauseAndType(EventAnalysisDTO eventAnalysis) {
WaveDataDTO waveDataDTO;
//由于计算原因是异步操作这里需要加锁不然JNI调用ddl文件会存在内存Invalid memory access
lock.lock();
try {
WaveDataDTO waveDataDTO;
String waveName = eventAnalysis.getWaveName();
String wlFilePath = eventAnalysis.getWlFilePath();
String cfgPath, datPath, cfgPath2, datPath2;
@@ -181,6 +187,9 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
}
System.out.println("暂降原因分析完毕===============");
System.out.println("cause:" + eventAnalysis);
} finally {
lock.unlock(); // 释放锁
}
return eventAnalysis;
}

View File

@@ -636,18 +636,16 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport
}
}, executor);
CompletableFuture<List<EventEigDetail>> eigFuture = CompletableFuture.supplyAsync(() ->
waveService.eventDetailEigenvalue(index, line.getPtType()), executor
);
// 等待所有异步任务完成并获取结果(无超时,但可加)
CompletableFuture<Void> allFutures = CompletableFuture.allOf(instantFuture, rmsFuture, eigFuture);
allFutures.join(); // 阻塞直到个任务都完成
CompletableFuture<Void> allFutures = CompletableFuture.allOf(instantFuture, rmsFuture);
allFutures.join(); // 阻塞直到2个任务都完成
// 获取结果此时所有任务已完成get()不会阻塞)
String imageShun64 = instantFuture.get();
String rmsShun64 = rmsFuture.get();
List<EventEigDetail> eventDetailEigenvalue = eigFuture.get();
List<EventEigDetail> eventDetailEigenvalue = waveService.eventDetailEigenvalue(index, line.getPtType());
// 主线程顺序调用 WordUtil 方法(保证线程安全)
wordUtil.translateShun(index, imageShun64);
wordUtil.translateRms(index, rmsShun64);

View File

@@ -181,7 +181,8 @@ public class EventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper, Rm
}else {
rmpEventDetailPO.setFileFlag(1);
}
//默认给0经过高级算法在赋值
rmpEventDetailPO.setDealFlag(0);
rmpEventDetailPO.setEventDescribe(" ");
//如果不为空,说明是二次上传波形文件了;