feat:完善新beta savetodb接口
This commit is contained in:
parent
0aeb76d959
commit
8cac8a6099
|
@ -4,10 +4,30 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
public enum SampleFileHeader {
|
public enum SampleFileHeader {
|
||||||
|
|
||||||
HEADER(0,"#Header"),COMMENT(1,"#Comment"),COLLECTION(2,"#Collection"),ACQUISITION(3,"#Acquisition"),PROCESSING(4,"#Processing"),SAMPLE(5,"#Sample"),
|
HEADER(0,"#Header"),
|
||||||
GENERGY(6,"#g_Energy"),BENERGY(7,"#b_Energy"),GRESOLUTION(8,"#g_Resolution"),BRESOLUTION(9,"#b_Resolution"),GEFFICIENCY(10,"#g_Efficiency"),
|
COMMENT(1,"#Comment"),
|
||||||
ROILIMITS(11,"#ROI_Limits"),BGEFFICIENCY(12,"#b-gEfficiency"),TOTALEFF(13,"#TotalEff"),RATIOS(14,"#Ratios"),GSPECTRUM(15,"#g_Spectrum"),BSPECTRUM(16,"#b_Spectrum"),
|
COLLECTION(2,"#Collection"),
|
||||||
HISTOGRAM(17,"#Histogram"),CALIBRATION(18,"#Calibration"),CERTIFICATE(19,"#Certificate"),STOP(20,"STOP"),BEGIN(21,"BEGIN"),SPECTRUM(22,"#Spectrum");
|
ACQUISITION(3,"#Acquisition"),
|
||||||
|
PROCESSING(4,"#Processing"),
|
||||||
|
SAMPLE(5,"#Sample"),
|
||||||
|
GENERGY(6,"#g_Energy"),
|
||||||
|
BENERGY(7,"#b_Energy"),
|
||||||
|
GRESOLUTION(8,"#g_Resolution"),
|
||||||
|
BRESOLUTION(9,"#b_Resolution"),
|
||||||
|
GEFFICIENCY(10,"#g_Efficiency"),
|
||||||
|
BEFFICIENCY(23,"#b_Efficiency"), // 20240801 自建台站增加
|
||||||
|
ROILIMITS(11,"#ROI_Limits"),
|
||||||
|
BGEFFICIENCY(12,"#b-gEfficiency"),
|
||||||
|
TOTALEFF(13,"#TotalEff"),
|
||||||
|
RATIOS(14,"#Ratios"),
|
||||||
|
GSPECTRUM(15,"#g_Spectrum"),
|
||||||
|
BSPECTRUM(16,"#b_Spectrum"),
|
||||||
|
HISTOGRAM(17,"#Histogram"),
|
||||||
|
CALIBRATION(18,"#Calibration"),
|
||||||
|
CERTIFICATE(19,"#Certificate"),
|
||||||
|
STOP(20,"STOP"),
|
||||||
|
BEGIN(21,"BEGIN"),
|
||||||
|
SPECTRUM(22,"#Spectrum");
|
||||||
|
|
||||||
private Integer code;
|
private Integer code;
|
||||||
|
|
||||||
|
|
|
@ -248,6 +248,22 @@ public class EnergySpectrumStruct {
|
||||||
|
|
||||||
public int g_e_record_count;
|
public int g_e_record_count;
|
||||||
|
|
||||||
|
/************************* g_Efficiency Block ******************/
|
||||||
|
/**
|
||||||
|
* β -energy (keV)
|
||||||
|
*/
|
||||||
|
public List<Double> b_e_energy;
|
||||||
|
/**
|
||||||
|
* efficiency (counts in peak/photon emitted)
|
||||||
|
*/
|
||||||
|
public List<Double> b_e_efficiency;
|
||||||
|
/**
|
||||||
|
* uncertainty (counts in peak/photon emitted)
|
||||||
|
*/
|
||||||
|
public List<Double> b_e_uncertainty;
|
||||||
|
|
||||||
|
public int b_e_record_count;
|
||||||
|
|
||||||
/************************* ROI_Limits Block ******************/
|
/************************* ROI_Limits Block ******************/
|
||||||
/**
|
/**
|
||||||
* ROI number
|
* ROI number
|
||||||
|
|
|
@ -1073,7 +1073,7 @@ public class SelfStationUtil extends AbstractLogOrReport {
|
||||||
detailedMap.put("systemType", struct.system_type);
|
detailedMap.put("systemType", struct.system_type);
|
||||||
detailedMap.put("dataType", dataType);
|
detailedMap.put("dataType", dataType);
|
||||||
detailedMap.put("spectralQualifier", struct.spectrum_quantity);
|
detailedMap.put("spectralQualifier", struct.spectrum_quantity);
|
||||||
detailedMap.put("SRID", struct.sample_ref_id);
|
// detailedMap.put("SRID", struct.sample_ref_id);
|
||||||
detailedMap.put("status", status);
|
detailedMap.put("status", status);
|
||||||
detailedMap.put("collectionStart", CollectionStart);
|
detailedMap.put("collectionStart", CollectionStart);
|
||||||
detailedMap.put("collectionStop", CollectionStop);
|
detailedMap.put("collectionStop", CollectionStop);
|
||||||
|
@ -1082,7 +1082,7 @@ public class SelfStationUtil extends AbstractLogOrReport {
|
||||||
if (Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop)) {
|
if (Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop)) {
|
||||||
timeSpan = (CollectionStop.getTime()/1000 - CollectionStart.getTime()/1000) / 3600.0;
|
timeSpan = (CollectionStop.getTime()/1000 - CollectionStart.getTime()/1000) / 3600.0;
|
||||||
}
|
}
|
||||||
detailedMap.put("samplingTime", String.format("%.2f", timeSpan));
|
// detailedMap.put("samplingTime", String.format("%.2f", timeSpan));
|
||||||
detailedMap.put("airVolume", String.format("%.5f", airVolume));
|
detailedMap.put("airVolume", String.format("%.5f", airVolume));
|
||||||
detailedMap.put("xeVolume", String.format("%.5f", xeVolume));
|
detailedMap.put("xeVolume", String.format("%.5f", xeVolume));
|
||||||
detailedMap.put("yeild", xeCollectionYield);
|
detailedMap.put("yeild", xeCollectionYield);
|
||||||
|
@ -1095,9 +1095,11 @@ public class SelfStationUtil extends AbstractLogOrReport {
|
||||||
if (Objects.nonNull(AcquisitionStart) && Objects.nonNull(CollectionStop)) {
|
if (Objects.nonNull(AcquisitionStart) && Objects.nonNull(CollectionStop)) {
|
||||||
timespan = (AcquisitionStart.getTime()/1000 - CollectionStop.getTime()/1000);
|
timespan = (AcquisitionStart.getTime()/1000 - CollectionStop.getTime()/1000);
|
||||||
}
|
}
|
||||||
detailedMap.put("acquisitionDecayTime", String.format("%.2f", timespan / 3600.0));
|
// detailedMap.put("acquisitionDecayTime", String.format("%.2f", timespan / 3600.0));
|
||||||
// todo 分级暂时定为1
|
// todo 分级暂时定为1
|
||||||
detailedMap.put("category", "1");
|
detailedMap.put("category", "1");
|
||||||
|
detailedMap.put("lat", struct.lat);
|
||||||
|
detailedMap.put("lon", struct.lon);
|
||||||
return detailedMap;
|
return detailedMap;
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
|
@ -9,12 +9,11 @@ import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class SelfStationData implements Serializable {
|
public class SelfStationData implements Serializable {
|
||||||
|
/********************************* 基本数据信息 *********************************/
|
||||||
/**
|
/**
|
||||||
* sample临时文件路径
|
* sample临时文件路径
|
||||||
*/
|
*/
|
||||||
private String sampleTmpPath;
|
private String sampleTmpPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* det临时文件路径
|
* det临时文件路径
|
||||||
*/
|
*/
|
||||||
|
@ -25,6 +24,32 @@ public class SelfStationData implements Serializable {
|
||||||
*/
|
*/
|
||||||
private String qcTmpPath;
|
private String qcTmpPath;
|
||||||
|
|
||||||
|
private String sampleFilePathName;
|
||||||
|
|
||||||
|
private String sampleFileName;
|
||||||
|
|
||||||
|
private String gasFilePathName;
|
||||||
|
|
||||||
|
private String gasFileName;
|
||||||
|
|
||||||
|
private String detFilePathName;
|
||||||
|
|
||||||
|
private String detFileName;
|
||||||
|
|
||||||
|
private String qcFilePathName;
|
||||||
|
|
||||||
|
private String qcFileName;
|
||||||
|
|
||||||
|
private String sampleId;
|
||||||
|
|
||||||
|
private String stationId;
|
||||||
|
|
||||||
|
private String detectorId;
|
||||||
|
|
||||||
|
private boolean bProcessed;
|
||||||
|
|
||||||
|
private boolean saveAnalysisResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sample文件分析内容
|
* sample文件分析内容
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -74,6 +74,20 @@ public class GardsCalibrationPairsOrigSpectrumServiceImpl extends ServiceImpl<Ga
|
||||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (readLines.contains(SampleFileHeader.BEFFICIENCY.getMessage())){
|
||||||
|
for (int i=0; i<sourceData.g_e_record_count; i++){
|
||||||
|
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||||
|
calibrationPairsOrig.setSampleId(sampleId);
|
||||||
|
calibrationPairsOrig.setSampleType(SystemType.BETA.getType());
|
||||||
|
calibrationPairsOrig.setCaltype(CalType.EFFICIENCY_CAL.getType());
|
||||||
|
calibrationPairsOrig.setInput("PHD");
|
||||||
|
calibrationPairsOrig.setIdCalPoint(i);
|
||||||
|
calibrationPairsOrig.setXValue(sourceData.b_e_energy.get(i));
|
||||||
|
calibrationPairsOrig.setYValue(sourceData.b_e_efficiency.get(i));
|
||||||
|
calibrationPairsOrig.setUncYValue(sourceData.b_e_uncertainty.get(i));
|
||||||
|
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (readLines.contains(SampleFileHeader.BRESOLUTION.getMessage())){
|
if (readLines.contains(SampleFileHeader.BRESOLUTION.getMessage())){
|
||||||
for (int i=0; i<sourceData.b_r_record_count; i++){
|
for (int i=0; i<sourceData.b_r_record_count; i++){
|
||||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||||
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
|
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
|
||||||
|
import org.jeecg.modules.base.enums.SampleFileHeader;
|
||||||
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
|
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
|
||||||
import org.jeecg.modules.entity.GardsXeResultsSpectrum;
|
import org.jeecg.modules.entity.GardsXeResultsSpectrum;
|
||||||
import org.jeecg.modules.entity.vo.*;
|
import org.jeecg.modules.entity.vo.*;
|
||||||
|
@ -103,6 +104,10 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGardsTotalEfficiencyPairsSpectrumService totalEfficiencyPairsSpectrumService;
|
private IGardsTotalEfficiencyPairsSpectrumService totalEfficiencyPairsSpectrumService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private IGardsRoiLimitsSpectrumService roiLimitsSpectrumService;
|
||||||
|
@Autowired
|
||||||
|
private IGardsHistogramSpectrumService histogramService;
|
||||||
|
@Autowired
|
||||||
private IGardsSpectrumSpectrumService spectrumService;
|
private IGardsSpectrumSpectrumService spectrumService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGardsCalibrationPairsSpectrumService calibrationPairsSpectrumService;
|
private IGardsCalibrationPairsSpectrumService calibrationPairsSpectrumService;
|
||||||
|
@ -305,12 +310,15 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
SelfStationData selfStationData = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName);
|
SelfStationData selfStationData = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName);
|
||||||
//判断缓存是否为空
|
//判断缓存是否为空
|
||||||
if (Objects.isNull(selfStationData)) {
|
if (Objects.isNull(selfStationData)) {
|
||||||
|
//拼接sample文件路径
|
||||||
|
String sampleFilePath = path + StringPool.SLASH + sampleFileName;
|
||||||
//初始化自建台站数据对象
|
//初始化自建台站数据对象
|
||||||
selfStationData = new SelfStationData();
|
selfStationData = new SelfStationData();
|
||||||
|
// 是否存储过beta数据
|
||||||
|
BetaDataFile betaDataFile = Objects.isNull(selfStationData.getBetaDataFile()) ? new BetaDataFile() : selfStationData.getBetaDataFile();
|
||||||
|
|
||||||
//判断sample文件名是否为空
|
//判断sample文件名是否为空
|
||||||
if (StringUtils.isNotBlank(sampleFileName)) {
|
if (StringUtils.isNotBlank(sampleFileName)) {
|
||||||
//拼接sample文件路径
|
|
||||||
String sampleFilePath = path + StringPool.SLASH + sampleFileName;
|
|
||||||
//返回结果map
|
//返回结果map
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
//获取sample分析后的对象
|
//获取sample分析后的对象
|
||||||
|
@ -318,6 +326,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
if (Objects.nonNull(struct)) {
|
if (Objects.nonNull(struct)) {
|
||||||
selfStationData.setSampleStruct(struct);
|
selfStationData.setSampleStruct(struct);
|
||||||
selfStationData.setSampleTmpPath(sampleFilePath);
|
selfStationData.setSampleTmpPath(sampleFilePath);
|
||||||
|
selfStationData.setSampleFileName(sampleFileName);
|
||||||
selfStationUtil.loadFile(selfStationData, null, null, "sample", map);
|
selfStationUtil.loadFile(selfStationData, null, null, "sample", map);
|
||||||
|
|
||||||
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
|
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
|
||||||
|
@ -364,6 +373,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
if (Objects.nonNull(struct)) {
|
if (Objects.nonNull(struct)) {
|
||||||
selfStationData.setDetStruct(struct);
|
selfStationData.setDetStruct(struct);
|
||||||
selfStationData.setDetTmpPath(detFilePath);
|
selfStationData.setDetTmpPath(detFilePath);
|
||||||
|
selfStationData.setDetFileName(detFileName);
|
||||||
selfStationUtil.loadFile(selfStationData, null, null, "det", map);
|
selfStationUtil.loadFile(selfStationData, null, null, "det", map);
|
||||||
resultMap.put("det", map);
|
resultMap.put("det", map);
|
||||||
}
|
}
|
||||||
|
@ -379,6 +389,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
if (Objects.nonNull(struct)) {
|
if (Objects.nonNull(struct)) {
|
||||||
selfStationData.setQcStruct(struct);
|
selfStationData.setQcStruct(struct);
|
||||||
selfStationData.setQcTmpPath(qcFilePath);
|
selfStationData.setQcTmpPath(qcFilePath);
|
||||||
|
selfStationData.setQcFileName(qcFileName);
|
||||||
selfStationUtil.loadFile(selfStationData, null, null, "qc", map);
|
selfStationUtil.loadFile(selfStationData, null, null, "qc", map);
|
||||||
resultMap.put("qc", map);
|
resultMap.put("qc", map);
|
||||||
}
|
}
|
||||||
|
@ -4847,12 +4858,14 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
result.error500("Please first Reprocessing!");
|
result.error500("Please first Reprocessing!");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
BetaDataFile betaDataFile = selfStationData.getBetaDataFile();
|
||||||
//获取当前操作的台站的id
|
//获取当前操作的台站的id
|
||||||
EnergySpectrumStruct sampleStruct = selfStationData.getSampleStruct();
|
EnergySpectrumStruct sampleStruct = selfStationData.getSampleStruct();
|
||||||
EnergySpectrumStruct qcStruct = selfStationData.getQcStruct();
|
EnergySpectrumStruct qcStruct = selfStationData.getQcStruct();
|
||||||
EnergySpectrumStruct detStruct = selfStationData.getDetStruct();
|
EnergySpectrumStruct detStruct = selfStationData.getDetStruct();
|
||||||
String siteCode = sampleStruct.site_code;
|
String siteCode = sampleStruct.site_code;
|
||||||
Integer stationId = spectrumAnalysisMapper.getStationId(siteCode);
|
Integer stationId = spectrumAnalysisMapper.getStationId(siteCode);
|
||||||
|
Integer sampleId = null, gasId = null, detId = null, qcId = null;
|
||||||
//判断当前分析员当天是否有对应台站的排班任务
|
//判断当前分析员当天是否有对应台站的排班任务
|
||||||
List<String> userStation = userTaskUtil.findUserStation(userName);
|
List<String> userStation = userTaskUtil.findUserStation(userName);
|
||||||
boolean bAnalysisResultWriteAuthority = userStation.contains(String.valueOf(stationId));
|
boolean bAnalysisResultWriteAuthority = userStation.contains(String.valueOf(stationId));
|
||||||
|
@ -4898,6 +4911,30 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
result.error500("Transform PHDFile into structGStoreMiddleProcessData failed.");
|
result.error500("Transform PHDFile into structGStoreMiddleProcessData failed.");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//处理文件名称
|
||||||
|
String sampleFilePathName = selfStationData.getSampleFilePathName();
|
||||||
|
String detFilePathName = selfStationData.getDetFilePathName();
|
||||||
|
String qcFilePathName = selfStationData.getQcFilePathName();
|
||||||
|
String sampleTmpPath = selfStationData.getSampleTmpPath();
|
||||||
|
String detTmpPath = selfStationData.getDetTmpPath();
|
||||||
|
String qcTmpPath = selfStationData.getQcTmpPath();
|
||||||
|
|
||||||
|
//根据sample文件名称模糊查询sampleId
|
||||||
|
String sampleFilePath = "", qcFilePath = "", detFilePath = "";
|
||||||
|
if (StringUtils.isNotBlank(sampleFilePathName)) {
|
||||||
|
sampleFilePath = StrUtil.subBefore(sampleFilePathName, StringPool.SLASH, true);
|
||||||
|
sampleFilePathName = phdFileUtil.NameStandardBy(sampleFilePath, sampleFilePathName);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(detFilePathName)) {
|
||||||
|
detFilePath = StrUtil.subBefore(detFilePathName, StringPool.SLASH, true);
|
||||||
|
detFilePathName = phdFileUtil.NameStandardBy(detFilePath, detFilePathName);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(qcFilePathName)) {
|
||||||
|
qcFilePath = StrUtil.subBefore(qcFilePathName, StringPool.SLASH, true);
|
||||||
|
qcFilePathName = phdFileUtil.NameStandardBy(qcFilePath, qcFilePathName);
|
||||||
|
}
|
||||||
|
|
||||||
// 读取参数内容
|
// 读取参数内容
|
||||||
Map<String, CalMDCInfo> mdcInfoMap1 = phdFile1.getMdcInfoMap();
|
Map<String, CalMDCInfo> mdcInfoMap1 = phdFile1.getMdcInfoMap();
|
||||||
Map<String, CalMDCInfo> mdcInfoMap2 = phdFile2.getMdcInfoMap();
|
Map<String, CalMDCInfo> mdcInfoMap2 = phdFile2.getMdcInfoMap();
|
||||||
|
@ -4914,14 +4951,25 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
phd.setStatus(sampleData.getStatus());
|
phd.setStatus(sampleData.getStatus());
|
||||||
} else {
|
} else {
|
||||||
// 如果sampleData为空 存储数据
|
// 如果sampleData为空 存储数据
|
||||||
bRet = SaveSampleToDB(phd, sampleInputFileName);
|
//判断文件是否存储过 如果没有则解析文件并进行存储
|
||||||
if (!bRet) {
|
if (!this.OriginalDataStore(sampleStruct, sampleTmpPath, sampleFilePathName) ){
|
||||||
result.error500("The Database hasn't this Spectrum(" + saveFileName + ") and Insert it to Database failed.");
|
result.error500("sampleFile save failed");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (!this.OriginalDataStore(detStruct, detTmpPath, detFilePathName) ){
|
||||||
|
result.error500("detFile save failed");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(qcFilePathName)) {
|
||||||
|
if (!this.OriginalDataStore(qcStruct, qcTmpPath, qcFilePathName) ){
|
||||||
|
result.error500("qcFile save failed");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
qcId = spectrumAnalysisMapper.getSampleId(qcFilePathName);
|
||||||
|
}
|
||||||
sampleData = spectrumAnalysisMapper.findSampleByFilePath(sampleInputFileName);
|
sampleData = spectrumAnalysisMapper.findSampleByFilePath(sampleInputFileName);
|
||||||
}
|
}
|
||||||
Integer sampleId = sampleData.getSampleId();
|
sampleId = sampleData.getSampleId();
|
||||||
// 根据sampleId 查询idAnalysis
|
// 根据sampleId 查询idAnalysis
|
||||||
String idAnalysisStr = spectrumAnalysisMapper.getIdAnalysisByIdAnalyst(sampleId.toString(), userName);
|
String idAnalysisStr = spectrumAnalysisMapper.getIdAnalysisByIdAnalyst(sampleId.toString(), userName);
|
||||||
Integer idAnalysis = StrUtil.isBlank(idAnalysisStr) ? null : Integer.valueOf(idAnalysisStr);
|
Integer idAnalysis = StrUtil.isBlank(idAnalysisStr) ? null : Integer.valueOf(idAnalysisStr);
|
||||||
|
@ -4973,12 +5021,24 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
analysisManService.saveAnalySettingROI(sampleId, idAnalysis, phdFiles);
|
analysisManService.saveAnalySettingROI(sampleId, idAnalysis, phdFiles);
|
||||||
// 向 RNMAN.GARDS_MDC 表写入 MDC计算结果
|
// 向 RNMAN.GARDS_MDC 表写入 MDC计算结果
|
||||||
analysisManService.saveMDCROI(sampleId, mdcInfoMaps, idAnalysis);
|
analysisManService.saveMDCROI(sampleId, mdcInfoMaps, idAnalysis);
|
||||||
if (bRet) {
|
try {
|
||||||
|
// 存储PHD文件
|
||||||
|
if (StringUtils.isNotBlank(sampleFilePathName)){
|
||||||
|
savePHDFileToDir(sampleTmpPath, sampleFilePathName);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(detFilePathName)){
|
||||||
|
savePHDFileToDir(detTmpPath, detFilePathName);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(qcFilePathName)){
|
||||||
|
savePHDFileToDir(qcTmpPath, qcFilePathName);
|
||||||
|
}
|
||||||
phd.setStatus("R");
|
phd.setStatus("R");
|
||||||
//分析成功后存储日志文件和报告文件
|
//分析成功后存储日志文件和报告文件
|
||||||
for (GStoreMiddleProcessData middleData : middleDatas) {
|
for (GStoreMiddleProcessData middleData : middleDatas) {
|
||||||
String logFileName = middleData.analyses_absolute_LogPath.substring(middleData.analyses_absolute_LogPath.lastIndexOf(StringPool.SLASH)+1);
|
String logFileName = selfStationData.getSampleFileName().replace("PHD", "log");
|
||||||
String rptFileName = middleData.analyses_absolute_ReportPath.substring(middleData.analyses_absolute_ReportPath.lastIndexOf(StringPool.SLASH)+1)+".txt";
|
// String logFileName = middleData.analyses_absolute_LogPath.substring(middleData.analyses_absolute_LogPath.lastIndexOf(StringPool.SLASH)+1);
|
||||||
|
// String rptFileName = middleData.analyses_absolute_ReportPath.substring(middleData.analyses_absolute_ReportPath.lastIndexOf(StringPool.SLASH)+1)+".txt";
|
||||||
|
String rptFileName = StrUtil.subBefore(middleData.analyses_absolute_ReportPath, StringPool.SLASH, true) + ".txt";
|
||||||
File logFile = new File(logFileName);
|
File logFile = new File(logFileName);
|
||||||
File rptFile = new File(rptFileName);
|
File rptFile = new File(rptFileName);
|
||||||
try {
|
try {
|
||||||
|
@ -4996,9 +5056,9 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
rptFile.delete();
|
rptFile.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
// 存储报告文件
|
||||||
result.error500("Save analysis results to DB failed.");
|
} catch (Exception e) {
|
||||||
return result;
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
//更新detial Information
|
//更新detial Information
|
||||||
|
@ -5014,7 +5074,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
map.put("sample", detailedInfo);
|
map.put("sample", detailedInfo);
|
||||||
map.put("qc", qcDetailedInfo);
|
map.put("qc", qcDetailedInfo);
|
||||||
map.put("det", detDetailedInfo);
|
map.put("det", detDetailedInfo);
|
||||||
//发送数据到redis
|
//todo 发送数据到redis
|
||||||
/*middleData.setSample_stationID(String.valueOf(stationId));
|
/*middleData.setSample_stationID(String.valueOf(stationId));
|
||||||
middleData.setSample_id(String.valueOf(phd.getId_sample()));
|
middleData.setSample_id(String.valueOf(phd.getId_sample()));
|
||||||
pushToRedis(middleData, phd);*/
|
pushToRedis(middleData, phd);*/
|
||||||
|
@ -5023,6 +5083,97 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将PHD文件保存到对应的savefile目录下
|
||||||
|
* @param fileTmpPath 临时文件
|
||||||
|
* @param filePath 存储目录
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
void savePHDFileToDir(String fileTmpPath, String filePath) throws Exception{
|
||||||
|
//sample文件的saveFile存储路径
|
||||||
|
String saveSamplePath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath;
|
||||||
|
if (StringUtils.isNotBlank(fileTmpPath) && !saveSamplePath.equals(fileTmpPath.replace(StringPool.BACK_SLASH, StringPool.SLASH))) {
|
||||||
|
File sampleTmp = new File(fileTmpPath);
|
||||||
|
ftpUtil.saveFile(saveSamplePath, new FileInputStream(sampleTmp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public boolean OriginalDataStore(EnergySpectrumStruct sourceData, String tmpPath, String filePathName) {
|
||||||
|
//根据新的文件路径名称查询数据是否存在
|
||||||
|
GardsSampleData isExist = spectrumAnalysisMapper.findSampleByFile(filePathName);
|
||||||
|
//如果数据已经存入过数据库 则 修改状态后返回
|
||||||
|
if (Objects.nonNull(isExist)){
|
||||||
|
//如果文件已经存入过数据库则修改状态
|
||||||
|
spectrumAnalysisMapper.updateAnalysesStatus(filePathName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//读取文件内容
|
||||||
|
File file = new File(tmpPath);
|
||||||
|
try {
|
||||||
|
//获取文件中块名信息
|
||||||
|
List<String> readLines = getFileBlockList(file);
|
||||||
|
//查询台站id
|
||||||
|
Integer stationId = spectrumAnalysisMapper.getStationId(sourceData.site_code);
|
||||||
|
Integer detectorId = spectrumAnalysisMapper.getDetectorId(sourceData.detector_code);
|
||||||
|
if(Objects.isNull(stationId) || Objects.isNull(detectorId)) {
|
||||||
|
String error = "get station_id or detect_id error";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// betaDataFile.setDetectorId(detectorId.toString());
|
||||||
|
//新增Gards_Sample_Data表数据
|
||||||
|
sampleDataSpectrumService.saveSampleData(sourceData, stationId, detectorId, filePathName, readLines);
|
||||||
|
//获取sampleId
|
||||||
|
Integer sampleId = spectrumAnalysisMapper.getSampleId(filePathName);
|
||||||
|
//存储Gards_Sample_Aux表数据
|
||||||
|
sampleAuxSpectrumService.saveSampleAux(sourceData, sampleId, readLines);
|
||||||
|
//判断文件是否包含Comment块 新增Gards_Description数据
|
||||||
|
if (readLines.contains(SampleFileHeader.COMMENT.getMessage())){
|
||||||
|
sampleDescriptionSpectrumService.saveSampleDescription(sourceData, sampleId);
|
||||||
|
}
|
||||||
|
//判断文件是否包含Certificate块 新增Gards_Sample_Cert数据
|
||||||
|
if (readLines.contains(SampleFileHeader.CERTIFICATE.getMessage())){
|
||||||
|
sampleCertSpectrumService.saveSampleCert(sourceData, sampleId);
|
||||||
|
sampleCertLineSpectrumService.saveSampleCertLine(sourceData, sampleId);
|
||||||
|
}
|
||||||
|
// #g_Energy、#b_Energy、#g_Efficiency #b_Efficiency、#b_Resolution、#g_Resolution 新增Gards_Calibration_Pairs_Orig数据
|
||||||
|
calibrationPairsOrigSpectrumService.saveGardsCalibrationPairsOrig(sourceData, sampleId, readLines);
|
||||||
|
//判断文件是否包含TotalEff块 新增Gards_Sample_Cert数据
|
||||||
|
if (readLines.contains(SampleFileHeader.TOTALEFF.getMessage())){
|
||||||
|
totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairs(sourceData, sampleId);
|
||||||
|
}
|
||||||
|
//判断是否包含ROI_Limits块 新增Gards_ROI_Limits数据
|
||||||
|
if (readLines.contains(SampleFileHeader.ROILIMITS.getMessage())){
|
||||||
|
roiLimitsSpectrumService.saveRoiLimits(sourceData, sampleId);
|
||||||
|
}
|
||||||
|
//新增Gards_Spectrum数据
|
||||||
|
spectrumService.saveSpectrum(sourceData, sampleId, readLines, filePathName);
|
||||||
|
//判断是否包含Histogram块 新增Gards_Histogram数据
|
||||||
|
if (readLines.contains(SampleFileHeader.HISTOGRAM.getMessage())){
|
||||||
|
histogramService.saveHistogram(sourceData, sampleId, filePathName);
|
||||||
|
}
|
||||||
|
// todo beta 卡出来的gammaROi数据是否要存入表中?
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public List<String> getFileBlockList(File file) {
|
||||||
|
List<String> readLines = new LinkedList<>();
|
||||||
|
try {
|
||||||
|
List<String> allLines = FileUtils.readLines(file, "UTF-8");
|
||||||
|
for (String line:allLines) {
|
||||||
|
if (line.contains("#")){
|
||||||
|
readLines.add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return readLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
|
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
|
||||||
boolean bRet = false;
|
boolean bRet = false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user