fix:Ftp改为本地

This commit is contained in:
nieziyan 2023-10-16 19:18:42 +08:00
parent fcaf1b8519
commit ae5bead768
4 changed files with 11 additions and 21 deletions

View File

@ -34,8 +34,6 @@ public class SpectrumPathProperties implements Serializable {
*/
private String emlPath;
private String saveFilePath;
/**
* 日志文件存储路径
*/

View File

@ -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<Double> 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();
}
}

View File

@ -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<String, NuclideLines> nuclideLibs = new HashMap<>();
if (this.systemType.equals(SpectrumSystemType.P.name())) {

View File

@ -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);