Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
45811d00e0
|
@ -62,7 +62,7 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
|
|||
*/
|
||||
@Override
|
||||
public GardsSampleData getSampleIdAndInputFileName(String measurementId, String dataType, String systemType) {
|
||||
String detectorId = measurementId.substring(0, 8);
|
||||
String detectorId = measurementId.substring(0, 9);
|
||||
final List<GardsSampleData> sampleDatas = this.baseMapper.getSampleIdAndInputFileName(measurementId, dataType, systemType, detectorId);
|
||||
if(!CollectionUtils.isEmpty(sampleDatas)){
|
||||
//如果查询出多条则需要根据inputFileName字段降序排序后返回第一个
|
||||
|
|
|
@ -65,6 +65,10 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
phd.setFilename(fileName);
|
||||
String fromPath = pathName + StringPool.SLASH + fileName;
|
||||
File file = ftpUtil.downloadFile(fromPath, "betaGamma");
|
||||
if (Objects.isNull(file)) {
|
||||
result.error500("ftp file can't find");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
//读取文件信息
|
||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||
|
@ -238,7 +242,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void SetBaseInfo(PHDFile phd) {
|
||||
public void SetBaseInfo(PHDFile phd, String prefixName) {
|
||||
String pathName = phd.getFilepath();
|
||||
String fileName = phd.getFilename();
|
||||
//文件名称需要加上自动处理的前缀以及修改不同的文件后缀名
|
||||
|
@ -248,7 +252,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
File scacFile = null;
|
||||
InputStream inputStreamBase = null;
|
||||
try {
|
||||
String lcFileName = "RNAUTO_"+subFileName + ".lc";
|
||||
String lcFileName = prefixName+"_"+subFileName + ".lc";
|
||||
String fromPathLc = pathName + StringPool.SLASH + lcFileName;
|
||||
lcFile = ftpUtil.downloadFile(fromPathLc, "betaGamma");
|
||||
|
||||
|
@ -258,7 +262,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
//将数据结果赋值给 phdFile的vLc
|
||||
phd.setVLc(vDataLc);
|
||||
|
||||
String scacFileName = "RNAUTO_"+subFileName + ".scac";
|
||||
String scacFileName = prefixName+"_"+subFileName + ".scac";
|
||||
String fromPathScac = pathName + StringPool.SLASH + scacFileName;
|
||||
scacFile = ftpUtil.downloadFile(fromPathScac, "betaGamma");
|
||||
|
||||
|
@ -268,7 +272,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
//将数据结果赋值给 phdFile的vLc
|
||||
phd.setVScac(vDataScac);
|
||||
|
||||
String baselineFileName = "RNAUTO_"+subFileName + ".baseline";
|
||||
String baselineFileName = prefixName+"_"+subFileName + ".baseline";
|
||||
String fromPathBase = pathName + StringPool.SLASH + baselineFileName;
|
||||
inputStreamBase = ftpUtil.downloadFileStream(fromPathBase);
|
||||
// 调用处理BaseCtrl的方法
|
||||
|
@ -861,7 +865,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
return true;
|
||||
}
|
||||
|
||||
public List<String> DetailedInfo(Integer sampleId, PHDFile phd) {
|
||||
public List<String> DetailedInfo(String sampleId, PHDFile phd) {
|
||||
try {
|
||||
// Sample_Id, Station_Code, Detector_Code, System_Type, Data_Type, Spectral_Qualifier,
|
||||
// SRID, Sample_Status, Collect_Start, Sampling_Time, Quantity, Flow_Rate,
|
||||
|
@ -872,7 +876,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
detailInfo.add("");
|
||||
}
|
||||
//读取phdFile的数据 修改detailInfo的数据
|
||||
detailInfo.set(0, Objects.nonNull(sampleId)?sampleId.toString():""); // Sample_Id
|
||||
detailInfo.set(0, StringUtils.isNotBlank(sampleId)?sampleId:""); // Sample_Id
|
||||
detailInfo.set(1, phd.getHeader().getSite_code()); // Station_Code
|
||||
detailInfo.set(2, phd.getHeader().getDetector_code()); // Detector_Code
|
||||
detailInfo.set(3, phd.getHeader().getSystem_type().toUpperCase()); // System_Type
|
||||
|
@ -3020,9 +3024,21 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
anylseEnd = DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss");
|
||||
middleData.analyses_analysisBegin = anylseBegin;
|
||||
middleData.analyses_analysisEnd = anylseEnd;
|
||||
} else if (type.equals(MiddleDataType.InterAction.getType())){ //如果是人工交互分析 则先上传phd对应文件信息
|
||||
//上传本次文件到ftp人工交互存储路径下
|
||||
File sampleTmp = null;
|
||||
try {
|
||||
sampleTmp = analyzeFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + fileAnlyse.getFilepath(), fileAnlyse.getFilename());
|
||||
if (Objects.nonNull(sampleTmp)) {
|
||||
bRet = ftpUtil.saveFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + middleData.analyses_save_filePath.substring(0, middleData.analyses_save_filePath.lastIndexOf(StringPool.SLASH)), middleData.analyses_save_filePath.substring(middleData.analyses_save_filePath.lastIndexOf(StringPool.SLASH)+1), new FileInputStream(sampleTmp));
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
sampleTmp.delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//gards_analyses
|
||||
String qsBaseLinePath = path+StringPool.SLASH+middleData.analyses_analyst+"_"+baselineName;
|
||||
qsBaseLinePath = qsBaseLinePath.replace(StringPool.BACK_SLASH, StringPool.SLASH);
|
||||
|
|
|
@ -605,7 +605,8 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
|||
return file;
|
||||
}
|
||||
|
||||
public void analyzeSpectrum(File sampleTmp, File gasTmp, File detTmp, BgCalibratePara BgCalPara, Map<String, Object> map) {
|
||||
public boolean analyzeSpectrum(File sampleTmp, File gasTmp, File detTmp, BgCalibratePara BgCalPara, Map<String, Object> map) {
|
||||
boolean bRet = true;
|
||||
//调用动态库解析文件
|
||||
BgAnalyseResult analyseResult = null;
|
||||
if (Objects.isNull(BgCalPara)) {
|
||||
|
@ -613,84 +614,90 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
|||
} else {
|
||||
analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), BgCalPara);
|
||||
}
|
||||
EnergySpectrumStruct sample = analyzeFileSourceData(sampleTmp);
|
||||
EnergySpectrumStruct gas = analyzeFileSourceData(gasTmp);
|
||||
EnergySpectrumStruct det = analyzeFileSourceData(detTmp);
|
||||
String sampleFileName = (String) map.get("sampleFileName");
|
||||
String logName = sampleFileName.replace("PHD", "log");
|
||||
OutPutRnLog(analyseResult, sample, gas, det, logName);
|
||||
//需要返回到前端的XeData数据
|
||||
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
|
||||
//存入计算后得到的xeData数据
|
||||
GardsXeResultsSpectrum xe131m = new GardsXeResultsSpectrum();
|
||||
xe131m.setNuclideName(XeNuclideName.XE_131m.getType());
|
||||
xe131m.setConc(analyseResult.Xe131m_con);
|
||||
xe131m.setConcErr(analyseResult.Xe131m_uncer);
|
||||
xe131m.setLc(analyseResult.LC_Xe131m);
|
||||
xe131m.setMdc(analyseResult.MDC_Xe131m);
|
||||
xe131m.setNidFlag(analyseResult.XE_131m_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe131m);
|
||||
GardsXeResultsSpectrum xe133 = new GardsXeResultsSpectrum();
|
||||
xe133.setNuclideName(XeNuclideName.XE_133.getType());
|
||||
xe133.setConc(analyseResult.Xe133_con);
|
||||
xe133.setConcErr(analyseResult.Xe133_uncer);
|
||||
xe133.setLc(analyseResult.LC_Xe133);
|
||||
xe133.setMdc(analyseResult.MDC_Xe133);
|
||||
xe133.setNidFlag(analyseResult.XE_133_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe133);
|
||||
GardsXeResultsSpectrum xe133m = new GardsXeResultsSpectrum();
|
||||
xe133m.setNuclideName(XeNuclideName.XE_133m.getType());
|
||||
xe133m.setConc(analyseResult.Xe133m_con);
|
||||
xe133m.setConcErr(analyseResult.Xe133m_uncer);
|
||||
xe133m.setLc(analyseResult.LC_Xe133m);
|
||||
xe133m.setMdc(analyseResult.MDC_Xe133m);
|
||||
xe133m.setNidFlag(analyseResult.XE_133m_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe133m);
|
||||
GardsXeResultsSpectrum xe135 = new GardsXeResultsSpectrum();
|
||||
xe135.setNuclideName(XeNuclideName.XE_135.getType());
|
||||
xe135.setConc(analyseResult.Xe135_con);
|
||||
xe135.setConcErr(analyseResult.Xe135_uncer);
|
||||
xe135.setLc(analyseResult.LC_Xe135);
|
||||
xe135.setMdc(analyseResult.MDC_Xe135);
|
||||
xe135.setNidFlag(analyseResult.XE_135_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe135);
|
||||
map.put("XeData", xeResultsSpectrumList);
|
||||
//新计算得到的边界值
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.S_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.S_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.S_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.S_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.S_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.S_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
if (StringUtils.isNotBlank(analyseResult.error_log) && !analyseResult.error_log.equalsIgnoreCase("no error.")) {
|
||||
bRet = false;
|
||||
return bRet;
|
||||
} else {
|
||||
EnergySpectrumStruct sample = analyzeFileSourceData(sampleTmp);
|
||||
EnergySpectrumStruct gas = analyzeFileSourceData(gasTmp);
|
||||
EnergySpectrumStruct det = analyzeFileSourceData(detTmp);
|
||||
String sampleFileName = (String) map.get("sampleFileName");
|
||||
String logName = sampleFileName.replace("PHD", "log");
|
||||
OutPutRnLog(analyseResult, sample, gas, det, logName);
|
||||
//需要返回到前端的XeData数据
|
||||
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
|
||||
//存入计算后得到的xeData数据
|
||||
GardsXeResultsSpectrum xe131m = new GardsXeResultsSpectrum();
|
||||
xe131m.setNuclideName(XeNuclideName.XE_131m.getType());
|
||||
xe131m.setConc(analyseResult.Xe131m_con);
|
||||
xe131m.setConcErr(analyseResult.Xe131m_uncer);
|
||||
xe131m.setLc(analyseResult.LC_Xe131m);
|
||||
xe131m.setMdc(analyseResult.MDC_Xe131m);
|
||||
xe131m.setNidFlag(analyseResult.XE_131m_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe131m);
|
||||
GardsXeResultsSpectrum xe133 = new GardsXeResultsSpectrum();
|
||||
xe133.setNuclideName(XeNuclideName.XE_133.getType());
|
||||
xe133.setConc(analyseResult.Xe133_con);
|
||||
xe133.setConcErr(analyseResult.Xe133_uncer);
|
||||
xe133.setLc(analyseResult.LC_Xe133);
|
||||
xe133.setMdc(analyseResult.MDC_Xe133);
|
||||
xe133.setNidFlag(analyseResult.XE_133_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe133);
|
||||
GardsXeResultsSpectrum xe133m = new GardsXeResultsSpectrum();
|
||||
xe133m.setNuclideName(XeNuclideName.XE_133m.getType());
|
||||
xe133m.setConc(analyseResult.Xe133m_con);
|
||||
xe133m.setConcErr(analyseResult.Xe133m_uncer);
|
||||
xe133m.setLc(analyseResult.LC_Xe133m);
|
||||
xe133m.setMdc(analyseResult.MDC_Xe133m);
|
||||
xe133m.setNidFlag(analyseResult.XE_133m_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe133m);
|
||||
GardsXeResultsSpectrum xe135 = new GardsXeResultsSpectrum();
|
||||
xe135.setNuclideName(XeNuclideName.XE_135.getType());
|
||||
xe135.setConc(analyseResult.Xe135_con);
|
||||
xe135.setConcErr(analyseResult.Xe135_uncer);
|
||||
xe135.setLc(analyseResult.LC_Xe135);
|
||||
xe135.setMdc(analyseResult.MDC_Xe135);
|
||||
xe135.setNidFlag(analyseResult.XE_135_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe135);
|
||||
map.put("XeData", xeResultsSpectrumList);
|
||||
//新计算得到的边界值
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.S_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.S_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.S_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.S_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.S_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.S_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
map.put("SampleBoundary", boundaryList);
|
||||
}
|
||||
map.put("SampleBoundary", boundaryList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.G_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.G_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.G_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.G_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.G_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.G_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.G_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.G_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.G_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.G_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.G_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.G_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
map.put("GasBoundary", boundaryList);
|
||||
}
|
||||
map.put("GasBoundary", boundaryList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.D_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.D_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.D_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.D_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.D_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.D_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.D_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.D_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.D_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.D_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.D_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.D_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
map.put("DetBoundary", boundaryList);
|
||||
}
|
||||
map.put("DetBoundary", boundaryList);
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1239,16 +1246,24 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
|||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//第三十六行数据
|
||||
if (bgAnalyseResult.s_b_fitting_c_e.size() > 0) {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_b_fitting_c_e.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_b_fitting_c_e.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_b_fitting_c_e.get(2)))));
|
||||
if (bgAnalyseResult.s_b_fitting_c_e != null && CollectionUtils.isNotEmpty(bgAnalyseResult.s_b_fitting_c_e)) {
|
||||
if (bgAnalyseResult.s_b_fitting_c_e.size() > 0) {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_b_fitting_c_e.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_b_fitting_c_e.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_b_fitting_c_e.get(2)))));
|
||||
} else {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
} else {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//第三十七行数据
|
||||
if (bgAnalyseResult.s_b_fitting_e_c.size() > 0) {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_b_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_b_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_b_fitting_e_c.get(2)))));
|
||||
if (bgAnalyseResult.s_b_fitting_e_c != null && CollectionUtils.isNotEmpty(bgAnalyseResult.s_b_fitting_e_c)) {
|
||||
if (bgAnalyseResult.s_b_fitting_e_c.size() > 0) {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_b_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_b_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_b_fitting_e_c.get(2)))));
|
||||
} else {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
} else {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
|
@ -1261,16 +1276,24 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
|||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//第三十六行数据
|
||||
if (bgAnalyseResult.s_g_fitting_c_e.size() > 0) {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_c_e.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_c_e.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_c_e.get(2)))));
|
||||
if (bgAnalyseResult.s_g_fitting_c_e !=null && CollectionUtils.isNotEmpty(bgAnalyseResult.s_g_fitting_c_e)) {
|
||||
if (bgAnalyseResult.s_g_fitting_c_e.size() > 0) {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_c_e.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_c_e.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_c_e.get(2)))));
|
||||
} else {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
} else {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//第三十七行数据
|
||||
if (bgAnalyseResult.s_g_fitting_e_c.size() > 0) {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_e_c.get(2)))));
|
||||
if (bgAnalyseResult.s_g_fitting_e_c != null && CollectionUtils.isNotEmpty(bgAnalyseResult.s_g_fitting_e_c)) {
|
||||
if (bgAnalyseResult.s_g_fitting_e_c.size() > 0) {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_e_c.get(2)))));
|
||||
} else {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
} else {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
|
@ -1323,20 +1346,28 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
|||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//第四十四行数据
|
||||
if (bgAnalyseResult.d_b_fitting_c_e.size() > 0) {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_b_fitting_c_e.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_b_fitting_c_e.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_b_fitting_c_e.get(2)))));
|
||||
if (bgAnalyseResult.d_b_fitting_c_e != null && CollectionUtils.isNotEmpty(bgAnalyseResult.d_b_fitting_c_e)) {
|
||||
if (bgAnalyseResult.d_b_fitting_c_e.size() > 0) {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_b_fitting_c_e.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_b_fitting_c_e.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_b_fitting_c_e.get(2)))));
|
||||
} else {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
} else {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
|
||||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//第四十五行数据
|
||||
if (bgAnalyseResult.d_b_fitting_e_c.size() > 0) {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_b_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_b_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_b_fitting_e_c.get(2)))));
|
||||
if (bgAnalyseResult.d_b_fitting_e_c != null && CollectionUtils.isNotEmpty(bgAnalyseResult.d_b_fitting_e_c)) {
|
||||
if (bgAnalyseResult.d_b_fitting_e_c.size() > 0) {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_b_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_b_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_b_fitting_e_c.get(2)))));
|
||||
} else {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
} else {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
|
||||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//换行
|
||||
|
@ -1346,16 +1377,24 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
|||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//第四十四行数据
|
||||
if (bgAnalyseResult.d_g_fitting_c_e.size() > 0) {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_g_fitting_c_e.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_g_fitting_c_e.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_g_fitting_c_e.get(2)))));
|
||||
if (bgAnalyseResult.d_g_fitting_c_e != null && CollectionUtils.isNotEmpty(bgAnalyseResult.d_g_fitting_c_e)) {
|
||||
if (bgAnalyseResult.d_g_fitting_c_e.size() > 0) {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_g_fitting_c_e.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_g_fitting_c_e.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_g_fitting_c_e.get(2)))));
|
||||
} else {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
} else {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//第四十五行数据
|
||||
if (bgAnalyseResult.d_g_fitting_e_c.size() > 0) {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_g_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_g_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_g_fitting_e_c.get(2)))));
|
||||
if (bgAnalyseResult.d_g_fitting_e_c != null && CollectionUtils.isNotEmpty(bgAnalyseResult.d_g_fitting_e_c)) {
|
||||
if (bgAnalyseResult.d_g_fitting_e_c.size() > 0) {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_g_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_g_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.d_g_fitting_e_c.get(2)))));
|
||||
} else {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
} else {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
|
@ -1403,16 +1442,24 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
|||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//第五十一行数据
|
||||
if (bgAnalyseResult.g_b_fitting_c_e.size() > 0) {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_b_fitting_c_e.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_b_fitting_c_e.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_b_fitting_c_e.get(2)))));
|
||||
if (bgAnalyseResult.g_b_fitting_c_e != null && CollectionUtils.isNotEmpty(bgAnalyseResult.g_b_fitting_c_e)) {
|
||||
if (bgAnalyseResult.g_b_fitting_c_e.size() > 0) {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_b_fitting_c_e.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_b_fitting_c_e.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_b_fitting_c_e.get(2)))));
|
||||
} else {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
} else {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//第五十二行数据
|
||||
if (bgAnalyseResult.g_b_fitting_e_c.size() > 0) {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_b_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_b_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_b_fitting_e_c.get(2)))));
|
||||
if (bgAnalyseResult.g_b_fitting_e_c != null && CollectionUtils.isNotEmpty(bgAnalyseResult.g_b_fitting_e_c)) {
|
||||
if (bgAnalyseResult.g_b_fitting_e_c.size() > 0) {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_b_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_b_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_b_fitting_e_c.get(2)))));
|
||||
} else {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
} else {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
|
@ -1425,16 +1472,24 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
|||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//第五十四行数据
|
||||
if (bgAnalyseResult.g_g_fitting_c_e.size() > 0) {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_g_fitting_c_e.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_g_fitting_c_e.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_g_fitting_c_e.get(2)))));
|
||||
if (bgAnalyseResult.g_g_fitting_c_e != null && CollectionUtils.isNotEmpty(bgAnalyseResult.g_g_fitting_c_e)) {
|
||||
if (bgAnalyseResult.g_g_fitting_c_e.size() > 0) {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_g_fitting_c_e.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_g_fitting_c_e.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_g_fitting_c_e.get(2)))));
|
||||
} else {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
} else {
|
||||
out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
//换行
|
||||
out.append(System.lineSeparator());
|
||||
//第五十五行数据
|
||||
if (bgAnalyseResult.g_g_fitting_e_c.size() > 0) {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_g_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_g_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_g_fitting_e_c.get(2)))));
|
||||
if (bgAnalyseResult.g_g_fitting_e_c != null && CollectionUtils.isNotEmpty(bgAnalyseResult.g_g_fitting_e_c)) {
|
||||
if (bgAnalyseResult.g_g_fitting_e_c.size() > 0) {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_g_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_g_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.g_g_fitting_e_c.get(2)))));
|
||||
} else {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
} else {
|
||||
out.append(rowFormat("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?", "?", "?"));
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class BgDataAnlyseResultIn implements Serializable {
|
|||
/**
|
||||
* 标识本次操作是否进行过解析
|
||||
*/
|
||||
private boolean bProcessed;
|
||||
private boolean savedAnalysisResult;
|
||||
|
||||
/**
|
||||
* 分析员名称
|
||||
|
@ -266,7 +266,7 @@ public class BgDataAnlyseResultIn implements Serializable {
|
|||
|
||||
public BgDataAnlyseResultIn() {
|
||||
comment = "";
|
||||
bProcessed = false;
|
||||
savedAnalysisResult = false;
|
||||
userName = "";
|
||||
stationName = "";
|
||||
dbName = "";
|
||||
|
|
|
@ -85,6 +85,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
@Autowired
|
||||
private FileFtransitUtil fileFtransitUtil;
|
||||
@Autowired
|
||||
private NameStandUtil nameStandUtil;
|
||||
@Autowired
|
||||
private DBUtil dbUtil;
|
||||
@Autowired
|
||||
private UserTaskUtil userTaskUtil;
|
||||
|
@ -160,9 +162,24 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
return result;
|
||||
}
|
||||
// 声明基础数组信息
|
||||
gammaFileUtil.SetBaseInfo(phd);
|
||||
if (dbName.equals("auto")) {
|
||||
gammaFileUtil.SetBaseInfo(phd, "RNAUTO");
|
||||
} else if (dbName.equals("man")) {
|
||||
gammaFileUtil.SetBaseInfo(phd, userName);
|
||||
}
|
||||
// 从数据库中读取相关信息
|
||||
boolean bRet = getResultFromDB(dbName, userName, sampleId, phd, result);
|
||||
if (!redisUtil.hasKey(fileName+"-"+userName)) {
|
||||
// 查询当前用户关联的核素信息
|
||||
List<String> userLib = new LinkedList<>();
|
||||
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
|
||||
if (CollectionUtils.isEmpty(userLib)) {
|
||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||
}
|
||||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
||||
}
|
||||
if (!bRet) {
|
||||
return result;
|
||||
}
|
||||
|
@ -171,6 +188,17 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||
String fileName = samfileName;
|
||||
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phd, result);
|
||||
if (!redisUtil.hasKey(fileName+"-"+userName)) {
|
||||
// 查询当前用户关联的核素信息
|
||||
List<String> userLib = new LinkedList<>();
|
||||
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
|
||||
if (CollectionUtils.isEmpty(userLib)) {
|
||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||
}
|
||||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
||||
}
|
||||
if (!flag) {
|
||||
return result;
|
||||
}
|
||||
|
@ -437,18 +465,24 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
return result;
|
||||
}
|
||||
// 加载phd数据所需的lc,scac,baseline数据
|
||||
gammaFileUtil.SetBaseInfo(phd);
|
||||
if (dbName.equals("auto")) {
|
||||
gammaFileUtil.SetBaseInfo(phd, "RNAUTO");
|
||||
} else if (dbName.equals("man")) {
|
||||
gammaFileUtil.SetBaseInfo(phd, userName);
|
||||
}
|
||||
// 从数据库中读取phd其他相关信息
|
||||
boolean bRet = getResultFromDB(dbName, userName, sampleId, phd, result);
|
||||
// 查询当前用户关联的核素信息
|
||||
List<String> userLib = new LinkedList<>();
|
||||
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
|
||||
if (CollectionUtils.isEmpty(userLib)) {
|
||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||
if (!redisUtil.hasKey(fileName+"-"+userName)) {
|
||||
// 查询当前用户关联的核素信息
|
||||
List<String> userLib = new LinkedList<>();
|
||||
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
|
||||
if (CollectionUtils.isEmpty(userLib)) {
|
||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||
}
|
||||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
||||
}
|
||||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
||||
// 判断数据库信息是否读取正常
|
||||
if (!bRet) {
|
||||
return result;
|
||||
|
@ -460,7 +494,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
List<String> qcstate = gammaFileUtil.Qcstate(phd);
|
||||
map.put("QCFlag", qcstate);
|
||||
// 更新 ‘Detailed Information’ 信息
|
||||
List<String> detailedInfo = gammaFileUtil.DetailedInfo(sampleId, phd);
|
||||
List<String> detailedInfo = gammaFileUtil.DetailedInfo(String.valueOf(sampleId), phd);
|
||||
map.put("DetailedInformation", detailedInfo);
|
||||
// 更新 ACQ 模块中各时间信息
|
||||
map.put("start_time", phd.getAcq().getAcquisition_start_date() + "\n" + phd.getAcq().getAcquisition_start_time());
|
||||
|
@ -486,7 +520,14 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
|
||||
public boolean getResultFromDB(String dbName, String userName, Integer sampleId, PHDFile phd, Result result) {
|
||||
// 判断连接的数据库
|
||||
String T_analy, T_calib, T_peaks, T_param, T_nuc_line, T_nuc_act, T_qc, T_setting;
|
||||
String T_analy = "";
|
||||
String T_calib = "";
|
||||
String T_peaks = "";
|
||||
String T_param = "";
|
||||
String T_nuc_line = "";
|
||||
String T_nuc_act = "";
|
||||
String T_qc = "";
|
||||
String T_setting = "";
|
||||
if (dbName.equals("auto")) {
|
||||
T_analy = "RNAUTO.GARDS_ANALYSES";
|
||||
T_calib = "RNAUTO.GARDS_CALIBRATION_PAIRS";
|
||||
|
@ -496,7 +537,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
T_nuc_act = "RNAUTO.GARDS_NUCL_IDED";
|
||||
T_qc = "RNAUTO.GARDS_QC_CHECK";
|
||||
userName = "RNAUTO";
|
||||
} else {
|
||||
} else if (dbName.equals("man")) {
|
||||
T_analy = "RNMAN.GARDS_ANALYSES";
|
||||
T_calib = "RNMAN.GARDS_CALIBRATION_PAIRS";
|
||||
T_peaks = "RNMAN.GARDS_PEAKS";
|
||||
|
@ -793,24 +834,26 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
phd = new PHDFile();
|
||||
// 加载文件内容
|
||||
boolean bRet = gammaFileUtil.loadFile(path, fileName, phd, result);
|
||||
// 查询当前用户关联的核素信息
|
||||
List<String> userLib = new LinkedList<>();
|
||||
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
|
||||
if (CollectionUtils.isEmpty(userLib)) {
|
||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||
}
|
||||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
||||
if (!bRet) {
|
||||
return result;
|
||||
}
|
||||
if (!redisUtil.hasKey(fileName+"-"+userName)) {
|
||||
// 查询当前用户关联的核素信息
|
||||
List<String> userLib = new LinkedList<>();
|
||||
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
|
||||
if (CollectionUtils.isEmpty(userLib)) {
|
||||
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||
}
|
||||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
||||
}
|
||||
}
|
||||
// 更新 ‘QC Flags’ 状态
|
||||
List<String> qcstate = gammaFileUtil.Qcstate(phd);
|
||||
map.put("QCFlag", qcstate);
|
||||
// 更新 ‘Detailed Information’ 信息
|
||||
List<String> detailedInfo = gammaFileUtil.DetailedInfo(null, phd);
|
||||
List<String> detailedInfo = gammaFileUtil.DetailedInfo(phd.getId_sample(), phd);
|
||||
map.put("DetailedInformation", detailedInfo);
|
||||
// 更新 ACQ 模块中各时间信息
|
||||
map.put("start_time", phd.getAcq().getAcquisition_start_date() + "\n" + phd.getAcq().getAcquisition_start_time());
|
||||
|
@ -839,6 +882,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
String key = fileName + StrUtil.DASHED + username;
|
||||
// 删除指定key的Cache
|
||||
localCache.deletePHDCache(key);
|
||||
redisUtil.del(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4328,26 +4372,36 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
public Result saveToDB(String fileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
boolean bRet = true;
|
||||
boolean bRet = false;
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName);
|
||||
if (Objects.isNull(phd)) {
|
||||
result.error500("Please select the parse file first!");
|
||||
return result;
|
||||
}
|
||||
// 查看分析员是否有权限操作当前台站信息
|
||||
// 判断当前分析员是否有过排班任务
|
||||
Integer stationId = spectrumAnalysisMapper.getStationId(phd.getHeader().getSite_code());
|
||||
boolean bAnalysisResultWriteAuthority = userTaskUtil.CheckUserWriteAuthorityForStation(userName, stationId);
|
||||
// 如果用户没有权限操作 则查看当前用户是否是高级分析员/管理员
|
||||
if (!bAnalysisResultWriteAuthority) {
|
||||
List<String> roleCodes = userTaskUtil.findRoleCodeByUserName(userName);
|
||||
// 如果只是分析员 则无法保存数据库 返回信息
|
||||
if (roleCodes.contains(RoleType.Role_Analyst) && !roleCodes.contains(RoleType.Role_SuperAnalyst) && !roleCodes.contains(RoleType.Role_Manager)) {
|
||||
bRet = false;
|
||||
}
|
||||
if (!phd.isBAnalyed()) {
|
||||
result.error500("Please first Reprocessing!");
|
||||
return result;
|
||||
}
|
||||
if (!bRet) {
|
||||
//获取当前操作的台站的id
|
||||
Integer stationId = spectrumAnalysisMapper.getStationId(phd.getHeader().getSite_code());
|
||||
//判断当前分析员当天是否有对应台站的排班任务
|
||||
List<String> userStation = userTaskUtil.findUserStation(userName);
|
||||
boolean bAnalysisResultWriteAuthority = false;
|
||||
if (userStation.contains(String.valueOf(stationId))) {
|
||||
bAnalysisResultWriteAuthority = true;
|
||||
}
|
||||
//根据系统类型获取系统存储前缀
|
||||
String sysTemSubdir = nameStandUtil.GetSysTemSubdir(phd.getHeader().getSystem_type());
|
||||
//根据数据类型获取数据存储前缀
|
||||
String dateTypeSubdir = nameStandUtil.GetDateTypeSubdir(phd.getMsgInfo().getData_type());
|
||||
//格式化名称
|
||||
Map<String, String> nameMap = nameStandUtil.NameStandard(phd);
|
||||
String mSaveFileName = nameMap.get("saveFile");
|
||||
//判断当前分析员是否有过历史分析当前文件
|
||||
Integer isExist = spectrumAnalysisMapper.SampleIsExist(sysTemSubdir+ dateTypeSubdir + StringPool.SLASH + mSaveFileName, userName);
|
||||
// 如果用户没有权限操作 则查看当前用户是否是高级分析员/管理员
|
||||
if (!bAnalysisResultWriteAuthority && Objects.isNull(isExist)) {
|
||||
result.error500("You have no permission to save results to DB!");
|
||||
return result;
|
||||
}
|
||||
|
@ -4366,7 +4420,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
phd.setStatus(sampleData.getStatus());
|
||||
} else {
|
||||
// 如果sampleData为空 存储数据
|
||||
SaveSampleToDB(phd, middleData.analyses_save_filePath);
|
||||
bRet = SaveSampleToDB(phd, middleData.analyses_save_filePath);
|
||||
}
|
||||
if (!bRet) {
|
||||
result.error500("The Database hasn't this Spectrum(" + phd.getFilename() + ") and Insert it to Database failed.");
|
||||
|
@ -4386,8 +4440,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
if (StringUtils.isBlank(idAnalysis)) {
|
||||
// 向 RNMAN.GARDS_ANALYSES 表插入数据
|
||||
analysesSpectrumService.insertEntity(middleData, phd, userName, comments);
|
||||
// 查询idAnalysis
|
||||
idAnalysis = spectrumAnalysisMapper.getIdAnalysisByIdAnalyst(phd.getId_sample(), userName);
|
||||
// 修改sample_data状态
|
||||
spectrumAnalysisMapper.updateAnalysesStatus(middleData.analyses_save_filePath);
|
||||
} else {
|
||||
|
@ -4427,27 +4479,48 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
paths.add(middleData.analyses_lc_filePath);
|
||||
paths.add(middleData.analyses_scac_filePath);
|
||||
paths.add(middleData.analyses_baseline_filePath);
|
||||
if (false) paths.add(middleData.analyses_save_filePath);
|
||||
if (bRet) {
|
||||
paths.add(middleData.analyses_save_filePath);
|
||||
}
|
||||
} else {
|
||||
result.error500("Save analysis results to DB failed.");
|
||||
return result;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
//更新detial Information
|
||||
List<String> detailedInfo = gammaFileUtil.DetailedInfo(phd.getId_sample(), phd);
|
||||
map.put("DetailedInformation", detailedInfo);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void SaveSampleToDB(PHDFile phd, String input_file_name) {
|
||||
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
|
||||
boolean bRet = false;
|
||||
String sit_det_code = phd.getHeader().getSite_code();
|
||||
String detect_code = phd.getHeader().getDetector_code();
|
||||
// 查询 station_id 和 detect_id
|
||||
Integer station_id = spectrumAnalysisMapper.getStationId(sit_det_code);
|
||||
Integer detect_id = spectrumAnalysisMapper.getDetectorId(detect_code);
|
||||
// ORIGINAL.GARDS_SAMPLE_DATA 表数据
|
||||
sampleDataSpectrumService.saveSampleDataGamma(phd, input_file_name, station_id, detect_id);
|
||||
Integer saveSampleDataGamma = sampleDataSpectrumService.saveSampleDataGamma(phd, input_file_name, station_id, detect_id);
|
||||
if (saveSampleDataGamma > 0) {
|
||||
bRet = true;
|
||||
} else {
|
||||
bRet = false;
|
||||
return bRet;
|
||||
}
|
||||
// 查询新增后的 sample_id 的值赋给变量 DECLARESAMPLEID
|
||||
Integer sampleId = spectrumAnalysisMapper.getSampleId(input_file_name);
|
||||
// ORIGINAL.GARDS_SAMPLE_AUX 表数据
|
||||
sampleAuxSpectrumService.saveSampleAuxGamma(phd, sampleId);
|
||||
Integer saveSampleAuxGamma = sampleAuxSpectrumService.saveSampleAuxGamma(phd, sampleId);
|
||||
if (saveSampleAuxGamma > 0) {
|
||||
bRet = true;
|
||||
} else {
|
||||
bRet = false;
|
||||
return bRet;
|
||||
}
|
||||
// ORIGINAL.gards_sample_description 数据表
|
||||
sampleDescriptionSpectrumService.saveSampleDescriptionGamma(phd, sampleId);
|
||||
// ORIGINAL.GARDS_SAMPLE_CERT 和 ORIGINAL.GARDS_SAMPLE_CERT_LINE 数据表
|
||||
|
@ -4456,17 +4529,18 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
sampleCertLineSpectrumService.saveSampleCertLineGamma(phd, sampleId);
|
||||
}
|
||||
// gards_ calibration_pairs_orig数据表
|
||||
calibrationPairsOrigSpectrumService.saveCalibrationPairsOrigGamma(phd, sampleId);
|
||||
Integer saveCalibrationPairsOrigGamma = calibrationPairsOrigSpectrumService.saveCalibrationPairsOrigGamma(phd, sampleId);
|
||||
// gards_total_efficiency _pairs数据表(IDC没有)
|
||||
totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairsGamma(phd, sampleId);
|
||||
Integer saveTotalEfficiencyPairsGamma = totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairsGamma(phd, sampleId);
|
||||
// gards_spectrum数据表
|
||||
spectrumService.saveSpectrumGamma(phd, sampleId, input_file_name);
|
||||
Integer saveSpectrumGamma = spectrumService.saveSpectrumGamma(phd, sampleId, input_file_name);
|
||||
// 根据文件名称获取sample基础数据信息
|
||||
GardsSampleDataSpectrum samplData = spectrumAnalysisMapper.findSampleByFilePath(input_file_name);
|
||||
if (Objects.nonNull(samplData)) {
|
||||
phd.setId_sample(samplData.getSampleId().toString());
|
||||
phd.setStatus(samplData.getStatus());
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4523,20 +4597,22 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
// 换行
|
||||
strBuild.append(System.lineSeparator());
|
||||
// 文本内容第三块数据
|
||||
List<List<String>> peakNuclides = phd.getVPeak().stream().map(item -> item.nuclides).collect(Collectors.toList());
|
||||
List<String> nuclides = new LinkedList<>();
|
||||
for (int i = 0; i < peakNuclides.size(); i++) {
|
||||
List<String> peakNuclide = peakNuclides.get(i);
|
||||
nuclides.addAll(peakNuclide);
|
||||
if (CollectionUtils.isNotEmpty(phd.getVPeak())) {
|
||||
List<List<String>> peakNuclides = phd.getVPeak().stream().map(item -> item.nuclides).collect(Collectors.toList());
|
||||
List<String> nuclides = new LinkedList<>();
|
||||
for (int i = 0; i < peakNuclides.size(); i++) {
|
||||
List<String> peakNuclide = peakNuclides.get(i);
|
||||
nuclides.addAll(peakNuclide);
|
||||
}
|
||||
nuclides = nuclides.stream().distinct().collect(Collectors.toList());
|
||||
String nuclideStr = "";
|
||||
for (int i = 0; i < nuclides.size(); i++) {
|
||||
nuclideStr += " " + nuclides.get(i);
|
||||
}
|
||||
strBuild.append(nuclideStr);
|
||||
// 换行
|
||||
strBuild.append(System.lineSeparator());
|
||||
}
|
||||
nuclides = nuclides.stream().distinct().collect(Collectors.toList());
|
||||
String nuclideStr = "";
|
||||
for (int i = 0; i < nuclides.size(); i++) {
|
||||
nuclideStr += " " + nuclides.get(i);
|
||||
}
|
||||
strBuild.append(nuclideStr);
|
||||
// 换行
|
||||
strBuild.append(System.lineSeparator());
|
||||
// 换行
|
||||
strBuild.append(System.lineSeparator());
|
||||
// 文本内容第四块
|
||||
|
@ -4569,42 +4645,44 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
strBuild.append(System.lineSeparator());
|
||||
// 文本内容第五块数据
|
||||
Map<String, NuclideActMda> mapNucActMda = phd.getMapNucActMda();
|
||||
for (Map.Entry<String, NuclideActMda> entry : mapNucActMda.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
NuclideActMda nuc = entry.getValue();
|
||||
String halflifeValue = "";
|
||||
if (nuc.isBCalculateMDA()) {
|
||||
String units = "S";
|
||||
double halflife = nuc.getHalflife();
|
||||
if (halflife >= 31556736) {// 1年 = 365.24 * 24 * 60 * 60 = 31556736s
|
||||
halflife /= 31556736;
|
||||
units = "A";
|
||||
} else if (halflife >= 86400) {// 1天 = 24 * 60 * 60 = 86400s
|
||||
halflife /= 86400;
|
||||
units = "D";
|
||||
} else if (halflife >= 3600) {
|
||||
halflife /= 3600;
|
||||
units = "H";
|
||||
if (CollectionUtils.isNotEmpty(mapNucActMda)) {
|
||||
for (Map.Entry<String, NuclideActMda> entry : mapNucActMda.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
NuclideActMda nuc = entry.getValue();
|
||||
String halflifeValue = "";
|
||||
if (nuc.isBCalculateMDA()) {
|
||||
String units = "S";
|
||||
double halflife = nuc.getHalflife();
|
||||
if (halflife >= 31556736) {// 1年 = 365.24 * 24 * 60 * 60 = 31556736s
|
||||
halflife /= 31556736;
|
||||
units = "A";
|
||||
} else if (halflife >= 86400) {// 1天 = 24 * 60 * 60 = 86400s
|
||||
halflife /= 86400;
|
||||
units = "D";
|
||||
} else if (halflife >= 3600) {
|
||||
halflife /= 3600;
|
||||
units = "H";
|
||||
}
|
||||
halflifeValue = NumberFormatUtil.numberFormat(String.valueOf(halflife)) + units;
|
||||
}
|
||||
String efficiency = NumberFormatUtil.numberFormat(String.valueOf(nuc.getEfficiency()));
|
||||
String activity = NumberFormatUtil.numberFormat(String.valueOf(nuc.getActivity()));
|
||||
String actErr = "";
|
||||
if (nuc.getActivity() > 0) {
|
||||
actErr = NumberFormatUtil.numberFormat(String.valueOf(nuc.getAct_err() / nuc.getActivity() * 100));
|
||||
}
|
||||
String mda = NumberFormatUtil.numberFormat(String.valueOf(nuc.getMda()));
|
||||
String conc = NumberFormatUtil.numberFormat(String.valueOf(nuc.getConcentration()));
|
||||
String mdc = NumberFormatUtil.numberFormat(String.valueOf(nuc.getMdc()));
|
||||
if (nuc.getCalculateIdx() >= 0 && nuc.getCalculateIdx() < nuc.getVEnergy().size()) {
|
||||
String yield = NumberFormatUtil.numberFormat(String.valueOf(nuc.getVYield().get(nuc.getCalculateIdx()) * 100));
|
||||
String energy = NumberFormatUtil.numberFormat(String.valueOf(nuc.getVEnergy().get(nuc.getCalculateIdx())));
|
||||
strBuild.append(rowFormat(title5, key, halflifeValue, yield, energy, efficiency, activity, actErr, mda, conc, mdc));
|
||||
strBuild.append(System.lineSeparator());
|
||||
} else {
|
||||
strBuild.append(rowFormat(title5, key, halflifeValue, "NULL", "NULL", efficiency, activity, actErr, mda, conc, mdc));
|
||||
strBuild.append(System.lineSeparator());
|
||||
}
|
||||
halflifeValue = NumberFormatUtil.numberFormat(String.valueOf(halflife)) + units;
|
||||
}
|
||||
String efficiency = NumberFormatUtil.numberFormat(String.valueOf(nuc.getEfficiency()));
|
||||
String activity = NumberFormatUtil.numberFormat(String.valueOf(nuc.getActivity()));
|
||||
String actErr = "";
|
||||
if (nuc.getActivity() > 0) {
|
||||
actErr = NumberFormatUtil.numberFormat(String.valueOf(nuc.getAct_err() / nuc.getActivity() * 100));
|
||||
}
|
||||
String mda = NumberFormatUtil.numberFormat(String.valueOf(nuc.getMda()));
|
||||
String conc = NumberFormatUtil.numberFormat(String.valueOf(nuc.getConcentration()));
|
||||
String mdc = NumberFormatUtil.numberFormat(String.valueOf(nuc.getMdc()));
|
||||
if (nuc.getCalculateIdx() >= 0 && nuc.getCalculateIdx() < nuc.getVEnergy().size()) {
|
||||
String yield = NumberFormatUtil.numberFormat(String.valueOf(nuc.getVYield().get(nuc.getCalculateIdx()) * 100));
|
||||
String energy = NumberFormatUtil.numberFormat(String.valueOf(nuc.getVEnergy().get(nuc.getCalculateIdx())));
|
||||
strBuild.append(rowFormat(title5, key, halflifeValue, yield, energy, efficiency, activity, actErr, mda, conc, mdc));
|
||||
strBuild.append(System.lineSeparator());
|
||||
} else {
|
||||
strBuild.append(rowFormat(title5, key, halflifeValue, "NULL", "NULL", efficiency, activity, actErr, mda, conc, mdc));
|
||||
strBuild.append(System.lineSeparator());
|
||||
}
|
||||
}
|
||||
strBuild.append(System.lineSeparator());
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.jeecg.modules.service.impl;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
@ -13,7 +12,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.net.ftp.FTP;
|
||||
|
@ -35,7 +33,7 @@ import org.jeecg.modules.base.dto.ROIChannelsDto;
|
|||
import org.jeecg.modules.base.dto.ROIResultsDto;
|
||||
import org.jeecg.modules.base.dto.XeResultsDto;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsDetectors;
|
||||
import org.jeecg.modules.base.entity.original.*;
|
||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||
import org.jeecg.modules.base.entity.rnman.*;
|
||||
import org.jeecg.modules.base.enums.*;
|
||||
import org.jeecg.modules.entity.*;
|
||||
|
@ -58,13 +56,10 @@ import javax.servlet.ServletOutputStream;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.sql.*;
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -393,6 +388,26 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
phdFileUtil.getLightColor(sampleMap,gasBgMap,detBgMap,qcMap);
|
||||
String sampleFileName = String.valueOf(sampleMap.get("fileName"));
|
||||
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
|
||||
Map<String, Object> dataCache = cache.getIfPresent(sampleFileName + "-" + userName + "-data");
|
||||
if (CollectionUtils.isNotEmpty(dataCache)) {
|
||||
SpectrumData sample = (SpectrumData) dataCache.get("sample");
|
||||
if (Objects.nonNull(sample)) {
|
||||
sampleMap.put("spectrumData", sample);
|
||||
}
|
||||
SpectrumData gas = (SpectrumData) dataCache.get("gas");
|
||||
if (Objects.nonNull(gas)) {
|
||||
gasBgMap.put("spectrumData", gas);
|
||||
}
|
||||
SpectrumData det = (SpectrumData) dataCache.get("det");
|
||||
if (Objects.nonNull(det)) {
|
||||
detBgMap.put("spectrumData", det);
|
||||
}
|
||||
SpectrumData qc = (SpectrumData) dataCache.get("qc");
|
||||
if (Objects.nonNull(qc)) {
|
||||
qcMap.put("spectrumData", qc);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> xeDataMap = cache.getIfPresent(sampleFileName + "-" + userName + "-xeData");
|
||||
if (CollectionUtils.isNotEmpty(xeDataMap)) {
|
||||
xeResultsSpectrumList = (List<GardsXeResultsSpectrum>) xeDataMap.get("XeData");
|
||||
|
@ -429,9 +444,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(xeData.getMdc()).substring(0, String.valueOf(xeData.getMdc()).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(xeData.getConc()).substring(0, String.valueOf(xeData.getConc()).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(xeData.getConcErr()).substring(0, String.valueOf(xeData.getConcErr()).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getMdc())).substring(0, String.valueOf(Math.abs(xeData.getMdc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getConc())).substring(0, String.valueOf(Math.abs(xeData.getConc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(Math.abs(xeData.getConcErr())).substring(0, String.valueOf(Math.abs(xeData.getConcErr())).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
}
|
||||
}
|
||||
resultMap.put("XeData", xeResultsSpectrumList);
|
||||
|
@ -490,6 +505,25 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
phdFileUtil.getLightColor(sampleMap,gasBgMap,detBgMap,qcMap);
|
||||
//获取本地缓存信息
|
||||
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
|
||||
Map<String, Object> dataCache = cache.getIfPresent(sampleFileName + "-" + userName + "-data");
|
||||
if (CollectionUtils.isNotEmpty(dataCache)) {
|
||||
SpectrumData sample = (SpectrumData) dataCache.get("sample");
|
||||
if (Objects.nonNull(sample)) {
|
||||
sampleMap.put("spectrumData", sample);
|
||||
}
|
||||
SpectrumData gas = (SpectrumData) dataCache.get("gas");
|
||||
if (Objects.nonNull(gas)) {
|
||||
gasBgMap.put("spectrumData", gas);
|
||||
}
|
||||
SpectrumData det = (SpectrumData) dataCache.get("det");
|
||||
if (Objects.nonNull(det)) {
|
||||
detBgMap.put("spectrumData", det);
|
||||
}
|
||||
SpectrumData qc = (SpectrumData) dataCache.get("qc");
|
||||
if (Objects.nonNull(qc)) {
|
||||
qcMap.put("spectrumData", qc);
|
||||
}
|
||||
}
|
||||
//根据key获取缓存数据
|
||||
Map<String, Object> xeDataMap = cache.getIfPresent(sampleFileName + "-" + userName + "-xeData");
|
||||
//如果缓存数据存在 则将缓存数据取出使用
|
||||
|
@ -516,9 +550,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%.6f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%.6f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%.6f", xeData.getConcErr())));
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getMdc())).substring(0, String.valueOf(Math.abs(xeData.getMdc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getConc())).substring(0, String.valueOf(Math.abs(xeData.getConc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(Math.abs(xeData.getConcErr())).substring(0, String.valueOf(Math.abs(xeData.getConcErr())).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(sampleBoundary)) {
|
||||
|
@ -562,6 +596,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
if (Objects.nonNull(inputStream)){
|
||||
//声明一个临时文件
|
||||
file = File.createTempFile("betaGamma", null);
|
||||
if (Objects.isNull(file)) {
|
||||
throw new RuntimeException("ftp file can't find!");
|
||||
}
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||
map = phdFileUtil.getSourceData(file.getAbsolutePath(), sampleId, status);
|
||||
|
@ -599,6 +636,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
betaCache.deleteBetaCache(analyseKey);
|
||||
String xeKey = sampleFileName + "-" + userName + "-xeData";
|
||||
betaCache.deleteBetaCache(xeKey);
|
||||
String dataKey = sampleFileName + "-" + userName + "-data";
|
||||
betaCache.deleteBetaCache(dataKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3082,9 +3121,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(xeData.getMdc()).substring(0, String.valueOf(xeData.getMdc()).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(xeData.getConc()).substring(0, String.valueOf(xeData.getConc()).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(xeData.getConcErr()).substring(0, String.valueOf(xeData.getConcErr()).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getMdc())).substring(0, String.valueOf(Math.abs(xeData.getMdc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getConc())).substring(0, String.valueOf(Math.abs(xeData.getConc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(Math.abs(xeData.getConcErr())).substring(0, String.valueOf(Math.abs(xeData.getConcErr())).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
}
|
||||
}
|
||||
map.put("xeData", analyseResult);
|
||||
|
@ -3110,14 +3149,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(xeData.getMdc()).substring(0, String.valueOf(xeData.getMdc()).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(xeData.getConc()).substring(0, String.valueOf(xeData.getConc()).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(xeData.getConcErr()).substring(0, String.valueOf(xeData.getConcErr()).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getMdc())).substring(0, String.valueOf(Math.abs(xeData.getMdc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getConc())).substring(0, String.valueOf(Math.abs(xeData.getConc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(Math.abs(xeData.getConcErr())).substring(0, String.valueOf(Math.abs(xeData.getConcErr())).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
}
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
}
|
||||
map.put("XeData", analyseResult);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
}
|
||||
|
@ -3191,14 +3230,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(xeData.getMdc()).substring(0, String.valueOf(xeData.getMdc()).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(xeData.getConc()).substring(0, String.valueOf(xeData.getConc()).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(xeData.getConcErr()).substring(0, String.valueOf(xeData.getConcErr()).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getMdc())).substring(0, String.valueOf(Math.abs(xeData.getMdc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getConc())).substring(0, String.valueOf(Math.abs(xeData.getConc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(Math.abs(xeData.getConcErr())).substring(0, String.valueOf(Math.abs(xeData.getConcErr())).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
}
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
}
|
||||
map.put("XeData", analyseResultList);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
}
|
||||
|
@ -3323,99 +3362,105 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
gasTmp = phdFileUtil.analyzeFile(gasFilePath, gasFileName);
|
||||
//获取det文件
|
||||
detTmp = phdFileUtil.analyzeFile(detFilePath, detFileName);
|
||||
//调用重新分析算法 获取算法结果
|
||||
BgAnalyseResult analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), spectrum_group.BgCalPara);
|
||||
//生成分析操作日志
|
||||
EnergySpectrumStruct sample = phdFileUtil.analyzeFileSourceData(sampleTmp);
|
||||
EnergySpectrumStruct gas = phdFileUtil.analyzeFileSourceData(gasTmp);
|
||||
EnergySpectrumStruct det = phdFileUtil.analyzeFileSourceData(detTmp);
|
||||
String logName = sampleFileName.replace("PHD", "log");
|
||||
phdFileUtil.OutPutRnLog(analyseResult, sample, gas, det, logName);
|
||||
//存入分析用到的数据
|
||||
map.put("reAnalyseParam", spectrum_group.BgCalPara);
|
||||
//存入计算后得到的xeData数据
|
||||
GardsXeResultsSpectrum xe131m = new GardsXeResultsSpectrum();
|
||||
xe131m.setNuclideName(XeNuclideName.XE_131m.getType());
|
||||
xe131m.setConc(analyseResult.Xe131m_con);
|
||||
xe131m.setConcErr(analyseResult.Xe131m_uncer);
|
||||
xe131m.setLc(analyseResult.LC_Xe131m);
|
||||
xe131m.setMdc(analyseResult.MDC_Xe131m);
|
||||
xe131m.setNidFlag(analyseResult.XE_131m_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe131m);
|
||||
GardsXeResultsSpectrum xe133 = new GardsXeResultsSpectrum();
|
||||
xe133.setNuclideName(XeNuclideName.XE_133.getType());
|
||||
xe133.setConc(analyseResult.Xe133_con);
|
||||
xe133.setConcErr(analyseResult.Xe133_uncer);
|
||||
xe133.setLc(analyseResult.LC_Xe133);
|
||||
xe133.setMdc(analyseResult.MDC_Xe133);
|
||||
xe133.setNidFlag(analyseResult.XE_133_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe133);
|
||||
GardsXeResultsSpectrum xe133m = new GardsXeResultsSpectrum();
|
||||
xe133m.setNuclideName(XeNuclideName.XE_133m.getType());
|
||||
xe133m.setConc(analyseResult.Xe133m_con);
|
||||
xe133m.setConcErr(analyseResult.Xe133m_uncer);
|
||||
xe133m.setLc(analyseResult.LC_Xe133m);
|
||||
xe133m.setMdc(analyseResult.MDC_Xe133m);
|
||||
xe133m.setNidFlag(analyseResult.XE_133m_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe133m);
|
||||
GardsXeResultsSpectrum xe135 = new GardsXeResultsSpectrum();
|
||||
xe135.setNuclideName(XeNuclideName.XE_135.getType());
|
||||
xe135.setConc(analyseResult.Xe135_con);
|
||||
xe135.setConcErr(analyseResult.Xe135_uncer);
|
||||
xe135.setLc(analyseResult.LC_Xe135);
|
||||
xe135.setMdc(analyseResult.MDC_Xe135);
|
||||
xe135.setNidFlag(analyseResult.XE_135_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe135);
|
||||
xeMap.put("XeData", xeResultsSpectrumList);
|
||||
//新计算得到的边界值
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.S_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.S_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.S_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.S_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.S_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.S_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
xeMap.put("SampleBoundary", boundaryList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.G_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.G_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.G_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.G_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.G_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.G_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
xeMap.put("GasBoundary", boundaryList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.D_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.D_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.D_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.D_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.D_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.D_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
xeMap.put("DetBoundary", boundaryList);
|
||||
}
|
||||
if (analyseData.isQcData()) {
|
||||
if (StringUtils.isNotBlank(qcFilePath)) {
|
||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcFilePath, qcFileName);
|
||||
if (Objects.nonNull(struct)) {
|
||||
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, xeMap);
|
||||
if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
||||
//调用重新分析算法 获取算法结果
|
||||
BgAnalyseResult analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), spectrum_group.BgCalPara);
|
||||
if (StringUtils.isNotBlank(analyseResult.error_log) && !analyseResult.error_log.equalsIgnoreCase("no error.")) {
|
||||
return Collections.EMPTY_LIST;
|
||||
} else {
|
||||
//生成分析操作日志
|
||||
EnergySpectrumStruct sample = phdFileUtil.analyzeFileSourceData(sampleTmp);
|
||||
EnergySpectrumStruct gas = phdFileUtil.analyzeFileSourceData(gasTmp);
|
||||
EnergySpectrumStruct det = phdFileUtil.analyzeFileSourceData(detTmp);
|
||||
String logName = sampleFileName.replace("PHD", "log");
|
||||
phdFileUtil.OutPutRnLog(analyseResult, sample, gas, det, logName);
|
||||
//存入分析用到的数据
|
||||
map.put("reAnalyseParam", spectrum_group.BgCalPara);
|
||||
//存入计算后得到的xeData数据
|
||||
GardsXeResultsSpectrum xe131m = new GardsXeResultsSpectrum();
|
||||
xe131m.setNuclideName(XeNuclideName.XE_131m.getType());
|
||||
xe131m.setConc(analyseResult.Xe131m_con);
|
||||
xe131m.setConcErr(analyseResult.Xe131m_uncer);
|
||||
xe131m.setLc(analyseResult.LC_Xe131m);
|
||||
xe131m.setMdc(analyseResult.MDC_Xe131m);
|
||||
xe131m.setNidFlag(analyseResult.XE_131m_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe131m);
|
||||
GardsXeResultsSpectrum xe133 = new GardsXeResultsSpectrum();
|
||||
xe133.setNuclideName(XeNuclideName.XE_133.getType());
|
||||
xe133.setConc(analyseResult.Xe133_con);
|
||||
xe133.setConcErr(analyseResult.Xe133_uncer);
|
||||
xe133.setLc(analyseResult.LC_Xe133);
|
||||
xe133.setMdc(analyseResult.MDC_Xe133);
|
||||
xe133.setNidFlag(analyseResult.XE_133_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe133);
|
||||
GardsXeResultsSpectrum xe133m = new GardsXeResultsSpectrum();
|
||||
xe133m.setNuclideName(XeNuclideName.XE_133m.getType());
|
||||
xe133m.setConc(analyseResult.Xe133m_con);
|
||||
xe133m.setConcErr(analyseResult.Xe133m_uncer);
|
||||
xe133m.setLc(analyseResult.LC_Xe133m);
|
||||
xe133m.setMdc(analyseResult.MDC_Xe133m);
|
||||
xe133m.setNidFlag(analyseResult.XE_133m_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe133m);
|
||||
GardsXeResultsSpectrum xe135 = new GardsXeResultsSpectrum();
|
||||
xe135.setNuclideName(XeNuclideName.XE_135.getType());
|
||||
xe135.setConc(analyseResult.Xe135_con);
|
||||
xe135.setConcErr(analyseResult.Xe135_uncer);
|
||||
xe135.setLc(analyseResult.LC_Xe135);
|
||||
xe135.setMdc(analyseResult.MDC_Xe135);
|
||||
xe135.setNidFlag(analyseResult.XE_135_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe135);
|
||||
xeMap.put("XeData", xeResultsSpectrumList);
|
||||
//新计算得到的边界值
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.S_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.S_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.S_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.S_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.S_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.S_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
xeMap.put("SampleBoundary", boundaryList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.G_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.G_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.G_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.G_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.G_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.G_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
xeMap.put("GasBoundary", boundaryList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.D_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.D_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.D_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.D_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.D_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.D_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
xeMap.put("DetBoundary", boundaryList);
|
||||
}
|
||||
if (analyseData.isQcData()) {
|
||||
if (StringUtils.isNotBlank(qcFilePath)) {
|
||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcFilePath, qcFileName);
|
||||
if (Objects.nonNull(struct)) {
|
||||
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, xeMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
//将重新计算的参数以及重新计算后的xeData的数据缓存到本地缓存中
|
||||
cache.put(sampleFileName + "-" + userName + "-reAnalyseParam", map);
|
||||
cache.put(sampleFileName + "-" + userName + "-xeData", xeMap);
|
||||
betaCache.setBetaCache(cache);
|
||||
}
|
||||
}
|
||||
//将重新计算的参数以及重新计算后的xeData的数据缓存到本地缓存中
|
||||
cache.put(sampleFileName + "-" + userName + "-reAnalyseParam", map);
|
||||
cache.put(sampleFileName + "-" + userName + "-xeData", xeMap);
|
||||
betaCache.setBetaCache(cache);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
@ -3539,100 +3584,106 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
sampleTmp = phdFileUtil.analyzeFile(sampleFilePath, sampleFileName);
|
||||
gasTmp = phdFileUtil.analyzeFile(gasFilePath, gasFileName);
|
||||
detTmp = phdFileUtil.analyzeFile(detFilePath, detFileName);
|
||||
BgAnalyseResult analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), spectrum_group.BgCalPara);
|
||||
//生成分析操作日志
|
||||
EnergySpectrumStruct sample = phdFileUtil.analyzeFileSourceData(sampleTmp);
|
||||
EnergySpectrumStruct gas = phdFileUtil.analyzeFileSourceData(gasTmp);
|
||||
EnergySpectrumStruct det = phdFileUtil.analyzeFileSourceData(detTmp);
|
||||
String logName = sampleFileName.replace("PHD", "log");
|
||||
phdFileUtil.OutPutRnLog(analyseResult, sample, gas, det, logName);
|
||||
//存入重新分析的参数
|
||||
map.put("reAnalyseParam", spectrum_group.BgCalPara);
|
||||
//存入xeData数据
|
||||
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
|
||||
GardsXeResultsSpectrum xe131m = new GardsXeResultsSpectrum();
|
||||
xe131m.setNuclideName(XeNuclideName.XE_131m.getType());
|
||||
xe131m.setConc(analyseResult.Xe131m_con);
|
||||
xe131m.setConcErr(analyseResult.Xe131m_uncer);
|
||||
xe131m.setLc(analyseResult.LC_Xe131m);
|
||||
xe131m.setMdc(analyseResult.MDC_Xe131m);
|
||||
xe131m.setNidFlag(analyseResult.XE_131m_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe131m);
|
||||
GardsXeResultsSpectrum xe133 = new GardsXeResultsSpectrum();
|
||||
xe133.setNuclideName(XeNuclideName.XE_133.getType());
|
||||
xe133.setConc(analyseResult.Xe133_con);
|
||||
xe133.setConcErr(analyseResult.Xe133_uncer);
|
||||
xe133.setLc(analyseResult.LC_Xe133);
|
||||
xe133.setMdc(analyseResult.MDC_Xe133);
|
||||
xe133.setNidFlag(analyseResult.XE_133_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe133);
|
||||
GardsXeResultsSpectrum xe133m = new GardsXeResultsSpectrum();
|
||||
xe133m.setNuclideName(XeNuclideName.XE_133m.getType());
|
||||
xe133m.setConc(analyseResult.Xe133m_con);
|
||||
xe133m.setConcErr(analyseResult.Xe133m_uncer);
|
||||
xe133m.setLc(analyseResult.LC_Xe133m);
|
||||
xe133m.setMdc(analyseResult.MDC_Xe133m);
|
||||
xe133m.setNidFlag(analyseResult.XE_133m_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe133m);
|
||||
GardsXeResultsSpectrum xe135 = new GardsXeResultsSpectrum();
|
||||
xe135.setNuclideName(XeNuclideName.XE_135.getType());
|
||||
xe135.setConc(analyseResult.Xe135_con);
|
||||
xe135.setConcErr(analyseResult.Xe135_uncer);
|
||||
xe135.setLc(analyseResult.LC_Xe135);
|
||||
xe135.setMdc(analyseResult.MDC_Xe135);
|
||||
xe135.setNidFlag(analyseResult.XE_135_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe135);
|
||||
xeMap.put("XeData", xeResultsSpectrumList);
|
||||
//新计算得到的边界值
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.S_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.S_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.S_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.S_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.S_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.S_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
xeMap.put("SampleBoundary", boundaryList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.G_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.G_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.G_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.G_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.G_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.G_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
xeMap.put("GasBoundary", boundaryList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.D_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.D_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.D_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.D_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.D_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.D_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
xeMap.put("DetBoundary", boundaryList);
|
||||
}
|
||||
if (analyseData.isQcData()) {
|
||||
if (StringUtils.isNotBlank(qcFilePath)) {
|
||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcFilePath, qcFileName);
|
||||
if (Objects.nonNull(struct)) {
|
||||
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, xeMap);
|
||||
if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
||||
BgAnalyseResult analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), spectrum_group.BgCalPara);
|
||||
if (StringUtils.isNotBlank(analyseResult.error_log) && !analyseResult.error_log.equalsIgnoreCase("no error.")) {
|
||||
analyseResultMap.put(sampleFileName, Collections.EMPTY_LIST);
|
||||
} else {
|
||||
//生成分析操作日志
|
||||
EnergySpectrumStruct sample = phdFileUtil.analyzeFileSourceData(sampleTmp);
|
||||
EnergySpectrumStruct gas = phdFileUtil.analyzeFileSourceData(gasTmp);
|
||||
EnergySpectrumStruct det = phdFileUtil.analyzeFileSourceData(detTmp);
|
||||
String logName = sampleFileName.replace("PHD", "log");
|
||||
phdFileUtil.OutPutRnLog(analyseResult, sample, gas, det, logName);
|
||||
//存入重新分析的参数
|
||||
map.put("reAnalyseParam", spectrum_group.BgCalPara);
|
||||
//存入xeData数据
|
||||
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
|
||||
GardsXeResultsSpectrum xe131m = new GardsXeResultsSpectrum();
|
||||
xe131m.setNuclideName(XeNuclideName.XE_131m.getType());
|
||||
xe131m.setConc(analyseResult.Xe131m_con);
|
||||
xe131m.setConcErr(analyseResult.Xe131m_uncer);
|
||||
xe131m.setLc(analyseResult.LC_Xe131m);
|
||||
xe131m.setMdc(analyseResult.MDC_Xe131m);
|
||||
xe131m.setNidFlag(analyseResult.XE_131m_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe131m);
|
||||
GardsXeResultsSpectrum xe133 = new GardsXeResultsSpectrum();
|
||||
xe133.setNuclideName(XeNuclideName.XE_133.getType());
|
||||
xe133.setConc(analyseResult.Xe133_con);
|
||||
xe133.setConcErr(analyseResult.Xe133_uncer);
|
||||
xe133.setLc(analyseResult.LC_Xe133);
|
||||
xe133.setMdc(analyseResult.MDC_Xe133);
|
||||
xe133.setNidFlag(analyseResult.XE_133_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe133);
|
||||
GardsXeResultsSpectrum xe133m = new GardsXeResultsSpectrum();
|
||||
xe133m.setNuclideName(XeNuclideName.XE_133m.getType());
|
||||
xe133m.setConc(analyseResult.Xe133m_con);
|
||||
xe133m.setConcErr(analyseResult.Xe133m_uncer);
|
||||
xe133m.setLc(analyseResult.LC_Xe133m);
|
||||
xe133m.setMdc(analyseResult.MDC_Xe133m);
|
||||
xe133m.setNidFlag(analyseResult.XE_133m_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe133m);
|
||||
GardsXeResultsSpectrum xe135 = new GardsXeResultsSpectrum();
|
||||
xe135.setNuclideName(XeNuclideName.XE_135.getType());
|
||||
xe135.setConc(analyseResult.Xe135_con);
|
||||
xe135.setConcErr(analyseResult.Xe135_uncer);
|
||||
xe135.setLc(analyseResult.LC_Xe135);
|
||||
xe135.setMdc(analyseResult.MDC_Xe135);
|
||||
xe135.setNidFlag(analyseResult.XE_135_NID_FLAG);
|
||||
xeResultsSpectrumList.add(xe135);
|
||||
xeMap.put("XeData", xeResultsSpectrumList);
|
||||
//新计算得到的边界值
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.S_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.S_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.S_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.S_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.S_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.S_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
xeMap.put("SampleBoundary", boundaryList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.G_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.G_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.G_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.G_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.G_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.G_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
xeMap.put("GasBoundary", boundaryList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(analyseResult.D_ROI_B_Boundary_start)) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<analyseResult.D_ROI_B_Boundary_start.size(); i++) {
|
||||
Boundary boundary = new Boundary();
|
||||
boundary.setMinX(analyseResult.D_ROI_B_Boundary_start.get(i));
|
||||
boundary.setMaxX(analyseResult.D_ROI_B_Boundary_stop.get(i));
|
||||
boundary.setMinY(analyseResult.D_ROI_G_Boundary_start.get(i));
|
||||
boundary.setMaxY(analyseResult.D_ROI_G_Boundary_stop.get(i));
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
xeMap.put("DetBoundary", boundaryList);
|
||||
}
|
||||
if (analyseData.isQcData()) {
|
||||
if (StringUtils.isNotBlank(qcFilePath)) {
|
||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcFilePath, qcFileName);
|
||||
if (Objects.nonNull(struct)) {
|
||||
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, xeMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
//将重新计算的参数以及重新计算后的xeData的数据缓存到本地缓存中
|
||||
cache.put(sampleFileName + "-" + userName + "-reAnalyseParam", map);
|
||||
cache.put(sampleFileName + "-" + userName + "-xeData", xeMap);
|
||||
betaCache.setBetaCache(cache);
|
||||
analyseResultMap.put(sampleFileName, xeResultsSpectrumList);
|
||||
}
|
||||
}
|
||||
//将重新计算的参数以及重新计算后的xeData的数据缓存到本地缓存中
|
||||
cache.put(sampleFileName + "-" + userName + "-reAnalyseParam", map);
|
||||
cache.put(sampleFileName + "-" + userName + "-xeData", xeMap);
|
||||
betaCache.setBetaCache(cache);
|
||||
analyseResultMap.put(sampleFileName, xeResultsSpectrumList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -3732,40 +3783,45 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
BgCalPara = (BgCalibratePara) reAnalyseParam.get("reAnalyseParam");
|
||||
}
|
||||
//调用分析方法
|
||||
phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
|
||||
//分析qc文件信息并重新计算qc边界值
|
||||
if (StringUtils.isNotBlank(qcPath)) {
|
||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
|
||||
if (Objects.nonNull(struct)) {
|
||||
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(map)) {
|
||||
List<GardsXeResultsSpectrum> xeDataList = (List<GardsXeResultsSpectrum>) map.get("XeData");
|
||||
if (CollectionUtils.isNotEmpty(xeDataList)){
|
||||
for (GardsXeResultsSpectrum xeData:xeDataList) {
|
||||
Double conc = xeData.getConc();
|
||||
Double mdc = xeData.getMdc();
|
||||
if (conc < 0){
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(xeData.getMdc()).substring(0, String.valueOf(xeData.getMdc()).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(xeData.getConc()).substring(0, String.valueOf(xeData.getConc()).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(xeData.getConcErr()).substring(0, String.valueOf(xeData.getConcErr()).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
|
||||
if (bRet) {
|
||||
//分析qc文件信息并重新计算qc边界值
|
||||
if (StringUtils.isNotBlank(qcPath)) {
|
||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
|
||||
if (Objects.nonNull(struct)) {
|
||||
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map);
|
||||
}
|
||||
}
|
||||
//更新分析后的缓存信息
|
||||
cache.put(sampleFileName + "-" + userName + "-xeData", map);
|
||||
betaCache.setBetaCache(cache);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
if (CollectionUtils.isNotEmpty(map)) {
|
||||
List<GardsXeResultsSpectrum> xeDataList = (List<GardsXeResultsSpectrum>) map.get("XeData");
|
||||
if (CollectionUtils.isNotEmpty(xeDataList)){
|
||||
for (GardsXeResultsSpectrum xeData:xeDataList) {
|
||||
Double conc = xeData.getConc();
|
||||
Double mdc = xeData.getMdc();
|
||||
if (conc < 0){
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getMdc())).substring(0, String.valueOf(Math.abs(xeData.getMdc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getConc())).substring(0, String.valueOf(Math.abs(xeData.getConc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(Math.abs(xeData.getConcErr())).substring(0, String.valueOf(Math.abs(xeData.getConcErr())).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
}
|
||||
}
|
||||
//更新分析后的缓存信息
|
||||
cache.put(sampleFileName + "-" + userName + "-xeData", map);
|
||||
betaCache.setBetaCache(cache);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
}
|
||||
} else {
|
||||
map.clear();
|
||||
map.put("XeData", Collections.EMPTY_LIST);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -3876,41 +3932,49 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
if (CollectionUtils.isNotEmpty(reAnalyseParam)) {
|
||||
BgCalPara = (BgCalibratePara) reAnalyseParam.get("reAnalyseParam");
|
||||
}
|
||||
//调用分析方法
|
||||
phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
|
||||
//分析qc文件信息并重新计算qc边界值
|
||||
if (StringUtils.isNotBlank(qcPath)) {
|
||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
|
||||
if (Objects.nonNull(struct)) {
|
||||
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map);
|
||||
}
|
||||
}
|
||||
List<GardsXeResultsSpectrum> xeDataList = (List<GardsXeResultsSpectrum>) map.get("XeData");
|
||||
if (CollectionUtils.isNotEmpty(xeDataList)){
|
||||
for (GardsXeResultsSpectrum xeData:xeDataList) {
|
||||
Double conc = xeData.getConc();
|
||||
Double mdc = xeData.getMdc();
|
||||
if (conc < 0){
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
if(Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
||||
//调用分析方法
|
||||
boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
|
||||
if (bRet) {
|
||||
//分析qc文件信息并重新计算qc边界值
|
||||
if (StringUtils.isNotBlank(qcPath)) {
|
||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
|
||||
if (Objects.nonNull(struct)) {
|
||||
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map);
|
||||
}
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(xeData.getMdc()).substring(0, String.valueOf(xeData.getMdc()).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(xeData.getConc()).substring(0, String.valueOf(xeData.getConc()).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(xeData.getConcErr()).substring(0, String.valueOf(xeData.getConcErr()).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
List<GardsXeResultsSpectrum> xeDataList = (List<GardsXeResultsSpectrum>) map.get("XeData");
|
||||
if (CollectionUtils.isNotEmpty(xeDataList)){
|
||||
for (GardsXeResultsSpectrum xeData:xeDataList) {
|
||||
Double conc = xeData.getConc();
|
||||
Double mdc = xeData.getMdc();
|
||||
if (conc < 0){
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getMdc())).substring(0, String.valueOf(Math.abs(xeData.getMdc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getConc())).substring(0, String.valueOf(Math.abs(xeData.getConc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(Math.abs(xeData.getConcErr())).substring(0, String.valueOf(Math.abs(xeData.getConcErr())).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||
}
|
||||
}
|
||||
//更新分析后的缓存信息
|
||||
cache.put(sampleFileName + "-" + userName + "-xeData", map);
|
||||
betaCache.setBetaCache(cache);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
mapList.put(sampleFileName, map);
|
||||
} else {
|
||||
map.clear();
|
||||
map.put("XeData", Collections.EMPTY_LIST);
|
||||
mapList.put(sampleFileName, map);
|
||||
}
|
||||
}
|
||||
//更新分析后的缓存信息
|
||||
cache.put(sampleFileName + "-" + userName + "-xeData", map);
|
||||
betaCache.setBetaCache(cache);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
mapList.put(sampleFileName, map);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -4018,8 +4082,18 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
@Transactional
|
||||
public Result saveToDB(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
//根据请求体获取用户名
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Integer sampleId = null;
|
||||
Integer gasId = null;
|
||||
Integer detId = null;
|
||||
Integer qcId = null;
|
||||
//判断保存分析结果标识
|
||||
if (!anlyseResultIn.isSavedAnalysisResult()) {
|
||||
result.error500("Please first Analyse File!");
|
||||
return result;
|
||||
}
|
||||
//用户名赋值到 分析员
|
||||
anlyseResultIn.setUserName(userName);
|
||||
//从本地缓存获取beta gamma的数组
|
||||
|
@ -4074,19 +4148,19 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
String beginDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
//获取当前时间作为人工分析结束时间
|
||||
String endDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
//判断当前分析员是否有过排班任务
|
||||
//根据台站名称获取台站id
|
||||
Integer stationId = spectrumAnalysisMapper.getStationId(anlyseResultIn.getStationName());
|
||||
//判断当前分析员是否有过当前台站的排班任务
|
||||
boolean bAnalysisResultWriteAuthority = userTaskUtil.CheckUserWriteAuthorityForStation(anlyseResultIn.getUserName(), stationId);
|
||||
if ( !bAnalysisResultWriteAuthority ){
|
||||
result.error500("This user has no right to store the results of the analysis to the database.");
|
||||
return result;
|
||||
//判断当前分析员当天是否有对应台站的排班任务
|
||||
List<String> userStation = userTaskUtil.findUserStation(userName);
|
||||
boolean bAnalysisResultWriteAuthority = false;
|
||||
if (userStation.contains(String.valueOf(stationId))) {
|
||||
bAnalysisResultWriteAuthority = true;
|
||||
}
|
||||
//获取ROI Limit数据
|
||||
// getROILimit(anlyseResultIn);
|
||||
//根据sample文件名称模糊查询sampleId
|
||||
if (StringUtils.isNotBlank(anlyseResultIn.getDbName())) {
|
||||
Integer sampleId = spectrumAnalysisMapper.getSampleIdLikeFileName(anlyseResultIn.getSampleFileName());
|
||||
sampleId = spectrumAnalysisMapper.getSampleIdLikeFileName(anlyseResultIn.getSampleFileName());
|
||||
Integer analysisID = null;
|
||||
if (anlyseResultIn.getDbName().equals("auto")) {
|
||||
anlyseResultIn.setDbName("RNAUTO");
|
||||
|
@ -4120,16 +4194,22 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
anlyseResultIn.setDetFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
|
||||
anlyseResultIn.setQcFilePath(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
|
||||
}
|
||||
|
||||
//处理数据 获取对应的channel/energy值
|
||||
getChannelAndEnergy(anlyseResultIn, betaList, gammaList);
|
||||
//分析文件内容
|
||||
analyzePHDFile(anlyseResultIn, BgCalPara, betaFittingPara, gammaFittingPara);
|
||||
//处理文件名称
|
||||
String sampleFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
String gasFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||
String detFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||
String qcFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getQcFilePath(), anlyseResultIn.getQcFileName());
|
||||
//判断当前分析员是否有过历史分析当前文件
|
||||
Integer isExist = spectrumAnalysisMapper.SampleIsExist(sampleFilePathName, anlyseResultIn.getUserName());
|
||||
//如果当前分析员在当天没有排班任务 并且 没有历史分析过当前文件 则不允许进行保存操作
|
||||
if ( !bAnalysisResultWriteAuthority && Objects.isNull(isExist) ){
|
||||
result.error500("You have no permission to save results to DB!");
|
||||
return result;
|
||||
}
|
||||
//处理数据 获取对应的channel/energy值
|
||||
getChannelAndEnergy(anlyseResultIn, betaList, gammaList);
|
||||
//分析文件内容
|
||||
analyzePHDFile(anlyseResultIn, BgCalPara, betaFittingPara, gammaFittingPara);
|
||||
//判断文件是否存储过 如果没有则解析文件并进行存储
|
||||
if ( !OriginalDataStore(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName(), gasFilePathName, anlyseResultIn.getUserName()) ){
|
||||
result.error500("gasFile save failed");
|
||||
|
@ -4144,17 +4224,16 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
result.error500("qcFile save failed");
|
||||
return result;
|
||||
}
|
||||
qcId = spectrumAnalysisMapper.getSampleId(qcFilePathName);
|
||||
}
|
||||
if ( !OriginalDataStore(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName(), sampleFilePathName, anlyseResultIn.getUserName()) ){
|
||||
result.error500("sampleFile save failed");
|
||||
return result;
|
||||
}
|
||||
//判断当前分析员是否有过历史分析当前文件
|
||||
Integer isExist = spectrumAnalysisMapper.SampleIsExist(sampleFilePathName, anlyseResultIn.getUserName());
|
||||
//根据文件名称查询对应的sampleId--- sampleFile gasFile detFile
|
||||
Integer sampleId = spectrumAnalysisMapper.getSampleId(sampleFilePathName);
|
||||
Integer gasId = spectrumAnalysisMapper.getSampleId(gasFilePathName);
|
||||
Integer detId = spectrumAnalysisMapper.getSampleId(detFilePathName);
|
||||
sampleId = spectrumAnalysisMapper.getSampleId(sampleFilePathName);
|
||||
gasId = spectrumAnalysisMapper.getSampleId(gasFilePathName);
|
||||
detId = spectrumAnalysisMapper.getSampleId(detFilePathName);
|
||||
//如果分析过就修改原记录--GARDS_ANALYSES
|
||||
GardsAnalysesSpectrum gardsAnalyses = new GardsAnalysesSpectrum();
|
||||
gardsAnalyses.setSampleId(sampleId);
|
||||
|
@ -4263,13 +4342,16 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
File sampleTmp = null;
|
||||
File gasTmp = null;
|
||||
File detTmp = null;
|
||||
File qcTmp = null;
|
||||
try {
|
||||
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp));
|
||||
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp));
|
||||
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + detFilePathName.substring(0, detFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getDetFileName(), new FileInputStream(detTmp));
|
||||
qcTmp = phdFileUtil.analyzeFile(anlyseResultIn.getQcFilePath(), anlyseResultIn.getQcFileName());
|
||||
ftpUtil.saveFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp));
|
||||
ftpUtil.saveFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp));
|
||||
ftpUtil.saveFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + detFilePathName.substring(0, detFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getDetFileName(), new FileInputStream(detTmp));
|
||||
ftpUtil.saveFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePathName.substring(0, qcFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getQcFileName(), new FileInputStream(qcTmp));
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
|
@ -4277,7 +4359,26 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
gasTmp.delete();
|
||||
detTmp.delete();
|
||||
}
|
||||
if (Objects.nonNull(sampleId)) {
|
||||
SpectrumData sampleData = getSpectrumData(sampleId);
|
||||
map.put("sample", sampleData);
|
||||
}
|
||||
if (Objects.nonNull(gasId)) {
|
||||
SpectrumData gasData = getSpectrumData(gasId);
|
||||
map.put("gas", gasData);
|
||||
}
|
||||
if (Objects.nonNull(detId)) {
|
||||
SpectrumData detData = getSpectrumData(detId);
|
||||
map.put("det", detData);
|
||||
}
|
||||
if (Objects.nonNull(qcId)) {
|
||||
SpectrumData qcData = getSpectrumData(qcId);
|
||||
map.put("qc", qcData);
|
||||
}
|
||||
cache.put(anlyseResultIn.getSampleFileName()+"-"+userName+"-data", map);
|
||||
betaCache.setBetaCache(cache);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -5782,4 +5883,81 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
return roiResultsList;
|
||||
}
|
||||
|
||||
public SpectrumData getSpectrumData(Integer sampleId) {
|
||||
//根据 sampleId获取sampleData的数据内容
|
||||
GardsSampleDataSpectrum sampleData = spectrumAnalysisMapper.getSampleData(sampleId);
|
||||
//获取文件存储路径
|
||||
String inputFileName = sampleData.getInputFileName();
|
||||
//拼接完整的ftp路径
|
||||
String filePath = StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + inputFileName;
|
||||
File file = ftpUtil.downloadFile(filePath, "betaGamma");
|
||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||
SpectrumData spectrumData = new SpectrumData();
|
||||
try {
|
||||
//封装散点图下的基础数据信息
|
||||
//Station Code
|
||||
String stationCode = struct.site_code;
|
||||
//Detector Code
|
||||
String detectorCode = struct.detector_code;
|
||||
//Data Type
|
||||
String dataType = struct.data_type;
|
||||
//Collection Start
|
||||
Date CollectionStart = null;
|
||||
if ( StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time) ){
|
||||
CollectionStart = DateUtils.parseDate(struct.collection_start_date + StringPool.SPACE + struct.collection_start_time);
|
||||
}
|
||||
//Collection Stop
|
||||
Date CollectionStop = null;
|
||||
if ( StringUtils.isNotBlank(struct.collection_stop_date) && StringUtils.isNotBlank(struct.collection_stop_time) ){
|
||||
CollectionStop = DateUtils.parseDate(struct.collection_stop_date + StringPool.SPACE + struct.collection_stop_time);
|
||||
}
|
||||
//Collection Time
|
||||
String CollectionTime = "";
|
||||
if ( Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop) ){
|
||||
CollectionTime = String.format ("%.2f",Double.valueOf(CollectionStop.getTime()/1000 - CollectionStart.getTime()/ 1000));
|
||||
}
|
||||
//Acquisition Start
|
||||
Date AcquisitionStart = null;
|
||||
if ( StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time) ){
|
||||
AcquisitionStart = DateUtils.parseDate(struct.acquisition_start_date + StringPool.SPACE + struct.acquisition_start_time);
|
||||
}
|
||||
//Acq Real Time
|
||||
double AcquisitionRealTime = struct.acquisition_real_time;
|
||||
//Acq live Time
|
||||
double AcquisitionLiveTime = struct.acquisition_live_time;
|
||||
//Air Volume[m3]
|
||||
double airVolume = struct.air_volume;
|
||||
//Xe Volume[m3]
|
||||
double xeVolume = struct.sample_volume_of_Xe;
|
||||
//xeCollectionYield
|
||||
double xeCollectionYield = struct.Xe_collection_yield;
|
||||
//gasBkMeasurementId
|
||||
String gasBkMeasurementId = struct.gas_bk_measurement_id;
|
||||
//detectorBkMeasurementId
|
||||
String detectorBkMeasurementId = struct.detector_bk_measurement_id;
|
||||
//measurementId
|
||||
String measurementId = struct.measurement_id;
|
||||
spectrumData.setSampleId(sampleId);
|
||||
spectrumData.setStatus(sampleData.getStatus());
|
||||
spectrumData.setStationCode(stationCode);
|
||||
spectrumData.setDetectorCode(detectorCode);
|
||||
spectrumData.setDataType(dataType);
|
||||
spectrumData.setCollectionStart(CollectionStart);
|
||||
spectrumData.setCollectionStop(CollectionStop);
|
||||
spectrumData.setCollectionTime(CollectionTime);
|
||||
spectrumData.setAcquisitionStart(AcquisitionStart);
|
||||
spectrumData.setAcquisitionRealTime(AcquisitionRealTime);
|
||||
spectrumData.setAcquisitionLiveTime(AcquisitionLiveTime);
|
||||
spectrumData.setAirVolume(airVolume);
|
||||
spectrumData.setXeVolume(xeVolume);
|
||||
spectrumData.setYield(xeCollectionYield);
|
||||
spectrumData.setGasBkMeasurementId(gasBkMeasurementId);
|
||||
spectrumData.setDetectorBkMeasurementId(detectorBkMeasurementId);
|
||||
spectrumData.setMeasurementId(measurementId);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return spectrumData;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user