fix:gamma自动处理修改log路径
This commit is contained in:
parent
0cb00dcb42
commit
c05c8f4b68
|
@ -32,6 +32,9 @@ import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
|||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
|
@ -122,7 +125,7 @@ public class Sample_G_Analysis {
|
|||
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phdFile, new Result());
|
||||
// 获取数据库 Gamma 默认参数
|
||||
// todo 测试阶段暂时注释掉,获取数据库 Gamma 默认参数
|
||||
// getSettingFromDB(phdFile);
|
||||
// 文件路径
|
||||
middleData.setAnalyses_save_filePath(this.sampleInputFilename);
|
||||
|
@ -142,7 +145,7 @@ public class Sample_G_Analysis {
|
|||
this.storageDataToDatabase(middleData, phdFile.getQcItems());
|
||||
|
||||
// 生成日志文件
|
||||
// writeLog(middleData.getAnalyses_LogPath(), middleData);
|
||||
writeLog(middleData.getAnalyses_LogPath(), middleData);
|
||||
// todo 报告文件
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
@ -199,6 +202,7 @@ public class Sample_G_Analysis {
|
|||
* @param middleData
|
||||
*/
|
||||
private void writeLog(String logFilePath, GStoreMiddleProcessData middleData) {
|
||||
logFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + logFilePath;
|
||||
String sampleId = middleData.getSample_id();
|
||||
MyLogFormatUtil myLogFormatUtil = new MyLogFormatUtil();
|
||||
List<String> writes = new LinkedList<>();
|
||||
|
@ -458,7 +462,21 @@ public class Sample_G_Analysis {
|
|||
String analyseEnd = MyLogFormatUtil.analyseResultsEnd.replace("%1", "date");
|
||||
writes.add(MyLogFormatUtil.getTitleFormat(analyseEnd));
|
||||
|
||||
FileUtil.writeLines(writes, logFilePath, "utf8");
|
||||
// 保存文件
|
||||
// 获取系统的临时目录
|
||||
String tempDir = System.getProperty("java.io.tmpdir");
|
||||
// 创建文件
|
||||
File file = FileUtil.writeLines(writes, tempDir + System.currentTimeMillis(), "utf8");
|
||||
String targetPath = StringUtils.substringBeforeLast(logFilePath, StringPool.SLASH);
|
||||
String targetName = StringUtils.substringAfterLast(logFilePath, StringPool.SLASH);
|
||||
try {
|
||||
ftpUtil.saveFile(targetPath, targetName, new FileInputStream(file));
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
// 删除临时文件
|
||||
if(null != file) file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
public void saveAnalysis(GStoreMiddleProcessData middleData,Integer sampleId){
|
||||
|
@ -589,8 +607,7 @@ public class Sample_G_Analysis {
|
|||
calibration.setFunctionDef(efFunctionDef);
|
||||
calibration.setStartOfRange((int)efStartOfRange);
|
||||
calibration.setEndOfRange((int)efEndOfRange);
|
||||
// todo 暂时固定
|
||||
calibration.setCoeffString("1,2,3");
|
||||
calibration.setCoeffString(efCoeffString);
|
||||
calibration.setModdate(new Date());
|
||||
calibrations.add(calibration);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user