fix:1.添加若文件来自于undel目录并且解析成功则进行删除
This commit is contained in:
parent
8d1cb29214
commit
758bd27f27
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除本地临时文件
|
||||
*/
|
||||
|
|
|
@ -70,8 +70,8 @@ public class AlertSpectrum extends AbstractSpectrumHandler{
|
|||
super.saveFileToSavefile();
|
||||
//结构体数据入库
|
||||
this.handlerOriginalData();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
//若本次文件来自于undel目录,解析成功则删除
|
||||
deleteIfFromUndelFile();
|
||||
}catch (Exception e){
|
||||
throw e;
|
||||
}finally {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -67,10 +67,10 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{
|
|||
super.saveFileToSavefile();
|
||||
//结构体数据入库
|
||||
this.handlerOriginalData();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
//把流程日志保存到日志目录
|
||||
this.saveLogToLogDir();
|
||||
//若本次文件来自于undel目录,解析成功则删除
|
||||
deleteIfFromUndelFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,10 +62,10 @@ public class MetSpectrum extends AbstractSpectrumHandler{
|
|||
super.saveFileToSavefile();
|
||||
//结构体数据入库
|
||||
this.handlerOriginalData();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
//把流程日志保存到日志目录
|
||||
this.saveLogToLogDir();
|
||||
//若本次文件来自于undel目录,解析成功则删除
|
||||
deleteIfFromUndelFile();
|
||||
}else{
|
||||
super.next.handler();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user