From ad90c521d04c1fede0c09ea08478fad1e283ca92 Mon Sep 17 00:00:00 2001 From: panbaolin <123456> Date: Tue, 2 Jan 2024 17:02:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:1.=E4=BF=AE=E6=94=B9=E8=83=BD=E8=B0=B1?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E5=AE=8C=E6=88=90=E5=90=8E=E5=86=8D=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E8=83=BD=E8=B0=B1=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spectrum/AbstractS_D_Q_G_SpectrumHandler.java | 3 +++ .../modules/spectrum/AbstractSpectrumHandler.java | 10 ++++------ .../java/org/jeecg/modules/spectrum/AlertSpectrum.java | 9 +++++++-- .../org/jeecg/modules/spectrum/DetbkphdSpectrum.java | 8 +++++--- .../org/jeecg/modules/spectrum/GasbkphdSpectrum.java | 8 +++++--- .../jeecg/modules/spectrum/HealthStatusSpectrum.java | 9 +++++++-- .../java/org/jeecg/modules/spectrum/MetSpectrum.java | 9 +++++++-- .../java/org/jeecg/modules/spectrum/QcphdSpectrum.java | 8 +++++--- .../org/jeecg/modules/spectrum/SamplephdSpectrum.java | 9 +++++---- 9 files changed, 48 insertions(+), 25 deletions(-) diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AbstractS_D_Q_G_SpectrumHandler.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AbstractS_D_Q_G_SpectrumHandler.java index 793e2386..c93f00a8 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AbstractS_D_Q_G_SpectrumHandler.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AbstractS_D_Q_G_SpectrumHandler.java @@ -169,6 +169,9 @@ public abstract class AbstractS_D_Q_G_SpectrumHandler extends AbstractSpectrumHa throw new FileNotFoundException(super.spectrumFile.getAbsolutePath()+" does not exist"); } super.spectrumFile = FileUtil.rename(super.spectrumFile, newFileName.toString(), true); + //设置能谱文件保存相对路径(包含文件名称) + String fileSavePath = this.getFileSaveRelativePath(); + this.spectrumFileRelativePath = fileSavePath+File.separator+this.spectrumFile.getName(); } /** diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AbstractSpectrumHandler.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AbstractSpectrumHandler.java index dd81ac3f..d1e9a8ff 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AbstractSpectrumHandler.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AbstractSpectrumHandler.java @@ -144,8 +144,6 @@ public abstract class AbstractSpectrumHandler extends AbstractChain { * 保存能谱文件到savefile */ protected void saveFileToSavefile() throws Exception{ - //修改能谱文件名称 - this.updateSpectrumFileName(); //获取文件保存路径 String fileSavePath = this.getFileSaveRelativePath(); final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties(); @@ -159,8 +157,6 @@ public abstract class AbstractSpectrumHandler extends AbstractChain { finalPath.append(this.spectrumFile.getName()); FileOperation.moveFile(this.spectrumFile,finalPath.toString(),true); this.spectrumFile = new File(finalPath.toString()); - //设置能谱文件保存相对路径(包含文件名称) - this.spectrumFileRelativePath = fileSavePath+File.separator+this.spectrumFile.getName(); } /** @@ -256,7 +252,7 @@ public abstract class AbstractSpectrumHandler extends AbstractChain { if (isDateFormatErr) { //修改能谱文件名称 this.updateErrorSpectrumFileName(); - //解析失败会把文件移动到undeal目录 + //解析失败会把文件移动到errorfile目录 final String rootPath = spectrumServiceQuotes.getSpectrumPathProperties().getRootPath(); final String errorFilePath = spectrumServiceQuotes.getSpectrumPathProperties().getErrorFilePath(); final String finalPath = rootPath+File.separator+errorFilePath; @@ -266,11 +262,13 @@ public abstract class AbstractSpectrumHandler extends AbstractChain { final String rootPath = spectrumServiceQuotes.getSpectrumPathProperties().getRootPath(); final String undealPath = spectrumServiceQuotes.getSpectrumPathProperties().getUndealPath(); final String finalPath = rootPath+File.separator+undealPath; - FileOperation.copyFile(spectrumFile,finalPath,true); + FileOperation.moveFile(spectrumFile,finalPath,true); } } catch (IOException ex) { ex.printStackTrace(); } + }else if(SpectrumSource.FROM_FILE_SOURCE.getSourceType().equals(spectrumSource) && (e instanceof FileRepeatException)){ + this.spectrumFile.delete(); } } diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AlertSpectrum.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AlertSpectrum.java index 68505342..cdea2677 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AlertSpectrum.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/AlertSpectrum.java @@ -78,10 +78,12 @@ public class AlertSpectrum extends AbstractSpectrumHandler{ super.printCurrDataType(); //解析邮件内容 this.parseingEmail(); - //保存PHD文件到savefile - super.saveFileToSavefile(); + //修改能谱文件名称 + this.updateSpectrumFileName(); //结构体数据入库 this.handlerOriginalData(); + //保存PHD文件到savefile + super.saveFileToSavefile(); //若本次文件来自于undel目录,解析成功则删除 deleteIfFromUndelFile(); }catch (Exception e){ @@ -149,6 +151,9 @@ public class AlertSpectrum extends AbstractSpectrumHandler{ throw new FileNotFoundException(super.spectrumFile.getAbsolutePath()+" does not exist"); } super.spectrumFile = FileOperation.rename(super.spectrumFile,newFileName.toString(),true); + //设置能谱文件保存相对路径(包含文件名称) + String fileSavePath = this.getFileSaveRelativePath(); + this.spectrumFileRelativePath = fileSavePath+File.separator+this.spectrumFile.getName(); } @Override diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/DetbkphdSpectrum.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/DetbkphdSpectrum.java index 056984b7..f13218c5 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/DetbkphdSpectrum.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/DetbkphdSpectrum.java @@ -38,10 +38,12 @@ public class DetbkphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { super.parseingEmail(); //读取邮件内容标签 super.readFileLabel(); - //保存PHD文件到savefile - super.saveFileToSavefile(); + //修改能谱文件名称 + super.updateSpectrumFileName(); //结构体数据入库 super.handlerOriginalData(); + //保存PHD文件到savefile + super.saveFileToSavefile(); //修改状态为解析完成 super.status = SampleStatus.COMPLETE.getValue(); super.updateStatus(); @@ -54,7 +56,7 @@ public class DetbkphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { super.status = SampleStatus.FAIL.getValue(); super.updateStatus(); - //处理解析失败的文件,上传到undeal目录 + //处理解析失败的文件 super.handleParseingFailFile(e); throw e; }finally { diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/GasbkphdSpectrum.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/GasbkphdSpectrum.java index e050b8f2..19e9888f 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/GasbkphdSpectrum.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/GasbkphdSpectrum.java @@ -40,10 +40,12 @@ public class GasbkphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { super.parseingEmail(); //读取邮件内容标签 super.readFileLabel(); - //保存PHD文件到savefile - super.saveFileToSavefile(); + //修改能谱文件名称 + super.updateSpectrumFileName(); //结构体数据入库 super.handlerOriginalData(); + //保存PHD文件到savefile + super.saveFileToSavefile(); //修改状态为解析完成 super.status = SampleStatus.COMPLETE.getValue(); super.updateStatus(); @@ -56,7 +58,7 @@ public class GasbkphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { super.status = SampleStatus.FAIL.getValue(); super.updateStatus(); - //处理解析失败的文件,上传到undeal目录 + //处理解析失败的文件 super.handleParseingFailFile(e); throw e; }finally { diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/HealthStatusSpectrum.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/HealthStatusSpectrum.java index 0438587d..552b392f 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/HealthStatusSpectrum.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/HealthStatusSpectrum.java @@ -78,10 +78,12 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{ super.printCurrDataType(); //解析邮件内容 this.parseingEmail(); - //保存PHD文件到savefile - super.saveFileToSavefile(); + //修改能谱文件名称 + this.updateSpectrumFileName(); //结构体数据入库 this.handlerOriginalData(); + //保存PHD文件到savefile + super.saveFileToSavefile(); //把流程日志保存到日志目录 this.saveLogToLogDir(); //若本次文件来自于undel目录,解析成功则删除 @@ -149,6 +151,9 @@ public class HealthStatusSpectrum extends AbstractSpectrumHandler{ throw new FileNotFoundException(super.spectrumFile.getAbsolutePath()+" does not exist"); } super.spectrumFile = FileOperation.rename(super.spectrumFile,newFileName.toString(),true); + //设置能谱文件保存相对路径(包含文件名称) + String fileSavePath = this.getFileSaveRelativePath(); + this.spectrumFileRelativePath = fileSavePath+File.separator+this.spectrumFile.getName(); } @Override diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/MetSpectrum.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/MetSpectrum.java index b0b6cadd..e252989d 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/MetSpectrum.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/MetSpectrum.java @@ -68,10 +68,12 @@ public class MetSpectrum extends AbstractSpectrumHandler{ super.printCurrDataType(); //解析邮件内容 this.parseingEmail(); - //保存PHD文件到savefile - super.saveFileToSavefile(); + //修改能谱文件名称 + this.updateSpectrumFileName(); //结构体数据入库 this.handlerOriginalData(); + //保存PHD文件到savefile + super.saveFileToSavefile(); //把流程日志保存到日志目录 this.saveLogToLogDir(); //若本次文件来自于undel目录,解析成功则删除 @@ -138,6 +140,9 @@ public class MetSpectrum extends AbstractSpectrumHandler{ throw new FileNotFoundException(super.spectrumFile.getAbsolutePath()+" does not exist"); } super.spectrumFile = FileOperation.rename(super.spectrumFile,newFileName.toString(),true); + //设置能谱文件保存相对路径(包含文件名称) + String fileSavePath = this.getFileSaveRelativePath(); + this.spectrumFileRelativePath = fileSavePath+File.separator+this.spectrumFile.getName(); } @Override diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/QcphdSpectrum.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/QcphdSpectrum.java index f2eb58bd..a540c7f1 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/QcphdSpectrum.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/QcphdSpectrum.java @@ -39,10 +39,12 @@ public class QcphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { super.parseingEmail(); //读取邮件内容标签 super.readFileLabel(); - //保存PHD文件到savefile - super.saveFileToSavefile(); + //修改能谱文件名称 + super.updateSpectrumFileName(); //结构体数据入库 super.handlerOriginalData(); + //保存PHD文件到savefile + super.saveFileToSavefile(); //修改状态为解析完成 super.status = SampleStatus.COMPLETE.getValue(); super.updateStatus(); @@ -55,7 +57,7 @@ public class QcphdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { super.status = SampleStatus.FAIL.getValue(); super.updateStatus(); - //处理解析失败的文件,上传到undeal目录 + //处理解析失败的文件 super.handleParseingFailFile(e); throw e; }finally { diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SamplephdSpectrum.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SamplephdSpectrum.java index eb2b5da4..27c12eb4 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SamplephdSpectrum.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SamplephdSpectrum.java @@ -39,13 +39,14 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { super.parseingEmail(); //读取邮件内容标签 super.readFileLabel(); - //保存PHD文件到savefile - super.saveFileToSavefile(); + //修改能谱文件名称 + super.updateSpectrumFileName(); //结构体数据入库 super.handlerOriginalData(); //进行B、G(P)谱分析 this.autoAnalysis(); - + //保存PHD文件到savefile + super.saveFileToSavefile(); //修改状态为解析完成 super.status = SampleStatus.COMPLETE.getValue(); super.updateStatus(); @@ -58,7 +59,7 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { super.status = SampleStatus.FAIL.getValue(); super.updateStatus(); - //处理解析失败的文件,上传到undeal目录 + //处理解析失败的文件 super.handleParseingFailFile(e); throw e; }finally {