From ae5bead768966218fbcc61aa88b51383e225253c Mon Sep 17 00:00:00 2001 From: nieziyan Date: Mon, 16 Oct 2023 19:18:42 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9AFtp=E6=94=B9=E4=B8=BA=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/SpectrumPathProperties.java | 2 -- .../org/jeecg/common/util/GammaReportUtil.java | 17 ++--------------- .../modules/spectrum/Sample_G_Analysis.java | 3 +++ .../org/jeecg/common/util/GammaFileUtil.java | 10 ++++++---- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SpectrumPathProperties.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SpectrumPathProperties.java index f8ad0fca..03906ee2 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SpectrumPathProperties.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SpectrumPathProperties.java @@ -34,8 +34,6 @@ public class SpectrumPathProperties implements Serializable { */ private String emlPath; - private String saveFilePath; - /** * 日志文件存储路径 */ diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/GammaReportUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/GammaReportUtil.java index d18418b8..42890ddf 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/GammaReportUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/GammaReportUtil.java @@ -16,10 +16,8 @@ public class GammaReportUtil { private static FTPUtil ftpUtil = ApplicationContextUtil.getContext().getBean(FTPUtil.class); private static int colLength = 15; public static void writeFile(BaseControls baseCtrl, String path){ - // 获取系统的临时目录 - String tempDir = System.getProperty("java.io.tmpdir"); // 创建文件 - File file = new File(tempDir + System.currentTimeMillis()); + File file = new File(path); // 创建PrintWriter对象 PrintWriter out = null; try { @@ -45,23 +43,17 @@ public class GammaReportUtil { out.println("#StepCounts"); format(baseCtrl.getStepCounts(), out); - String targetPath = StringUtils.substringBeforeLast(path, StringPool.SLASH); - String targetName = StringUtils.substringAfterLast(path, StringPool.SLASH); - ftpUtil.saveFile(targetPath, targetName, new FileInputStream(file)); } catch (FileNotFoundException e) { e.printStackTrace(); } finally { if (null != out) { out.close(); } - file.delete(); } } public static void writeFile(List data, String fileType, String path){ - // 获取系统的临时目录 - String tempDir = System.getProperty("java.io.tmpdir"); // 创建文件 - File file = new File(tempDir + System.currentTimeMillis()); + File file = new File(path); // 创建PrintWriter对象 PrintWriter out = null; try { @@ -70,17 +62,12 @@ public class GammaReportUtil { out.printf("%" + (String.valueOf(data.size()).length() + (colLength - String.valueOf(data.size()).length())) + "s", data.size() + "\n"); format(data, out); - String targetPath = StringUtils.substringBeforeLast(path, StringPool.SLASH); - String targetName = StringUtils.substringAfterLast(path, StringPool.SLASH); - ftpUtil.saveFile(targetPath, targetName, new FileInputStream(file)); - } catch (FileNotFoundException e) { e.printStackTrace(); } finally { if (null != out) { out.close(); } - file.delete(); } } diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_G_Analysis.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_G_Analysis.java index 35cfc6d2..11884004 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_G_Analysis.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_G_Analysis.java @@ -18,6 +18,7 @@ import org.jeecg.common.constant.*; import org.jeecg.common.constant.enums.SpectrumSystemType; import org.jeecg.common.properties.ParameterProperties; import org.jeecg.common.properties.SpectrumPathProperties; +import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.GammaFileUtil; import org.jeecg.common.util.RedisUtil; import org.jeecg.modules.base.bizVo.AttributeItemVo; @@ -133,6 +134,8 @@ public class Sample_G_Analysis { middleData.setAnalyses_save_filePath(this.sampleInputFilename); // 读取文件内容并附值 this.setPHDFile(phdFile, this.energySpectrumStruct); + phdFile.getSetting().setRefTime_act(DateUtils.parseDate(phdFile.getAcq().getAcquisition_start_date()+" "+phdFile.getAcq().getAcquisition_start_time())); + phdFile.getSetting().setRefTime_conc(DateUtils.parseDate(phdFile.getCollect().getCollection_start_date()+" "+phdFile.getCollect().getCollection_start_time())); // todo 根据系统类型传入不同的核素参数 Map nuclideLibs = new HashMap<>(); if (this.systemType.equals(SpectrumSystemType.P.name())) { diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java index fd6ee86f..1ef80323 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java @@ -2810,7 +2810,8 @@ public class GammaFileUtil extends AbstractLogOrReport { strBuffer.append(String.format("%s:%-30s%s", " RiskLevelK", StringPool.SPACE, String.valueOf(middleData.setting_specSetup.getRiskLevelK()))); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(String.format("%s:%-30s%s", " refTime_act", StringPool.SPACE, DateUtils.formatDate(middleData.setting_specSetup.getRefTime_act()), "yyyy-MM-dd HH:mm:ss")); + Date refTimeAct = middleData.setting_specSetup.getRefTime_act(); + strBuffer.append(String.format("%s:%-30s%s", " refTime_act", StringPool.SPACE, DateUtils.formatDate(refTimeAct), "yyyy-MM-dd HH:mm:ss")); //换行 strBuffer.append(System.lineSeparator()); strBuffer.append(String.format("%s:%-30s%s", " refTime_conc", StringPool.SPACE, DateUtils.formatDate(middleData.setting_specSetup.getRefTime_conc(), "yyyy-MM-dd HH:mm:ss"))); @@ -3108,9 +3109,10 @@ public class GammaFileUtil extends AbstractLogOrReport { String qsSaveBaseLine = StringPool.SLASH+spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsBaseLinePath; String qsSaveLc = StringPool.SLASH+spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsLcPath; String qsSaveScac = StringPool.SLASH+spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsScacPath; - GammaReportUtil.writeFile(fileAnlyse.getBaseCtrls(), qsSaveBaseLine); - GammaReportUtil.writeFile(fileAnlyse.getVLc(), "LC", qsSaveLc); - GammaReportUtil.writeFile(fileAnlyse.getVScac(), "SCSC", qsSaveScac); + String rootPath = spectrumPathProperties.getRootPath(); + GammaReportUtil.writeFile(fileAnlyse.getBaseCtrls(), rootPath + qsSaveBaseLine); + GammaReportUtil.writeFile(fileAnlyse.getVLc(), "LC", rootPath + qsSaveLc); + GammaReportUtil.writeFile(fileAnlyse.getVScac(), "SCSC", rootPath + qsSaveScac); // WriteBaseInfo(fileAnlyse.getBaseCtrls(),qsSaveBaseLine); // WriteLcScac(fileAnlyse.getVLc(),"Lc",qsSaveLc); // WriteLcScac(fileAnlyse.getVScac(),"Scac",qsSaveScac);