fix:1.添加若文件来自于undel目录并且解析成功则进行删除

This commit is contained in:
panbaolin 2023-10-25 16:05:22 +08:00
parent 8d1cb29214
commit 758bd27f27
9 changed files with 33 additions and 6 deletions

View File

@ -195,6 +195,7 @@ public abstract class AbstractS_D_Q_G_SpectrumHandler extends AbstractSpectrumHa
* 修改解析状态
*/
protected void updateStatus(){
//这里要加非空判断若台站或探测器不存在这时所有数据还都没有入库sampleData还为null不需要修改状态
if(Objects.nonNull(this.sampleData)){
this.spectrumServiceQuotes.getSampleDataService().updateStatus(this.status,this.sampleData.getInputFileName());
}

View File

@ -197,6 +197,24 @@ public abstract class AbstractSpectrumHandler extends AbstractChain {
}
}
/**
* 若文件件来自于undel并且解析成功后则需要把undel目录里文件删除
*/
protected void deleteIfFromUndelFile(){
if(fromUndel){
StringBuilder undealFilePath = new StringBuilder();
undealFilePath.append(spectrumServiceQuotes.getSpectrumPathProperties().getRootPath());
undealFilePath.append(File.separator);
undealFilePath.append(spectrumServiceQuotes.getSpectrumPathProperties().getUndealPath());
undealFilePath.append(File.separator);
undealFilePath.append(this.spectrumFile.getName());
File undelFile = new File(undealFilePath.toString());
if(undelFile.exists()){
undelFile.delete();
}
}
}
/**
* 删除本地临时文件
*/

View File

@ -70,8 +70,8 @@ public class AlertSpectrum extends AbstractSpectrumHandler{
super.saveFileToSavefile();
//结构体数据入库
this.handlerOriginalData();
//删除本地临时文件
super.deleteLocalTemporaryFile();
//若本次文件来自于undel目录解析成功则删除
deleteIfFromUndelFile();
}catch (Exception e){
throw e;
}finally {

View File

@ -45,6 +45,8 @@ public class DetbkphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
//修改状态为解析完成
super.status = SampleStatus.COMPLETE.getValue();
super.updateStatus();
//若本次文件来自于undel目录解析成功则删除
deleteIfFromUndelFile();
}catch (Exception e){
//修改状态为解析失败
super.status = SampleStatus.FAIL.getValue();

View File

@ -47,6 +47,8 @@ public class GasbkphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
//修改状态为解析完成
super.status = SampleStatus.COMPLETE.getValue();
super.updateStatus();
//若本次文件来自于undel目录解析成功则删除
deleteIfFromUndelFile();
}catch (Exception e){
//修改状态为解析失败
super.status = SampleStatus.FAIL.getValue();

View File

@ -67,10 +67,10 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
super.saveFileToSavefile();
//结构体数据入库
this.handlerOriginalData();
//删除本地临时文件
super.deleteLocalTemporaryFile();
//把流程日志保存到日志目录
this.saveLogToLogDir();
//若本次文件来自于undel目录解析成功则删除
deleteIfFromUndelFile();
}
}

View File

@ -62,10 +62,10 @@ public class MetSpectrum extends AbstractSpectrumHandler{
super.saveFileToSavefile();
//结构体数据入库
this.handlerOriginalData();
//删除本地临时文件
super.deleteLocalTemporaryFile();
//把流程日志保存到日志目录
this.saveLogToLogDir();
//若本次文件来自于undel目录解析成功则删除
deleteIfFromUndelFile();
}else{
super.next.handler();
}

View File

@ -46,6 +46,8 @@ public class QcphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
//修改状态为解析完成
super.status = SampleStatus.COMPLETE.getValue();
super.updateStatus();
//若本次文件来自于undel目录解析成功则删除
deleteIfFromUndelFile();
}catch (Exception e){
//修改状态为解析失败
super.status = SampleStatus.FAIL.getValue();

View File

@ -49,6 +49,8 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
//修改状态为解析完成
super.status = SampleStatus.COMPLETE.getValue();
super.updateStatus();
//若本次文件来自于undel目录解析成功则删除
deleteIfFromUndelFile();
}catch (Exception e){
//修改状态为解析失败
super.status = SampleStatus.FAIL.getValue();