diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NumberFormatUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NumberFormatUtil.java index f1aebd6e..0343ce2c 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NumberFormatUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NumberFormatUtil.java @@ -50,34 +50,39 @@ public class NumberFormatUtil { //总数字个数是6位的数 public static String numberSixLen(String number) { - Double preNum = null; - String suffixNum = ""; - //判断传进来的数据是否是科学计数法的数据 - if (number.indexOf("e") > 0) { - String calNumber = number.substring(0, number.indexOf("e")); - if (calNumber.length() < 6) { + String value = ""; + if (number.equalsIgnoreCase("nan")) { + value = number; + } else { + Double preNum = null; + String suffixNum = ""; + //判断传进来的数据是否是科学计数法的数据 + if (number.indexOf("e") > 0) { + String calNumber = number.substring(0, number.indexOf("e")); + if (calNumber.length() < 6) { + preNum = Double.valueOf(number); + } else { + preNum = Double.valueOf(calNumber); + suffixNum = number.substring(number.indexOf("e")); + } + } else if (number.indexOf("E") > 0) { + String calNumber = number.substring(0, number.indexOf("E")); + if (calNumber.length() < 6) { + preNum = Double.valueOf(number); + } else { + preNum = Double.valueOf(calNumber); + suffixNum = number.substring(number.indexOf("E")); + } + } else { preNum = Double.valueOf(number); - } else { - preNum = Double.valueOf(calNumber); - suffixNum = number.substring(number.indexOf("e")); } - } else if (number.indexOf("E") > 0) { - String calNumber = number.substring(0, number.indexOf("E")); - if (calNumber.length() < 6) { - preNum = Double.valueOf(number); - } else { - preNum = Double.valueOf(calNumber); - suffixNum = number.substring(number.indexOf("E")); + double absNum = Math.abs(preNum); + //获取长度 + int length = String.valueOf(absNum).substring(0, String.valueOf(absNum).indexOf(StringPool.DOT)).length(); + value = String.format("%." + (6 - length) + "f", preNum); + if (StringUtils.isNotBlank(suffixNum)) { + value = value + suffixNum; } - } else { - preNum = Double.valueOf(number); - } - double absNum = Math.abs(preNum); - //获取长度 - int length = String.valueOf(absNum).substring(0, String.valueOf(absNum).indexOf(StringPool.DOT)).length(); - String value = String.format("%." + (6 - length) + "f", preNum); - if (StringUtils.isNotBlank(suffixNum)) { - value = value + suffixNum; } return value; } diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/PHDFile.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/PHDFile.java index 0739895b..33d25597 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/PHDFile.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/PHDFile.java @@ -4,10 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; import java.io.Serializable; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import java.util.*; @Data @JsonIgnoreProperties(ignoreUnknown = true) @@ -17,6 +14,8 @@ public class PHDFile implements Serializable { private String xmlFilePath; + private String tmpFilePath; + private boolean isValid; // 是否有效谱 private boolean bAnalyed; // 记录是否被分析 @@ -215,8 +214,8 @@ public class PHDFile implements Serializable { calibration = new CalibrationBlock(); sampleBlock = new SampleBlock(); certificate = new CertificateBlock(); - QcItems = new HashMap<>(); - mapNucActMda = new HashMap<>(); + QcItems = new TreeMap<>(); + mapNucActMda = new TreeMap<>(); } } diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java index bdad11e2..318945be 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java @@ -504,15 +504,15 @@ public class GammaFileUtil extends AbstractLogOrReport { //计算得到衰减耗时 double Decay_hour = (acq.getTime()/1000 - end.getTime()/1000) / 3600.0; //声明一个double数据 - Double ener_Be7 = 0.0; + List Be7Value = new LinkedList<>(); //声明一个map用于存储计算数据 Map vMdcInfoMap = new HashMap<>(); //声明一个数组存储计算数据 List vMdcInfo = new LinkedList<>(); //声明一个数组存储QcItems数据 - Map qcItems = new LinkedHashMap<>(); + Map qcItems = new TreeMap<>(); //调用方法 读取文件信息 判断QC数据 - if(!ReadQCLimit(qcItems, vMdcInfoMap, ener_Be7, phd.getHeader().getSystem_type().toUpperCase())) { + if(!ReadQCLimit(qcItems, vMdcInfoMap, Be7Value, phd.getHeader().getSystem_type().toUpperCase())) { String WARNING = "Read QC Flags from SystemManager.xml Failed!"; } //判断map是否为空 @@ -555,12 +555,8 @@ public class GammaFileUtil extends AbstractLogOrReport { if(phd.isValid() && phd.getVBase().size() == phd.getSpec().getNum_g_channel()) { //判断system_type是否匹配P if(phd.getHeader().getSystem_type().equalsIgnoreCase("P")) { - //声明一个energy集合 - List energy = new LinkedList<>(); - //集合增加数据 - energy.add(ener_Be7); //调用算法计算 - CalValuesOut calValuesOut = CalValuesHandler.calFcnEval(energy, phd.getUsedResoPara().getP()); + CalValuesOut calValuesOut = CalValuesHandler.calFcnEval(Be7Value, phd.getUsedResoPara().getP()); //获取计算结果的counts赋值给 fwhm集合 List fwhm = calValuesOut.counts; //获取QcItems中Be7-FWHM数据 @@ -646,22 +642,24 @@ public class GammaFileUtil extends AbstractLogOrReport { //获取能谱获取时间 Date acqStart = DateUtils.parseDate(phd.getAcq().getAcquisition_start_date() + StringPool.SPACE + phd.getAcq().getAcquisition_start_time().substring(0,phd.getAcq().getAcquisition_start_time().indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss"); //计算采样时间 - double Ts = (collectStart.getTime()/1000 - collectStop.getTime()/1000); + double Ts = (collectStop.getTime()/1000 - collectStart.getTime()/1000); //计算衰变时间 - double Td = (collectStop.getTime()/1000 - acqStart.getTime()/1000); + double Td = (acqStart.getTime()/1000 - collectStop.getTime()/1000); //获取能谱获取实时间 double Ta = phd.getAcq().getAcquisition_real_time(); //获取能谱获取活时间 double Tl = phd.getAcq().getAcquisition_live_time(); //获取样品采样体积 double Svol = phd.getCollect().getAir_volume(); - double DCF1, DCF2, DCF3; + double DCF1 = 0; + double DCF2 = 0; + double DCF3 = 0; //计算得到lamda计算值 double lambda = Math.log(2.0) / (vMdcInfo.get(2) * 86400); if ( Ts == 0 ) { DCF1 = 1; } else { - DCF1 = lambda * Ts / (1-Math.exp(-lambda*Ts)); + DCF1 = lambda * Ts / (1-Math.exp(-lambda * Ts)); } if ( Td == 0 ) { DCF2 = 1; @@ -674,7 +672,7 @@ public class GammaFileUtil extends AbstractLogOrReport { DCF3 = lambda * Ta / (1-Math.exp(-lambda*Ta)); } //计算得到DCF_conc - double DCF_conc = Math.exp(lambda * (phd.getUsedSetting().getRefTime_conc().getTime()/1000 - collectStart.getTime()/1000)); + double DCF_conc = Math.exp(lambda * (collectStart.getTime()/1000 - phd.getUsedSetting().getRefTime_conc().getTime()/1000)); //声明一个集合 List energy = new LinkedList<>(); energy.add(vMdcInfo.get(0)); @@ -705,7 +703,7 @@ public class GammaFileUtil extends AbstractLogOrReport { for(int i=1; i= vMdcInfo.get(0)) { index = i; - if(phd.getVEnergy().get(i) - vMdcInfo.get(0) > vMdcInfo.get(0) - phd.getVEnergy().get(i-1)){ + if( (phd.getVEnergy().get(i) - vMdcInfo.get(0)) > (vMdcInfo.get(0) - phd.getVEnergy().get(i-1)) ){ index = i-1; } break; @@ -720,7 +718,7 @@ public class GammaFileUtil extends AbstractLogOrReport { } } - public boolean ReadQCLimit(Map qcItems, Map vMdcInfoMap, Double ener_Be7, String systemType) { + public boolean ReadQCLimit(Map qcItems, Map vMdcInfoMap, List Be7Value, String systemType) { try { String filePath = parameterProperties.getFilePath()+ File.separator +"SystemManager.xml"; //创建一个文档解析器工厂 @@ -778,7 +776,7 @@ public class GammaFileUtil extends AbstractLogOrReport { Node item = attributes.item(j); //判断属性名称是否是 number if(item.getNodeName().equals(CalType.ENERGY_CAL.getType())) { - ener_Be7 = Double.valueOf(item.getNodeValue()); + Be7Value.add(Double.valueOf(item.getNodeValue())); } } } @@ -1441,8 +1439,8 @@ public class GammaFileUtil extends AbstractLogOrReport { phd.setUsedTotEPara(value); } if (entry.getKey().equalsIgnoreCase("mapNucActMda")) { - HashMap jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class); - Map value = new HashMap<>(); + TreeMap jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), TreeMap.class); + Map value = new TreeMap<>(); for (Map.Entry objectEntry:jsonMap.entrySet()) { String key = objectEntry.getKey(); NuclideActMda entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), NuclideActMda.class); @@ -1618,8 +1616,8 @@ public class GammaFileUtil extends AbstractLogOrReport { if(rate > 0.8 || bActBigger) { ActMda.setHalflife(halflife); ActMda.setKey_flag(-1); - if(!vNuclides.contains(iter.getKey())) // 需要计算活度浓度的核素 - { + // 需要计算活度浓度的核素 + if(!vNuclides.contains(iter.getKey())) { ActMda.setBCalculateMDA(true); } else { ActMda.setActivity(0); @@ -1677,12 +1675,11 @@ public class GammaFileUtil extends AbstractLogOrReport { if(strList.size() == 3) { mapHalflife.put(strList.get(0), Double.valueOf(strList.get(2)) * 86400); } - }else { + } else { i=j; break; } } - break; } if(line.contains("#Identify")) { for (int j=i+1; j0?StringUtils.join(middleData.peaks_Nuclide_name.get(i), StringPool.SEMICOLON):""; strBuffer.append(rowFormat(data14, idPeak, energy, peakCentroid, fwhm, area, areaErr, signif, sensit, nuclide)); //换行 strBuffer.append(System.lineSeparator()); @@ -2499,7 +2489,7 @@ public class GammaFileUtil extends AbstractLogOrReport { String activity = String.format("%.3f", Double.valueOf(middleData.nucl_ided_activ_key.get(i))) + " bq"; String relErr = String.format("%.3f", (Double.valueOf(middleData.nucl_ided_activ_key_err.get(i)) / Double.valueOf(middleData.nucl_ided_activ_key.get(i)) * 100)) + " %"; String conc = middleData.nucl_ided_Concentration.get(i) + " uBq/m^3"; - String mdc = StringUtils.join(middleData.nucl_ided_MDC, " "); + String mdc = StringUtils.join(middleData.nucl_ided_MDC.get(i), " "); strBuffer.append(rowFormat(data15, nuclideName, halflife, activity, relErr, conc, mdc)); //换行 strBuffer.append(System.lineSeparator()); @@ -2689,10 +2679,10 @@ public class GammaFileUtil extends AbstractLogOrReport { peaksUsed++; } } - strBuffer.append(StringPool.SPACE+peaksUsed+" peaks with ID ("+(peaksUsed/middleData.peaks_idPeak.size()*100)+"%):"); + strBuffer.append(StringPool.SPACE+peaksUsed+" peaks with ID ("+NumberFormatUtil.numberSixLen(String.valueOf(peaksUsed/middleData.peaks_idPeak.size()*100))+"%):"); //换行 strBuffer.append(System.lineSeparator()); - strBuffer.append(StringPool.SPACE+(middleData.peaks_idPeak.size()-peaksUsed)+" peaks without ID("+Double.valueOf(middleData.peaks_idPeak.size()-peaksUsed)/middleData.peaks_idPeak.size()*100+"%):"); + strBuffer.append(StringPool.SPACE+(middleData.peaks_idPeak.size()-peaksUsed)+" peaks without ID("+NumberFormatUtil.numberSixLen(String.valueOf(Double.valueOf(middleData.peaks_idPeak.size()-peaksUsed)/middleData.peaks_idPeak.size()*100))+"%):"); //换行 strBuffer.append(System.lineSeparator()); //换行 @@ -2916,7 +2906,7 @@ public class GammaFileUtil extends AbstractLogOrReport { //换行 strBuffer.append(System.lineSeparator()); for (int i=0;i 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_e_c != null && CollectionUtils.isNotEmpty(bgAnalyseResult.s_b_fitting_e_c)) { + if (bgAnalyseResult.s_b_fitting_e_c.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_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("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?1", "?2", "?3")); } @@ -1536,9 +1536,9 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第三十七行数据 - 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))))); + 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("channel to energy equation: E(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("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?1", "?2", "?3")); } @@ -1554,9 +1554,9 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第三十六行数据 - 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))))); + 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("energy to channel equation: CH(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("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?1", "?2", "?3")); } @@ -1566,9 +1566,9 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第三十七行数据 - 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))))); + 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("channel to energy equation: E(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("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?1", "?2", "?3")); } @@ -1598,7 +1598,7 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第四十一行数据 - String dataFormat7 = "ROI : %-7sBeta : %-2sto %-4schannels Gamma : %-4sto %-8s"; + String dataFormat7 = "ROI : %-7sBeta : %-2s to %-4s channels Gamma : %-4s to %-8s"; for (int i = 0; i < bgAnalyseResult.S_ROI.size(); i++) { String roi = String.valueOf(bgAnalyseResult.S_ROI.get(i)); String bStart = String.valueOf(bgAnalyseResult.S_ROI_B_Boundary_start.get(i)); @@ -1624,9 +1624,9 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第四十四行数据 - 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))))); + 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("energy to channel equation: CH(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("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?1", "?2", "?3")); } @@ -1637,9 +1637,9 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第四十五行数据 - 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))))); + 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("channel to energy equation: E(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("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?1", "?2", "?3")); } @@ -1655,9 +1655,9 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第四十四行数据 - 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))))); + 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("energy to channel equation: CH(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("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?1", "?2", "?3")); } @@ -1667,9 +1667,9 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第四十五行数据 - 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))))); + 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("channel to energy equation: E(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("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?1", "?2", "?3")); } @@ -1693,12 +1693,12 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第四十八行数据 - for (int i = 0; i < bgAnalyseResult.S_ROI.size(); i++) { - String roi = String.valueOf(bgAnalyseResult.S_ROI.get(i)); - String bStart = String.valueOf(bgAnalyseResult.S_ROI_B_Boundary_start.get(i)); - String bStop = String.valueOf(bgAnalyseResult.S_ROI_B_Boundary_stop.get(i)); - String gStart = String.valueOf(bgAnalyseResult.S_ROI_G_Boundary_start.get(i)); - String gStop = String.valueOf(bgAnalyseResult.S_ROI_G_Boundary_stop.get(i)); + for (int i = 0; i < bgAnalyseResult.D_ROI.size(); i++) { + String roi = String.valueOf(bgAnalyseResult.D_ROI.get(i)); + String bStart = String.valueOf(bgAnalyseResult.D_ROI_B_Boundary_start.get(i)); + String bStop = String.valueOf(bgAnalyseResult.D_ROI_B_Boundary_stop.get(i)); + String gStart = String.valueOf(bgAnalyseResult.D_ROI_G_Boundary_start.get(i)); + String gStop = String.valueOf(bgAnalyseResult.D_ROI_G_Boundary_stop.get(i)); out.append(rowFormat(dataFormat7, roi, bStart, bStop, gStart, gStop)); //换行 out.append(System.lineSeparator()); @@ -1720,9 +1720,9 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第五十一行数据 - 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))))); + 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("energy to channel equation: CH(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("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?1", "?2", "?3")); } @@ -1732,9 +1732,9 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第五十二行数据 - 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))))); + 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("channel to energy equation: E(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("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?1", "?2", "?3")); } @@ -1750,9 +1750,9 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第五十四行数据 - 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))))); + 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("energy to channel equation: CH(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("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", "?1", "?2", "?3")); } @@ -1762,9 +1762,9 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第五十五行数据 - 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))))); + 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("channel to energy equation: E(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("channel to energy equation: E(x) = (%s)+(%s)*x+(%s)x*x", "?1", "?2", "?3")); } @@ -1788,12 +1788,12 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第五十八行数据 - for (int i = 0; i < bgAnalyseResult.S_ROI.size(); i++) { - String roi = String.valueOf(bgAnalyseResult.S_ROI.get(i)); - String bStart = String.valueOf(bgAnalyseResult.S_ROI_B_Boundary_start.get(i)); - String bStop = String.valueOf(bgAnalyseResult.S_ROI_B_Boundary_stop.get(i)); - String gStart = String.valueOf(bgAnalyseResult.S_ROI_G_Boundary_start.get(i)); - String gStop = String.valueOf(bgAnalyseResult.S_ROI_G_Boundary_stop.get(i)); + for (int i = 0; i < bgAnalyseResult.G_ROI.size(); i++) { + String roi = String.valueOf(bgAnalyseResult.G_ROI.get(i)); + String bStart = String.valueOf(bgAnalyseResult.G_ROI_B_Boundary_start.get(i)); + String bStop = String.valueOf(bgAnalyseResult.G_ROI_B_Boundary_stop.get(i)); + String gStart = String.valueOf(bgAnalyseResult.G_ROI_G_Boundary_start.get(i)); + String gStop = String.valueOf(bgAnalyseResult.G_ROI_G_Boundary_stop.get(i)); out.append(rowFormat(dataFormat7, roi, bStart, bStop, gStart, gStop)); //换行 out.append(System.lineSeparator()); @@ -1812,8 +1812,8 @@ public class PHDFileUtil extends AbstractLogOrReport { out.append(System.lineSeparator()); //第六十行数据 String dataFormat8 = "ROI : %-8sSample : %-8sGasBkgnd : %-7sDetBkgnd : %-8s"; - for (int i = 0; i < bgAnalyseResult.ROI.size(); i++) { - String roi = String.valueOf(bgAnalyseResult.ROI.get(i)); + for (int i = 0; i < bgAnalyseResult.G_ROI_G_Boundary_stop.size(); i++) { + String roi = String.valueOf(bgAnalyseResult.G_ROI_G_Boundary_stop.get(i)); String sCts = String.valueOf(bgAnalyseResult.s_roi_cts.get(i)); String gCts = String.valueOf(bgAnalyseResult.g_roi_cts.get(i)); String dCts = String.valueOf(bgAnalyseResult.d_roi_cts.get(i)); @@ -1833,22 +1833,19 @@ public class PHDFileUtil extends AbstractLogOrReport { out.append(System.lineSeparator()); //换行 out.append(System.lineSeparator()); - //第六十二行信息 - out.append(titleFormat("Net counts and Lc per ROI%s", 5, StringPool.DOT)); - //换行 - out.append(System.lineSeparator()); - //换行 - out.append(System.lineSeparator()); +// //第六十二行信息 +// out.append(titleFormat("Net counts and Lc per ROI%s", 5, StringPool.DOT)); +// //换行 +// out.append(System.lineSeparator()); +// //换行 +// out.append(System.lineSeparator()); //第六十三行数据 String dataFormat9 = "ROI : %-8sNet count : %-2s+/- %-20sLC : %-12s"; - for (int i = 0; i < bgAnalyseResult.ROI.size(); i++) { - String roi = String.valueOf(bgAnalyseResult.ROI.get(i)); - String net = String.valueOf(bgAnalyseResult.ROI_net_coutns.get(i)); - String netErr = String.valueOf(bgAnalyseResult.ROI_net_coutns_err.get(i)); - String lcCts = "0"; - if (i > 0) { - lcCts = String.valueOf(bgAnalyseResult.LC_CTS.get(i-1)); - } + for (int i = 0; i < bgAnalyseResult.G_ROI_G_Boundary_stop.size(); i++) { + String roi = String.valueOf(bgAnalyseResult.G_ROI_G_Boundary_stop.get(i)); + String net = NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.ROI_net_coutns.get(i))); + String netErr = NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.ROI_net_coutns_err.get(i))); + String lcCts = NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.LC_CTS.get(i))); out.append(rowFormat(dataFormat9, roi, net, netErr, lcCts)); //换行 out.append(System.lineSeparator()); @@ -1867,18 +1864,12 @@ public class PHDFileUtil extends AbstractLogOrReport { out.append(System.lineSeparator()); //第六十五行数据 String dataFormat10 = "ROI : %-8sConc : %-2s+/- %-2smBq/m3 LC : %-2smBq/m3 MDC : %-2smBq/m3 "; - for (int i = 0; i < bgAnalyseResult.ROI.size(); i++) { - String roi = String.valueOf(bgAnalyseResult.ROI.get(i)); - String conc = String.valueOf(bgAnalyseResult.ROI_con_uncer.get(i)); - String concErr = String.valueOf(bgAnalyseResult.ROI_con_uncer_err.get(i)); - String lc = "0"; - if (i > 0) { - lc = String.valueOf(bgAnalyseResult.LC.get(i-1)); - } - String mdc = "0"; - if (i > 0) { - mdc = String.valueOf(bgAnalyseResult.MDC.get(i-1)); - } + for (int i = 0; i < bgAnalyseResult.G_ROI_G_Boundary_stop.size(); i++) { + String roi = String.valueOf(bgAnalyseResult.G_ROI_G_Boundary_stop.get(i)); + String conc = NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.ROI_con_uncer.get(i))); + String concErr = NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.ROI_con_uncer_err.get(i))); + String lc = NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.LC.get(i))); + String mdc = NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.MDC.get(i))); out.append(rowFormat(dataFormat10, roi, conc, concErr, lc, mdc)); //换行 out.append(System.lineSeparator()); @@ -1896,7 +1887,7 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第六十七行数据 - out.append(rowFormat("XE-135 Conc : %-9s+/- %-8smBq/m3 LC : %-9smBq/m3 MDC : %-9smBq/m3 Nid flag : %-6s", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe135_con)), + out.append(rowFormat("XE-135 Conc : %-9s +/- %-8smBq/m3 LC : %-9smBq/m3 MDC : %-9s mBq/m3 Nid flag : %-6s", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe135_con)), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe135_uncer)), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.LC_Xe135)), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.MDC_Xe135)), String.valueOf(bgAnalyseResult.XE_135_NID_FLAG))); //换行 @@ -1904,29 +1895,29 @@ public class PHDFileUtil extends AbstractLogOrReport { //换行 out.append(System.lineSeparator()); //第六十八行数据 - out.append(rowFormat("XE-131M Conc : %-9s+/- %-8smBq/m3 LC : %-9smBq/m3 MDC : %-9smBq/m3 Nid flag : %-6s", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe131m_con)), + out.append(rowFormat("XE-131M Conc : %-9s +/- %-8smBq/m3 LC : %-9smBq/m3 MDC : %-9s mBq/m3 Nid flag : %-6s", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe131m_con)), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe131m_uncer)), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.LC_Xe131m)), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.MDC_Xe131m)), String.valueOf(bgAnalyseResult.XE_131m_NID_FLAG))); //换行 out.append(System.lineSeparator()); //换行 out.append(System.lineSeparator()); - //第六十九行数据 - out.append(rowFormat("XE-133 Conc : %-9s+/- %-8smBq/m3 LC : %-9smBq/m3 MDC : %-9smBq/m3 Nid flag : %-6s", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe133_con)), - NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe133_uncer)), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.LC_Xe133)), - NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.MDC_Xe133)), String.valueOf(bgAnalyseResult.XE_133_NID_FLAG))); - //换行 - out.append(System.lineSeparator()); - //换行 - out.append(System.lineSeparator()); //第七十行数据 - out.append(rowFormat("XE-133M Conc : %-9s+/- %-8smBq/m3 LC : %-9smBq/m3 MDC : %-9smBq/m3 Nid flag : %-6s", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe133m_con)), + out.append(rowFormat("XE-133M Conc : %-9s +/- %-8smBq/m3 LC : %-9smBq/m3 MDC : %-9s mBq/m3 Nid flag : %-6s", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe133m_con)), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe133m_uncer)), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.LC_Xe133m)), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.MDC_Xe133m)), String.valueOf(bgAnalyseResult.XE_133m_NID_FLAG))); //换行 out.append(System.lineSeparator()); //换行 out.append(System.lineSeparator()); + //第六十九行数据 + out.append(rowFormat("XE-133 Conc : %-9s +/- %-8smBq/m3 LC : %-9smBq/m3 MDC : %-9s mBq/m3 Nid flag : %-6s", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe133_con)), + NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.Xe133_uncer)), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.LC_Xe133)), + NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.MDC_Xe133)), String.valueOf(bgAnalyseResult.XE_133_NID_FLAG))); + //换行 + out.append(System.lineSeparator()); + //换行 + out.append(System.lineSeparator()); //第七十一行信息 out.append(titleFormat("%s NCC analysis finished %s", 40, StringPool.DOT, StringPool.DOT)); //换行 diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/BetaDataFile.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/BetaDataFile.java index f29ce0f9..402a9942 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/BetaDataFile.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/BetaDataFile.java @@ -13,6 +13,14 @@ import java.util.List; public class BetaDataFile implements Serializable { //基本数据信息 + private String sampleTmpPath; + + private String detTmpPath; + + private String gasTmpPath; + + private String qcTmpPath; + private String sampleFilePathName; private String sampleFileName; diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java index cd670af6..a8f726ff 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java @@ -157,17 +157,20 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi } String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH)); String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH) + 1); + // 读取文件内容 + // 调用加载文件的方法 传入文件路径,文件名称,全局变量phd,响应结果result boolean flag = gammaFileUtil.loadFile(pathName, fileName, phd, result); + // 如果文件加载失败 返回失败原因 if (!flag) { return result; } - // 声明基础数组信息 + // 加载phd数据所需的lc,scac,baseline数据 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); if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) { // 查询当前用户关联的核素信息 @@ -177,17 +180,24 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi if (CollectionUtils.isEmpty(userLib)) { userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); } + userLib = userLib.stream().sorted().collect(Collectors.toList()); Map nuclideMap = GetNuclideLines(userLib); redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap); } + // 判断数据库信息是否读取正常 if (!bRet) { return result; } + gammaFileUtil.Qcstate(phd); key = fileName + "-" + userName; } else { String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName; String fileName = samfileName; - boolean flag = gammaFileUtil.loadFile(pathName, fileName, phd, result); + // 加载文件内容 + boolean bRet = gammaFileUtil.loadFile(pathName, fileName, phd, result); + if (!bRet) { + return result; + } if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) { // 查询当前用户关联的核素信息 List userLib = new LinkedList<>(); @@ -196,12 +206,10 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi if (CollectionUtils.isEmpty(userLib)) { userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); } - Map nuclideMap = GetNuclideLines(userLib); + userLib = userLib.stream().sorted().collect(Collectors.toList()); + Map nuclideMap = GetNuclideLinesLocal(userLib); redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap); } - if (!flag) { - return result; - } key = fileName + "-" + userName; } phdCache.put(key, phd); @@ -480,6 +488,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi if (CollectionUtils.isEmpty(userLib)) { userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); } + userLib = userLib.stream().sorted().collect(Collectors.toList()); Map nuclideMap = GetNuclideLines(userLib); redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap); } @@ -845,7 +854,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi if (CollectionUtils.isEmpty(userLib)) { userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); } - Map nuclideMap = GetNuclideLines(userLib); + userLib = userLib.stream().sorted().collect(Collectors.toList()); + Map nuclideMap = GetNuclideLinesLocal(userLib);//GetNuclideLinesLocal(userLib); redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap); } } @@ -1036,13 +1046,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi phd.setXmlFilePath(parameterProperties.getFilePath()); // 获取当前角色的颜色配置 Map colorMap = sysUserColorService.initColor(userName); -// // 查询当前用户关联的核素信息 -// List nuclides = new LinkedList<>(); -// // 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的 -// nuclides = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase()); -// if (CollectionUtils.isEmpty(nuclides)) { -// nuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); -// } // 分析文件数据 int flag = gammaFileUtil.AnalyseData(phd); if (flag == 0) { @@ -1063,10 +1066,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi Map nuclideLinesMap = (Map) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());//GetNuclideLines(nuclides); gammaFileUtil.AnalyseSpectrum(phd, nuclideLinesMap); // 重新分析各峰值对应的核素信息 -// gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap); + gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap); Map map = new HashMap<>(); gammaFileUtil.UpdateChart(phd, map, colorMap); // 更新 ‘QC Flags’ 状态 + phd.getQcItems().clear(); List qcstate = gammaFileUtil.Qcstate(phd); map.put("QCFlag", qcstate); map.put("bAnalyed", phd.isBAnalyed()); @@ -1111,6 +1115,53 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi return mapLines; } + public Map GetNuclideLinesLocal(List nuclideList) { + Map mapLines = new HashMap<>(); + if (nuclideList.size() < 1) { + return mapLines; + } + //需要查询的两个表的名称 + String table_lines = "lines"; + String table_lib = "libdata"; + // 建立数据库连接 + Connection conn = dbUtil.openDB(); + Statement statement = null; + try { + statement = conn.createStatement(); + for (String name : nuclideList) { + NuclideLines nlines = new NuclideLines(); + //根据核素名称查询相关核素信息 + String sql1 = "select fullname, energy, energy_uncert, yield, yield_uncert, key_flag from "+table_lines+" where name = '"+name+"' Order by energy"; + ResultSet resultSet = statement.executeQuery(sql1); + int j=0; + while (resultSet.next()) { + nlines.getFullNames().add(resultSet.getString("fullname")); + nlines.getVenergy().add(resultSet.getDouble("energy")); + nlines.getVuncertE().add(resultSet.getDouble("energy_uncert")); + nlines.getVyield().add(resultSet.getDouble("yield") / 100); + nlines.getVuncertY().add(resultSet.getDouble("yield_uncert")); + if (Objects.nonNull(resultSet.getInt("key_flag")) && resultSet.getInt("key_flag") > 0) { + nlines.key_flag = j; + nlines.maxYeildIdx = j; + } + ++j; + } + mapLines.put(name, nlines); + } + String names = "'" + String.join("','", nuclideList) + "'"; + String sql2 = "select name, halflife from "+table_lib+" where name in ("+names+")"; + ResultSet executeQuery = statement.executeQuery(sql2); + while (executeQuery.next()) { + NuclideLines nuclideLines = mapLines.get(executeQuery.getString("name")); + nuclideLines.setHalflife(Double.valueOf(executeQuery.getDouble("halflife")) == null ? 0 : executeQuery.getDouble("halflife") * 86400);// 将天转换成秒 + mapLines.put(executeQuery.getString("name"), nuclideLines); + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + return mapLines; + } + @Override public Result InteractiveTool(Integer sampleId, String fileName, HttpServletRequest request) { Result result = new Result(); diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java index 0f87d7b6..c33029d1 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java @@ -1573,9 +1573,15 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements map.put("max", max); map.put("gammaSpectrum", seriseDataList); - betaDataFile.setGammaList(oldScatterSeries); - betaDataFile.setGammaFittingPara(fittingParaStr); - betaDataFile.setGammaFittingParaToUi(fittingParaToUiStr); + if (betaDataFile.getGammaList().size()<=0) { + betaDataFile.setGammaList(oldScatterSeries); + } + if (betaDataFile.getGammaFittingPara().size()<=0) { + betaDataFile.setGammaFittingPara(fittingParaStr); + } + if (betaDataFile.getGammaFittingParaToUi().size()<=0) { + betaDataFile.setGammaFittingParaToUi(fittingParaToUiStr); + } betaDataFile.setGammaFittingParaOld(fittingParaStr); betaDataFile.setGammaFittingParaToUiOld(fittingParaToUiStr); } @@ -1681,9 +1687,15 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } map.put("EToC", fittingParaToUiStr); - betaDataFile.setBetaList(oldScatterSeries); - betaDataFile.setBetaFittingPara(fittingParaStr); - betaDataFile.setBetaFittingParaToUi(fittingParaToUiStr); + if (betaDataFile.getBetaList().size()<=0) { + betaDataFile.setBetaList(oldScatterSeries); + } + if (betaDataFile.getBetaFittingPara().size()<=0) { + betaDataFile.setBetaFittingPara(fittingParaStr); + } + if (betaDataFile.getBetaFittingParaToUi().size()<=0) { + betaDataFile.setBetaFittingParaToUi(fittingParaToUiStr); + } betaDataFile.setBetaFittingParaOld(fittingParaStr); betaDataFile.setBetaFittingParaToUiOld(fittingParaToUiStr); } @@ -2770,98 +2782,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } else { xeMap.put("XeData", Collections.EMPTY_LIST); } -// if (StringUtils.isNotBlank(analyseResult.error_log) && !analyseResult.error_log.equalsIgnoreCase("no error.")) { -// return Collections.EMPTY_LIST; -// } else { -// //生成分析操作日志 -// EnergySpectrumStruct sample = betaDataFile.getSampleStruct(); -// EnergySpectrumStruct gas = betaDataFile.getGasStruct(); -// EnergySpectrumStruct det = betaDataFile.getDetStruct(); -// String logName = betaDataFile.getSampleFileName().replace("PHD", "log"); -// phdFileUtil.OutPutRnLog(analyseResult, sample, gas, det, logName); -// //存入计算后得到的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 boundaryList = new LinkedList<>(); -// for (int i=0; i boundaryList = new LinkedList<>(); -// for (int i=0; i boundaryList = new LinkedList<>(); -// for (int i=0; i